Skip to content

Commit

Permalink
Refactored the io-helper code and added a menu version tagging throug…
Browse files Browse the repository at this point in the history
…h the workflow
  • Loading branch information
curiousjaki committed Jan 5, 2023
1 parent 0db587c commit 1ad64b7
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 55 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
- run: |
npm install
npm run all
sed -i "s/TILT Extension (Development Build)/TILT Extension ${{ github.ref_name }}/" ./index.js
zip tilt-release.zip -r ./dist ./client ./index.js ./README.md ./LICENSE.md
- name: Create Release
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,19 @@ export function createElement(elementType, properties, parent, factory) {
export function createExtensionElements(element, bpmnFactory) {
const bo = getBusinessObject(element);
return createElement('bpmn:ExtensionElements', { values: []}, bo, bpmnFactory);
}

export function removeDollarProperties(options){
const pick = (obj, keys) => Object.keys(obj).filter(k => keys.includes(k)).reduce((res, k) => Object.assign(res, {[k]: obj[k]}), {});
return pick(options,Object.keys(options).filter(item => !item.includes("$")))
}

export function updateTiltProperty(element, property, newProps, modeling) {
const currentProps = property;
var props = {}
props = removeDollarProperties({
...currentProps,
...newProps
});
return modeling.updateModdleProperties(element, property, props);
}
21 changes: 13 additions & 8 deletions client/tilt-properties/props/tilt-property-groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import { TextFieldEntry } from '@bpmn-io/properties-panel';
import {
findExtensions,
createExtensionElements,
createElement
} from '../extensions-helper';
import { updateTiltProperty } from '../tilt-io-helper';
createElement,
removeDollarProperties,
updateTiltProperty
} from '../io-extension-helper';

import { createMetaPropertyGroup } from './meta-property-group';
import { createControllerPropertyGroup } from './controller-property-group';
Expand Down Expand Up @@ -48,14 +49,20 @@ function addFactory(tilt_type, element, injector){
}

export function removeFactory(element, property, modeling) {

return function(event) {
event.stopPropagation();
const extensionElements = getBusinessObject(element).get('extensionElements');

modeling.updateModdleProperties(element, extensionElements, {
values: extensionElements.get('values').filter(value => value !== property)
});

if (extensionElements.values.length == 0){
var updated_bo = getBusinessObject(element)
delete updated_bo.extensionElements;
updated_bo = removeDollarProperties(updated_bo)
modeling.updateModdleProperties(element,getBusinessObject(element),updated_bo)
}
};
}

Expand All @@ -77,7 +84,7 @@ export function createTiltPropertiesGroup(element,injector,extension_type="tilt:
};

const tiltGroup = {
id: "tilt-specification-group",
id: `tilt-specification-group-${element.id}`,
label: "TILT elements",
add:addButton,
component: ListGroup,
Expand All @@ -98,16 +105,14 @@ export function createTextField(props){
validation_text
} = props;

var tilt_type = id.split("-")[0];

const modeling = useService('modeling');
const translate = useService('translate');
const debounce = useService('debounceInput');

const setValue = (value) => {
var newPropertyObject = {};
newPropertyObject[type_name] = value || '';
updateTiltProperty(element, properties, newPropertyObject, modeling, tilt_type);
updateTiltProperty(element, properties, newPropertyObject, modeling);
};

const getValue = () => {
Expand Down
46 changes: 0 additions & 46 deletions client/tilt-properties/tilt-io-helper.js

This file was deleted.

2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

module.exports = {
name: 'TILT Extension',
name: `TILT Extension (Development Build)`,
script: './dist/client.js'
//menu: './client/tilt-extractor/menu.js'
};

0 comments on commit 1ad64b7

Please sign in to comment.