Skip to content

Commit

Permalink
Update screen and script refs after generate assets with AI
Browse files Browse the repository at this point in the history
  • Loading branch information
agustinbusso committed Jan 16, 2024
1 parent 7f4b7bc commit 9f9c0ad
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/components/inspectors/InspectorPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ export default {
'highlightedNode.definition.assignmentRules'(current, previous) { this.handleAssignmentChanges(current, previous); },
'highlightedNode.definition.allowInterstitial'(current, previous) { this.handleAssignmentChanges(current, previous); },
'highlightedNode.definition.interstitialScreenRef'(current, previous) { this.handleAssignmentChanges(current, previous); },
'highlightedNode.definition.screenRef'(current, previous) { this.handleAssignmentChanges(current, previous); },
'highlightedNode.definition.scriptRef'(current, previous) { this.handleAssignmentChanges(current, previous); },
},
computed: {
inspectorHeaderTitle() {
Expand Down
29 changes: 26 additions & 3 deletions src/components/modeler/Modeler.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2215,9 +2215,8 @@ export default {
streamCompletedEvent,
(response) => {
if (response.data) {
setTimeout(() => {
window.location.replace(window.location.href.split('?')[0]);
}, 1500);
this.updateScreenRefs(response.data.screenIds);
this.updateScriptRefs(response.data.scriptIds);
}
},
);
Expand All @@ -2241,6 +2240,30 @@ export default {
this.loadingAI = false;
}
},
updateScreenRefs(elements) {
elements.forEach(el => {
const node = this.nodes.find(n => n.definition.id === el.node_id);
let definition = node.definition;
if (node.type === 'processmaker-modeler-task') {
definition.screenRef = el.screen_id;
store.commit('updateNodeProp', { node, key: 'definition', value: definition });
this.$emit('save-state');
}
});
},
updateScriptRefs(elements) {
elements.forEach(el => {
const node = this.nodes.find(n => n.definition.id === el.node_id);
let definition = node.definition;
if (node.type === 'processmaker-modeler-script-task') {
definition.scriptRef = el.script_id;
store.commit('updateNodeProp', { node, key: 'definition', value: definition });
this.$emit('save-state');
}
});
},
},
created() {
if (runningInCypressTest()) {
Expand Down

0 comments on commit 9f9c0ad

Please sign in to comment.