linting.
This commit is contained in:
parent
71cf495df1
commit
2a4c1ffc6e
|
@ -2,9 +2,7 @@ import RulesModule from 'diagram-js/lib/features/rules';
|
|||
import CustomDataStorePropertiesProvider from './propertiesPanel/CustomDataStorePropertiesProvider';
|
||||
|
||||
export default {
|
||||
__depends__: [
|
||||
RulesModule
|
||||
],
|
||||
__init__: [ 'dataSourcePropertiesProvider' ],
|
||||
dataSourcePropertiesProvider: [ 'type', CustomDataStorePropertiesProvider ]
|
||||
__depends__: [RulesModule],
|
||||
__init__: ['dataSourcePropertiesProvider'],
|
||||
dataSourcePropertiesProvider: ['type', CustomDataStorePropertiesProvider],
|
||||
};
|
||||
|
|
|
@ -4,60 +4,73 @@ import { DataStoreSelect, OPTION_TYPE } from './DataStoreSelect';
|
|||
const LOW_PRIORITY = 500;
|
||||
|
||||
export default function CustomDataStorePropertiesProvider(
|
||||
modeling,
|
||||
propertiesPanel,
|
||||
translate,
|
||||
moddle,
|
||||
commandStack,
|
||||
bpmnFactory,
|
||||
elementRegistry
|
||||
modeling,
|
||||
propertiesPanel,
|
||||
translate,
|
||||
moddle,
|
||||
commandStack,
|
||||
bpmnFactory,
|
||||
elementRegistry
|
||||
) {
|
||||
this.getGroups = function (element) {
|
||||
return function (groups) {
|
||||
if (is(element, 'bpmn:DataStoreReference')) {
|
||||
groups.push(
|
||||
createCustomDataStoreGroup(modeling, element, translate, moddle, commandStack, bpmnFactory)
|
||||
);
|
||||
}
|
||||
return groups;
|
||||
};
|
||||
this.getGroups = function (element) {
|
||||
return function (groups) {
|
||||
if (is(element, 'bpmn:DataStoreReference')) {
|
||||
groups.push(
|
||||
createCustomDataStoreGroup(
|
||||
modeling,
|
||||
element,
|
||||
translate,
|
||||
moddle,
|
||||
commandStack,
|
||||
bpmnFactory
|
||||
)
|
||||
);
|
||||
}
|
||||
return groups;
|
||||
};
|
||||
propertiesPanel.registerProvider(LOW_PRIORITY, this);
|
||||
};
|
||||
propertiesPanel.registerProvider(LOW_PRIORITY, this);
|
||||
}
|
||||
|
||||
CustomDataStorePropertiesProvider.$inject = [
|
||||
'modeling',
|
||||
'propertiesPanel',
|
||||
'translate',
|
||||
'moddle',
|
||||
'commandStack',
|
||||
'bpmnFactory',
|
||||
'elementRegistry'
|
||||
'modeling',
|
||||
'propertiesPanel',
|
||||
'translate',
|
||||
'moddle',
|
||||
'commandStack',
|
||||
'bpmnFactory',
|
||||
'elementRegistry',
|
||||
];
|
||||
|
||||
function createCustomDataStoreGroup(modeling, element, translate, moddle, commandStack, bpmnFactory) {
|
||||
function createCustomDataStoreGroup(
|
||||
modeling,
|
||||
element,
|
||||
translate,
|
||||
moddle,
|
||||
commandStack,
|
||||
bpmnFactory
|
||||
) {
|
||||
const group = {
|
||||
label: translate('Custom Data Store Properties'),
|
||||
id: 'custom-datastore-properties',
|
||||
entries: [],
|
||||
};
|
||||
|
||||
let group = {
|
||||
label: translate('Custom Data Store Properties'),
|
||||
id: 'custom-datastore-properties',
|
||||
entries: []
|
||||
};
|
||||
// other custom properties as needed
|
||||
group.entries.push({
|
||||
id: 'selectDataStore',
|
||||
element,
|
||||
component: DataStoreSelect,
|
||||
optionType: OPTION_TYPE.data_stores,
|
||||
moddle,
|
||||
commandStack,
|
||||
translate,
|
||||
name: 'dataStoreRef',
|
||||
label: translate('Select DataSource'),
|
||||
description: translate('Select a datasource from the list'),
|
||||
modeling,
|
||||
bpmnFactory,
|
||||
});
|
||||
|
||||
// other custom properties as needed
|
||||
group.entries.push({
|
||||
id: 'selectDataStore',
|
||||
element,
|
||||
component: DataStoreSelect,
|
||||
optionType: OPTION_TYPE.data_stores,
|
||||
moddle,
|
||||
commandStack,
|
||||
translate,
|
||||
name: 'dataStoreRef',
|
||||
label: translate('Select DataSource'),
|
||||
description: translate('Select a datasource from the list'),
|
||||
modeling,
|
||||
bpmnFactory
|
||||
})
|
||||
|
||||
return group;
|
||||
return group;
|
||||
}
|
||||
|
|
|
@ -17,23 +17,24 @@ export function DataStoreSelect(props) {
|
|||
const eventBus = useService('eventBus');
|
||||
|
||||
const getValue = () => {
|
||||
const value = (element.businessObject.dataStoreRef) ? element.businessObject.dataStoreRef.id : '';
|
||||
return value;
|
||||
return element.businessObject.dataStoreRef
|
||||
? element.businessObject.dataStoreRef.id
|
||||
: '';
|
||||
};
|
||||
|
||||
const setValue = (value) => {
|
||||
if(!value || value == ''){
|
||||
if (!value || value === '') {
|
||||
modeling.updateProperties(element, {
|
||||
dataStoreRef: null
|
||||
dataStoreRef: null,
|
||||
});
|
||||
return;
|
||||
}
|
||||
const dataStore = bpmnFactory.create('bpmn:DataStore', {
|
||||
id: value,
|
||||
name: 'DataStore_' + value
|
||||
name: `DataStore_${value}`,
|
||||
});
|
||||
modeling.updateProperties(element, {
|
||||
dataStoreRef: dataStore
|
||||
dataStoreRef: dataStore,
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -64,7 +65,7 @@ export function DataStoreSelect(props) {
|
|||
}
|
||||
return optionList;
|
||||
};
|
||||
|
||||
|
||||
return SelectEntry({
|
||||
id,
|
||||
element,
|
||||
|
@ -83,4 +84,3 @@ function requestOptions(eventBus, element, commandStack, optionType) {
|
|||
});
|
||||
eventBus.fire(`spiff.${optionType}.requested`, { eventBus });
|
||||
}
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
"build:watch": "webpack --watch",
|
||||
"dev": "run-p build:watch serve",
|
||||
"serve": "sirv public --dev",
|
||||
"lint": "./node_modules/.bin/eslint src *.js",
|
||||
"lint:fix": "./node_modules/.bin/eslint --fix src *.js",
|
||||
"lint": "./node_modules/.bin/eslint app *.js",
|
||||
"lint:fix": "./node_modules/.bin/eslint --fix app *.js",
|
||||
"start": "run-s build serve",
|
||||
"test": "karma start karma.conf.js"
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue