@processmaker/modeler 1.43.8 → 1.43.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@processmaker/modeler",
3
- "version": "1.43.8",
3
+ "version": "1.43.9",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve --mode development",
6
6
  "test:unit": "vue-cli-service test:unit",
@@ -25,7 +25,7 @@
25
25
  @clearSelection="clearSelection"
26
26
  :players="filteredPlayers"
27
27
  @action="handleToolbarAction"
28
- @onGenerateAssets="generateAssets()"
28
+ @onGenerateAssets="onGenerateAssets()"
29
29
  />
30
30
  <b-row class="modeler h-100">
31
31
  <b-tooltip
@@ -60,7 +60,7 @@
60
60
  <CreateAssetsCard
61
61
  ref="createAssetsCard"
62
62
  v-if="isAiGenerated"
63
- @onGenerateAssets="generateAssets()"
63
+ @onGenerateAssets="onGenerateAssets()"
64
64
  @closeCreateAssets="isAiGenerated = false"
65
65
  />
66
66
 
@@ -654,7 +654,7 @@ export default {
654
654
  async close() {
655
655
  this.$emit('close');
656
656
  },
657
- async saveBpmn(redirectTo = null, id = null) {
657
+ async saveBpmn(redirectTo = null, id = null, generatingAssets = false) {
658
658
  const svg = document.querySelector('.mini-paper svg');
659
659
  const css = 'text { font-family: sans-serif; }';
660
660
  const style = document.createElement('style');
@@ -663,7 +663,7 @@ export default {
663
663
  svg.appendChild(style);
664
664
  const xml = await this.getXmlFromDiagram();
665
665
  const svgString = (new XMLSerializer()).serializeToString(svg);
666
- this.$emit('saveBpmn', { xml, svg: svgString, redirectUrl: redirectTo, nodeId: id });
666
+ this.$emit('saveBpmn', { xml, svg: svgString, redirectUrl: redirectTo, nodeId: id, generatingAssets });
667
667
  },
668
668
  borderOutline(nodeId) {
669
669
  return this.decorations.borderOutline && this.decorations.borderOutline[nodeId];
@@ -1904,6 +1904,9 @@ export default {
1904
1904
  }
1905
1905
  });
1906
1906
  },
1907
+ onGenerateAssets() {
1908
+ this.saveBpmn(null, null, true);
1909
+ },
1907
1910
  generateAssets() {
1908
1911
  this.getNonce();
1909
1912
 
@@ -2001,6 +2004,20 @@ export default {
2001
2004
  },
2002
2005
  );
2003
2006
  },
2007
+ subscribeToGenerationCompleted() {
2008
+ const channel = `ProcessMaker.Models.User.${window.ProcessMaker?.modeler?.process?.user_id}`;
2009
+ const streamCompletedEvent = '.ProcessMaker\\Package\\PackageAi\\Events\\GenerateArtifactsCompletedEvent';
2010
+ window.Echo.private(channel).listen(
2011
+ streamCompletedEvent,
2012
+ (response) => {
2013
+ if (response.data) {
2014
+ setTimeout(() => {
2015
+ window.location.replace(window.location.href.split('?')[0]);
2016
+ }, 1500);
2017
+ }
2018
+ },
2019
+ );
2020
+ },
2004
2021
  subscribeToErrors() {
2005
2022
  const channel = `ProcessMaker.Models.User.${window.ProcessMaker?.modeler?.process?.user_id}`;
2006
2023
  const streamProgressEvent = '.ProcessMaker\\Package\\PackageAi\\Events\\GenerateArtifactsErrorEvent';
@@ -2202,10 +2219,13 @@ export default {
2202
2219
  this.replaceAiNode(data);
2203
2220
  });
2204
2221
 
2205
- window.ProcessMaker.EventBus.$on('save-changes', (redirectUrl) => {
2222
+ window.ProcessMaker.EventBus.$on('save-changes', (redirectUrl, nodeId, generatingAssets) => {
2206
2223
  if (redirectUrl) {
2207
2224
  this.redirect(redirectUrl);
2208
2225
  }
2226
+ if (generatingAssets) {
2227
+ this.generateAssets();
2228
+ }
2209
2229
  });
2210
2230
 
2211
2231
  // AI Setup
@@ -2221,6 +2241,7 @@ export default {
2221
2241
  this.promptSessionId = this.getPromptSessionForUser();
2222
2242
  this.fetchHistory();
2223
2243
  this.subscribeToProgress();
2244
+ this.subscribeToGenerationCompleted();
2224
2245
  this.subscribeToErrors();
2225
2246
  },
2226
2247
  };