@kumologica/sdk 3.4.0 → 3.5.0-beta2

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.
Files changed (51) hide show
  1. package/cli/commands/create-commands/openapi.js +42 -0
  2. package/cli/commands/create.js +17 -8
  3. package/cli/commands/login.js +87 -0
  4. package/package.json +18 -7
  5. package/src/app/lib/ai/layout.js +75 -0
  6. package/src/app/lib/ai/openai.js +108 -0
  7. package/src/app/lib/ai/prompt.txt +583 -0
  8. package/src/app/lib/aws/ca-cloudwatch-api.js +2 -10
  9. package/src/app/lib/aws/ca-dynamodb-api.js +6 -10
  10. package/src/app/lib/aws/ca-elb-api.js +4 -24
  11. package/src/app/lib/aws/ca-events-api.js +5 -12
  12. package/src/app/lib/aws/ca-iot-api.js +3 -87
  13. package/src/app/lib/aws/ca-s3-api.js +17 -62
  14. package/src/app/lib/aws/ca-sns-api.js +6 -15
  15. package/src/app/lib/aws/ca-sqs-api.js +9 -6
  16. package/src/app/lib/aws/index.js +70 -86
  17. package/src/app/lib/aws/kl-apigw-api.js +40 -0
  18. package/src/app/lib/aws/kl-iam-api.js +5 -5
  19. package/src/app/lib/github/index.js +0 -17
  20. package/src/app/lib/serverless/index.js +1 -1
  21. package/src/app/lib/stores/settings-cloud-store.js +35 -2
  22. package/src/app/main.js +34 -32
  23. package/src/app/preload.js +36 -28
  24. package/src/app/ui/editor-client/public/red/red.js +924 -458
  25. package/src/app/ui/editor-client/public/red/red.min.js +2 -2
  26. package/src/app/ui/editor-client/public/red/style.min.css +1 -1
  27. package/src/app/ui/editor-client/src/js/nodes.js +19 -18
  28. package/src/app/ui/editor-client/src/js/red.js +6 -3
  29. package/src/app/ui/editor-client/src/js/ui/editor.js +70 -70
  30. package/src/app/ui/editor-client/src/js/ui/footer.js +143 -0
  31. package/src/app/ui/editor-client/src/js/ui/search.js +43 -34
  32. package/src/app/ui/editor-client/src/js/ui/sidebar.js +26 -24
  33. package/src/app/ui/editor-client/src/js/ui/signup.js +56 -0
  34. package/src/app/ui/editor-client/src/js/ui/tab-ai.js +210 -0
  35. package/src/app/ui/editor-client/src/js/ui/tab-awsDeploy.js +30 -5
  36. package/src/app/ui/editor-client/src/js/ui/tab-test.js +120 -99
  37. package/src/app/ui/editor-client/src/js/ui/update-panel.js +0 -1
  38. package/src/app/ui/editor-client/src/js/ui/view.js +201 -202
  39. package/src/app/ui/editor-client/src/sass/editor.scss +715 -645
  40. package/src/app/ui/editor-client/src/sass/sidebar.scss +21 -12
  41. package/src/app/ui/editor-client/src/sass/style.scss +101 -0
  42. package/src/app/ui/editor-client/src/sass/tab-ai.scss +68 -0
  43. package/src/app/ui/editor-client/src/sass/workspace.scss +12 -2
  44. package/src/app/ui/editor-client/templates/index.mst +41 -7
  45. package/src/server/DesignerServer.js +2 -1
  46. package/cli/.DS_Store +0 -0
  47. package/fixtures/.DS_Store +0 -0
  48. package/src/app/lib/aws/ca-apigw-api.js +0 -216
  49. package/src/app/lib/aws/ca-codecommit-api.js +0 -63
  50. package/src/app/lib/aws/kl-rekognition-api.js +0 -66
  51. package/src/app/lib/aws/kl-ssm-api.js +0 -24
