Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/components/modeler/ModelerReadonly.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
:is-rendering="isRendering"
:is-completed="requestCompletedNodes.includes(node.definition.id)"
:is-in-progress="requestInProgressNodes.includes(node.definition.id)"
:is-idle="requestIdleNodes.includes(node.definition.id)"
@add-node="addNode"
@set-cursor="cursor = $event"
@set-pool-target="poolTarget = $event"
Expand Down Expand Up @@ -135,6 +136,10 @@ export default {
type: Boolean,
default: true,
},
requestIdleNodes: {
type: Array,
default: () => [],
},
requestCompletedNodes: {
type: Array,
default: () => [],
Expand Down
34 changes: 29 additions & 5 deletions src/mixins/highlightConfig.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
/* eslint-disable no-unused-vars */
import cloneDeep from 'lodash/cloneDeep';
import store from '@/store';

const COLOR_DEFAULT = '#5096db';
const COLOR_ERROR = '##FF0000';
const COLOR_IN_PROGRESS = '#1572C2';
const COLOR_IDLE = '#ced4da';
const COLOR_COMPLETED = '#00875A';
const COLOR_COMPLETED_FILL = '#edfffc';

const errorHighlighter = {
highlighter: {
name: 'stroke',
options: {
padding: 10,
attrs: {
stroke: 'red',
stroke: COLOR_ERROR,
'stroke-width': 10,
opacity: 0.3,
},
Expand All @@ -21,7 +27,7 @@ const defaultHighlighter = {
name: 'stroke',
options: {
attrs: {
stroke: '#5096db',
stroke: COLOR_DEFAULT,
'stroke-width': 3,
'data-cy': 'selected',
},
Expand All @@ -34,7 +40,7 @@ const completedHighlighter = {
name: 'stroke',
options: {
attrs: {
stroke: '#1572C2',
stroke: COLOR_COMPLETED,
'stroke-width': 3,
},
},
Expand All @@ -46,14 +52,26 @@ const inProgressHighlighter = {
name: 'stroke',
options: {
attrs: {
stroke: '#00875A',
stroke: COLOR_IN_PROGRESS,
'stroke-width': 3,
'stroke-dasharray': '4 4',
},
},
},
};

const idleHighlighter = {
highlighter: {
name: 'stroke',
options: {
attrs: {
stroke: COLOR_IDLE,
'stroke-width': 3,
},
},
},
};

export default {
props: [
'highlighted',
Expand All @@ -63,6 +81,7 @@ export default {
'borderOutline',
'isCompleted',
'isInProgress',
'isIdle',
],
data() {
return {
Expand Down Expand Up @@ -100,12 +119,17 @@ export default {
if (store.getters.isReadOnly) {
this.shapeView.unhighlight(this.shapeBody, completedHighlighter);
if (this.isCompleted) {
this.shape.attr('body/fill', COLOR_COMPLETED_FILL);
this.shapeView.highlight(this.shapeBody, completedHighlighter);
}
this.shapeView.unhighlight(this.shapeBody, inProgressHighlighter);
if (this.isInProgress) {
this.shapeView.highlight(this.shapeBody, inProgressHighlighter);
}
if (this.isIdle) {
this.shape.attr('body/fill', COLOR_IDLE);
this.shapeView.highlight(this.shapeBody, idleHighlighter);
}
return;
}

Expand Down
19 changes: 18 additions & 1 deletion src/mixins/linkConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ function isPoint(item) {
return item.x && item.y;
}

const COLOR_IDLE = '#ced4da';
const COLOR_COMPLETED = '#00875A';

export default {
props: ['highlighted', 'paper'],
props: ['highlighted', 'paper', 'paperManager', 'isCompleted'],
data() {
return {
sourceShape: null,
Expand Down Expand Up @@ -76,6 +79,12 @@ export default {
},
},
methods: {
setShapeHighlight() {
const COLOR = this.isCompleted ? COLOR_COMPLETED : COLOR_IDLE;
this.shape.attr({
line: { stroke: COLOR },
});
},
findSourceShape() {
return this.graph.getElements().find(element => {
return element.component && element.component.node.definition === this.node.definition.get('sourceRef');
Expand Down Expand Up @@ -326,6 +335,14 @@ export default {
this.shape.on('change:vertices', function() {
this.component.$emit('shape-resize');
});

if (store.getters.isReadOnly) {
this.$nextTick(() => {
this.paperManager.awaitScheduledUpdates().then(() => {
this.setShapeHighlight();
});
});
}
},
beforeDestroy() {
document.removeEventListener('mouseup', this.emitSave);
Expand Down