This commit is contained in:
Ayoub ait lachgar 2024-03-01 11:01:18 +01:00
parent f0b308ee0d
commit 8636878c1a
3 changed files with 37 additions and 17 deletions

View File

@ -270,7 +270,6 @@ bpmnModeler.on('spiff.message_schemas.requested', (event) => {
});
});
// As call activites might refernce processes across the system
// it should be possible to search for a paticular call activity.
bpmnModeler.on('spiff.callactivity.search', (event) => {
@ -289,7 +288,7 @@ bpmnModeler.on('import.parse.complete', event => {
refs.forEach(ref => {
const props = {
id: ref.id,
name: ref.id ? typeof(ref.name) === 'undefined': ref.name,
name: ref.id ? typeof (ref.name) === 'undefined' : ref.name,
};
let elem = bpmnModeler._moddle.create(desc, props);
elem.$parent = ref.element;
@ -297,7 +296,7 @@ bpmnModeler.on('import.parse.complete', event => {
});
});
bpmnModeler.importXML(diagramXML).then(() => {});
bpmnModeler.importXML(diagramXML).then(() => { });
// This handles the download and upload buttons - it isn't specific to
// the BPMN modeler or these extensions, just a quick way to allow you to

View File

@ -28,7 +28,7 @@ export function MessageJsonSchemaSelect(props) {
let definitions = getRoot(businessObject);
if (!definitions.get('rootElements')) {
definitions.set('rootElements', []);
definitions.set('rootElements', []);
}
// Retrieve Message
@ -36,7 +36,7 @@ export function MessageJsonSchemaSelect(props) {
element.$type === 'bpmn:Message' && (element.id === msgRef.id || element.name === msgRef.id)
);
if(!bpmnMessage){
if (!bpmnMessage) {
return '';
}
@ -55,7 +55,7 @@ export function MessageJsonSchemaSelect(props) {
let definitions = getRoot(businessObject);
if (!definitions.get('rootElements')) {
definitions.set('rootElements', []);
definitions.set('rootElements', []);
}
// Retrieve Message

View File

@ -7,11 +7,9 @@ import { MessageVariable } from './MessageVariable';
import { CorrelationPropertiesArray } from './CorrelationPropertiesArray';
import { CorrelationPropertiesList } from './CorrelationPropertiesList';
import { MessageArray } from './MessageArray';
import { isMessageElement, canReceiveMessage } from '../MessageHelpers';
import { isMessageElement, canReceiveMessage, getRoot, getMessageRefElement } from '../MessageHelpers';
import { CorrelationCheckboxEntry } from './CorrelationCheckbox';
import { OPTION_TYPE, SpiffExtensionSelect } from '../../extensions/propertiesPanel/SpiffExtensionSelect';
import { SpiffExtensionLaunchButton } from '../../extensions/propertiesPanel/SpiffExtensionLaunchButton';
import { HeaderButton, TextFieldEntry } from '@bpmn-io/properties-panel';
import { HeaderButton } from '@bpmn-io/properties-panel';
import { useService } from 'bpmn-js-properties-panel';
import { MessageJsonSchemaSelect } from './MessageJsonSchemaSelect';
@ -133,7 +131,7 @@ function createCollaborationGroup(
}),
})
}
return results;
}
@ -237,13 +235,13 @@ function createMessageGroup(
label: translate('Json-Schema'),
entries: [
{
element,
moddle,
commandStack,
component: MessageJsonSchemaSelect,
element,
name: 'msgJsonSchema',
label: translate('Json-schema input'),
description: translate('Json-schema description'),
moddle,
commandStack
},
{
component: LaunchJsonSchemaEditorButton,
@ -265,9 +263,32 @@ function LaunchJsonSchemaEditorButton(props) {
class: 'spiffworkflow-properties-panel-button',
children: 'Launch Editor',
onClick: () => {
const messageId = (element.businessObject && element.businessObject.messageRef) ? element.businessObject.messageRef['name']: '';
eventBus.fire('spiff.msg_json_schema_files.requested', {
messageId,
const { businessObject } = element;
const msgRef = getMessageRefElement(element);
if (!msgRef) {
alert('Please select a message');
return '';
}
let definitions = getRoot(businessObject);
if (!definitions.get('rootElements')) {
definitions.set('rootElements', []);
}
// Retrieve Message
let bpmnMessage = definitions.get('rootElements').find(element =>
element.$type === 'bpmn:Message' && (element.id === msgRef.id || element.name === msgRef.id)
);
if (!bpmnMessage) {
alert('Error : Message not found!');
return '';
}
eventBus.fire('spiff.msg_json_schema_editor.requested', {
messageId: msgRef.name,
schemaId: bpmnMessage.get('jsonSchemaId'),
eventBus,
element
});