@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.
- package/cli/commands/export-commands/cloudformation.js +16 -1
- package/cli/commands/export-commands/utils/validator.js +17 -0
- package/cli/commands/test-utils/TestSuiteController.js +7 -22
- package/cli/commands/test.js +36 -12
- package/package.json +7 -4
- package/src/app/lib/aws/cf.js +19 -9
- package/src/app/lib/aws/index.js +12 -7
- package/src/app/main-process/main-window.js +1 -1
- package/src/app/main-process/menu.js +1 -1
- package/src/app/main.js +4 -4
- package/src/app/preload.js +5 -7
- package/src/app/ui/editor-api/lib/editor/comms.js +3 -3
- package/src/app/ui/editor-client/public/red/red.js +387 -124
- package/src/app/ui/editor-client/public/red/red.min.js +1 -1
- package/src/app/ui/editor-client/public/red/style.min.css +1 -1
- package/src/app/ui/editor-client/public/vendor/simplemde/simplemde.min.css +0 -7
- package/src/app/ui/editor-client/public/vendor/simplemde/simplemde.min.js +0 -15
- package/src/app/ui/editor-client/public/vendor/xterm/lib/xterm.js +0 -2
- package/src/app/ui/editor-client/src/js/ui/common/tabs.js +16 -1
- package/src/app/ui/editor-client/src/js/ui/editor.js +4 -4
- package/src/app/ui/editor-client/src/js/ui/sidebar.js +43 -111
- package/src/app/ui/editor-client/src/js/ui/tab-git.js +320 -0
- package/src/app/ui/editor-client/src/js/ui/tab-test.js +2 -5
- package/src/app/ui/editor-client/src/js/ui/tray.js +2 -2
- package/src/app/ui/editor-client/src/js/ui/view.js +1 -1
- package/src/app/ui/editor-client/src/sass/editor.scss +10 -3
- package/src/app/ui/editor-client/src/sass/sidebar.scss +9 -9
- package/src/app/ui/editor-client/src/sass/style.scss +1 -0
- package/src/app/ui/editor-client/src/sass/tab-git.scss +54 -0
- package/src/app/ui/editor-client/src/sass/tabs.scss +1 -1
- package/src/app/ui/editor-client/src/sass/workspace.scss +1 -1
- package/src/app/ui/editor-client/templates/index.mst +2 -1
- package/cli/commands/import-commands/mulesoft.js +0 -61
- package/cli/commands/import.js +0 -6
|
@@ -337,11 +337,26 @@ RED.tabs = (function () {
|
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
339
|
|
|
340
|
+
function getTabsMaxWidthAvailable() {
|
|
341
|
+
const workspaceWidth = $('#main-container').width();
|
|
342
|
+
|
|
343
|
+
const paletteWidth = $('#palette').is(':hidden')? 0 : $('#palette').width();
|
|
344
|
+
const sidebarWidth = $('#sidebar').is(':hidden')? 0 : $('#sidebar').width();
|
|
345
|
+
const sidebarShortcuts = $('#sidebar-shortcuts').width();
|
|
346
|
+
const occupied = paletteWidth + sidebarWidth + sidebarShortcuts;
|
|
347
|
+
|
|
348
|
+
return workspaceWidth - occupied;
|
|
349
|
+
}
|
|
350
|
+
|
|
340
351
|
function updateTabWidths() {
|
|
341
352
|
if (options.vertical) {
|
|
342
353
|
return;
|
|
343
354
|
}
|
|
344
355
|
var tabs = ul.find('li.red-ui-tab');
|
|
356
|
+
|
|
357
|
+
// Update the width of the tabs container
|
|
358
|
+
$('#workspace').find('.red-ui-tabs').width(getTabsMaxWidthAvailable());
|
|
359
|
+
|
|
345
360
|
var width = wrapper.width();
|
|
346
361
|
var tabCount = tabs.size();
|
|
347
362
|
var tabWidth;
|
|
@@ -371,7 +386,7 @@ RED.tabs = (function () {
|
|
|
371
386
|
currentTabWidth = (100 * tabWidth) / width + '%';
|
|
372
387
|
currentActiveTabWidth = currentTabWidth + '%';
|
|
373
388
|
if (options.scrollable) {
|
|
374
|
-
tabWidth = Math.max(tabWidth,
|
|
389
|
+
tabWidth = Math.max(tabWidth, 150); // minimum width for the tab
|
|
375
390
|
currentTabWidth = tabWidth + 'px';
|
|
376
391
|
currentActiveTabWidth = 0;
|
|
377
392
|
var listWidth = Math.max(
|
|
@@ -1391,7 +1391,6 @@ RED.editor = (function () {
|
|
|
1391
1391
|
}
|
|
1392
1392
|
|
|
1393
1393
|
function resetEditor(){
|
|
1394
|
-
// console.log('[editor] reset the editor')
|
|
1395
1394
|
editStack.pop();
|
|
1396
1395
|
RED.sidebar.nodeinfo.emptyTab();
|
|
1397
1396
|
RED.actions.invoke('core:hide-sidebar');
|
|
@@ -1689,8 +1688,11 @@ RED.editor = (function () {
|
|
|
1689
1688
|
}
|
|
1690
1689
|
|
|
1691
1690
|
function showEditDialog(node) {
|
|
1691
|
+
if (RED.sidebar.isDragging()){
|
|
1692
|
+
return;
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1692
1695
|
let editing_node;
|
|
1693
|
-
// console.log('[editor] showEditDialog. Node=', node);
|
|
1694
1696
|
if (Object.keys(node).length === 0 && node.constructor === Object){
|
|
1695
1697
|
resetEditor();
|
|
1696
1698
|
return;
|
|
@@ -2869,8 +2871,6 @@ RED.editor = (function () {
|
|
|
2869
2871
|
}
|
|
2870
2872
|
if (options.mode === 'ace/mode/markdown') {
|
|
2871
2873
|
$(el).addClass('node-text-editor-container-toolbar');
|
|
2872
|
-
console.log('[editor] options', options);
|
|
2873
|
-
|
|
2874
2874
|
if (options.toolbar === false ){
|
|
2875
2875
|
// do not show the toolbar
|
|
2876
2876
|
} else {
|
|
@@ -3,7 +3,6 @@ RED.sidebar = (function () {
|
|
|
3
3
|
var sidebar_tabs = RED.tabs.create({
|
|
4
4
|
id: 'sidebar-tabs',
|
|
5
5
|
onchange: function (tab) {
|
|
6
|
-
// console.log('[sidebar] - onChange | tab=', tab);
|
|
7
6
|
$('#editor-stack').hide();
|
|
8
7
|
$('#sidebar-content').children().hide();
|
|
9
8
|
$('#sidebar-footer').children().hide();
|
|
@@ -111,89 +110,38 @@ RED.sidebar = (function () {
|
|
|
111
110
|
RED.menu.removeItem('menu-item-view-menu-' + id);
|
|
112
111
|
}
|
|
113
112
|
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
// Dragable sidebar logic
|
|
114
|
+
let sidebarDragging = false;
|
|
115
|
+
let sidebarWidthP0 = null;
|
|
116
|
+
let delta = 0;
|
|
116
117
|
|
|
117
118
|
$('#sidebar-separator').draggable({
|
|
118
119
|
axis: 'x',
|
|
119
120
|
start: function (event, ui) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
sidebarSeparator.closing = false;
|
|
124
|
-
sidebarSeparator.opening = false;
|
|
125
|
-
var winWidth = $(window).width();
|
|
126
|
-
sidebarSeparator.start = ui.position.left;
|
|
127
|
-
sidebarSeparator.workspaceWidth = $('#workspace').width();
|
|
128
|
-
sidebarSeparator.workspaceRight = parseInt($('#workspace').css('right'));
|
|
129
|
-
sidebarSeparator.dragging = true;
|
|
130
|
-
|
|
131
|
-
if (!RED.menu.isSelected('menu-item-sidebar')) {
|
|
132
|
-
sidebarSeparator.opening = true;
|
|
133
|
-
var newChartRight = 7;
|
|
134
|
-
$('#sidebar').addClass('closing');
|
|
135
|
-
$('#workspace').css('right', newChartRight);
|
|
136
|
-
$('#editor-stack').css('right', newChartRight + 1);
|
|
137
|
-
$('#sidebar').width(0);
|
|
138
|
-
|
|
139
|
-
RED.menu.setSelected('menu-item-sidebar', true);
|
|
140
|
-
RED.events.emit('sidebar:resize');
|
|
141
|
-
}
|
|
142
|
-
sidebarSeparator.width = $('#sidebar').width();
|
|
143
|
-
// console.log('Sidebar start point=', sidebarSeparator.start);
|
|
121
|
+
sidebarDragging = true;
|
|
122
|
+
sidebarWidthP0 = $('#sidebar').width();
|
|
123
|
+
delta = 0;
|
|
144
124
|
},
|
|
145
125
|
drag: function (event, ui) {
|
|
146
|
-
let d = ui.position.left
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
// console.log(`distance: ${d} -> new right for worspace: ${sidebarSeparator.workspaceRight - d}`);
|
|
152
|
-
|
|
153
|
-
// if (sidebarSeparator.opening) {
|
|
154
|
-
// newSidebarWidth -= 3;
|
|
155
|
-
// }
|
|
156
|
-
|
|
157
|
-
const MIN_SIDEBAR_WIDTH = 435;
|
|
158
|
-
let desiredSidebarWidth = sidebarSeparator.width - d;
|
|
159
|
-
let desiredWorkspaceRight = sidebarSeparator.workspaceRight - d;
|
|
160
|
-
|
|
161
|
-
if (desiredSidebarWidth > 435){
|
|
162
|
-
// console.log(`Recalibrating sidebar width!!`)
|
|
163
|
-
$('#sidebar').width(desiredSidebarWidth);
|
|
164
|
-
$('#workspace').css('right', desiredWorkspaceRight);
|
|
165
|
-
} else{
|
|
166
|
-
// console.log('STOP THIS NOW!!!! IT IS TOO NARROW!!!');
|
|
167
|
-
$('#sidebar').width(433);
|
|
168
|
-
let sidebarWidth= $('#sidebar').width();
|
|
169
|
-
$('#workspace').css('right', 491);
|
|
170
|
-
// console.log('Window width=',$(window).width());
|
|
171
|
-
// let sidebarFinalPoint = $(window).width() - MIN_SIDEBAR_WIDTH - 50;
|
|
172
|
-
// console.log(`Sidebar final point: ${startingPointSeparator}`);
|
|
173
|
-
ui.position.left = startingPointSeparator; //$(window).width() - MIN_SIDEBAR_WIDTH - 50; // 11:width separator, 50: size icons
|
|
174
|
-
// console.log(`sidebar width after dragging end is: ${ sidebarWidth }`)
|
|
175
|
-
$('#sidebar').removeAttr('width');
|
|
126
|
+
let d = ui.position.left;
|
|
127
|
+
delta = sidebarWidthP0 - d;
|
|
128
|
+
$('#sidebar').width(delta);
|
|
129
|
+
if ($('#sidebar').width() > maxWidthSidebar()){
|
|
130
|
+
$('#sidebar').width(maxWidthSidebar());
|
|
176
131
|
}
|
|
132
|
+
event.stopImmediatePropagation();
|
|
177
133
|
RED.events.emit('sidebar:resize');
|
|
178
134
|
},
|
|
179
135
|
stop: function (event, ui) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
$('#sidebar').removeClass('closing');
|
|
184
|
-
RED.menu.setSelected('menu-item-sidebar', false);
|
|
185
|
-
if ($('#sidebar').width() < 435) {
|
|
186
|
-
$('#sidebar').width(435);
|
|
187
|
-
$('#workspace').css('right', 491);
|
|
188
|
-
// $('#editor-stack').css('right', 188);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
//$('#sidebar-separator').css('left', 'auto');
|
|
192
|
-
//$('#sidebar-separator').css('right', $('#sidebar').width() + 2 + 'px');
|
|
136
|
+
setTimeout(function() {
|
|
137
|
+
sidebarDragging = false;
|
|
138
|
+
},1000);
|
|
193
139
|
RED.events.emit('sidebar:resize');
|
|
194
140
|
},
|
|
195
141
|
});
|
|
196
142
|
|
|
143
|
+
|
|
144
|
+
|
|
197
145
|
var sidebarControls = $(
|
|
198
146
|
'<div class="sidebar-control-right"><i class="fa fa-chevron-right"</div>'
|
|
199
147
|
).appendTo($('#sidebar-separator'));
|
|
@@ -201,37 +149,19 @@ RED.sidebar = (function () {
|
|
|
201
149
|
sidebarControls.hide();
|
|
202
150
|
RED.menu.toggleSelected('menu-item-sidebar');
|
|
203
151
|
});
|
|
204
|
-
$('#sidebar-separator').on('mouseenter', function () {
|
|
205
|
-
if (!sidebarSeparator.dragging) {
|
|
206
|
-
if (RED.menu.isSelected('menu-item-sidebar')) {
|
|
207
|
-
sidebarControls
|
|
208
|
-
.find('i')
|
|
209
|
-
.addClass('fa-chevron-right')
|
|
210
|
-
.removeClass('fa-chevron-left');
|
|
211
|
-
} else {
|
|
212
|
-
sidebarControls
|
|
213
|
-
.find('i')
|
|
214
|
-
.removeClass('fa-chevron-right')
|
|
215
|
-
.addClass('fa-chevron-left');
|
|
216
|
-
}
|
|
217
|
-
sidebarControls.toggle('slide', { direction: 'right' }, 200);
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
$('#sidebar-separator').on('mouseleave', function () {
|
|
221
|
-
if (!sidebarSeparator.dragging) {
|
|
222
|
-
sidebarControls.hide();
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
152
|
|
|
226
|
-
function
|
|
153
|
+
function maxWidthSidebar() {
|
|
227
154
|
const totalWidth = $('#main-container').width();
|
|
228
155
|
const shortcutsWidth = 50;
|
|
229
156
|
const paletteWidth = $('#palette').width();
|
|
230
157
|
const sidebarSeparatorWidth = $('#sidebar-separator').width()
|
|
231
158
|
|
|
232
|
-
|
|
159
|
+
return totalWidth - shortcutsWidth - paletteWidth - sidebarSeparatorWidth;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function maximizeSidebar(){
|
|
163
|
+
const targetWidth = maxWidthSidebar();
|
|
233
164
|
$('#sidebar').width(targetWidth);
|
|
234
|
-
$('#sidebar-separator').css('left', paletteWidth);
|
|
235
165
|
|
|
236
166
|
// Hack: Make sure the workspace if reset before maximizing the sidebar. This is because when dragging the sidebar the workspace width is also modified
|
|
237
167
|
$('#workspace').css('right', 491);
|
|
@@ -242,7 +172,7 @@ RED.sidebar = (function () {
|
|
|
242
172
|
const offsetWidth = 435;
|
|
243
173
|
|
|
244
174
|
$('#sidebar').width(offsetWidth);
|
|
245
|
-
$('#sidebar-separator').css('left', '');
|
|
175
|
+
// $('#sidebar-separator').css('left', '');
|
|
246
176
|
RED.events.emit('sidebar:resize');
|
|
247
177
|
}
|
|
248
178
|
|
|
@@ -251,7 +181,6 @@ RED.sidebar = (function () {
|
|
|
251
181
|
}
|
|
252
182
|
|
|
253
183
|
function toggleSidebar(state) {
|
|
254
|
-
// console.log(`[sidebar] toggling the sidebar to: ${state} ...`);
|
|
255
184
|
let checkIfscrollWorkspaceRequired = false;
|
|
256
185
|
if (!state) {
|
|
257
186
|
// Hide the sidebar and sidebar-separator
|
|
@@ -283,11 +212,13 @@ RED.sidebar = (function () {
|
|
|
283
212
|
// `);
|
|
284
213
|
if (nodeSelectedPosX - initialScrollLeft + safeDistNodeSidebar > sidebarPosLeftX ){
|
|
285
214
|
let targetScrollLeft = nodeSelectedPosX - sidebarPosLeftX + safeDistNodeSidebar;
|
|
286
|
-
// console.log(`[sidebar] TargetScrollLeft: (${targetScrollLeft})...`);
|
|
287
215
|
$('#chart').animate( { scrollLeft: targetScrollLeft})
|
|
288
216
|
}
|
|
289
217
|
}
|
|
290
|
-
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function isSidebarDragging() {
|
|
221
|
+
return sidebarDragging;
|
|
291
222
|
}
|
|
292
223
|
|
|
293
224
|
function showSidebar(id) {
|
|
@@ -317,12 +248,11 @@ RED.sidebar = (function () {
|
|
|
317
248
|
});
|
|
318
249
|
|
|
319
250
|
//hide the sidebar-separator
|
|
320
|
-
$('#sidebar-separator').hide();
|
|
251
|
+
// $('#sidebar-separator').hide();
|
|
321
252
|
|
|
322
253
|
}
|
|
323
254
|
|
|
324
255
|
function selectTab(index){
|
|
325
|
-
// console.log('[sidebar] selectTab clicked with index=', index);
|
|
326
256
|
let selectedTab = $('#sidebar-shortcuts').find('.sidebar-shortcuts-icons').children()[index];
|
|
327
257
|
// Click only if has not been selected
|
|
328
258
|
// console.log('[sidebar] selectedTab.hasClass(selected)=', selectedTab.hasClass('selected'));
|
|
@@ -345,14 +275,9 @@ RED.sidebar = (function () {
|
|
|
345
275
|
toggleSidebar(true);
|
|
346
276
|
|
|
347
277
|
//show the sidebar-separator
|
|
348
|
-
let sidebarSeparator = $('#sidebar-separator');
|
|
349
|
-
sidebarSeparator.show();
|
|
350
|
-
|
|
351
|
-
// resize the workspace to adjust to the left of the sidebar separator
|
|
352
|
-
let sidebarSepatorToRight = sidebarSeparator.position().left;
|
|
353
|
-
let mainContainerWidth = $('#main-container').width();
|
|
354
|
-
let targetRightPosToWorkspace = mainContainerWidth - sidebarSepatorToRight - 1;
|
|
355
|
-
$('#workspace').css('right', targetRightPosToWorkspace);
|
|
278
|
+
// let sidebarSeparator = $('#sidebar-separator');
|
|
279
|
+
// sidebarSeparator.show();
|
|
280
|
+
|
|
356
281
|
// Select internally the tab
|
|
357
282
|
if (e && e.hasOwnProperty('selectIndex')){
|
|
358
283
|
selectTab(e.selectIndex);
|
|
@@ -360,8 +285,12 @@ RED.sidebar = (function () {
|
|
|
360
285
|
});
|
|
361
286
|
|
|
362
287
|
RED.actions.add('core:hide-sidebar', function(){
|
|
363
|
-
|
|
364
|
-
|
|
288
|
+
if (!sidebarDragging){
|
|
289
|
+
toggleSidebar(false);
|
|
290
|
+
deselectAll();
|
|
291
|
+
}else {
|
|
292
|
+
console.log('[sidebar] Ignoring hide-sidebar as dragging is still enabled')
|
|
293
|
+
}
|
|
365
294
|
});
|
|
366
295
|
|
|
367
296
|
// RED.popover.tooltip(
|
|
@@ -375,11 +304,13 @@ RED.sidebar = (function () {
|
|
|
375
304
|
RED.sidebar.nodeinfo.init();
|
|
376
305
|
RED.sidebar.info.init();
|
|
377
306
|
RED.sidebar.test.init();
|
|
307
|
+
RED.sidebar.git.init();
|
|
378
308
|
RED.sidebar.kumohub.init();
|
|
379
309
|
RED.sidebar.azure.init();
|
|
380
310
|
RED.sidebar.awsDeploy.init();
|
|
381
311
|
|
|
382
312
|
|
|
313
|
+
|
|
383
314
|
// hide info bar at start if screen rather narrow...
|
|
384
315
|
// if ($(window).width() < 600) {
|
|
385
316
|
// RED.menu.setSelected('menu-item-sidebar', false);
|
|
@@ -404,6 +335,7 @@ RED.sidebar = (function () {
|
|
|
404
335
|
restore: restoreSidebar,
|
|
405
336
|
deselectAll: deselectAll,
|
|
406
337
|
selectTab: selectTab,
|
|
407
|
-
isSidebarVisible: isSidebarVisible
|
|
338
|
+
isSidebarVisible: isSidebarVisible,
|
|
339
|
+
isDragging: isSidebarDragging,
|
|
408
340
|
};
|
|
409
341
|
})();
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
RED.sidebar.git = (function(){
|
|
2
|
+
|
|
3
|
+
let tabContent;
|
|
4
|
+
let sections;
|
|
5
|
+
let stackContainer;
|
|
6
|
+
const PUSHING_LABEL = 'Pushing...';
|
|
7
|
+
const COMMIT_MESSAGE_LABEL = `Commit message... (ctrl+enter to commit)`;
|
|
8
|
+
let initalizationRequired = true;
|
|
9
|
+
|
|
10
|
+
const simpleGit = window.__kumologica.libs.simpleGit;
|
|
11
|
+
|
|
12
|
+
function getGitOptions() {
|
|
13
|
+
return {
|
|
14
|
+
baseDir: window.__kumologica.settings.projectDir,
|
|
15
|
+
binary: 'git',
|
|
16
|
+
maxConcurrentProcesses: 6,
|
|
17
|
+
trimmed: false,
|
|
18
|
+
// config: ['http.proxy=someproxy']
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function initHTML() {
|
|
23
|
+
tabContent = document.createElement('div');
|
|
24
|
+
tabContent.className = 'sidebar-git';
|
|
25
|
+
|
|
26
|
+
RED.actions.add('core:show-git-tab', show);
|
|
27
|
+
|
|
28
|
+
stackContainer = $('<div>', {
|
|
29
|
+
class: 'sidebar-node-info-stack',
|
|
30
|
+
}).appendTo(tabContent);
|
|
31
|
+
|
|
32
|
+
// Append the header
|
|
33
|
+
let headerContentHtml = `
|
|
34
|
+
<div class="sidebar-title-wrapper">
|
|
35
|
+
<div style="display:flex;flex-direction:column;padding-right:10px; width:100%">
|
|
36
|
+
<div id="sidebar-title-wrapper-left" style="display:flex">
|
|
37
|
+
<span>Source Control</span>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<div id="sidebar-git-body">
|
|
41
|
+
<div id="sidebar-git-error-wrapper" style="display:none">
|
|
42
|
+
<span><b>The directoryLocal is not under git source control</b>
|
|
43
|
+
<span>The project {projectDir} is not a git repository</span>
|
|
44
|
+
</div>
|
|
45
|
+
<div id="sidebar-git-general-options-wrapper">
|
|
46
|
+
<div id="sidebar-git-general-pullpush-wrapper">
|
|
47
|
+
<a id="sidebar-git-push-btn" class="sidebar-header-button" href="#" style="display:flex; margin-right: 5px;">
|
|
48
|
+
<span id="git-ahead" style="display:none"><i class="icofont-arrow-up"></i><span id="git-ahead-value" style="margin-right:4px"></span></span>
|
|
49
|
+
<span id="git-behind" style="display:none"><i class="icofont-arrow-down"></i><span id="git-behind-value" style="margin-right:4px"></span></span>
|
|
50
|
+
<span id="git-push-label">Push</span>
|
|
51
|
+
</a>
|
|
52
|
+
<!-- reload btn -->
|
|
53
|
+
<a id="sidebar-git-reload-btn" class="sidebar-header-button" href="#">
|
|
54
|
+
<i id="git-reload-icon" class="fa fa-refresh" aria-hidden="true"></i>
|
|
55
|
+
</a>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<div id="pending-commit-wrapper">
|
|
60
|
+
<div id="sidebar-git-commit-msg-wrapper">
|
|
61
|
+
<textarea id="sidebar-git-commit-msg" rows="4" placeholder="${COMMIT_MESSAGE_LABEL}" style="min-height:130px"></textarea>
|
|
62
|
+
</div>
|
|
63
|
+
<div id="sidebar-git-commit-options-wrapper">
|
|
64
|
+
<div id="sidebar-git-branch-info-wrapper">
|
|
65
|
+
Commit to
|
|
66
|
+
<div id="sidebar-git-branch"></div>
|
|
67
|
+
branch
|
|
68
|
+
</div>
|
|
69
|
+
<div id="sidebar-git-commit-wrapper">
|
|
70
|
+
<!-- commit btn -->
|
|
71
|
+
<a id="sidebar-git-commit-btn" class="sidebar-header-button" href="#" style="width: 70px; color: white !important; background: #2979ff; margin-right:5px">
|
|
72
|
+
Commit
|
|
73
|
+
</a>
|
|
74
|
+
<!-- commit & push btn -->
|
|
75
|
+
<a id="sidebar-git-commitpush-btn" class="sidebar-header-button" href="#" style="width: 140px;">
|
|
76
|
+
Commit and Push...
|
|
77
|
+
</a>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
<div id="git-not-initialized" style="display:none">
|
|
83
|
+
<div style="display:flex; flex-direction: column; align-items: center; margin-top: 150px">
|
|
84
|
+
<div><i class="fa fa-code-fork" style="font-size: 56px; color: lightgrey;"></i></div>
|
|
85
|
+
<div style="font-weight: bold; font-size: 22px; margin-top: 15px;color: grey;">Unversioned project</div>
|
|
86
|
+
<div style="margin-top: 5px; color: grey;font-weight: 400; font-size: 13px;">Git repository not found on project directory</div>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
`;
|
|
92
|
+
|
|
93
|
+
$(headerContentHtml).appendTo(stackContainer);
|
|
94
|
+
|
|
95
|
+
RED.sidebar.addTab({
|
|
96
|
+
id: 'git',
|
|
97
|
+
label: ' Git',
|
|
98
|
+
name: 'Source Control',
|
|
99
|
+
iconClass: 'fa fa-code-fork',
|
|
100
|
+
action: 'core:show-git-tab',
|
|
101
|
+
content: tabContent,
|
|
102
|
+
pinned: true,
|
|
103
|
+
enableOnEdit: true,
|
|
104
|
+
onchange: refreshTab,
|
|
105
|
+
onsame: onsame
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function reloading(){
|
|
110
|
+
$('#git-reload-icon').addClass('fa-spin');
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function resetReload(){
|
|
114
|
+
$('#git-reload-icon').removeClass('fa-spin');
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function initJS() {
|
|
118
|
+
$('#sidebar-git-commit-msg').keydown(e => {
|
|
119
|
+
if ((e.ctrlKey || e.metaKey) && (e.keyCode == 13 || e.keyCode == 10)) {
|
|
120
|
+
$('#sidebar-git-commit-btn').click();
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
$('#sidebar-git-commit-btn').click(async e => {
|
|
124
|
+
let commitMessage = $('#sidebar-git-commit-msg').val();
|
|
125
|
+
addAllAndCommit(commitMessage);
|
|
126
|
+
await wait(2000);
|
|
127
|
+
checkGitStatus();
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
$('#sidebar-git-commitpush-btn').click(async e => {
|
|
131
|
+
let commitMessage = $('#sidebar-git-commit-msg').val();
|
|
132
|
+
addAllAndCommit(commitMessage);
|
|
133
|
+
await wait(3000);
|
|
134
|
+
pushChanges();
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
$('#sidebar-git-reload-btn').click(async e => {
|
|
138
|
+
reloading();
|
|
139
|
+
checkGitStatus();
|
|
140
|
+
await wait(1000);
|
|
141
|
+
resetReload();
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
$('#sidebar-git-push-btn').click(e => {
|
|
145
|
+
if ($('#sidebar-git-push-btn').html() !== PUSHING_LABEL){
|
|
146
|
+
pushChanges();
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function renderInitializationRequired() {
|
|
152
|
+
$('#sidebar-git-body').hide();
|
|
153
|
+
$('#git-not-initialized').show();
|
|
154
|
+
initalizationRequired = true;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function renderGitInitialized() {
|
|
158
|
+
$('#sidebar-git-body').show();
|
|
159
|
+
$('#git-not-initialized').hide();
|
|
160
|
+
initalizationRequired = false;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
async function checkGitStatus(){
|
|
164
|
+
if (initalizationRequired) {
|
|
165
|
+
$('#sidebar-git-body').hide();
|
|
166
|
+
$('#git-not-initialized').hide();
|
|
167
|
+
}
|
|
168
|
+
const git = simpleGit(getGitOptions());
|
|
169
|
+
try{
|
|
170
|
+
// ==> Compare with stage
|
|
171
|
+
const status = await git.status()
|
|
172
|
+
if ( status.not_added.length > 0 ||
|
|
173
|
+
status.created.length > 0 ||
|
|
174
|
+
status.deleted.length > 0 ||
|
|
175
|
+
status.modified.length > 0 ||
|
|
176
|
+
status.renamed.length > 0 ) {
|
|
177
|
+
allowCommits();
|
|
178
|
+
} else {
|
|
179
|
+
disallowCommits()
|
|
180
|
+
}
|
|
181
|
+
let newStatus = await git.status(['-','sb']); // newStatus = {ahead, behind, current, tracking};
|
|
182
|
+
renderGitInitialized();
|
|
183
|
+
$('#sidebar-git-branch').html(newStatus.current);
|
|
184
|
+
renderAhead(newStatus.ahead);
|
|
185
|
+
renderBehind(newStatus.behind);
|
|
186
|
+
}catch(err){
|
|
187
|
+
renderInitializationRequired();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
async function wait(msecs){
|
|
192
|
+
await sleep(msecs);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function sleep(ms) {
|
|
196
|
+
return new Promise((resolve) => {
|
|
197
|
+
setTimeout(resolve, ms);
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function renderAhead(numCommits){
|
|
202
|
+
if (numCommits === 0){
|
|
203
|
+
$('#git-ahead').hide();
|
|
204
|
+
} else {
|
|
205
|
+
$('#git-ahead-value').html(numCommits);
|
|
206
|
+
$('#git-ahead').show();
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function renderBehind(numCommits){
|
|
211
|
+
if (numCommits === 0){
|
|
212
|
+
$('#git-behind').hide();
|
|
213
|
+
} else {
|
|
214
|
+
$('#git-behind-value').html(numCommits);
|
|
215
|
+
$('#git-behind').show();
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function showPushing() {
|
|
220
|
+
$('#git-ahead').hide();
|
|
221
|
+
$('#git-behind').hide();
|
|
222
|
+
$('#git-push-label').html(PUSHING_LABEL);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function resetPushButton() {
|
|
226
|
+
$('#git-push-label').html('Push');
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
async function pushChanges() {
|
|
230
|
+
const git = simpleGit(getGitOptions());
|
|
231
|
+
try{
|
|
232
|
+
let currentBranch = await readCurrentBranch();
|
|
233
|
+
showPushing();
|
|
234
|
+
const result = await git.push('origin', currentBranch);
|
|
235
|
+
RED.notify(`Changes pushed successfully`, 'success', undefined, 800);
|
|
236
|
+
} catch(e) {
|
|
237
|
+
let notification = RED.notify(`<strong>Error</strong>: ${e.message}`, {
|
|
238
|
+
type: 'error',
|
|
239
|
+
modal: true,
|
|
240
|
+
fixed: true,
|
|
241
|
+
buttons: [
|
|
242
|
+
{
|
|
243
|
+
text: "Cancel",
|
|
244
|
+
click: function() {
|
|
245
|
+
notification.close();
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
]
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
} finally {
|
|
252
|
+
resetPushButton();
|
|
253
|
+
checkGitStatus();
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
async function addAllAndCommit(message){
|
|
258
|
+
const git = simpleGit(getGitOptions());
|
|
259
|
+
try{
|
|
260
|
+
await git.add('./*').commit(message);
|
|
261
|
+
disallowCommits();
|
|
262
|
+
RED.notify(`Changed committed successfully`, 'success', undefined, 800);
|
|
263
|
+
} catch(e) {
|
|
264
|
+
RED.notify(`<strong>Error</strong>: ${e.message}`, 'error');
|
|
265
|
+
clearCommitMessage();
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
async function readCurrentBranch(){
|
|
270
|
+
const git = simpleGit(getGitOptions());
|
|
271
|
+
try{
|
|
272
|
+
const localBranches = await git.branchLocal();
|
|
273
|
+
return localBranches.current;
|
|
274
|
+
}catch(e){
|
|
275
|
+
RED.notify(`<strong>Error</strong>: ${e.message}`, 'error');
|
|
276
|
+
return ''
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
}
|
|
280
|
+
function allowCommits() {
|
|
281
|
+
$("#sidebar-git-commit-msg").attr("placeholder", `${COMMIT_MESSAGE_LABEL}`).val("");
|
|
282
|
+
$("#sidebar-git-commit-msg").attr("disabled", false);
|
|
283
|
+
$('#sidebar-git-commit-wrapper').show();
|
|
284
|
+
}
|
|
285
|
+
function disallowCommits() {
|
|
286
|
+
$("#sidebar-git-commit-msg").attr("placeholder", "Nothing to commit").val("").focus().blur();
|
|
287
|
+
$("#sidebar-git-commit-msg").attr("disabled", true)
|
|
288
|
+
$('#sidebar-git-commit-wrapper').hide();
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
function clearCommitMessage() {
|
|
292
|
+
$('#sidebar-git-commit-msg').val('');
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
function init() {
|
|
296
|
+
initHTML();
|
|
297
|
+
initJS();
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
function show() {
|
|
301
|
+
RED.sidebar.show('git');
|
|
302
|
+
checkGitStatus();
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
function refreshTab(silently){
|
|
306
|
+
if (!silently) {
|
|
307
|
+
RED.actions.invoke('core:show-sidebar');
|
|
308
|
+
}
|
|
309
|
+
checkGitStatus();
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
function onsame(){
|
|
313
|
+
RED.actions.invoke('core:hide-sidebar');
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return {
|
|
317
|
+
init: init,
|
|
318
|
+
show: show,
|
|
319
|
+
}
|
|
320
|
+
})();
|
|
@@ -575,9 +575,6 @@ RED.sidebar.test = (function() {
|
|
|
575
575
|
// Clear the cache of debug messages
|
|
576
576
|
$('#test-debug-messages-caches').empty();
|
|
577
577
|
|
|
578
|
-
// Check if traceability is enabled
|
|
579
|
-
let traceabilityEnabled = $('#isTraceabilitySelected').is(':checked');
|
|
580
|
-
|
|
581
578
|
// Run the selected case
|
|
582
579
|
// - check whether there is only one test case to run or we should run all of them
|
|
583
580
|
if (testCaseIdSelected) {
|
|
@@ -594,7 +591,7 @@ RED.sidebar.test = (function() {
|
|
|
594
591
|
createDebugMessageCache(testNodes[i].id);
|
|
595
592
|
try{
|
|
596
593
|
// console.log(`[tab-test] Running testcase: ${testNodes[i].id} ...`, )
|
|
597
|
-
await window.__kumologica.libs.testFlow('{}', testNodes[i].id, environment
|
|
594
|
+
await window.__kumologica.libs.testFlow('{}', testNodes[i].id, environment);
|
|
598
595
|
}catch(err){
|
|
599
596
|
console.log('[tab-test] error found: ', err);
|
|
600
597
|
}
|
|
@@ -602,7 +599,7 @@ RED.sidebar.test = (function() {
|
|
|
602
599
|
} else {
|
|
603
600
|
try {
|
|
604
601
|
createDebugMessageCache(testCaseIdSelected);
|
|
605
|
-
await window.__kumologica.libs.testFlow('{}', testCaseIdSelected, environment
|
|
602
|
+
await window.__kumologica.libs.testFlow('{}', testCaseIdSelected, environment);
|
|
606
603
|
} catch(err) {
|
|
607
604
|
console.log('[tab-test] error found: ', err);
|
|
608
605
|
//App.notify(`Error found: ${JSON.stringify(err)}`, { type: 'error'});
|