mirror of
https://github.com/status-im/spiff-arena.git
synced 2025-02-05 06:34:03 +00:00
Minor tweak, in the hopes of getting a text box to update correctly.
This commit is contained in:
parent
f825b2ec36
commit
1a6389ae09
@ -109,7 +109,7 @@ function FindProcessButton(props) {
|
||||
// First, set up the listen, then fire the event, just
|
||||
// in case we are testing and things are happening super fast.
|
||||
eventBus.once('spiff.callactivity.update', (response) => {
|
||||
commandStack.execute('element.updateModdleProperties', {
|
||||
commandStack.execute('element.updateProperties', {
|
||||
element,
|
||||
moddleElement: element.businessObject,
|
||||
properties: {
|
||||
|
53
spiffworkflow-frontend/src/components/ProcessSearch.tsx
Normal file
53
spiffworkflow-frontend/src/components/ProcessSearch.tsx
Normal file
@ -0,0 +1,53 @@
|
||||
import {
|
||||
ComboBox,
|
||||
// @ts-ignore
|
||||
} from '@carbon/react';
|
||||
import { truncateString } from '../helpers';
|
||||
import { ProcessReference } from '../interfaces';
|
||||
|
||||
type OwnProps = {
|
||||
onChange: (..._args: any[]) => any;
|
||||
processes: ProcessReference[];
|
||||
selectedItem?: ProcessReference | null;
|
||||
titleText?: string;
|
||||
height?: string;
|
||||
};
|
||||
|
||||
export default function ProcessSearch({
|
||||
processes,
|
||||
selectedItem,
|
||||
onChange,
|
||||
titleText = 'Process model',
|
||||
height = '50px',
|
||||
}: OwnProps) {
|
||||
const shouldFilter = (options: any) => {
|
||||
const process: ProcessReference = options.item;
|
||||
const { inputValue } = options;
|
||||
return `${process.identifier} (${process.display_name})`.includes(
|
||||
inputValue
|
||||
);
|
||||
};
|
||||
return (
|
||||
<div style={{ width: '100%', height }}>
|
||||
<ComboBox
|
||||
onChange={onChange}
|
||||
id="process-model-select"
|
||||
data-qa="process-model-selection"
|
||||
items={processes}
|
||||
itemToString={(process: ProcessReference) => {
|
||||
if (process) {
|
||||
return `${process.identifier} (${truncateString(
|
||||
process.display_name,
|
||||
20
|
||||
)})`;
|
||||
}
|
||||
return null;
|
||||
}}
|
||||
shouldFilterItem={shouldFilter}
|
||||
placeholder="Choose a process"
|
||||
titleText={titleText}
|
||||
selectedItem={selectedItem}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user