@kumologica/sdk 3.0.26 → 3.0.27-beta10

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 (34) hide show
  1. package/cli/commands/export-commands/cloudformation.js +16 -1
  2. package/cli/commands/export-commands/utils/validator.js +17 -0
  3. package/cli/commands/test-utils/TestSuiteController.js +7 -22
  4. package/cli/commands/test.js +36 -12
  5. package/package.json +7 -4
  6. package/src/app/lib/aws/cf.js +19 -9
  7. package/src/app/lib/aws/index.js +12 -7
  8. package/src/app/main-process/main-window.js +1 -1
  9. package/src/app/main-process/menu.js +1 -1
  10. package/src/app/main.js +4 -4
  11. package/src/app/preload.js +5 -7
  12. package/src/app/ui/editor-api/lib/editor/comms.js +3 -3
  13. package/src/app/ui/editor-client/public/red/red.js +387 -124
  14. package/src/app/ui/editor-client/public/red/red.min.js +1 -1
  15. package/src/app/ui/editor-client/public/red/style.min.css +1 -1
  16. package/src/app/ui/editor-client/public/vendor/simplemde/simplemde.min.css +0 -7
  17. package/src/app/ui/editor-client/public/vendor/simplemde/simplemde.min.js +0 -15
  18. package/src/app/ui/editor-client/public/vendor/xterm/lib/xterm.js +0 -2
  19. package/src/app/ui/editor-client/src/js/ui/common/tabs.js +16 -1
  20. package/src/app/ui/editor-client/src/js/ui/editor.js +4 -4
  21. package/src/app/ui/editor-client/src/js/ui/sidebar.js +43 -111
  22. package/src/app/ui/editor-client/src/js/ui/tab-git.js +320 -0
  23. package/src/app/ui/editor-client/src/js/ui/tab-test.js +2 -5
  24. package/src/app/ui/editor-client/src/js/ui/tray.js +2 -2
  25. package/src/app/ui/editor-client/src/js/ui/view.js +1 -1
  26. package/src/app/ui/editor-client/src/sass/editor.scss +10 -3
  27. package/src/app/ui/editor-client/src/sass/sidebar.scss +9 -9
  28. package/src/app/ui/editor-client/src/sass/style.scss +1 -0
  29. package/src/app/ui/editor-client/src/sass/tab-git.scss +54 -0
  30. package/src/app/ui/editor-client/src/sass/tabs.scss +1 -1
  31. package/src/app/ui/editor-client/src/sass/workspace.scss +1 -1
  32. package/src/app/ui/editor-client/templates/index.mst +2 -1
  33. package/cli/commands/import-commands/mulesoft.js +0 -61
  34. package/cli/commands/import.js +0 -6
@@ -9060,11 +9060,26 @@ RED.panels = (function() {
9060
9060
  }
9061
9061
  }
9062
9062
 
