diff --git a/src/assets/spiner.svg b/src/assets/spiner.svg
new file mode 100644
index 000000000..176f8da5d
--- /dev/null
+++ b/src/assets/spiner.svg
@@ -0,0 +1,13 @@
+
+
diff --git a/src/components/inspectors/PreviewPanel.vue b/src/components/inspectors/PreviewPanel.vue
index f72bd5184..718e6264c 100644
--- a/src/components/inspectors/PreviewPanel.vue
+++ b/src/components/inspectors/PreviewPanel.vue
@@ -57,11 +57,15 @@
- {{ screenTitle }}
{{ taskTitle }}
-
+
+
+
+
+
+
@@ -71,20 +75,28 @@ import store from '@/store';
import NoPreviewAvailable from '@/components/inspectors/NoPreviewAvailable';
export default {
- props: ['nodeRegistry', 'visible'],
+ props: ['nodeRegistry', 'visible', 'previewConfigs'],
components: { NoPreviewAvailable },
data() {
return {
data: {},
+ previewUrl: null,
+ showSpinner: false,
+ spinner: require('@/assets/spiner.svg'),
selectedPreview: '1',
taskTitle: '',
- screenTitle: '',
- width: 400,
+ itemTitle: '',
+ width: 600,
isDragging: false,
- currentPos: 400,
+ currentPos: 600,
};
},
watch: {
+ previewUrl(value, oldValue) {
+ if (value !== oldValue) {
+ this.showSpinner = true;
+ }
+ },
highlightedNode() {
document.activeElement.blur();
this.prepareData();
@@ -102,12 +114,24 @@ export default {
},
},
methods: {
+ loading() {
+ this.showSpinner = false;
+ },
prepareData() {
if (!this.highlightedNode) {
return {};
}
+ const defaultDataTransform = (node) => Object.entries(node.definition).reduce((data, [key, value]) => {
+ data[key] = value;
+ return data;
+ }, {});
+
+ this.data = defaultDataTransform(this.highlightedNode);
+ this.taskTitle = this.data?.name;
+
this.taskTitle = this?.highlightedNode?.definition?.name;
+ this.previewNode();
},
handleAssignmentChanges(currentValue, previousValue) {
@@ -120,8 +144,25 @@ export default {
onSelectedPreview(item) {
this.selectedPreview = item;
},
- previewNode(node) {
- this.taskTitle = node?.name;
+ previewNode(force = false) {
+ if (!this.highlightedNode || (!this.visible && !force)) {
+ return;
+ }
+
+ const previewConfig = this.previewConfigs.find(config => {
+ return config.matcher(this.data);
+ });
+
+ let clone = {};
+ for (let prop in this.data) {
+ if ((previewConfig?.receivingParams ?? []).includes(prop)) {
+ clone[prop] = this.data[prop];
+ }
+ }
+ const nodeData = encodeURI(JSON.stringify(clone));
+
+ this.previewUrl = previewConfig ? `${previewConfig.url}?node=${nodeData}` : null;
+ this.taskTitle = this.highlightedNode?.definition?.name;
this.showPanel = true;
},
onClose() {
diff --git a/src/components/modeler/Modeler.vue b/src/components/modeler/Modeler.vue
index 8325a8c33..53ead108c 100644
--- a/src/components/modeler/Modeler.vue
+++ b/src/components/modeler/Modeler.vue
@@ -67,6 +67,7 @@
@previewResize="setInspectorButtonPosition"
:visible="isOpenPreview"
:nodeRegistry="nodeRegistry"
+ :previewConfigs="previewConfigs"
/>
store.getters.showComponent,
},
methods: {
+ registerPreview(config) {
+ this.previewConfigs.push(config);
+ },
handleToolbarAction(action) {
if (action.handler instanceof Function) {
action.handler(this);
@@ -397,8 +402,8 @@ export default {
this.showInspectorButton = !(value ?? true);
this.isOpenInspector = value;
},
- handlePreview(node) {
- this.$refs['preview-panel'].previewNode(node);
+ handlePreview() {
+ this.$refs['preview-panel'].previewNode(true);
this.handleTogglePreview(true) ;
},
handleTogglePreview(value) {
@@ -1483,6 +1488,7 @@ export default {
registerNode: this.registerNode,
registerStatusBar: this.registerStatusBar,
registerPmBlock: this.registerPmBlock,
+ registerPreview: this.registerPreview,
});
this.moddle = new BpmnModdle(this.extensions);