@processmaker/modeler 1.43.4 → 1.43.5

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.4",
3
+ "version": "1.43.5",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve --mode development",
6
6
  "test:unit": "vue-cli-service test:unit",
@@ -1895,6 +1895,34 @@ export default {
1895
1895
  this.assetFail = true;
1896
1896
  });
1897
1897
  },
1898
+ highlightTaskArrays(data) {
1899
+ if (data) {
1900
+ this.addAiHighlights(data.tasks);
1901
+ this.addAiHighlights(data.serviceTasks);
1902
+ this.addAiHighlights(data.scriptTasks);
1903
+ }
1904
+ },
1905
+ unhighlightTaskArrays(data) {
1906
+ if (data) {
1907
+ this.removeAiHighlights(data.tasks);
1908
+ this.removeAiHighlights(data.serviceTasks);
1909
+ this.removeAiHighlights(data.scriptTasks);
1910
+ }
1911
+ },
1912
+ addAiHighlights(taskArray) {
1913
+ let self = this;
1914
+ taskArray.forEach(task => {
1915
+ const taskNode = self.getElementByNodeId(task.id);
1916
+ taskNode.component.setAiStatusHighlight(task.status);
1917
+ });
1918
+ },
1919
+ removeAiHighlights(taskArray) {
1920
+ let self = this;
1921
+ taskArray.forEach(task => {
1922
+ const taskNode = self.getElementByNodeId(task.id);
1923
+ taskNode.component.unsetHighlights();
1924
+ });
1925
+ },
1898
1926
  subscribeToProgress() {
1899
1927
  const channel = `ProcessMaker.Models.User.${window.ProcessMaker?.modeler?.process?.user_id}`;
1900
1928
  const streamProgressEvent = '.ProcessMaker\\Package\\PackageAi\\Events\\GenerateArtifactsProgressEvent';
@@ -1902,17 +1930,19 @@ export default {
1902
1930
  streamProgressEvent,
1903
1931
  (response) => {
1904
1932
  if (response.data.promptSessionId !== this.promptSessionId) {
1933
+ this.unhighlightTaskArrays(response.data);
1905
1934
  return;
1906
1935
  }
1907
1936
 
1908
1937
  if (this.cancelledJobs.some((element) => element === response.data.nonce)) {
1938
+ this.unhighlightTaskArrays(response.data);
1909
1939
  return;
1910
1940
  }
1911
1941
 
1912
1942
  if (response.data) {
1913
1943
  if (response.data.progress.status === 'running') {
1914
1944
  this.loadingAI = true;
1915
- // Blue color for nodes running
1945
+ this.highlightTaskArrays(response.data);
1916
1946
  } else if (response.data.progress.status === 'error') {
1917
1947
  this.loadingAI = false;
1918
1948
  window.ProcessMaker.alert(response.data.message, 'danger');
@@ -1922,6 +1952,7 @@ export default {
1922
1952
  this.setPromptSessions(response.data.promptSessionId);
1923
1953
  // Successful generation
1924
1954
  this.assetsCreated = true;
1955
+ this.unhighlightTaskArrays(response.data);
1925
1956
  this.fetchHistory();
1926
1957
  setTimeout(() => {
1927
1958
  this.loadingAI = false;
@@ -143,7 +143,29 @@ export default {
143
143
  } else {
144
144
  this.shapeView.unhighlight(this.shapeBody, this.prepareCustomColorHighlighter(color));
145
145
  }
146
-
146
+ },
147
+ setAiStatusHighlight(status) {
148
+ this.shapeView.unhighlight(this.shapeBody, completedHighlighter);
149
+ if (status === 'generated') {
150
+ this.shape.attr('body/fill', COLOR_COMPLETED_FILL);
151
+ this.shapeView.highlight(this.shapeBody, completedHighlighter);
152
+ }
153
+ this.shapeView.unhighlight(this.shapeBody, inProgressHighlighter);
154
+ if (status === 'generating') {
155
+ this.shape.attr('body/fill', COLOR_IN_PROGRESS_FILL);
156
+ this.shapeView.highlight(this.shapeBody, inProgressHighlighter);
157
+ }
158
+ this.shapeView.unhighlight(this.shapeBody, idleHighlighter);
159
+ if (status === 'previously generated') {
160
+ this.shape.attr('body/fill', COLOR_IDLE_FILL);
161
+ this.shapeView.highlight(this.shapeBody, idleHighlighter);
162
+ }
163
+ },
164
+ unsetHighlights() {
165
+ this.shape.attr('body/fill', '#FFFFFF');
166
+ this.shapeView.unhighlight(this.shapeBody, inProgressHighlighter);
167
+ this.shapeView.unhighlight(this.shapeBody, completedHighlighter);
168
+ this.shapeView.unhighlight(this.shapeBody, idleHighlighter);
147
169
  },
148
170
  setShapeHighlightForReadOnly() {
149
171
  if (!this.shapeView) {