9063
+ function getTabsMaxWidthAvailable() {
9064
+ const workspaceWidth = $('#main-container').width();
9065
+
9066
+ const paletteWidth = $('#palette').is(':hidden')? 0 : $('#palette').width();
9067
+ const sidebarWidth = $('#sidebar').is(':hidden')? 0 : $('#sidebar').width();
9068
+ const sidebarShortcuts = $('#sidebar-shortcuts').width();
9069
+ const occupied = paletteWidth + sidebarWidth + sidebarShortcuts;
9070
+
9071
+ return workspaceWidth - occupied;
9072
+ }
9073
+
9063
9074
  function updateTabWidths() {
9064
9075
  if (options.vertical) {
9065
9076
  return;
9066
9077
  }
9067
9078
  var tabs = ul.find('li.red-ui-tab');
9079
+
9080
+ // Update the width of the tabs container
9081
+ $('#workspace').find('.red-ui-tabs').width(getTabsMaxWidthAvailable());
9082
+
9068
9083
  var width = wrapper.width();
9069
9084
  var tabCount = tabs.size();
9070
9085
  var tabWidth;
@@ -9094,7 +9109,7 @@ RED.panels = (function() {
9094
9109
  currentTabWidth = (100 * tabWidth) / width + '%';
9095
9110
  currentActiveTabWidth = currentTabWidth + '%';
9096
9111
  if (options.scrollable) {
9097
- tabWidth = Math.max(tabWidth, 60);
9112
+ tabWidth = Math.max(tabWidth, 150); // minimum width for the tab
9098
9113
  currentTabWidth = tabWidth + 'px';
9099
9114
  currentActiveTabWidth = 0;
9100
9115
  var listWidth = Math.max(
@@ -17144,7 +17159,7 @@ RED.h = handlers;
17144
17159
  RED.editor.edit(selection);
17145
17160
  }else{
17146
17161
  // User has clicked on the canvas or link
17147
- // console.log('[view] Selection has not changed. Ignore');
17162
+ console.log('[view] Selection has not changed. Ignore');
17148
17163
  // Just close the sidebar
17149
17164
  RED.editor.resetEditor();
17150
17165
  }
@@ -20863,7 +20878,6 @@ RED.view.tools = (function() {
20863
20878
  var sidebar_tabs = RED.tabs.create({
20864
20879
  id: 'sidebar-tabs',
20865
20880
  onchange: function (tab) {
20866
- // console.log('[sidebar] - onChange | tab=', tab);
20867
20881
  $('#editor-stack').hide();
20868
20882
  $('#sidebar-content').children().hide();
20869
20883
  $('#sidebar-footer').children().hide();
@@ -20971,89 +20985,38 @@ RED.view.tools = (function() {
20971
20985
  RED.menu.removeItem('menu-item-view-menu-' + id);
20972
20986
  }
20973
20987
 
20974
- var sidebarSeparator = {};
20975
- sidebarSeparator.dragging = false;
20988
+ // Dragable sidebar logic
20989
+ let sidebarDragging = false;
20990
+ let sidebarWidthP0 = null;
20991
+ let delta = 0;
20976
20992
 
20977
20993
  $('#sidebar-separator').draggable({
20978
20994
  axis: 'x',
20979
20995
  start: function (event, ui) {
20980
- if (!startingPointSeparator){
20981
- startingPointSeparator = ui.position.left;
20982
- }
20983
- sidebarSeparator.closing = false;
20984
- sidebarSeparator.opening = false;
20985
- var winWidth = $(window).width();
20986
- sidebarSeparator.start = ui.position.left;
20987
- sidebarSeparator.workspaceWidth = $('#workspace').width();
20988
- sidebarSeparator.workspaceRight = parseInt($('#workspace').css('right'));
20989
- sidebarSeparator.dragging = true;
20990
-
20991
- if (!RED.menu.isSelected('menu-item-sidebar')) {
20992
- sidebarSeparator.opening = true;
20993
- var newChartRight = 7;
20994
- $('#sidebar').addClass('closing');
20995
- $('#workspace').css('right', newChartRight);
20996
- $('#editor-stack').css('right', newChartRight + 1);
20997
- $('#sidebar').width(0);
20998
-
20999
- RED.menu.setSelected('menu-item-sidebar', true);
21000
- RED.events.emit('sidebar:resize');
21001
- }
21002
- sidebarSeparator.width = $('#sidebar').width();
21003
- // console.log('Sidebar start point=', sidebarSeparator.start);
20996
+ sidebarDragging = true;
20997
+ sidebarWidthP0 = $('#sidebar').width();
20998
+ delta = 0;
21004
20999
  },
21005
21000
  drag: function (event, ui) {
21006
- let d = ui.position.left - sidebarSeparator.start;
21007
- // sidebar should be original + the distance
21008
- // sidebarSeparator.width = sidebarSeparator.width - d ;
21009
- // newSidebarWidth = sidebarSeparator.width + 50;
21010
- // console.log(ui.position.left);
21011
- // console.log(`distance: ${d} -> new right for worspace: ${sidebarSeparator.workspaceRight - d}`);
21012
-
21013
- // if (sidebarSeparator.opening) {
21014
- // newSidebarWidth -= 3;
21015
- // }
21016
-
21017
- const MIN_SIDEBAR_WIDTH = 435;
21018
- let desiredSidebarWidth = sidebarSeparator.width - d;
21019
- let desiredWorkspaceRight = sidebarSeparator.workspaceRight - d;
21020
-
21021
- if (desiredSidebarWidth > 435){
21022
- // console.log(`Recalibrating sidebar width!!`)
21023
- $('#sidebar').width(desiredSidebarWidth);
21024
- $('#workspace').css('right', desiredWorkspaceRight);
21025
- } else{
21026
- // console.log('STOP THIS NOW!!!! IT IS TOO NARROW!!!');
21027
- $('#sidebar').width(433);
21028
- let sidebarWidth= $('#sidebar').width();
21029
- $('#workspace').css('right', 491);
21030
- // console.log('Window width=',$(window).width());
21031
- // let sidebarFinalPoint = $(window).width() - MIN_SIDEBAR_WIDTH - 50;
21032
- // console.log(`Sidebar final point: ${startingPointSeparator}`);
21033
- ui.position.left = startingPointSeparator; //$(window).width() - MIN_SIDEBAR_WIDTH - 50; // 11:width separator, 50: size icons
21034
- // console.log(`sidebar width after dragging end is: ${ sidebarWidth }`)
21035
- $('#sidebar').removeAttr('width');
21001
+ let d = ui.position.left;
21002
+ delta = sidebarWidthP0 - d;
21003
+ $('#sidebar').width(delta);
21004
+ if ($('#sidebar').width() > maxWidthSidebar()){
21005
+ $('#sidebar').width(maxWidthSidebar());
21036
21006
  }
21007
+ event.stopImmediatePropagation();
21037
21008
  RED.events.emit('sidebar:resize');
21038
21009
  },
21039
21010
  stop: function (event, ui) {
21040
- sidebarSeparator.dragging = false;
21041
- if (sidebarSeparator.closing) {
21042
- // console.log('sidebar-> stop: closing...')
21043
- $('#sidebar').removeClass('closing');
21044
- RED.menu.setSelected('menu-item-sidebar', false);
21045
- if ($('#sidebar').width() < 435) {
21046
- $('#sidebar').width(435);
21047
- $('#workspace').css('right', 491);
21048
- // $('#editor-stack').css('right', 188);
21049
- }
21050
- }
21051
- //$('#sidebar-separator').css('left', 'auto');
21052
- //$('#sidebar-separator').css('right', $('#sidebar').width() + 2 + 'px');
21011
+ setTimeout(function() {
21012
+ sidebarDragging = false;
21013
+ },1000);
21053
21014
  RED.events.emit('sidebar:resize');
21054
21015
  },
21055
21016
  });
21056
21017
 
21018
+
21019
+
21057
21020
  var sidebarControls = $(
21058
21021
  '<div class="sidebar-control-right"><i class="fa fa-chevron-right"</div>'
21059
21022
  ).appendTo($('#sidebar-separator'));
@@ -21061,37 +21024,19 @@ RED.view.tools = (function() {
21061
21024
  sidebarControls.hide();
21062
21025
  RED.menu.toggleSelected('menu-item-sidebar');
21063
21026
  });
21064
- $('#sidebar-separator').on('mouseenter', function () {
21065
- if (!sidebarSeparator.dragging) {
21066
- if (RED.menu.isSelected('menu-item-sidebar')) {
21067
- sidebarControls
21068
- .find('i')
21069
- .addClass('fa-chevron-right')
21070
- .removeClass('fa-chevron-left');
21071
- } else {
21072
- sidebarControls
21073
- .find('i')
21074
- .removeClass('fa-chevron-right')
21075
- .addClass('fa-chevron-left');
21076
- }
21077
- sidebarControls.toggle('slide', { direction: 'right' }, 200);
21078
- }
21079
- });
21080
- $('#sidebar-separator').on('mouseleave', function () {
21081
- if (!sidebarSeparator.dragging) {
21082
- sidebarControls.hide();
21083
- }
21084
- });
21085
21027
 
21086
- function maximizeSidebar(){
21028
+ function maxWidthSidebar() {
21087
21029
  const totalWidth = $('#main-container').width();
21088
21030
  const shortcutsWidth = 50;
21089
21031
  const paletteWidth = $('#palette').width();
21090
21032
  const sidebarSeparatorWidth = $('#sidebar-separator').width()
21091
21033
 
21092
- const targetWidth = totalWidth - shortcutsWidth - paletteWidth - sidebarSeparatorWidth;
21034
+ return totalWidth - shortcutsWidth - paletteWidth - sidebarSeparatorWidth;
21035
+ }
21036
+
21037
+ function maximizeSidebar(){
21038
+ const targetWidth = maxWidthSidebar();
21093
21039
  $('#sidebar').width(targetWidth);
21094
- $('#sidebar-separator').css('left', paletteWidth);
21095
21040
 
21096
21041
  // Hack: Make sure the workspace if reset before maximizing the sidebar. This is because when dragging the sidebar the workspace width is also modified
21097
21042
  $('#workspace').css('right', 491);
@@ -21102,7 +21047,7 @@ RED.view.tools = (function() {
21102
21047
  const offsetWidth = 435;
21103
21048
 
21104
21049
  $('#sidebar').width(offsetWidth);
21105
- $('#sidebar-separator').css('left', '');
21050
+ // $('#sidebar-separator').css('left', '');
21106
21051
  RED.events.emit('sidebar:resize');
21107
21052
  }
21108
21053
 
@@ -21111,7 +21056,6 @@ RED.view.tools = (function() {
21111
21056
  }
21112
21057
 
21113
21058
  function toggleSidebar(state) {
21114
- // console.log(`[sidebar] toggling the sidebar to: ${state} ...`);
21115
21059
  let checkIfscrollWorkspaceRequired = false;
21116
21060
  if (!state) {
21117
21061
  // Hide the sidebar and sidebar-separator
@@ -21143,11 +21087,13 @@ RED.view.tools = (function() {
21143
21087
  // `);
21144
21088
  if (nodeSelectedPosX - initialScrollLeft + safeDistNodeSidebar > sidebarPosLeftX ){
21145
21089
  let targetScrollLeft = nodeSelectedPosX - sidebarPosLeftX + safeDistNodeSidebar;
21146
- // console.log(`[sidebar] TargetScrollLeft: (${targetScrollLeft})...`);
21147
21090
  $('#chart').animate( { scrollLeft: targetScrollLeft})
21148
21091
  }
21149
21092
  }
21150
-
21093
+ }
21094
+
21095
+ function isSidebarDragging() {
21096
+ return sidebarDragging;
21151
21097
  }
21152
21098
 
21153
21099
  function showSidebar(id) {
@@ -21177,12 +21123,11 @@ RED.view.tools = (function() {
21177
21123
  });
21178
21124
 
21179
21125
  //hide the sidebar-separator
21180
- $('#sidebar-separator').hide();
21126
+ // $('#sidebar-separator').hide();
21181
21127
 
21182
21128
  }
21183
21129
 
21184
21130
  function selectTab(index){
21185
- // console.log('[sidebar] selectTab clicked with index=', index);
21186
21131
  let selectedTab = $('#sidebar-shortcuts').find('.sidebar-shortcuts-icons').children()[index];
21187
21132
  // Click only if has not been selected
21188
21133
  // console.log('[sidebar] selectedTab.hasClass(selected)=', selectedTab.hasClass('selected'));
@@ -21205,14 +21150,9 @@ RED.view.tools = (function() {
21205
21150
  toggleSidebar(true);
21206
21151
 
21207
21152
  //show the sidebar-separator
21208
- let sidebarSeparator = $('#sidebar-separator');
21209
- sidebarSeparator.show();
21210
-
21211
- // resize the workspace to adjust to the left of the sidebar separator
21212
- let sidebarSepatorToRight = sidebarSeparator.position().left;
21213
- let mainContainerWidth = $('#main-container').width();
21214
- let targetRightPosToWorkspace = mainContainerWidth - sidebarSepatorToRight - 1;
21215
- $('#workspace').css('right', targetRightPosToWorkspace);
21153
+ // let sidebarSeparator = $('#sidebar-separator');
21154
+ // sidebarSeparator.show();
21155
+
21216
21156
  // Select internally the tab
21217
21157
  if (e && e.hasOwnProperty('selectIndex')){
21218
21158
  selectTab(e.selectIndex);
@@ -21220,8 +21160,12 @@ RED.view.tools = (function() {
21220
21160
  });
21221
21161
 
21222
21162
  RED.actions.add('core:hide-sidebar', function(){
21223
- toggleSidebar(false);
21224
- deselectAll();
21163
+ if (!sidebarDragging){
21164
+ toggleSidebar(false);
21165
+ deselectAll();
21166
+ }else {
21167
+ console.log('[sidebar] Ignoring hide-sidebar as dragging is still enabled')
21168
+ }
21225
21169
  });
21226
21170
 
21227
21171
  // RED.popover.tooltip(
@@ -21235,11 +21179,13 @@ RED.view.tools = (function() {
21235
21179
  RED.sidebar.nodeinfo.init();
21236
21180
  RED.sidebar.info.init();
21237
21181
  RED.sidebar.test.init();
21182
+ RED.sidebar.git.init();
21238
21183
  RED.sidebar.kumohub.init();
21239
21184
  RED.sidebar.azure.init();
21240
21185
  RED.sidebar.awsDeploy.init();
21241
21186
 
21242
21187
 
21188
+
21243
21189
  // hide info bar at start if screen rather narrow...
21244
21190
  // if ($(window).width() < 600) {
21245
21191
  // RED.menu.setSelected('menu-item-sidebar', false);
@@ -21264,7 +21210,8 @@ RED.view.tools = (function() {
21264
21210
  restore: restoreSidebar,
21265
21211
  deselectAll: deselectAll,
21266
21212
  selectTab: selectTab,
21267
- isSidebarVisible: isSidebarVisible
21213
+ isSidebarVisible: isSidebarVisible,
21214
+ isDragging: isSidebarDragging,
21268
21215
  };
21269
21216
  })();
21270
21217
  ;RED.sidebar.info = (function () {
@@ -24849,9 +24796,6 @@ RED.sidebar.nodeinfo = (function(){
24849
24796
  // Clear the cache of debug messages
24850
24797
  $('#test-debug-messages-caches').empty();
24851
24798
 
24852
- // Check if traceability is enabled
24853
- let traceabilityEnabled = $('#isTraceabilitySelected').is(':checked');
24854
-
24855
24799
  // Run the selected case
24856
24800
  // - check whether there is only one test case to run or we should run all of them
24857
24801
  if (testCaseIdSelected) {
@@ -24868,7 +24812,7 @@ RED.sidebar.nodeinfo = (function(){
24868
24812
  createDebugMessageCache(testNodes[i].id);
24869
24813
  try{
24870
24814
  // console.log(`[tab-test] Running testcase: ${testNodes[i].id} ...`, )
24871
- await window.__kumologica.libs.testFlow('{}', testNodes[i].id, environment, traceabilityEnabled);
24815
+ await window.__kumologica.libs.testFlow('{}', testNodes[i].id, environment);
24872
24816
  }catch(err){
24873
24817
  console.log('[tab-test] error found: ', err);
24874
24818
  }
@@ -24876,7 +24820,7 @@ RED.sidebar.nodeinfo = (function(){
24876
24820
  } else {
24877
24821
  try {
24878
24822
  createDebugMessageCache(testCaseIdSelected);
24879
- await window.__kumologica.libs.testFlow('{}', testCaseIdSelected, environment, traceabilityEnabled);
24823
+ await window.__kumologica.libs.testFlow('{}', testCaseIdSelected, environment);
24880
24824
  } catch(err) {
24881
24825
  console.log('[tab-test] error found: ', err);
24882
24826
  //App.notify(`Error found: ${JSON.stringify(err)}`, { type: 'error'});
@@ -26088,6 +26032,325 @@ RED.sidebar.nodeinfo = (function(){
26088
26032
  init: init,
26089
26033
  show: show,
26090
26034
  };
26035
+ })();;RED.sidebar.git = (function(){
26036
+
26037
+ let tabContent;
26038
+ let sections;
26039
+ let stackContainer;
26040
+ const PUSHING_LABEL = 'Pushing...';
26041
+ const COMMIT_MESSAGE_LABEL = `Commit message... (ctrl+enter to commit)`;
26042
+ let initalizationRequired = true;
26043
+
26044
+ const simpleGit = window.__kumologica.libs.simpleGit;
26045
+
26046
+ function getGitOptions() {
26047
+ return {
26048
+ baseDir: window.__kumologica.settings.projectDir,
26049
+ binary: 'git',
26050
+ maxConcurrentProcesses: 6,
26051
+ trimmed: false,
26052
+ // config: ['http.proxy=someproxy']
26053
+ }
26054
+ }
26055
+
26056
+ function initHTML() {
26057
+ tabContent = document.createElement('div');
26058
+ tabContent.className = 'sidebar-git';
26059
+
26060
+ RED.actions.add('core:show-git-tab', show);
26061
+
26062
+ stackContainer = $('<div>', {
26063
+ class: 'sidebar-node-info-stack',
26064
+ }).appendTo(tabContent);
26065
+
26066
+ // Append the header
26067
+ let headerContentHtml = `
26068
+ <div class="sidebar-title-wrapper">
26069
+ <div style="display:flex;flex-direction:column;padding-right:10px; width:100%">
26070
+ <div id="sidebar-title-wrapper-left" style="display:flex">
26071
+ <span>Source Control</span>
26072
+ </div>
26073
+
26074
+ <div id="sidebar-git-body">
26075
+ <div id="sidebar-git-error-wrapper" style="display:none">
26076
+ <span><b>The directoryLocal is not under git source control</b>
26077
+ <span>The project {projectDir} is not a git repository</span>
26078
+ </div>
26079
+ <div id="sidebar-git-general-options-wrapper">
26080
+ <div id="sidebar-git-general-pullpush-wrapper">
26081
+ <a id="sidebar-git-push-btn" class="sidebar-header-button" href="#" style="display:flex; margin-right: 5px;">
26082
+ <span id="git-ahead" style="display:none"><i class="icofont-arrow-up"></i><span id="git-ahead-value" style="margin-right:4px"></span></span>
26083
+ <span id="git-behind" style="display:none"><i class="icofont-arrow-down"></i><span id="git-behind-value" style="margin-right:4px"></span></span>
26084
+ <span id="git-push-label">Push</span>
26085
+ </a>
26086
+ <!-- reload btn -->
26087
+ <a id="sidebar-git-reload-btn" class="sidebar-header-button" href="#">
26088
+ <i id="git-reload-icon" class="fa fa-refresh" aria-hidden="true"></i>
26089
+ </a>
26090
+ </div>
26091
+ </div>
26092
+
26093
+ <div id="pending-commit-wrapper">
26094
+ <div id="sidebar-git-commit-msg-wrapper">
26095
+ <textarea id="sidebar-git-commit-msg" rows="4" placeholder="${COMMIT_MESSAGE_LABEL}" style="min-height:130px"></textarea>
26096
+ </div>
26097
+ <div id="sidebar-git-commit-options-wrapper">
26098
+ <div id="sidebar-git-branch-info-wrapper">
26099
+ Commit to
26100
+ <div id="sidebar-git-branch"></div>
26101
+ branch
26102
+ </div>
26103
+ <div id="sidebar-git-commit-wrapper">
26104
+ <!-- commit btn -->
26105
+ <a id="sidebar-git-commit-btn" class="sidebar-header-button" href="#" style="width: 70px; color: white !important; background: #2979ff; margin-right:5px">
26106
+ Commit
26107
+ </a>
26108
+ <!-- commit & push btn -->
26109
+ <a id="sidebar-git-commitpush-btn" class="sidebar-header-button" href="#" style="width: 140px;">
26110
+ Commit and Push...
26111
+ </a>
26112
+ </div>
26113
+ </div>
26114
+ </div>
26115
+ </div>
26116
+ <div id="git-not-initialized" style="display:none">
26117
+ <div style="display:flex; flex-direction: column; align-items: center; margin-top: 150px">
26118
+ <div><i class="fa fa-code-fork" style="font-size: 56px; color: lightgrey;"></i></div>
26119
+ <div style="font-weight: bold; font-size: 22px; margin-top: 15px;color: grey;">Unversioned project</div>
26120
+ <div style="margin-top: 5px; color: grey;font-weight: 400; font-size: 13px;">Git repository not found on project directory</div>
26121
+ </div>
26122
+ </div>
26123
+ </div>
26124
+ </div>
26125
+ `;
26126
+
26127
+ $(headerContentHtml).appendTo(stackContainer);
26128
+
26129
+ RED.sidebar.addTab({
26130
+ id: 'git',
26131
+ label: ' Git',
26132
+ name: 'Source Control',
26133
+ iconClass: 'fa fa-code-fork',
26134
+ action: 'core:show-git-tab',
26135
+ content: tabContent,
26136
+ pinned: true,
26137
+ enableOnEdit: true,
26138
+ onchange: refreshTab,
26139
+ onsame: onsame
26140
+ })
26141
+ }
26142
+
26143
+ function reloading(){
26144
+ $('#git-reload-icon').addClass('fa-spin');
26145
+ }
26146
+
26147
+ function resetReload(){
26148
+ $('#git-reload-icon').removeClass('fa-spin');
26149
+ }
26150
+
26151
+ function initJS() {
26152
+ $('#sidebar-git-commit-msg').keydown(e => {
26153
+ if ((e.ctrlKey || e.metaKey) && (e.keyCode == 13 || e.keyCode == 10)) {
26154
+ $('#sidebar-git-commit-btn').click();
26155
+ }
26156
+ })
26157
+ $('#sidebar-git-commit-btn').click(async e => {
26158
+ let commitMessage = $('#sidebar-git-commit-msg').val();
26159
+ addAllAndCommit(commitMessage);
26160
+ await wait(2000);
26161
+ checkGitStatus();
26162
+ });
26163
+
26164
+ $('#sidebar-git-commitpush-btn').click(async e => {
26165
+ let commitMessage = $('#sidebar-git-commit-msg').val();
26166
+ addAllAndCommit(commitMessage);
26167
+ await wait(3000);
26168
+ pushChanges();
26169
+ });
26170
+
26171
+ $('#sidebar-git-reload-btn').click(async e => {
26172
+ reloading();
26173
+ checkGitStatus();
26174
+ await wait(1000);
26175
+ resetReload();
26176
+ });
26177
+
26178
+ $('#sidebar-git-push-btn').click(e => {
26179
+ if ($('#sidebar-git-push-btn').html() !== PUSHING_LABEL){
26180
+ pushChanges();
26181
+ }
26182
+ });
26183
+ }
26184
+
26185
+ function renderInitializationRequired() {
26186
+ $('#sidebar-git-body').hide();
26187
+ $('#git-not-initialized').show();
26188
+ initalizationRequired = true;
26189
+ }
26190
+
26191
+ function renderGitInitialized() {
26192
+ $('#sidebar-git-body').show();
26193
+ $('#git-not-initialized').hide();
26194
+ initalizationRequired = false;
26195
+ }
26196
+
26197
+ async function checkGitStatus(){
26198
+ if (initalizationRequired) {
26199
+ $('#sidebar-git-body').hide();
26200
+ $('#git-not-initialized').hide();
26201
+ }
26202
+ const git = simpleGit(getGitOptions());
26203
+ try{
26204
+ // ==> Compare with stage
26205
+ const status = await git.status()
26206
+ if ( status.not_added.length > 0 ||
26207
+ status.created.length > 0 ||
26208
+ status.deleted.length > 0 ||
26209
+ status.modified.length > 0 ||
26210
+ status.renamed.length > 0 ) {
26211
+ allowCommits();
26212
+ } else {
26213
+ disallowCommits()
26214
+ }
26215
+ let newStatus = await git.status(['-','sb']); // newStatus = {ahead, behind, current, tracking};
26216
+ renderGitInitialized();
26217
+ $('#sidebar-git-branch').html(newStatus.current);
26218
+ renderAhead(newStatus.ahead);
26219
+ renderBehind(newStatus.behind);
26220
+ }catch(err){
26221
+ renderInitializationRequired();
26222
+ }
26223
+ }
26224
+
26225
+ async function wait(msecs){
26226
+ await sleep(msecs);
26227
+ }
26228
+
26229
+ function sleep(ms) {
26230
+ return new Promise((resolve) => {
26231
+ setTimeout(resolve, ms);
26232
+ });
26233
+ }
26234
+
26235
+ function renderAhead(numCommits){
26236
+ if (numCommits === 0){
26237
+ $('#git-ahead').hide();
26238
+ } else {
26239
+ $('#git-ahead-value').html(numCommits);
26240
+ $('#git-ahead').show();
26241
+ }
26242
+ }
26243
+
26244
+ function renderBehind(numCommits){
26245
+ if (numCommits === 0){
26246
+ $('#git-behind').hide();
26247
+ } else {
26248
+ $('#git-behind-value').html(numCommits);
26249
+ $('#git-behind').show();
26250
+ }
26251
+ }
26252
+
26253
+ function showPushing() {
26254
+ $('#git-ahead').hide();
26255
+ $('#git-behind').hide();
26256
+ $('#git-push-label').html(PUSHING_LABEL);
26257
+ }
26258
+
26259
+ function resetPushButton() {
26260
+ $('#git-push-label').html('Push');
26261
+ }
26262
+
26263
+ async function pushChanges() {
26264
+ const git = simpleGit(getGitOptions());
26265
+ try{
26266
+ let currentBranch = await readCurrentBranch();
26267
+ showPushing();
26268
+ const result = await git.push('origin', currentBranch);
26269
+ RED.notify(`Changes pushed successfully`, 'success', undefined, 800);
26270
+ } catch(e) {
26271
+ let notification = RED.notify(`<strong>Error</strong>: ${e.message}`, {
26272
+ type: 'error',
26273
+ modal: true,
26274
+ fixed: true,
26275
+ buttons: [
26276
+ {
26277
+ text: "Cancel",
26278
+ click: function() {
26279
+ notification.close();
26280
+ }
26281
+ }
26282
+ ]
26283
+ });
26284
+
26285
+ } finally {
26286
+ resetPushButton();
26287
+ checkGitStatus();
26288
+ }
26289
+ }
26290
+
26291
+ async function addAllAndCommit(message){
26292
+ const git = simpleGit(getGitOptions());
26293
+ try{
26294
+ await git.add('./*').commit(message);
26295
+ disallowCommits();
26296
+ RED.notify(`Changed committed successfully`, 'success', undefined, 800);
26297
+ } catch(e) {
26298
+ RED.notify(`<strong>Error</strong>: ${e.message}`, 'error');
26299
+ clearCommitMessage();
26300
+ }
26301
+ }
26302
+
26303
+ async function readCurrentBranch(){
26304
+ const git = simpleGit(getGitOptions());
26305
+ try{
26306
+ const localBranches = await git.branchLocal();
26307
+ return localBranches.current;
26308
+ }catch(e){
26309
+ RED.notify(`<strong>Error</strong>: ${e.message}`, 'error');
26310
+ return ''
26311
+ }
26312
+
26313
+ }
26314
+ function allowCommits() {
26315
+ $("#sidebar-git-commit-msg").attr("placeholder", `${COMMIT_MESSAGE_LABEL}`).val("");
26316
+ $("#sidebar-git-commit-msg").attr("disabled", false);
26317
+ $('#sidebar-git-commit-wrapper').show();
26318
+ }
26319
+ function disallowCommits() {
26320
+ $("#sidebar-git-commit-msg").attr("placeholder", "Nothing to commit").val("").focus().blur();
26321
+ $("#sidebar-git-commit-msg").attr("disabled", true)
26322
+ $('#sidebar-git-commit-wrapper').hide();
26323
+ }
26324
+
26325
+ function clearCommitMessage() {
26326
+ $('#sidebar-git-commit-msg').val('');
26327
+ }
26328
+
26329
+ function init() {
26330
+ initHTML();
26331
+ initJS();
26332
+ }
26333
+
26334
+ function show() {
26335
+ RED.sidebar.show('git');
26336
+ checkGitStatus();
26337
+ }
26338
+
26339
+ function refreshTab(silently){
26340
+ if (!silently) {
26341
+ RED.actions.invoke('core:show-sidebar');
26342
+ }
26343
+ checkGitStatus();
26344
+ }
26345
+
26346
+ function onsame(){
26347
+ RED.actions.invoke('core:hide-sidebar');
26348
+ }
26349
+
26350
+ return {
26351
+ init: init,
26352
+ show: show,
26353
+ }
26091
26354
  })();;
26092
26355
  RED.sidebar.azure = (function () {
26093
26356
  marked.setOptions({
@@ -30387,7 +30650,6 @@ RED.editor = (function () {
30387
30650
  }
30388
30651
 
30389
30652
  function resetEditor(){
30390
- // console.log('[editor] reset the editor')
30391
30653
  editStack.pop();
30392
30654
  RED.sidebar.nodeinfo.emptyTab();
30393
30655
  RED.actions.invoke('core:hide-sidebar');
@@ -30685,8 +30947,11 @@ RED.editor = (function () {
30685
30947
  }
30686
30948
 
30687
30949
  function showEditDialog(node) {
30950
+ if (RED.sidebar.isDragging()){
30951
+ return;
30952
+ }
30953
+
30688
30954
  let editing_node;
30689
- // console.log('[editor] showEditDialog. Node=', node);
30690
30955
  if (Object.keys(node).length === 0 && node.constructor === Object){
30691
30956
  resetEditor();
30692
30957
  return;
@@ -31865,8 +32130,6 @@ RED.editor = (function () {
31865
32130
  }
31866
32131
  if (options.mode === 'ace/mode/markdown') {
31867
32132
  $(el).addClass('node-text-editor-container-toolbar');
31868
- console.log('[editor] options', options);
31869
-
31870
32133
  if (options.toolbar === false ){
31871
32134
  // do not show the toolbar
31872
32135
  } else {
@@ -33515,7 +33778,7 @@ RED.eventLog = (function() {
33515
33778
 
33516
33779
  function resize() {}
33517
33780
  function showTray(options) {
33518
- console.log('[tray] showTray. options=', options);
33781
+ // console.log('[tray] showTray. options=', options);
33519
33782
 
33520
33783
  $('#editor-stack').empty();
33521
33784
 
@@ -33828,7 +34091,7 @@ RED.eventLog = (function() {
33828
34091
 
33829
34092
 
33830
34093
  if (stack.length === 0) {
33831
- console.log('[tray] Emiting event: (editor:open) ...')
34094
+ // console.log('[tray] Emiting event: (editor:open) ...')
33832
34095
  RED.events.emit('editor:open');
33833
34096
  showTray(options);
33834
34097
  } else if (stack.length > 0 && options.title.startsWith('_')) {