@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.
- package/cli/commands/create-commands/openapi.js +42 -0
- package/cli/commands/create.js +17 -8
- package/cli/commands/login.js +87 -0
- package/package.json +18 -7
- package/src/app/lib/ai/layout.js +75 -0
- package/src/app/lib/ai/openai.js +108 -0
- package/src/app/lib/ai/prompt.txt +583 -0
- package/src/app/lib/aws/ca-cloudwatch-api.js +2 -10
- package/src/app/lib/aws/ca-dynamodb-api.js +6 -10
- package/src/app/lib/aws/ca-elb-api.js +4 -24
- package/src/app/lib/aws/ca-events-api.js +5 -12
- package/src/app/lib/aws/ca-iot-api.js +3 -87
- package/src/app/lib/aws/ca-s3-api.js +17 -62
- package/src/app/lib/aws/ca-sns-api.js +6 -15
- package/src/app/lib/aws/ca-sqs-api.js +9 -6
- package/src/app/lib/aws/index.js +70 -86
- package/src/app/lib/aws/kl-apigw-api.js +40 -0
- package/src/app/lib/aws/kl-iam-api.js +5 -5
- package/src/app/lib/github/index.js +0 -17
- package/src/app/lib/serverless/index.js +1 -1
- package/src/app/lib/stores/settings-cloud-store.js +35 -2
- package/src/app/main.js +34 -32
- package/src/app/preload.js +36 -28
- package/src/app/ui/editor-client/public/red/red.js +924 -458
- package/src/app/ui/editor-client/public/red/red.min.js +2 -2
- package/src/app/ui/editor-client/public/red/style.min.css +1 -1
- package/src/app/ui/editor-client/src/js/nodes.js +19 -18
- package/src/app/ui/editor-client/src/js/red.js +6 -3
- package/src/app/ui/editor-client/src/js/ui/editor.js +70 -70
- package/src/app/ui/editor-client/src/js/ui/footer.js +143 -0
- package/src/app/ui/editor-client/src/js/ui/search.js +43 -34
- package/src/app/ui/editor-client/src/js/ui/sidebar.js +26 -24
- package/src/app/ui/editor-client/src/js/ui/signup.js +56 -0
- package/src/app/ui/editor-client/src/js/ui/tab-ai.js +210 -0
- package/src/app/ui/editor-client/src/js/ui/tab-awsDeploy.js +30 -5
- package/src/app/ui/editor-client/src/js/ui/tab-test.js +120 -99
- package/src/app/ui/editor-client/src/js/ui/update-panel.js +0 -1
- package/src/app/ui/editor-client/src/js/ui/view.js +201 -202
- package/src/app/ui/editor-client/src/sass/editor.scss +715 -645
- package/src/app/ui/editor-client/src/sass/sidebar.scss +21 -12
- package/src/app/ui/editor-client/src/sass/style.scss +101 -0
- package/src/app/ui/editor-client/src/sass/tab-ai.scss +68 -0
- package/src/app/ui/editor-client/src/sass/workspace.scss +12 -2
- package/src/app/ui/editor-client/templates/index.mst +41 -7
- package/src/server/DesignerServer.js +2 -1
- package/cli/.DS_Store +0 -0
- package/fixtures/.DS_Store +0 -0
- package/src/app/lib/aws/ca-apigw-api.js +0 -216
- package/src/app/lib/aws/ca-codecommit-api.js +0 -63
- package/src/app/lib/aws/kl-rekognition-api.js +0 -66
- package/src/app/lib/aws/kl-ssm-api.js +0 -24
|
@@ -86,14 +86,14 @@ RED.view = (function () {
|
|
|
86
86
|
{
|
|
87
87
|
title: 'Paste',
|
|
88
88
|
shortcut: 'Ctrl+V',
|
|
89
|
-
action: async function(elm, d, i) {
|
|
89
|
+
action: async function (elm, d, i) {
|
|
90
90
|
RED.actions.invoke('core:paste-from-internal-clipboard');
|
|
91
91
|
}
|
|
92
92
|
},
|
|
93
93
|
{
|
|
94
94
|
title: 'Search Node...',
|
|
95
95
|
shortcut: 'Ctrl+F',
|
|
96
|
-
action: async function(elm, d, i) {
|
|
96
|
+
action: async function (elm, d, i) {
|
|
97
97
|
$('#btn-search').click();
|
|
98
98
|
d3.event.stopPropagation();
|
|
99
99
|
}
|
|
@@ -101,7 +101,7 @@ RED.view = (function () {
|
|
|
101
101
|
{ separator: true },
|
|
102
102
|
{
|
|
103
103
|
title: 'Clear All Breakpoints',
|
|
104
|
-
action: async function(elm, d, i) {
|
|
104
|
+
action: async function (elm, d, i) {
|
|
105
105
|
await window.__kumologica.debugger.removeAllBreakpoints();
|
|
106
106
|
await redrawBreakpoints();
|
|
107
107
|
redraw();
|
|
@@ -111,7 +111,7 @@ RED.view = (function () {
|
|
|
111
111
|
{
|
|
112
112
|
title: 'Run TestCase',
|
|
113
113
|
shortcut: '',
|
|
114
|
-
action: async function(elm, d, i) {
|
|
114
|
+
action: async function (elm, d, i) {
|
|
115
115
|
$('#red-ui-tab-test-link-button').click();
|
|
116
116
|
$('#test-sidebar-run-btn').click();
|
|
117
117
|
}
|
|
@@ -119,7 +119,7 @@ RED.view = (function () {
|
|
|
119
119
|
{
|
|
120
120
|
title: 'Debug TestCase',
|
|
121
121
|
shortcut: '',
|
|
122
|
-
action: async function(elm, d, i) {
|
|
122
|
+
action: async function (elm, d, i) {
|
|
123
123
|
$('#red-ui-tab-test-link-button').click();
|
|
124
124
|
$('#test-sidebar-debug-btn').click();
|
|
125
125
|
}
|
|
@@ -128,14 +128,14 @@ RED.view = (function () {
|
|
|
128
128
|
{
|
|
129
129
|
title: 'Toggle Navigator',
|
|
130
130
|
shortcut: '',
|
|
131
|
-
action: async function(elm, d, i) {
|
|
131
|
+
action: async function (elm, d, i) {
|
|
132
132
|
RED.view.navigator.toggle();
|
|
133
133
|
}
|
|
134
|
-
},
|
|
134
|
+
},
|
|
135
135
|
{
|
|
136
136
|
title: 'Automatic Layout',
|
|
137
137
|
shortcut: '',
|
|
138
|
-
action: async function(elm, d, i) {
|
|
138
|
+
action: async function (elm, d, i) {
|
|
139
139
|
applyLayout();
|
|
140
140
|
}
|
|
141
141
|
},
|
|
@@ -143,25 +143,25 @@ RED.view = (function () {
|
|
|
143
143
|
{
|
|
144
144
|
title: 'Open Node Library',
|
|
145
145
|
shortcut: '',
|
|
146
|
-
action: async function(elm, d, i) {
|
|
146
|
+
action: async function (elm, d, i) {
|
|
147
147
|
$('#launch-node-library').click()
|
|
148
148
|
}
|
|
149
149
|
},
|
|
150
150
|
{
|
|
151
151
|
title: 'Add Node...',
|
|
152
152
|
shortcut: 'Ctrl+Click',
|
|
153
|
-
action: async function(elm, d, i) {
|
|
153
|
+
action: async function (elm, d, i) {
|
|
154
154
|
d3.event.stopPropagation();
|
|
155
155
|
|
|
156
156
|
let eventProps = {
|
|
157
|
-
ctrlKey: true,
|
|
157
|
+
ctrlKey: true,
|
|
158
158
|
metaKey: true,
|
|
159
159
|
screenX: d3.event.screenX,
|
|
160
160
|
screenY: d3.event.screenY,
|
|
161
161
|
clientX: d3.event.clientX,
|
|
162
162
|
clientY: d3.event.clientY,
|
|
163
163
|
offsetX: d3.event.offsetX,
|
|
164
|
-
offsetY: d3.event.offsetY
|
|
164
|
+
offsetY: d3.event.offsetY
|
|
165
165
|
}
|
|
166
166
|
mouse_mode = RED.state.DEFAULT;
|
|
167
167
|
|
|
@@ -281,8 +281,8 @@ RED.view = (function () {
|
|
|
281
281
|
Math.max(
|
|
282
282
|
0.3,
|
|
283
283
|
scaleFactor +
|
|
284
|
-
|
|
285
|
-
|
|
284
|
+
Math.floor(moveTouchDistance * 100 - startTouchDistance * 100) /
|
|
285
|
+
10000
|
|
286
286
|
)
|
|
287
287
|
);
|
|
288
288
|
|
|
@@ -301,7 +301,7 @@ RED.view = (function () {
|
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
303
|
})
|
|
304
|
-
|
|
304
|
+
|
|
305
305
|
vis.on('contextmenu', d3.contextMenu('canvas', menuCanvas, () => { zoomZero() }));
|
|
306
306
|
|
|
307
307
|
var outer_background = vis
|
|
@@ -370,13 +370,13 @@ RED.view = (function () {
|
|
|
370
370
|
var contextMenuLayer = vis.append('g');
|
|
371
371
|
// add the context menu placeholder for the canvas
|
|
372
372
|
contextMenuLayer
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
373
|
+
.append('foreignObject')
|
|
374
|
+
.attr('id', `d3-context-menu-canvas`)
|
|
375
|
+
.attr('class', `d3-context-menu-canvas d3-context-menu`)
|
|
376
|
+
.attr('width', 350)
|
|
377
|
+
.attr('height', 100)
|
|
378
|
+
.attr('x', 100)
|
|
379
|
+
.attr('y', 100)
|
|
380
380
|
|
|
381
381
|
var drag_lines = [];
|
|
382
382
|
|
|
@@ -501,7 +501,7 @@ RED.view = (function () {
|
|
|
501
501
|
zoomIn();
|
|
502
502
|
});
|
|
503
503
|
|
|
504
|
-
$('#btn-minimize-restore').click(
|
|
504
|
+
$('#btn-minimize-restore').click(() => {
|
|
505
505
|
if (scaleFactor === 1) {
|
|
506
506
|
scaleFactor = 0.6;
|
|
507
507
|
} else {
|
|
@@ -510,7 +510,7 @@ RED.view = (function () {
|
|
|
510
510
|
zoomView(scaleFactor);
|
|
511
511
|
});
|
|
512
512
|
|
|
513
|
-
$('#btn-layouter').click(function(){
|
|
513
|
+
$('#btn-layouter').click(function () {
|
|
514
514
|
applyLayout();
|
|
515
515
|
});
|
|
516
516
|
|
|
@@ -538,28 +538,28 @@ RED.view = (function () {
|
|
|
538
538
|
|
|
539
539
|
// Handle dragging the workspace
|
|
540
540
|
$('#chart')
|
|
541
|
-
.keydown(function(e){
|
|
542
|
-
if(e.keyCode == 32) {
|
|
541
|
+
.keydown(function (e) {
|
|
542
|
+
if (e.keyCode == 32) {
|
|
543
543
|
e.preventDefault();
|
|
544
544
|
if (!drag) {
|
|
545
545
|
drag = true;
|
|
546
|
-
$('#chart').attr('style','cursor: grab !important')
|
|
546
|
+
$('#chart').attr('style', 'cursor: grab !important')
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
549
|
})
|
|
550
|
-
.keyup(function(e){
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
550
|
+
.keyup(function (e) {
|
|
551
|
+
if (e.keyCode == 32 && drag) {
|
|
552
|
+
e.preventDefault();
|
|
553
|
+
drag = false;
|
|
554
|
+
dragging = false;
|
|
555
|
+
$('#chart').attr('style', 'cursor: default !important')
|
|
556
|
+
}
|
|
557
557
|
})
|
|
558
|
-
.on("mousedown", function(e) {
|
|
558
|
+
.on("mousedown", function (e) {
|
|
559
559
|
if (drag && !dragging) {
|
|
560
560
|
e.preventDefault();
|
|
561
|
-
|
|
562
|
-
$('#chart').attr('style','cursor: grabbing !important')
|
|
561
|
+
|
|
562
|
+
$('#chart').attr('style', 'cursor: grabbing !important')
|
|
563
563
|
dragging = true;
|
|
564
564
|
draggingPos = {
|
|
565
565
|
// The current scroll
|
|
@@ -571,27 +571,27 @@ RED.view = (function () {
|
|
|
571
571
|
}
|
|
572
572
|
})
|
|
573
573
|
|
|
574
|
-
.on("mouseup", function(e) {
|
|
575
|
-
if (drag && dragging){
|
|
574
|
+
.on("mouseup", function (e) {
|
|
575
|
+
if (drag && dragging) {
|
|
576
576
|
e.preventDefault();
|
|
577
577
|
dragging = false;
|
|
578
578
|
// console.log('Dragging off')
|
|
579
|
-
$('#chart').attr('style','cursor: grab !important')
|
|
579
|
+
$('#chart').attr('style', 'cursor: grab !important')
|
|
580
580
|
}
|
|
581
|
-
|
|
581
|
+
|
|
582
582
|
})
|
|
583
583
|
|
|
584
|
-
.on("mousemove", function(e) {
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
584
|
+
.on("mousemove", function (e) {
|
|
585
|
+
if (drag && dragging) {
|
|
586
|
+
e.preventDefault();
|
|
587
|
+
|
|
588
|
+
// How far the mouse has been moved
|
|
589
|
+
const dx = e.clientX - draggingPos.x;
|
|
590
|
+
const dy = e.clientY - draggingPos.y;
|
|
591
|
+
|
|
592
|
+
$("#chart").scrollLeft(draggingPos.left - dx);
|
|
593
|
+
$("#chart").scrollTop(draggingPos.top - dy);
|
|
594
|
+
}
|
|
595
595
|
});
|
|
596
596
|
|
|
597
597
|
|
|
@@ -741,10 +741,10 @@ RED.view = (function () {
|
|
|
741
741
|
scale =
|
|
742
742
|
0.4 -
|
|
743
743
|
0.2 *
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
744
|
+
Math.max(
|
|
745
|
+
0,
|
|
746
|
+
(node_width - Math.min(Math.abs(dx), Math.abs(dy))) / node_width
|
|
747
|
+
);
|
|
748
748
|
}
|
|
749
749
|
if (dx * sc > 0) {
|
|
750
750
|
return (
|
|
@@ -1004,10 +1004,10 @@ RED.view = (function () {
|
|
|
1004
1004
|
.attr(
|
|
1005
1005
|
'transform',
|
|
1006
1006
|
'translate(' +
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1007
|
+
(point[0] - node_width / 2) +
|
|
1008
|
+
',' +
|
|
1009
|
+
(point[1] - node_height / 2) +
|
|
1010
|
+
')'
|
|
1011
1011
|
);
|
|
1012
1012
|
ghostNode
|
|
1013
1013
|
.append('rect')
|
|
@@ -1297,10 +1297,10 @@ RED.view = (function () {
|
|
|
1297
1297
|
ghostNode.attr(
|
|
1298
1298
|
'transform',
|
|
1299
1299
|
'translate(' +
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1300
|
+
(point[0] - node_width / 2) +
|
|
1301
|
+
',' +
|
|
1302
|
+
(point[1] - node_height / 2) +
|
|
1303
|
+
')'
|
|
1304
1304
|
);
|
|
1305
1305
|
rebuildQuickAddLink();
|
|
1306
1306
|
} else {
|
|
@@ -1315,7 +1315,7 @@ RED.view = (function () {
|
|
|
1315
1315
|
redraw();
|
|
1316
1316
|
}
|
|
1317
1317
|
}
|
|
1318
|
-
|
|
1318
|
+
|
|
1319
1319
|
// console.log('[view] Create a lasso.... mouse_mode = ', mouse_mode);
|
|
1320
1320
|
// console.log('[view] Create a lasso....d3.event.ctrlKey = ', d3.event.ctrlKey);
|
|
1321
1321
|
|
|
@@ -1988,27 +1988,27 @@ RED.view = (function () {
|
|
|
1988
1988
|
}
|
|
1989
1989
|
return value;
|
|
1990
1990
|
});
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
if (ignoreEdit){
|
|
1991
|
+
|
|
1992
|
+
|
|
1993
|
+
if (ignoreEdit) {
|
|
1994
1994
|
// This is used during the hovering over the debug traces
|
|
1995
1995
|
lastSelection = selectionJSON;
|
|
1996
1996
|
// console.log('[view] the selection should not be edited');
|
|
1997
|
-
}else{
|
|
1997
|
+
} else {
|
|
1998
1998
|
if (selectionJSON !== lastSelection) {
|
|
1999
1999
|
lastSelection = selectionJSON;
|
|
2000
2000
|
RED.editor.edit(selection);
|
|
2001
|
-
}else{
|
|
2001
|
+
} else {
|
|
2002
2002
|
// User has clicked on the canvas or link
|
|
2003
2003
|
// console.log('[view::updateSelection] Selection has not changed. Ignore');
|
|
2004
|
-
|
|
2004
|
+
|
|
2005
2005
|
// Just close the sidebar
|
|
2006
2006
|
RED.editor.resetEditor();
|
|
2007
2007
|
}
|
|
2008
2008
|
}
|
|
2009
2009
|
}
|
|
2010
2010
|
|
|
2011
|
-
|
|
2011
|
+
|
|
2012
2012
|
function editSelection() {
|
|
2013
2013
|
// console.log('[view] editSelection invoked')
|
|
2014
2014
|
if (moving_set.length > 0) {
|
|
@@ -2571,9 +2571,9 @@ RED.view = (function () {
|
|
|
2571
2571
|
} catch (err) {
|
|
2572
2572
|
console.log(
|
|
2573
2573
|
'Definition error: ' +
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2574
|
+
node.type +
|
|
2575
|
+
'.' +
|
|
2576
|
+
(portType === PORT_TYPE_INPUT ? 'inputLabels' : 'outputLabels'),
|
|
2577
2577
|
err
|
|
2578
2578
|
);
|
|
2579
2579
|
result = null;
|
|
@@ -2584,7 +2584,7 @@ RED.view = (function () {
|
|
|
2584
2584
|
return result;
|
|
2585
2585
|
}
|
|
2586
2586
|
function showTooltip(x, y, content, direction) {
|
|
2587
|
-
if (!content){
|
|
2587
|
+
if (!content) {
|
|
2588
2588
|
return;
|
|
2589
2589
|
}
|
|
2590
2590
|
|
|
@@ -2686,7 +2686,7 @@ RED.view = (function () {
|
|
|
2686
2686
|
(mouse_mode != RED.state.JOINING &&
|
|
2687
2687
|
mouse_mode != RED.state.QUICK_JOINING) || // Not currently joining - all ports active
|
|
2688
2688
|
(drag_lines.length > 0 && // Currently joining
|
|
2689
|
-
|
|
2689
|
+
drag_lines[0].portType !== portType && // INPUT->OUTPUT OUTPUT->INPUT
|
|
2690
2690
|
(!drag_lines[0].virtualLink || // Not a link wire
|
|
2691
2691
|
(drag_lines[0].node.type === 'link in' && d.type === 'link out') ||
|
|
2692
2692
|
(drag_lines[0].node.type === 'link out' && d.type === 'link in')));
|
|
@@ -2746,8 +2746,8 @@ RED.view = (function () {
|
|
|
2746
2746
|
? 1
|
|
2747
2747
|
: 0
|
|
2748
2748
|
: d.direction == 'in'
|
|
2749
|
-
|
|
2750
|
-
|
|
2749
|
+
? 0
|
|
2750
|
+
: 1;
|
|
2751
2751
|
var wasJoining = false;
|
|
2752
2752
|
if (
|
|
2753
2753
|
mouse_mode === RED.state.JOINING ||
|
|
@@ -3057,7 +3057,7 @@ RED.view = (function () {
|
|
|
3057
3057
|
}
|
|
3058
3058
|
}
|
|
3059
3059
|
|
|
3060
|
-
async function redrawBreakpoint(node){
|
|
3060
|
+
async function redrawBreakpoint(node) {
|
|
3061
3061
|
let resp = await window.__kumologica.debugger.isBreakpointFound(node.id);
|
|
3062
3062
|
let breakpointFound = resp.body;
|
|
3063
3063
|
if (breakpointFound) {
|
|
@@ -3073,15 +3073,15 @@ RED.view = (function () {
|
|
|
3073
3073
|
let bpids = resp.body;
|
|
3074
3074
|
|
|
3075
3075
|
activeNodes
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3076
|
+
.filter(node => node.z === 'main.flow')
|
|
3077
|
+
.forEach(node => {
|
|
3078
|
+
node.dirty = true;
|
|
3079
|
+
if (bpids.includes(node.id)) {
|
|
3080
|
+
node.status = { fill: "red", shape: "dot" };
|
|
3081
|
+
} else {
|
|
3082
|
+
node.status = {};
|
|
3083
|
+
}
|
|
3084
|
+
});
|
|
3085
3085
|
}
|
|
3086
3086
|
|
|
3087
3087
|
function redraw(focusActivated) {
|
|
@@ -3433,7 +3433,7 @@ RED.view = (function () {
|
|
|
3433
3433
|
|
|
3434
3434
|
return d.id;
|
|
3435
3435
|
});
|
|
3436
|
-
|
|
3436
|
+
|
|
3437
3437
|
node.exit().remove();
|
|
3438
3438
|
|
|
3439
3439
|
var nodeEnter = node
|
|
@@ -3447,7 +3447,7 @@ RED.view = (function () {
|
|
|
3447
3447
|
return d.type === 'link in' || d.type === 'link out';
|
|
3448
3448
|
})
|
|
3449
3449
|
|
|
3450
|
-
|
|
3450
|
+
|
|
3451
3451
|
nodeEnter.each(function (d, i) {
|
|
3452
3452
|
var node = d3.select(this);
|
|
3453
3453
|
var isLink = d.type === 'link in' || d.type === 'link out';
|
|
@@ -3594,23 +3594,23 @@ RED.view = (function () {
|
|
|
3594
3594
|
let infoTooltipTimeout;
|
|
3595
3595
|
let infoTooltipHover;
|
|
3596
3596
|
node
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3597
|
+
.on('mouseover', function (d) {
|
|
3598
|
+
infoTooltipTimeout = setTimeout(
|
|
3599
|
+
() => {
|
|
3600
|
+
var pos = getElementPosition(node.node());
|
|
3601
|
+
infoTooltipHover = showTooltip(pos[0] + 46, pos[1] + 10, d.info, 'right')
|
|
3602
|
+
}, 200
|
|
3603
|
+
)
|
|
3604
|
+
})
|
|
3605
|
+
.on('mouseout', function (d) {
|
|
3606
|
+
clearTimeout(infoTooltipTimeout);
|
|
3607
|
+
if (infoTooltipHover) {
|
|
3608
|
+
infoTooltipHover.remove();
|
|
3609
|
+
infoTooltipHover = null;
|
|
3610
|
+
}
|
|
3611
|
+
let tooltipEl = d3.select(this);
|
|
3612
|
+
tooltipEl.classed('port_hovered', false);
|
|
3613
|
+
})
|
|
3614
3614
|
|
|
3615
3615
|
|
|
3616
3616
|
var selectionRect = node
|
|
@@ -3620,7 +3620,7 @@ RED.view = (function () {
|
|
|
3620
3620
|
.attr('height', 100)
|
|
3621
3621
|
.attr('height', 100)
|
|
3622
3622
|
.attr('stroke', '#1890ff')
|
|
3623
|
-
.attr('fill', '#e6f7ff')
|
|
3623
|
+
.attr('fill', '#e6f7ff')
|
|
3624
3624
|
.attr('stroke-width', 2)
|
|
3625
3625
|
.attr('opacity', 0.4)
|
|
3626
3626
|
.attr('rx', 2)
|
|
@@ -3855,9 +3855,9 @@ RED.view = (function () {
|
|
|
3855
3855
|
{
|
|
3856
3856
|
title: 'Toggle Breakpoint',
|
|
3857
3857
|
disabled: d._def.hasOwnProperty('disableToggleBreakpoint'),
|
|
3858
|
-
action: async function(elm, d, i) {
|
|
3859
|
-
let disabledFlagOn =
|
|
3860
|
-
if (!disabledFlagOn || (disabledFlagOn && d._def.disableToggleBreakpoint === false)){
|
|
3858
|
+
action: async function (elm, d, i) {
|
|
3859
|
+
let disabledFlagOn = d._def.hasOwnProperty('disableToggleBreakpoint');
|
|
3860
|
+
if (!disabledFlagOn || (disabledFlagOn && d._def.disableToggleBreakpoint === false)) {
|
|
3861
3861
|
await window.__kumologica.debugger.toggleBreakpoint(d.id);
|
|
3862
3862
|
await redrawBreakpoint(d);
|
|
3863
3863
|
redraw();
|
|
@@ -3868,13 +3868,13 @@ RED.view = (function () {
|
|
|
3868
3868
|
{
|
|
3869
3869
|
title: 'Cut',
|
|
3870
3870
|
shortcut: 'Ctrl+X',
|
|
3871
|
-
action: async function(elm, d, i, ctx) {
|
|
3871
|
+
action: async function (elm, d, i, ctx) {
|
|
3872
3872
|
if (ctx && ctx.nodes) {
|
|
3873
3873
|
RED.view.select(ctx.nodes.map(n => n.id));
|
|
3874
3874
|
} else {
|
|
3875
3875
|
RED.view.select(d.id);
|
|
3876
3876
|
}
|
|
3877
|
-
|
|
3877
|
+
|
|
3878
3878
|
copySelection();
|
|
3879
3879
|
deleteSelection();
|
|
3880
3880
|
}
|
|
@@ -3882,7 +3882,7 @@ RED.view = (function () {
|
|
|
3882
3882
|
{
|
|
3883
3883
|
title: 'Copy',
|
|
3884
3884
|
shortcut: 'Ctrl+C',
|
|
3885
|
-
action: async function(elm, d, i, ctx) {
|
|
3885
|
+
action: async function (elm, d, i, ctx) {
|
|
3886
3886
|
if (ctx && ctx.nodes) {
|
|
3887
3887
|
RED.view.select(ctx.nodes.map(n => n.id));
|
|
3888
3888
|
} else {
|
|
@@ -3901,7 +3901,7 @@ RED.view = (function () {
|
|
|
3901
3901
|
{
|
|
3902
3902
|
title: 'Delete',
|
|
3903
3903
|
shortcut: 'Del',
|
|
3904
|
-
action: async function(elm, d, i, ctx) {
|
|
3904
|
+
action: async function (elm, d, i, ctx) {
|
|
3905
3905
|
if (ctx && ctx.nodes) {
|
|
3906
3906
|
RED.view.select(ctx.nodes.map(n => n.id));
|
|
3907
3907
|
} else {
|
|
@@ -3914,20 +3914,20 @@ RED.view = (function () {
|
|
|
3914
3914
|
{ separator: true },
|
|
3915
3915
|
{
|
|
3916
3916
|
title: 'Copy Node ID',
|
|
3917
|
-
action: async function(elm, d, i, ctx) {
|
|
3918
|
-
if (ctx.nodes.length > 1){
|
|
3917
|
+
action: async function (elm, d, i, ctx) {
|
|
3918
|
+
if (ctx.nodes.length > 1) {
|
|
3919
3919
|
RED.notify('<strong>Error:</strong> This option requires selecing a single node', 'error');
|
|
3920
3920
|
return;
|
|
3921
3921
|
} else {
|
|
3922
3922
|
RED.clipboard.copyText(d.id);
|
|
3923
|
-
RED.notify(`Node ID [ <b>${d.id}</b> ] copied to clipboard`)
|
|
3923
|
+
RED.notify(`Node ID [ <b>${d.id}</b> ] copied to clipboard`)
|
|
3924
3924
|
}
|
|
3925
3925
|
}
|
|
3926
3926
|
},
|
|
3927
3927
|
{
|
|
3928
3928
|
title: 'Settings...',
|
|
3929
|
-
action: async function(elm, d, i, ctx) {
|
|
3930
|
-
if (ctx.nodes.length > 1){
|
|
3929
|
+
action: async function (elm, d, i, ctx) {
|
|
3930
|
+
if (ctx.nodes.length > 1) {
|
|
3931
3931
|
RED.notify('<strong>Error:</strong> This options requires selecting a single node', 'error');
|
|
3932
3932
|
return;
|
|
3933
3933
|
} else {
|
|
@@ -3940,15 +3940,15 @@ RED.view = (function () {
|
|
|
3940
3940
|
// TODO Javier - prototype to support context menu extensions...
|
|
3941
3941
|
// =============================================================
|
|
3942
3942
|
// if there is special context menu for the element, attach it
|
|
3943
|
-
if (d._def.hasOwnProperty('oncontextmenu')){
|
|
3943
|
+
if (d._def.hasOwnProperty('oncontextmenu')) {
|
|
3944
3944
|
let nodeContextMenu = d._def.oncontextmenu.call(this, window) || [];
|
|
3945
3945
|
menu = [...nodeContextMenu, { separator: true }, ...menu];
|
|
3946
3946
|
}
|
|
3947
3947
|
|
|
3948
|
-
|
|
3948
|
+
|
|
3949
3949
|
|
|
3950
3950
|
let nodeId = d.id.replace('.', '_');
|
|
3951
|
-
node.on('contextmenu', d3.contextMenu(nodeId, menu, ()=> {
|
|
3951
|
+
node.on('contextmenu', d3.contextMenu(nodeId, menu, () => {
|
|
3952
3952
|
console.log('[view] before context menu');
|
|
3953
3953
|
console.log('[view] selection of nodes:', RED.view.selection());
|
|
3954
3954
|
zoomZero()
|
|
@@ -3982,7 +3982,7 @@ RED.view = (function () {
|
|
|
3982
3982
|
.attr('rx', 8)
|
|
3983
3983
|
.attr('ry', 8)
|
|
3984
3984
|
.attr('stroke-width', '2');
|
|
3985
|
-
|
|
3985
|
+
|
|
3986
3986
|
statusLabel = status
|
|
3987
3987
|
.append('svg:text')
|
|
3988
3988
|
.attr('class', 'node_status_label')
|
|
@@ -4056,17 +4056,17 @@ RED.view = (function () {
|
|
|
4056
4056
|
const MEDIUM_HEIGHT = 100;
|
|
4057
4057
|
const LARGE_HEIGHT = 110;
|
|
4058
4058
|
|
|
4059
|
-
if (numberOfLinesDesc <= 1){
|
|
4059
|
+
if (numberOfLinesDesc <= 1) {
|
|
4060
4060
|
selectionHeight = SMALL_HEIGHT;
|
|
4061
4061
|
} else if (numberOfLinesDesc === 2) {
|
|
4062
4062
|
selectionHeight = MEDIUM_HEIGHT;
|
|
4063
4063
|
} else {
|
|
4064
4064
|
selectionHeight = LARGE_HEIGHT;
|
|
4065
4065
|
}
|
|
4066
|
-
|
|
4067
|
-
thisNode
|
|
4066
|
+
|
|
4067
|
+
thisNode
|
|
4068
4068
|
.selectAll('.selectionRect')
|
|
4069
|
-
.classed('selection_shown', function (d){
|
|
4069
|
+
.classed('selection_shown', function (d) {
|
|
4070
4070
|
return d.selected;
|
|
4071
4071
|
})
|
|
4072
4072
|
.attr('height', selectionHeight);
|
|
@@ -4424,7 +4424,7 @@ RED.view = (function () {
|
|
|
4424
4424
|
return (
|
|
4425
4425
|
'M ' +
|
|
4426
4426
|
((!d._def.align && d.inputs !== 0 && d.outputs === 0) ||
|
|
4427
|
-
|
|
4427
|
+
'right' === d._def.align
|
|
4428
4428
|
? 0
|
|
4429
4429
|
: 30) +
|
|
4430
4430
|
' 1 l 0 ' +
|
|
@@ -4530,7 +4530,7 @@ RED.view = (function () {
|
|
|
4530
4530
|
if (d && d.status && d.status.text) {
|
|
4531
4531
|
if (typeof d.status.text == 'object') {
|
|
4532
4532
|
const err = d.status.text;
|
|
4533
|
-
errTxt = err.message || err.error || err.errorMessage || JSON.stringify(d.status.text);
|
|
4533
|
+
errTxt = err.message || err.error || err.errorMessage || JSON.stringify(d.status.text);
|
|
4534
4534
|
} else {
|
|
4535
4535
|
errTxt = d.status.text;
|
|
4536
4536
|
}
|
|
@@ -4724,21 +4724,21 @@ RED.view = (function () {
|
|
|
4724
4724
|
.attr(
|
|
4725
4725
|
'd',
|
|
4726
4726
|
'M ' +
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4727
|
+
stemLength +
|
|
4728
|
+
' 0 ' +
|
|
4729
|
+
'C ' +
|
|
4730
|
+
(stemLength + 1.7 * branchLength) +
|
|
4731
|
+
' ' +
|
|
4732
|
+
0 +
|
|
4733
|
+
' ' +
|
|
4734
|
+
(stemLength + 0.1 * branchLength) +
|
|
4735
|
+
' ' +
|
|
4736
|
+
y +
|
|
4737
|
+
' ' +
|
|
4738
|
+
(stemLength + branchLength * 1.5) +
|
|
4739
|
+
' ' +
|
|
4740
|
+
y +
|
|
4741
|
+
' '
|
|
4742
4742
|
);
|
|
4743
4743
|
linkG
|
|
4744
4744
|
.append('svg:path')
|
|
@@ -4746,26 +4746,26 @@ RED.view = (function () {
|
|
|
4746
4746
|
.attr(
|
|
4747
4747
|
'd',
|
|
4748
4748
|
'M ' +
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4749
|
+
(stemLength + branchLength * 1.5 + s * (linkWidth + 7)) +
|
|
4750
|
+
' ' +
|
|
4751
|
+
(y - 12) +
|
|
4752
|
+
' ' +
|
|
4753
|
+
'h ' +
|
|
4754
|
+
-s * linkWidth +
|
|
4755
|
+
' ' +
|
|
4756
|
+
'a 3 3 45 0 ' +
|
|
4757
|
+
(s === 1 ? '0' : '1') +
|
|
4758
|
+
' ' +
|
|
4759
|
+
s * -3 +
|
|
4760
|
+
' 3 ' +
|
|
4761
|
+
'v 18 ' +
|
|
4762
|
+
'a 3 3 45 0 ' +
|
|
4763
|
+
(s === 1 ? '0' : '1') +
|
|
4764
|
+
' ' +
|
|
4765
|
+
s * 3 +
|
|
4766
|
+
' 3 ' +
|
|
4767
|
+
'h ' +
|
|
4768
|
+
s * linkWidth
|
|
4769
4769
|
);
|
|
4770
4770
|
linkG
|
|
4771
4771
|
.append('svg:path')
|
|
@@ -4773,20 +4773,20 @@ RED.view = (function () {
|
|
|
4773
4773
|
.attr(
|
|
4774
4774
|
'd',
|
|
4775
4775
|
'M ' +
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4776
|
+
(stemLength + branchLength * 1.5 + s * (linkWidth + 10)) +
|
|
4777
|
+
' ' +
|
|
4778
|
+
(y - 12) +
|
|
4779
|
+
' ' +
|
|
4780
|
+
'h ' +
|
|
4781
|
+
s * (linkWidth * 3) +
|
|
4782
|
+
' ' +
|
|
4783
|
+
'M ' +
|
|
4784
|
+
(stemLength + branchLength * 1.5 + s * (linkWidth + 10)) +
|
|
4785
|
+
' ' +
|
|
4786
|
+
(y + 12) +
|
|
4787
|
+
' ' +
|
|
4788
|
+
'h ' +
|
|
4789
|
+
s * (linkWidth * 3)
|
|
4790
4790
|
)
|
|
4791
4791
|
.style('stroke-dasharray', '12 3 8 4 3');
|
|
4792
4792
|
linkG
|
|
@@ -4885,11 +4885,11 @@ RED.view = (function () {
|
|
|
4885
4885
|
}
|
|
4886
4886
|
}
|
|
4887
4887
|
|
|
4888
|
-
function filterWorkspaces(newNodesStr){
|
|
4888
|
+
function filterWorkspaces(newNodesStr) {
|
|
4889
4889
|
try {
|
|
4890
4890
|
let newNodes = JSON.parse(newNodesStr);
|
|
4891
|
-
if (newNodes && Array.isArray(newNodes)){
|
|
4892
|
-
return newNodes.filter(
|
|
4891
|
+
if (newNodes && Array.isArray(newNodes)) {
|
|
4892
|
+
return newNodes.filter(e => (e.hasOwnProperty('type') && (e.type !== 'tab')));
|
|
4893
4893
|
} else {
|
|
4894
4894
|
return newNodes;
|
|
4895
4895
|
}
|
|
@@ -4907,7 +4907,6 @@ RED.view = (function () {
|
|
|
4907
4907
|
* - attached to mouse for placing - "IMPORT_DRAGGING"
|
|
4908
4908
|
*/
|
|
4909
4909
|
function importNodes(newNodesStr, addNewFlow, touchImport) {
|
|
4910
|
-
// Kumologica only has two flows: main and test, so never create a new flow
|
|
4911
4910
|
addNewFlow = false;
|
|
4912
4911
|
try {
|
|
4913
4912
|
// Strip the newNodesStr from workspaces elements
|
|
@@ -5171,7 +5170,7 @@ RED.view = (function () {
|
|
|
5171
5170
|
|
|
5172
5171
|
function applyLayout() {
|
|
5173
5172
|
const NODE_SIZE = 45;
|
|
5174
|
-
let ns = [];
|
|
5173
|
+
let ns = [];
|
|
5175
5174
|
|
|
5176
5175
|
const dagre = window.__kumologica.libs.dagre;
|
|
5177
5176
|
// Get all active nodes
|
|
@@ -5181,14 +5180,14 @@ RED.view = (function () {
|
|
|
5181
5180
|
let g = new dagre.graphlib.Graph();
|
|
5182
5181
|
|
|
5183
5182
|
// Set an object for the graph label
|
|
5184
|
-
g.setGraph({rankdir: "LR", nodesep: 50, marginx: 50, marginy: 50 });
|
|
5183
|
+
g.setGraph({ rankdir: "LR", nodesep: 50, marginx: 50, marginy: 50 });
|
|
5185
5184
|
|
|
5186
5185
|
// Default to assigning a new object as a label for each new edge.
|
|
5187
|
-
g.setDefaultEdgeLabel(function() { return {}; });
|
|
5186
|
+
g.setDefaultEdgeLabel(function () { return {}; });
|
|
5188
5187
|
|
|
5189
5188
|
// Create nodes for the graph
|
|
5190
5189
|
nodes.forEach(n => {
|
|
5191
|
-
g.setNode(n.id, {label: n.name, width: NODE_SIZE, height: NODE_SIZE })
|
|
5190
|
+
g.setNode(n.id, { label: n.name, width: NODE_SIZE, height: NODE_SIZE })
|
|
5192
5191
|
});
|
|
5193
5192
|
|
|
5194
5193
|
// Create the edges
|
|
@@ -5200,7 +5199,7 @@ RED.view = (function () {
|
|
|
5200
5199
|
dagre.layout(g);
|
|
5201
5200
|
|
|
5202
5201
|
// Apply the coordinates
|
|
5203
|
-
g.nodes().forEach(nid=> {
|
|
5202
|
+
g.nodes().forEach(nid => {
|
|
5204
5203
|
if (nid) {
|
|
5205
5204
|
let node = nodes.find(n => n.id === nid);
|
|
5206
5205
|
if (node) {
|
|
@@ -5251,7 +5250,7 @@ RED.view = (function () {
|
|
|
5251
5250
|
if (node._def.category !== 'config' && node.z) {
|
|
5252
5251
|
node.dirty = true;
|
|
5253
5252
|
RED.workspaces.show(node.z);
|
|
5254
|
-
|
|
5253
|
+
|
|
5255
5254
|
var screenSize = [
|
|
5256
5255
|
chart.width() / scaleFactor,
|
|
5257
5256
|
chart.height() / scaleFactor,
|
|
@@ -5260,7 +5259,7 @@ RED.view = (function () {
|
|
|
5260
5259
|
chart.scrollLeft() / scaleFactor,
|
|
5261
5260
|
chart.scrollTop() / scaleFactor,
|
|
5262
5261
|
];
|
|
5263
|
-
|
|
5262
|
+
|
|
5264
5263
|
if (
|
|
5265
5264
|
node.x < scrollPos[0] ||
|
|
5266
5265
|
node.y < scrollPos[1] ||
|
|
@@ -5281,7 +5280,7 @@ RED.view = (function () {
|
|
|
5281
5280
|
}
|
|
5282
5281
|
}
|
|
5283
5282
|
}
|
|
5284
|
-
|
|
5283
|
+
// ----
|
|
5285
5284
|
|
|
5286
5285
|
if (selectedNode) {
|
|
5287
5286
|
selectedNode.selected = true;
|
|
@@ -5291,21 +5290,21 @@ RED.view = (function () {
|
|
|
5291
5290
|
}
|
|
5292
5291
|
if (Array.isArray(selection)) {
|
|
5293
5292
|
console.log('[view] selection pre=', selection);
|
|
5294
|
-
let selectionNodes =
|
|
5295
|
-
(selection.length === 0)?
|
|
5296
|
-
|
|
5293
|
+
let selectionNodes =
|
|
5294
|
+
(selection.length === 0) ?
|
|
5295
|
+
RED.nodes.filterNodes({ z: 'main.flow' }) : RED.nodes.filterNodes({ id: selection });
|
|
5297
5296
|
|
|
5298
5297
|
console.log('[view] selection nodes=', selectionNodes);
|
|
5299
|
-
if (selectionNodes && Array.isArray(selectionNodes)){
|
|
5298
|
+
if (selectionNodes && Array.isArray(selectionNodes)) {
|
|
5300
5299
|
moving_set = [];
|
|
5301
5300
|
selectionNodes.forEach(sn => {
|
|
5302
5301
|
sn.selected = true;
|
|
5303
5302
|
sn.dirty = true;
|
|
5304
|
-
moving_set.push({n: sn})
|
|
5303
|
+
moving_set.push({ n: sn })
|
|
5305
5304
|
})
|
|
5306
5305
|
}
|
|
5307
|
-
|
|
5308
|
-
|
|
5306
|
+
|
|
5307
|
+
|
|
5309
5308
|
}
|
|
5310
5309
|
} else {
|
|
5311
5310
|
clearSelection();
|
|
@@ -5382,7 +5381,7 @@ RED.view = (function () {
|
|
|
5382
5381
|
200
|
|
5383
5382
|
);
|
|
5384
5383
|
}
|
|
5385
|
-
|
|
5384
|
+
|
|
5386
5385
|
if (!node._flashing) {
|
|
5387
5386
|
node._flashing = true;
|
|
5388
5387
|
var flash = 22;
|
|
@@ -5416,10 +5415,10 @@ RED.view = (function () {
|
|
|
5416
5415
|
getActiveNodes: function () {
|
|
5417
5416
|
return activeNodes;
|
|
5418
5417
|
},
|
|
5419
|
-
getActiveLinks: function() {
|
|
5418
|
+
getActiveLinks: function () {
|
|
5420
5419
|
return activeLinks;
|
|
5421
5420
|
},
|
|
5422
5421
|
showTooltip: showTooltip,
|
|
5423
|
-
applyLayout:applyLayout
|
|
5422
|
+
applyLayout: applyLayout
|
|
5424
5423
|
};
|
|
5425
5424
|
})();
|