@@ -574,6 +574,8 @@ RED.sidebar.awsDeploy = (function () {
574
574
  return;
575
575
  }
576
576
 
577
+ console.log(`attaching data list for ${serviceType} ${itemId} ${dataListId}`);
578
+
577
579
  $(`#${dataListId}`).empty();
578
580
  try {
579
581
  let services = await window.__kumologica.cloud.listServices(serviceType);
@@ -590,6 +592,7 @@ RED.sidebar.awsDeploy = (function () {
590
592
  $('<option>').attr('value', item.id).text(item.name)
591
593
  );
592
594
  });
595
+
593
596
  $(`#${itemId}`).attr('list', dataListId);
594
597
 
595
598
  $(itemId).change(function () {
@@ -625,6 +628,27 @@ RED.sidebar.awsDeploy = (function () {
625
628
  $(itemId).change(function () {
626
629
  saveSettings();
627
630
  });
631
+
632
+ // api got 2 levels dependency lists
633
+ if (serviceType === "api") {
634
+
635
+ $(itemId).on('input', function() {
636
+ let id = $(this).val(); // api id
637
+ alert("Make Ajax call here.2");
638
+
639
+ $(`#${dataListId}`).find("option").each(function() {
640
+ console.log($(this).val() + "<>" + id);
641
+ if ($(this).val() === id) {
642
+ // api id has been selected, populate stages and parentIds
643
+ // find itemId of stage
644
+ const stageItemId = itemId.replace("-api", "-stage");
645
+ const parentItemId = itemId.replace("-api", "-parentId");
646
+ // console.log("stage " + stageItemId + " parnet " + parentItemId);
647
+ //alert("Make Ajax call here.2");
648
+ }
649
+ })
650
+ })
651
+ }
628
652
  }
629
653
  }
630
654
 
@@ -643,6 +667,7 @@ RED.sidebar.awsDeploy = (function () {
643
667
  return msg;
644
668
  }
645
669
 
670
+ // functions adds trigger definition to the list
646
671
  function eventTableHtml(eventSource, values, itemId, dataListId) {
647
672
  html = `
648
673
  <table id="cloud-fn-event-table" class="node-info" style="table-layout: fixed; padding: 0px; margin: 0px;">
@@ -654,7 +679,7 @@ RED.sidebar.awsDeploy = (function () {
654
679
  </tr>
655
680
  </thead>
656
681
  <tbody>`;
657
-
682
+
658
683
  // add parameters
659
684
  parameterSets[eventSource].forEach(function (p, i) {
660
685
  let placeholder = 'optional';
@@ -673,7 +698,7 @@ RED.sidebar.awsDeploy = (function () {
673
698
  if (p.list) {
674
699
  html += `
675
700
  <td style="background: white; width:46%">
676
- <select type="text" class="palette-textinput" id="${itemId}-${i}" style="float: left; width: 100%; padding: 0px; outline: 0px solid #ccc; ">
701
+ <select type="text" class="palette-textinput" id="${itemId}-${p.key}" style="float: left; width: 100%; padding: 0px; outline: 0px solid #ccc; ">
677
702
  `;
678
703
  $.each(p.list, function () {
679
704
  if (values && this.v == values[p.key]) {
@@ -688,7 +713,7 @@ RED.sidebar.awsDeploy = (function () {
688
713
  } else if (p.function) {
689
714
  html += `
690
715
  <td style="background: white; width:46%">
691
- <input id="${itemId}-${i}"
716
+ <input id="${itemId}-${p.key}"
692
717
  class="palette-textinput" type="text"
693
718
  list="${dataListId}"
694
719
  placeholder="required" style="width:100%"
@@ -703,7 +728,7 @@ RED.sidebar.awsDeploy = (function () {
703
728
  } else {
704
729
  html += `
705
730
  <td style="background: white; width:46%">
706
- <input id="${itemId}-${i}" class="palette-textinput" type="text" placeholder="${placeholder}" style="width:100%" value="${
731
+ <input id="${itemId}-${p.key}" class="palette-textinput" type="text" placeholder="${placeholder}" style="width:100%" value="${
707
732
  values == undefined || values[p.key] == undefined ? '' : values[p.key]
708
733
  }" ${requiredAttribute}>
709
734
  </td>
@@ -1387,7 +1412,7 @@ RED.sidebar.awsDeploy = (function () {
1387
1412
  ];
1388
1413
  parameterSets['websocket'] = [
1389
1414
  {
1390
- label: 'ApiId',
1415
+ label: 'Api Id',
1391
1416
  key: 'apiId',
1392
1417
  value: '',
1393
1418
  required: true,
@@ -1,4 +1,4 @@
1
- RED.sidebar.test = (function() {
1
+ RED.sidebar.test = (function () {
2
2
  let editors = {};
3
3
 
4
4
  // html anchors
@@ -8,7 +8,7 @@ RED.sidebar.test = (function() {
8
8
  let stackContainer;
9
9
  let testNodes;
10
10
  let triggeredTest; // Flag to indicate when launch a test. As we dont want to launch test for every deployment
11
-
11
+
12
12
  // control variables
13
13
  let testCaseIdSelected; // nodeID | __runall | undefined
14
14
  let environmentSelected;
@@ -23,7 +23,7 @@ RED.sidebar.test = (function() {
23
23
 
24
24
  function updateTestCaseInit(event, msg) {
25
25
  let { testCaseID, testCaseDescription } = msg.payload.testCase;
26
-
26
+
27
27
  // sanitize the testCaseId, i.e. removing dots as jquery selector does not like it
28
28
  let testCaseId = testCaseID.replace(/\./g, '_');
29
29
 
@@ -74,8 +74,8 @@ RED.sidebar.test = (function() {
74
74
  })
75
75
  .appendTo(testcaseTabs);
76
76
 
77
- // This is the dropzone for content that will be selected in the tabs
78
- $(`<div class="testcase-info-container">
77
+ // This is the dropzone for content that will be selected in the tabs
78
+ $(`<div class="testcase-info-container">
79
79
  <div id="testcase-info-response-${testCaseId}" class="testcase-info selected">
80
80
  <div style="display: flex; justify-content: flex-end; margin-right: 10px"><span class="testcase-resp-status">Status: </span><span id="testcase-status-${testCaseId}" style="font-size: 12px; color:#2979ff; margin-right: 4px"></span></div>
81
81
  <div id="testcase-info-response-header">
@@ -126,11 +126,11 @@ RED.sidebar.test = (function() {
126
126
  });
127
127
 
128
128
  // Create an editor the the response body
129
- editors[testCaseId] = RED.editor.createEditor({
129
+ editors[testCaseId] = RED.editor.createEditor({
130
130
  id: `testcase-resp-body-${testCaseId}`,
131
131
  lineNumbers: true,
132
132
  showFoldWidgets: true,
133
- mode:"ace/mode/text",
133
+ mode: "ace/mode/text",
134
134
  options: {
135
135
  wrap: true
136
136
  }
@@ -140,24 +140,24 @@ RED.sidebar.test = (function() {
140
140
  $(`#testcase-info-response-bodyformat-${testCaseId}`).on('change', function (e) {
141
141
  var valueSelected = this.value;
142
142
  switch (valueSelected) {
143
- case 'json':
143
+ case 'json':
144
144
  let rjson = editors[testCaseId].getSession().getValue();
145
145
  let prjson = JSON.parse(rjson);
146
146
  editors[testCaseId].getSession().setValue(JSON.stringify(prjson, null, 2));
147
- editors[testCaseId].getSession().setMode('ace/mode/json');
147
+ editors[testCaseId].getSession().setMode('ace/mode/json');
148
148
  break;
149
- case 'xml':
150
- editors[testCaseId].getSession().setMode('ace/mode/xml');
149
+ case 'xml':
150
+ editors[testCaseId].getSession().setMode('ace/mode/xml');
151
151
  let vxml = editors[testCaseId].getSession().getValue();
152
152
  editors[testCaseId].getSession().setValue(formatXml(vxml));
153
153
  break;
154
- case 'html':
155
- editors[testCaseId].getSession().setMode('ace/mode/html');
154
+ case 'html':
155
+ editors[testCaseId].getSession().setMode('ace/mode/html');
156
156
  let vhtml = editors[testCaseId].getSession().getValue();
157
157
  editors[testCaseId].getSession().setValue(formatXml(vhtml));
158
158
  break;
159
- default:
160
- editors[testCaseId].getSession().setMode('ace/mode/text');
159
+ default:
160
+ editors[testCaseId].getSession().setMode('ace/mode/text');
161
161
  break
162
162
  }
163
163
  });
@@ -169,10 +169,10 @@ RED.sidebar.test = (function() {
169
169
  })
170
170
  });
171
171
 
172
- $(`#testcase-info-copypaste-container-${testCaseId}`).click(e=> {
172
+ $(`#testcase-info-copypaste-container-${testCaseId}`).click(e => {
173
173
  RED.clipboard.copyText(
174
- editors[testCaseId].getSession().getValue(),
175
- $(`#testcase-info-copypaste-container-${testCaseId}`),
174
+ editors[testCaseId].getSession().getValue(),
175
+ $(`#testcase-info-copypaste-container-${testCaseId}`),
176
176
  'Response Copied to Clipboard');
177
177
  });
178
178
 
@@ -180,14 +180,14 @@ RED.sidebar.test = (function() {
180
180
  }
181
181
 
182
182
  function formatXml(xml, tab) { // tab = optional indent value, default is tab (\t)
183
- var formatted = '', indent= '';
183
+ var formatted = '', indent = '';
184
184
  tab = tab || '\t';
185
- xml.split(/>\s*</).forEach(function(node) {
186
- if (node.match( /^\/\w/ )) indent = indent.substring(tab.length); // decrease indent by one 'tab'
187
- formatted += indent + '<' + node + '>\r\n';
188
- if (node.match( /^<?\w[^>]*[^\/]$/ )) indent += tab; // increase indent
185
+ xml.split(/>\s*</).forEach(function (node) {
186
+ if (node.match(/^\/\w/)) indent = indent.substring(tab.length); // decrease indent by one 'tab'
187
+ formatted += indent + '<' + node + '>\r\n';
188
+ if (node.match(/^<?\w[^>]*[^\/]$/)) indent += tab; // increase indent
189
189
  });
190
- return formatted.substring(1, formatted.length-3);
190
+ return formatted.substring(1, formatted.length - 3);
191
191
  }
192
192
 
193
193
  function updateTestCaseStart(event, msg) {
@@ -209,21 +209,21 @@ RED.sidebar.test = (function() {
209
209
 
210
210
  }
211
211
 
212
- function convertBodyToString(body){
212
+ function convertBodyToString(body) {
213
213
  let typeBody = typeof body;
214
214
 
215
- if (typeBody === 'object'){
215
+ if (typeBody === 'object') {
216
216
  return JSON.stringify(body, null, 2);
217
- }else if (typeBody === 'string') {
217
+ } else if (typeBody === 'string') {
218
218
  //return body.replace(/['"]+/g, '');;
219
219
  return body;
220
220
  } else {
221
221
  return ""
222
222
  }
223
-
223
+
224
224
  }
225
225
 
226
- function attachHeaders(headers, testCaseId){
226
+ function attachHeaders(headers, testCaseId) {
227
227
  let headersContainerEl = $(`#testcase-resp-headers-${testCaseId}`);
228
228
  for (let header in headers) {
229
229
  $(`
@@ -238,7 +238,7 @@ RED.sidebar.test = (function() {
238
238
  }
239
239
  }
240
240
 
241
- function changeTabSelection(key, testCaseId){
241
+ function changeTabSelection(key, testCaseId) {
242
242
  // if headers selected, then disable the output format and wrap line option
243
243
  if (key === 'headers') {
244
244
  $(`#testcase-info-response-bodyformat-container-${testCaseId}`).hide();
@@ -264,7 +264,7 @@ RED.sidebar.test = (function() {
264
264
  $(`#testcase-resp-${key}-${testCaseId}`).addClass('selected');
265
265
  }
266
266
 
267
- function selectTestcaseTab(key, testCaseID){
267
+ function selectTestcaseTab(key, testCaseID) {
268
268
  // Reset the tabs
269
269
  $(`#testcase-tab-assertion-${testCaseID}`).removeClass('selected');
270
270
  $(`#testcase-tab-response-${testCaseID}`).removeClass('selected');
@@ -289,14 +289,14 @@ RED.sidebar.test = (function() {
289
289
  let status = 'passed';
290
290
 
291
291
  // Check whether the testcase is failed or not ...
292
- for (let i=0; i < assertionResults.length; i++){
292
+ for (let i = 0; i < assertionResults.length; i++) {
293
293
  if (assertionResults[i].status === 'failed') {
294
294
  status = 'failed';
295
295
  break;
296
296
  }
297
297
  }
298
298
  // Find the testcase section
299
- if (status === 'failed'){
299
+ if (status === 'failed') {
300
300
  $(`#section-${testCaseId}`).parent().parent().addClass('failed');
301
301
  } else {
302
302
  $(`#section-${testCaseId}`).parent().parent().addClass('passed');
@@ -309,7 +309,7 @@ RED.sidebar.test = (function() {
309
309
  let testCaseId = testCaseID.replace(/\./g, '_')
310
310
 
311
311
  let assertionSectionHtml
312
- if (status === 'failed'){
312
+ if (status === 'failed') {
313
313
  assertionSectionHtml = `
314
314
  <div class="assertion assertion-failed" style="display: flex; flex-direction: column;">
315
315
  <div style="display:flex; align-items: center;">
@@ -327,34 +327,35 @@ RED.sidebar.test = (function() {
327
327
  </div>
328
328
  `;
329
329
  }
330
-
330
+
331
331
  let testCaseAssertionsContainer = $(`#testcase-info-assertion-${testCaseId}`)
332
332
 
333
333
  $(assertionSectionHtml).appendTo(testCaseAssertionsContainer);
334
334
  testCaseSection.container.show();
335
335
  }
336
336
 
337
- function onsame(){
337
+ function onsame() {
338
338
  RED.actions.invoke('core:hide-sidebar');
339
339
  }
340
340
 
341
341
  // Refresh the test tab
342
342
  // silently - if true, we will update the nodes if required, but do not show the sidebar. Used primarily for the save button
343
343
  function refreshTab(silently) {
344
- if (!silently){
344
+ console.log('[tab-test] refreshTab, silently=', silently);
345
+ if (!silently) {
345
346
  RED.actions.invoke('core:show-sidebar');
346
347
  }
347
348
 
348
349
  // Append to the selector all testcases found in the project
349
350
  let $testSidebarTestcases = $('#test-sidebar-testcases');
350
-
351
+
351
352
  // Searching for all testcases in the test.flow node.
352
353
  let testcasenodes = App.nodes.filterNodes({ type: 'TestCase' });
353
354
  // Searching for all HTTP testcases in the test.flow node.
354
355
  let httptestcasenodes = App.nodes.filterNodes({ type: 'HTTPTestCase' });
355
356
 
356
357
  testNodes = testcasenodes.concat(httptestcasenodes);
357
-
358
+
358
359
 
359
360
  if (testNodes && Array.isArray(testNodes) && testNodes.length > 0) {
360
361
  $('#test-sidebar-notestfound-explainer').hide();
@@ -371,7 +372,7 @@ RED.sidebar.test = (function() {
371
372
  );
372
373
  $testSidebarTestcases.append(
373
374
  `<option value="${RUN_ALL_TEST_CASES}"> Run all TestCases</option>`
374
- );
375
+ );
375
376
  // Check which option will be selected
376
377
  // a) If nothing was selected, select the empty
377
378
  if (testCaseIdSelected === undefined || testCaseIdSelected === null) {
@@ -392,6 +393,10 @@ RED.sidebar.test = (function() {
392
393
  $('#test-sidebar-notestfound-explainer').show();
393
394
  }
394
395
 
396
+ // Notify the footer about the changes in the testCase dropdown
397
+ refreshTestCases();
398
+
399
+ // Refresh the values of the environments in case there was a change in the config
395
400
  refreshEnvironments();
396
401
  }
397
402
 
@@ -400,23 +405,33 @@ RED.sidebar.test = (function() {
400
405
  if (config) {
401
406
  // Preselect the last testCase selected
402
407
  testCaseIdSelected = config.getLatestSelectedTestCase();
403
-
408
+
404
409
  $(`#test-sidebar-testcases option[value="${testCaseIdSelected}"]`).attr(
405
410
  'selected',
406
411
  true
407
412
  );
413
+
414
+ let testCaseSelectedName = $('#test-sidebar-testcases option:selected').text()
415
+ console.log(`[tab-test] refreshTestCases invoked with id=${testCaseIdSelected}`);
416
+ console.log(`[tab-test] refreshTestCases invoked with name=${testCaseSelectedName}`);
417
+
418
+ RED.actions.invoke('test:change-testcase-selected',
419
+ {
420
+ id: testCaseIdSelected,
421
+ name: testCaseSelectedName
422
+ });
408
423
  }
409
-
424
+
410
425
  }
411
426
 
412
427
  function refreshEnvironments() {
413
- let config = window.__kumologica.settings.testConfig;
428
+ let config = window.__kumologica.settings.testConfig;
414
429
  if (config) {
415
- let environmentsList =config.listEnvironments();
430
+ let environmentsList = config.listEnvironments();
416
431
 
417
432
  let $testSidebarEnvironments = $('#test-sidebar-environments');
418
433
  $testSidebarEnvironments.empty();
419
-
434
+
420
435
  // Attach the "no environments" option
421
436
  $testSidebarEnvironments.append(
422
437
  `<option value="__no_environment__">No Environment</option>`
@@ -426,7 +441,7 @@ RED.sidebar.test = (function() {
426
441
  `<option value=${e}>${e}</option>`
427
442
  );
428
443
  });
429
-
444
+
430
445
  // Select the latest environment
431
446
  environmentSelected = window.__kumologica.settings.testConfig.getLatestSelectedEnvironment();
432
447
  $(`#test-sidebar-environments option[value="${environmentSelected}"]`).attr('selected', true);
@@ -440,16 +455,16 @@ RED.sidebar.test = (function() {
440
455
  * this to keep fake new row at the bottom.
441
456
  */
442
457
  function refreshProperties() {
443
- if (window.__kumologica.settings.testConfig){
458
+ if (window.__kumologica.settings.testConfig) {
444
459
  let envvars = window.__kumologica.settings.testConfig.listVariablesByEnvironment();
445
460
  // Clean up the table before starting injecting the new variables.
446
461
  $('#table-test-properties').empty();
447
-
462
+
448
463
  envvars.forEach(ev => {
449
464
  attachPropertyRow(ev.key, ev.value);
450
465
  })
451
466
  }
452
-
467
+
453
468
  }
454
469
 
455
470
  function init() {
@@ -466,7 +481,7 @@ RED.sidebar.test = (function() {
466
481
  ipcRenderer.on('test:assertion-report', updateTestCaseAssertion);
467
482
 
468
483
  ipcRenderer.on('debugger:stopped', debuggerStoppedOnBreakpoint);
469
-
484
+
470
485
 
471
486
  // Prepare the html wrappers
472
487
  initHtml();
@@ -483,6 +498,14 @@ RED.sidebar.test = (function() {
483
498
  // Attach the change event to the "testcase" select
484
499
  $('#test-sidebar-testcases').change(e => {
485
500
  testCaseIdSelected = e.target.value;
501
+ let testCaseSelectedName = $('#test-sidebar-testcases option:selected').text();
502
+
503
+ RED.actions.invoke('test:change-testcase-selected',
504
+ {
505
+ id: testCaseIdSelected,
506
+ name: testCaseSelectedName
507
+ });
508
+
486
509
  saveSettings();
487
510
  });
488
511
  $('#test-sidebar-environments').change(e => {
@@ -498,40 +521,38 @@ RED.sidebar.test = (function() {
498
521
  });
499
522
 
500
523
  // Attach debugger events
501
- $('#test-sidebar-debug-continue').click( async (e)=> {
524
+ $('#test-sidebar-debug-continue').click(async (e) => {
502
525
  await window.__kumologica.debugger.continue()
503
526
  });
504
527
 
505
- $('#test-sidebar-debug-terminate').click( async (e)=> {
528
+ $('#test-sidebar-debug-terminate').click(async (e) => {
506
529
  await window.__kumologica.debugger.terminate();
507
530
  });
508
531
 
509
- $('#test-sidebar-debug-next').click( async (e)=> {
532
+ $('#test-sidebar-debug-next').click(async (e) => {
510
533
  await window.__kumologica.debugger.next();
511
534
  });
512
535
 
513
536
 
514
- $('#test-sidebar-debug-restart').click( async (e)=> {
537
+ $('#test-sidebar-debug-restart').click(async (e) => {
515
538
  await window.__kumologica.debugger.terminate();
516
539
  // give 1 sec to clean up the tab
517
- setTimeout(async()=> {
540
+ setTimeout(async () => {
518
541
  await triggerDebugTestSuite();
519
542
  }, 500);
520
543
  });
521
544
 
522
- RED.events.on('deploy:finished', async()=> {
523
- if (triggeredTest){
545
+ RED.events.on('deploy:finished', async () => {
546
+ if (triggeredTest) {
524
547
  await executeTestSuite();
525
548
  triggeredTest = false;
526
549
  }
527
550
  });
528
551
 
529
552
  // Case where the environment variables config has change
530
- RED.events.on('settings:environment-variables-changed', ()=> {
553
+ RED.events.on('settings:environment-variables-changed', () => {
531
554
  refreshEnvironments();
532
555
  })
533
-
534
-
535
556
  }
536
557
 
537
558
  function show() {
@@ -542,7 +563,7 @@ RED.sidebar.test = (function() {
542
563
  $('#test-results-wrapper').empty();
543
564
  }
544
565
 
545
- async function triggerExecuteTestSuite(opts){
566
+ async function triggerExecuteTestSuite(opts) {
546
567
  // Clean up the test results from the secion
547
568
  if (sections) {
548
569
  sections.removeAll();
@@ -565,10 +586,10 @@ RED.sidebar.test = (function() {
565
586
 
566
587
  // Clean up the previous test results
567
588
  $('#test-results-wrapper').empty();
568
-
589
+
569
590
  // Show the terminal if close
570
591
  let terminalOpen = $('#workspace-terminal').is(":visible");
571
- if (!terminalOpen){
592
+ if (!terminalOpen) {
572
593
  $('#shelve-middle').click();
573
594
  }
574
595
 
@@ -587,20 +608,20 @@ RED.sidebar.test = (function() {
587
608
 
588
609
  // Trigger the testcases
589
610
  if (RUN_ALL_TEST_CASES === testCaseIdSelected) {
590
- for (let i=0; i < testNodes.length; i++) {
611
+ for (let i = 0; i < testNodes.length; i++) {
591
612
  createDebugMessageCache(testNodes[i].id);
592
- try{
613
+ try {
593
614
  // console.log(`[tab-test] Running testcase: ${testNodes[i].id} ...`, )
594
615
  await window.__kumologica.libs.testFlow('{}', testNodes[i].id, environment);
595
- }catch(err){
616
+ } catch (err) {
596
617
  console.log('[tab-test] error found: ', err);
597
618
  }
598
- }
619
+ }
599
620
  } else {
600
621
  try {
601
622
  createDebugMessageCache(testCaseIdSelected);
602
623
  await window.__kumologica.libs.testFlow('{}', testCaseIdSelected, environment);
603
- } catch(err) {
624
+ } catch (err) {
604
625
  console.log('[tab-test] error found: ', err);
605
626
  //App.notify(`Error found: ${JSON.stringify(err)}`, { type: 'error'});
606
627
  }
@@ -610,7 +631,7 @@ RED.sidebar.test = (function() {
610
631
  }
611
632
  }
612
633
 
613
- function createDebugMessageCache(testCaseID){
634
+ function createDebugMessageCache(testCaseID) {
614
635
  let sanitizeTestCaseID = testCaseID.replace(/\./g, '_')
615
636
  $(`<div id="test-debug-message-cache-${sanitizeTestCaseID}" style="margin-right: 2px"></div>`).appendTo($('#test-debug-messages-caches'));
616
637
  }
@@ -764,11 +785,11 @@ RED.sidebar.test = (function() {
764
785
  });
765
786
 
766
787
  // ==> Load initial data to the screen
767
- refreshScreen();
788
+ refreshScreen();
768
789
 
769
790
  // Append to the list of properties a fake record to append a new property
770
791
  // attachAppendPropertyRow(); // TODO: Javier review
771
-
792
+
772
793
  // Load the tooltips
773
794
  RED.popover.tooltip($('#test-sidebar-header-wrapper-left'), 'Select Test Case to Run');
774
795
  RED.popover.tooltip(
@@ -797,8 +818,8 @@ RED.sidebar.test = (function() {
797
818
  attachAppendPropertyRow();
798
819
  });
799
820
 
800
- function toggleProperties(){
801
- if (propertiesOpened){
821
+ function toggleProperties() {
822
+ if (propertiesOpened) {
802
823
  // close the properties window
803
824
  $('#propertiesSection').hide();
804
825
  } else {
@@ -819,9 +840,9 @@ RED.sidebar.test = (function() {
819
840
  refreshProperties();
820
841
  }
821
842
 
822
-
823
843
 
824
- function attachPropertyRow(key, value){
844
+
845
+ function attachPropertyRow(key, value) {
825
846
  const s = key;
826
847
  const keyid = s.replace(/[^a-zA-Z0-9-]/g, '_');
827
848
  let propertyRow = `
@@ -851,30 +872,30 @@ RED.sidebar.test = (function() {
851
872
  });
852
873
  }
853
874
 
854
- function deleteProperty(key){
875
+ function deleteProperty(key) {
855
876
  // detach the DOM element
856
877
  $(`#row-${key}`).remove();
857
878
  saveSettings();
858
879
  }
859
880
 
860
- function addProperty(key, value){
881
+ function addProperty(key, value) {
861
882
  // reset the errors have happened in the past,... pity we cannot do the same in real life
862
883
  $('#new-prop-key').removeClass('wrong-value');
863
884
  $('#new-prop-value').removeClass('wrong-value');
864
885
 
865
886
  let errorsFound = false;
866
887
 
867
- if (!key){
888
+ if (!key) {
868
889
  errorsFound = true;
869
890
  $('#new-prop-key').addClass('wrong-value');
870
891
  }
871
892
 
872
- if (!value){
893
+ if (!value) {
873
894
  errorsFound = true;
874
895
  $('#new-prop-value').addClass('wrong-value');
875
896
  }
876
897
 
877
- if (!errorsFound){
898
+ if (!errorsFound) {
878
899
  // remove the addPropertyRow...
879
900
  $('#table-row-append').remove();
880
901
  // Sanitize the key. As this will be used as a valid `id` property of the html element
@@ -918,37 +939,37 @@ RED.sidebar.test = (function() {
918
939
  <div id="addSaveProperty" class="table-cell-btn"><i class="icofont-save"></i></div>
919
940
  </div>
920
941
  `;
921
- $(addPropertyRow).appendTo($('#table-test-properties'));
942
+ $(addPropertyRow).appendTo($('#table-test-properties'));
922
943
 
923
- // Attach the save event
924
- $('#addSaveProperty').click(e => {
925
- let key = $('#new-prop-key').val();
926
- let value = $('#new-prop-value').val();
927
- addProperty(key, value);
928
- });
929
- // Do not allow spaces on the key - replace if for dashes
930
- $('#new-prop-key').on('input', () => {
931
- let old = $('#new-prop-key').val();
932
- $('#new-prop-key').val(old.replace(/\s+/g, '-') );
933
- });
944
+ // Attach the save event
945
+ $('#addSaveProperty').click(e => {
946
+ let key = $('#new-prop-key').val();
947
+ let value = $('#new-prop-value').val();
948
+ addProperty(key, value);
949
+ });
950
+ // Do not allow spaces on the key - replace if for dashes
951
+ $('#new-prop-key').on('input', () => {
952
+ let old = $('#new-prop-key').val();
953
+ $('#new-prop-key').val(old.replace(/\s+/g, '-'));
954
+ });
934
955
  }
935
956
 
936
957
  // Debugger operations
937
958
  async function triggerDebugTestSuite() {
938
959
  // console.log('[tab-test] Debugger started ...');
939
- let { body} = await window.__kumologica.debugger.listBreakpoints();
960
+ let { body } = await window.__kumologica.debugger.listBreakpoints();
940
961
  // console.log('[tab-test] Breakpoints =', body);
941
- if ( body.length === 0 ) {
962
+ if (body.length === 0) {
942
963
  // case of no breakpoints found in the flow
943
964
  await triggerExecuteTestSuite({ debug: false });
944
965
  RED.notifications.notify('No breakpoints found in the flow', 'warning', undefined, 2000);
945
- } else{
966
+ } else {
946
967
  $('#test-info-wrapper').hide();
947
968
  $('#properties-wrapper').hide();
948
969
  $('#debugger-wrapper').show();
949
970
  await triggerExecuteTestSuite({ debug: true });
950
971
  }
951
-
972
+
952
973
  }
953
974
 
954
975
  async function hideDebuggerControls() {
@@ -965,17 +986,17 @@ RED.sidebar.test = (function() {
965
986
  $('#debugger-wrapper').show();
966
987
  }
967
988
 
968
- function debuggerStoppedOnBreakpoint(e,msg) {
989
+ function debuggerStoppedOnBreakpoint(e, msg) {
969
990
  // console.log('[tab-test] Debugger stopped on breakpoint ...e=', e);
970
991
  // console.log('[tab-test] Debugger stopped on breakpoint ...msg=', msg);
971
992
 
972
993
  showDebuggerControls();
973
994
 
974
- let universalNodeId = msg.payload.nodeId;
995
+ let universalNodeId = msg.payload.nodeId;
975
996
  let testCaseID = universalNodeId.split('::')[0];
976
997
  // sanitize the testCaseId, i.e. removing dots as jquery selector does not like it
977
998
  testCaseId = testCaseID.replace(/\./g, '_');
978
-
999
+
979
1000
  sections.expandLastEntry();
980
1001
  selectTestcaseTab('traces', testCaseId);
981
1002
  }