@kumologica/sdk 3.4.0-beta9 → 3.5.0-beta1
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/start.js +43 -0
- package/cli/commands/test.js +11 -7
- package/cli/utils/logger.js +6 -1
- package/package.json +4 -4
- package/src/app/main-process/modal-newproject.js +4 -1
- package/src/app/main-process/modal-renameTab.js +106 -0
- package/src/app/main.js +22 -0
- package/src/app/ui/editor-api/lib/editor/index.js +8 -0
- package/src/app/ui/editor-api/lib/editor/ui.js +21 -1
- package/src/app/ui/editor-client/public/red/red.js +303 -159
- 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/modals/modal-rename-tab.js +74 -0
- package/src/app/ui/editor-client/src/js/red.js +1 -0
- package/src/app/ui/editor-client/src/js/ui/palette-explorer.js +210 -155
- package/src/app/ui/editor-client/src/js/ui/project-info.js +2 -2
- package/src/app/ui/editor-client/src/js/ui/search.js +1 -1
- package/src/app/ui/editor-client/src/js/ui/sidebar.js +1 -1
- package/src/app/ui/editor-client/src/js/ui/workspaces.js +14 -0
- package/src/app/ui/editor-client/src/sass/modals/modalNewTab.scss +1 -0
- package/src/app/ui/editor-client/src/sass/search.scss +6 -3
- package/src/app/ui/editor-client/src/sass/workspace.scss +1 -0
- package/src/app/ui/editor-client/templates/index.mst +4 -2
- package/src/app/ui/editor-client/templates/modals/modalRenameTab.mst +78 -0
- package/src/server/DesignerServer.js +6 -1
|
@@ -684,6 +684,7 @@ jQuery.propHooks.disabled = {
|
|
|
684
684
|
// Modals
|
|
685
685
|
RED.modalNewProject.init();
|
|
686
686
|
RED.modalNewTab.init();
|
|
687
|
+
RED.modalRenameTab.init();
|
|
687
688
|
RED.modalHome.init();
|
|
688
689
|
RED.modalWelcome.init();
|
|
689
690
|
RED.updatePanel.init();
|
|
@@ -14678,11 +14679,13 @@ RED.h = handlers;
|
|
|
14678
14679
|
var workspaceOrder = RED.nodes.getWorkspaceOrder();
|
|
14679
14680
|
ws._index = workspaceOrder.indexOf(ws.id);
|
|
14680
14681
|
removeWorkspace(ws);
|
|
14682
|
+
|
|
14681
14683
|
// var historyEvent = RED.nodes.removeWorkspace(ws.id);
|
|
14682
14684
|
// historyEvent.t = 'delete';
|
|
14683
14685
|
// historyEvent.dirty = RED.nodes.dirty();
|
|
14684
14686
|
// historyEvent.workspaces = [ws];
|
|
14685
14687
|
// RED.history.push(historyEvent);
|
|
14688
|
+
|
|
14686
14689
|
RED.nodes.dirty(true);
|
|
14687
14690
|
RED.sidebar.config.refresh();
|
|
14688
14691
|
}
|
|
@@ -15113,6 +15116,17 @@ RED.h = handlers;
|
|
|
15113
15116
|
|
|
15114
15117
|
}
|
|
15115
15118
|
|
|
15119
|
+
function renameTabFn(id, newLabel){
|
|
15120
|
+
if (workspace_tabs) {
|
|
15121
|
+
closeWorkspace(id);
|
|
15122
|
+
RED.nodes.eachWorkspace(function(ws) {
|
|
15123
|
+
if (ws.id === id){
|
|
15124
|
+
ws.label = newLabel;
|
|
15125
|
+
}
|
|
15126
|
+
});
|
|
15127
|
+
}
|
|
15128
|
+
}
|
|
15129
|
+
|
|
15116
15130
|
function setWorkspaceOrder(order) {
|
|
15117
15131
|
RED.nodes.setWorkspaceOrder(
|
|
15118
15132
|
order.filter(function(id) {
|
|
@@ -15131,6 +15145,7 @@ RED.h = handlers;
|
|
|
15131
15145
|
contains: function(id) {
|
|
15132
15146
|
return workspace_tabs.contains(id);
|
|
15133
15147
|
},
|
|
15148
|
+
renameTab: renameTabFn,
|
|
15134
15149
|
count: function() {
|
|
15135
15150
|
return workspaceTabCount;
|
|
15136
15151
|
},
|
|
@@ -21050,7 +21065,7 @@ RED.view.tools = (function() {
|
|
|
21050
21065
|
$('#sidebar').width(targetWidth);
|
|
21051
21066
|
|
|
21052
21067
|
// Hack: Make sure the workspace if reset before maximizing the sidebar. This is because when dragging the sidebar the workspace width is also modified
|
|
21053
|
-
$('#workspace').css('right',
|
|
21068
|
+
$('#workspace').css('right', 485);
|
|
21054
21069
|
RED.events.emit('sidebar:resize');
|
|
21055
21070
|
}
|
|
21056
21071
|
|
|
@@ -26525,115 +26540,156 @@ RED.sidebar.azure = (function () {
|
|
|
26525
26540
|
let path = window.__kumologica.libs.path;
|
|
26526
26541
|
|
|
26527
26542
|
const openProject = (projectLocation) => {
|
|
26528
|
-
|
|
26529
|
-
|
|
26530
|
-
|
|
26531
|
-
|
|
26543
|
+
if (projectLocation === RED.projectInfo.getWorkspaceInfo()[0].path) {
|
|
26544
|
+
RED.notify(`<strong>Warning</strong>: "${path.basename(projectLocation)}" project is already opened.`, 'warning');
|
|
26545
|
+
return;
|
|
26546
|
+
}
|
|
26547
|
+
|
|
26548
|
+
window.__kumologica.main.dispatch('modal-home:open-project-in-editor', {
|
|
26549
|
+
payload: {
|
|
26550
|
+
projectLocation
|
|
26551
|
+
}
|
|
26532
26552
|
});
|
|
26533
26553
|
}
|
|
26534
|
-
|
|
26554
|
+
|
|
26535
26555
|
const initCurrentProject = () => {
|
|
26536
|
-
|
|
26537
|
-
|
|
26538
|
-
|
|
26539
|
-
|
|
26540
|
-
|
|
26541
|
-
|
|
26542
|
-
|
|
26543
|
-
|
|
26544
|
-
|
|
26545
|
-
|
|
26546
|
-
|
|
26547
|
-
|
|
26548
|
-
|
|
26549
|
-
|
|
26550
|
-
|
|
26551
|
-
|
|
26552
|
-
|
|
26553
|
-
|
|
26554
|
-
|
|
26556
|
+
// Add Tab button
|
|
26557
|
+
let addTabBtn = `<div id="createTab" class="header-btn2"><i class="icofont-plus"></i></div>`;
|
|
26558
|
+
$(addTabBtn).appendTo($('#exp-open-project-createTab'));
|
|
26559
|
+
RED.popover.tooltip($('#exp-open-project-createTab'), 'Create Tab...');
|
|
26560
|
+
|
|
26561
|
+
$('#createTab').on('click', event => {
|
|
26562
|
+
event.stopPropagation();
|
|
26563
|
+
window.__kumologica.main.dispatch('navigator:open-new-tab-dialog', null);
|
|
26564
|
+
})
|
|
26565
|
+
|
|
26566
|
+
// Initialize the palette explorer with folder only
|
|
26567
|
+
let data = [
|
|
26568
|
+
{
|
|
26569
|
+
id: '__root__',
|
|
26570
|
+
name: 'OPEN PROJECT',
|
|
26571
|
+
children: []
|
|
26572
|
+
}
|
|
26573
|
+
];
|
|
26574
|
+
|
|
26575
|
+
try {
|
|
26555
26576
|
if (!window.jqtree) return; // Hack - otherwise the nodeLibrary modal fail to load due to this library being missed
|
|
26556
26577
|
|
|
26557
|
-
|
|
26558
|
-
|
|
26559
|
-
|
|
26560
|
-
|
|
26561
|
-
|
|
26562
|
-
|
|
26563
|
-
|
|
26564
|
-
|
|
26565
|
-
|
|
26566
|
-
|
|
26567
|
-
|
|
26568
|
-
|
|
26569
|
-
|
|
26570
|
-
|
|
26571
|
-
|
|
26572
|
-
|
|
26573
|
-
|
|
26574
|
-
if (node.id !== '__root__'){
|
|
26578
|
+
$('#exp-open-project').tree({
|
|
26579
|
+
data: data,
|
|
26580
|
+
autoOpen: true,
|
|
26581
|
+
selectable: true,
|
|
26582
|
+
onCanSelectNode: function (node) {
|
|
26583
|
+
if (node.id === '__root__') {
|
|
26584
|
+
$('#exp-open-project').tree('toggle', node);
|
|
26585
|
+
return false;
|
|
26586
|
+
} else {
|
|
26587
|
+
return true;
|
|
26588
|
+
}
|
|
26589
|
+
|
|
26590
|
+
},
|
|
26591
|
+
usecontextmenu: true,
|
|
26592
|
+
closedIcon: $('<i class="icofont-rounded-right"></i>'),
|
|
26593
|
+
openedIcon: $('<i class="icofont-rounded-down"></i>'),
|
|
26594
|
+
onCreateLi: function (node, $li) {
|
|
26595
|
+
if (node.id !== '__root__') {
|
|
26575
26596
|
$li.find('.jqtree-title').before('<span class="icon tab-icon">T</span>');
|
|
26576
26597
|
}
|
|
26577
|
-
|
|
26578
|
-
|
|
26579
|
-
|
|
26580
|
-
|
|
26581
|
-
|
|
26582
|
-
|
|
26583
|
-
|
|
26584
|
-
|
|
26585
|
-
|
|
26586
|
-
|
|
26587
|
-
|
|
26588
|
-
|
|
26589
|
-
|
|
26590
|
-
|
|
26591
|
-
|
|
26592
|
-
|
|
26593
|
-
|
|
26594
|
-
|
|
26595
|
-
|
|
26596
|
-
|
|
26597
|
-
|
|
26598
|
-
|
|
26599
|
-
|
|
26600
|
-
|
|
26601
|
-
|
|
26602
|
-
|
|
26603
|
-
|
|
26604
|
-
|
|
26605
|
-
|
|
26606
|
-
|
|
26607
|
-
|
|
26608
|
-
|
|
26609
|
-
|
|
26610
|
-
|
|
26611
|
-
|
|
26612
|
-
|
|
26613
|
-
|
|
26614
|
-
|
|
26615
|
-
|
|
26616
|
-
|
|
26617
|
-
|
|
26618
|
-
|
|
26619
|
-
|
|
26620
|
-
|
|
26621
|
-
|
|
26622
|
-
|
|
26623
|
-
|
|
26624
|
-
|
|
26625
|
-
|
|
26626
|
-
|
|
26627
|
-
|
|
26628
|
-
|
|
26629
|
-
|
|
26630
|
-
|
|
26631
|
-
|
|
26632
|
-
|
|
26633
|
-
|
|
26634
|
-
|
|
26635
|
-
|
|
26636
|
-
|
|
26598
|
+
}
|
|
26599
|
+
});
|
|
26600
|
+
|
|
26601
|
+
// Add the context menu
|
|
26602
|
+
$('#exp-open-project').jqTreeContextMenu({
|
|
26603
|
+
menu: '#palette-explorer-context-menu',
|
|
26604
|
+
onContextMenuItem: function (e, node, $el) {
|
|
26605
|
+
let operation = $el.data("item");
|
|
26606
|
+
switch (operation) {
|
|
26607
|
+
case "open":
|
|
26608
|
+
RED.workspaces.showSafe(node.id);
|
|
26609
|
+
break;
|
|
26610
|
+
case "renameTab":
|
|
26611
|
+
window.__kumologica.main.dispatch('navigator:open-rename-tab-dialog', {
|
|
26612
|
+
tabId: node.id,
|
|
26613
|
+
oldTabName: node.name
|
|
26614
|
+
});
|
|
26615
|
+
break;
|
|
26616
|
+
case "deleteTab": {
|
|
26617
|
+
// Lets put a confirmation dialog before deleting the tab...
|
|
26618
|
+
|
|
26619
|
+
let currentWindow = window.__kumologica.electron.remote.getCurrentWindow()
|
|
26620
|
+
let dialog = window.__kumologica.electron.remote.dialog;
|
|
26621
|
+
let options = {
|
|
26622
|
+
title: 'Warning',
|
|
26623
|
+
type: 'warning',
|
|
26624
|
+
message: `Are you sure you want to permanently delete the "${node.name}" tab?`,
|
|
26625
|
+
detail: 'This operation is irreversible',
|
|
26626
|
+
checkboxLabel: 'I have read and understand these effects.',
|
|
26627
|
+
buttons: ['Cancel', 'Delete'],
|
|
26628
|
+
};
|
|
26629
|
+
dialog.showMessageBox(currentWindow, options).then((result) => {
|
|
26630
|
+
// result.response 0 = Cancel, 1 = Delete
|
|
26631
|
+
// result.checkboxChecked = true if checkbox is checked
|
|
26632
|
+
if (result.response === 1 && result.checkboxChecked) {
|
|
26633
|
+
RED.actions.invoke('core:deploy');
|
|
26634
|
+
RED.workspaces.remove(node.id);
|
|
26635
|
+
RED.actions.invoke('core:deploy'); // save it so we can persist the tab straight away.
|
|
26636
|
+
refresh();
|
|
26637
|
+
}
|
|
26638
|
+
});
|
|
26639
|
+
|
|
26640
|
+
break;
|
|
26641
|
+
}
|
|
26642
|
+
default: { }
|
|
26643
|
+
}
|
|
26644
|
+
|
|
26645
|
+
}
|
|
26646
|
+
});
|
|
26647
|
+
} catch (err) {
|
|
26648
|
+
// HACK: case where a modal is using this module, which it has no biz on tree
|
|
26649
|
+
}
|
|
26650
|
+
|
|
26651
|
+
// [=== Comms coming from the main thread ===]
|
|
26652
|
+
let ipcRenderer = window.__kumologica.electron.ipcRenderer;
|
|
26653
|
+
// Create tab...
|
|
26654
|
+
ipcRenderer.on('create-new-tab', (event, payload) => {
|
|
26655
|
+
let tabName = payload.tabName;
|
|
26656
|
+
if (tabName) {
|
|
26657
|
+
createTabFn(tabName.toLowerCase());
|
|
26658
|
+
}
|
|
26659
|
+
});
|
|
26660
|
+
// Rename tab...
|
|
26661
|
+
ipcRenderer.on('explorer:rename-tab', (event, payload) => {
|
|
26662
|
+
const {tabId , newTabName} = payload;
|
|
26663
|
+
RED.workspaces.renameTab(tabId, newTabName);
|
|
26664
|
+
RED.nodes.dirty(true); // force dirty to true so the deployment pickup the changes
|
|
26665
|
+
RED.actions.invoke('core:deploy'); // save it so we can persist the tab straight away.
|
|
26666
|
+
refresh();
|
|
26667
|
+
});
|
|
26668
|
+
|
|
26669
|
+
|
|
26670
|
+
// On select tab option
|
|
26671
|
+
$('#exp-open-project').on(
|
|
26672
|
+
'tree.dblclick',
|
|
26673
|
+
function (event) {
|
|
26674
|
+
event.stopImmediatePropagation();
|
|
26675
|
+
if (event.node) {
|
|
26676
|
+
// node was selected
|
|
26677
|
+
var node = event.node;
|
|
26678
|
+
if (node.id) {
|
|
26679
|
+
RED.workspaces.showSafe(node.id);
|
|
26680
|
+
}
|
|
26681
|
+
}
|
|
26682
|
+
else {
|
|
26683
|
+
var prevNode = event.previous_node
|
|
26684
|
+
if (prevNode.id) {
|
|
26685
|
+
RED.workspaces.showSafe(prevNode.id);
|
|
26686
|
+
selectTab(prevNode.id);
|
|
26687
|
+
}
|
|
26688
|
+
}
|
|
26689
|
+
}
|
|
26690
|
+
);
|
|
26691
|
+
|
|
26692
|
+
refresh();
|
|
26637
26693
|
}
|
|
26638
26694
|
|
|
26639
26695
|
const initWorkspaceProjects = () => {
|
|
@@ -26641,7 +26697,7 @@ RED.sidebar.azure = (function () {
|
|
|
26641
26697
|
let addProjectToWorkspaceBtn = `<div id="addProjectToWorkspace" class="header-btn2"><i class="icofont-plus"></i></div>`;
|
|
26642
26698
|
$(addProjectToWorkspaceBtn).appendTo($('#exp-workspace-addFolder'));
|
|
26643
26699
|
RED.popover.tooltip($('#exp-workspace-addFolder'), 'Add Project to Workspace...');
|
|
26644
|
-
|
|
26700
|
+
|
|
26645
26701
|
// Add action to the add button
|
|
26646
26702
|
$('#addProjectToWorkspace').click((event) => {
|
|
26647
26703
|
|
|
@@ -26652,10 +26708,10 @@ RED.sidebar.azure = (function () {
|
|
|
26652
26708
|
properties: ['openDirectory', 'multiSelections'],
|
|
26653
26709
|
};
|
|
26654
26710
|
dialog.showOpenDialog(currentWindow, options).then((result) => {
|
|
26655
|
-
if (!result.canceled){
|
|
26711
|
+
if (!result.canceled) {
|
|
26656
26712
|
let projects = result.filePaths;
|
|
26657
26713
|
projects.forEach(project => {
|
|
26658
|
-
let valid = window.__kumologica.libs.findKumologicaFlowInDir(project);
|
|
26714
|
+
let valid = window.__kumologica.libs.findKumologicaFlowInDir(project);
|
|
26659
26715
|
if (valid) {
|
|
26660
26716
|
workspacePreferences.addProjectToWorkspace(project);
|
|
26661
26717
|
} else {
|
|
@@ -26667,24 +26723,25 @@ RED.sidebar.azure = (function () {
|
|
|
26667
26723
|
});
|
|
26668
26724
|
});
|
|
26669
26725
|
|
|
26670
|
-
|
|
26671
|
-
|
|
26672
|
-
{
|
|
26673
|
-
|
|
26674
|
-
|
|
26726
|
+
// Initialize the projects in workspace
|
|
26727
|
+
let data = [
|
|
26728
|
+
{
|
|
26729
|
+
id: '__root__',
|
|
26730
|
+
name: 'WORKSPACE PROJECTS',
|
|
26731
|
+
children: []
|
|
26675
26732
|
}
|
|
26676
26733
|
];
|
|
26677
26734
|
|
|
26678
|
-
try{
|
|
26735
|
+
try {
|
|
26679
26736
|
$('#exp-workspace').tree({
|
|
26680
|
-
data:data,
|
|
26737
|
+
data: data,
|
|
26681
26738
|
autoOpen: true,
|
|
26682
26739
|
selectable: true,
|
|
26683
|
-
onCanSelectNode: function(node) {
|
|
26684
|
-
if (node.id === '__root__'){
|
|
26740
|
+
onCanSelectNode: function (node) {
|
|
26741
|
+
if (node.id === '__root__') {
|
|
26685
26742
|
$('#exp-workspace').tree('toggle', node);
|
|
26686
26743
|
return false;
|
|
26687
|
-
} else {
|
|
26744
|
+
} else {
|
|
26688
26745
|
const el = $(node.element);
|
|
26689
26746
|
const selectionRequired = !el.hasClass('jqtree-selected');
|
|
26690
26747
|
// Deselect all nodes
|
|
@@ -26693,16 +26750,16 @@ RED.sidebar.azure = (function () {
|
|
|
26693
26750
|
if (selectionRequired) {
|
|
26694
26751
|
el.addClass('jqtree-selected');
|
|
26695
26752
|
}
|
|
26696
|
-
|
|
26753
|
+
|
|
26697
26754
|
return false;
|
|
26698
26755
|
}
|
|
26699
|
-
|
|
26756
|
+
|
|
26700
26757
|
},
|
|
26701
26758
|
usecontextmenu: true,
|
|
26702
26759
|
closedIcon: $('<i class="icofont-rounded-right"></i>'),
|
|
26703
26760
|
openedIcon: $('<i class="icofont-rounded-down"></i>'),
|
|
26704
|
-
onCreateLi: function(node, $li) {
|
|
26705
|
-
if (node.id !== '__root__'){
|
|
26761
|
+
onCreateLi: function (node, $li) {
|
|
26762
|
+
if (node.id !== '__root__') {
|
|
26706
26763
|
RED.popover.tooltip(
|
|
26707
26764
|
$li.find('.jqtree-title'),
|
|
26708
26765
|
node.path
|
|
@@ -26715,13 +26772,13 @@ RED.sidebar.azure = (function () {
|
|
|
26715
26772
|
// Add the context menu
|
|
26716
26773
|
$('#exp-workspace').jqTreeContextMenu({
|
|
26717
26774
|
menu: '#palette-workspace-context-menu',
|
|
26718
|
-
onContextMenuItem: function(e, node, $el){
|
|
26719
|
-
|
|
26775
|
+
onContextMenuItem: function (e, node, $el) {
|
|
26776
|
+
|
|
26720
26777
|
let operation = $el.data("item");
|
|
26721
26778
|
let projectLocation = node.path;
|
|
26722
26779
|
|
|
26723
|
-
switch(operation) {
|
|
26724
|
-
case "open":
|
|
26780
|
+
switch (operation) {
|
|
26781
|
+
case "open":
|
|
26725
26782
|
openProject(projectLocation);
|
|
26726
26783
|
break;
|
|
26727
26784
|
case "openLocation":
|
|
@@ -26732,12 +26789,12 @@ RED.sidebar.azure = (function () {
|
|
|
26732
26789
|
refreshWorkspaceProjects();
|
|
26733
26790
|
break;
|
|
26734
26791
|
}
|
|
26735
|
-
default: {}
|
|
26792
|
+
default: { }
|
|
26736
26793
|
}
|
|
26737
|
-
|
|
26794
|
+
|
|
26738
26795
|
}
|
|
26739
26796
|
});
|
|
26740
|
-
}catch(err) {
|
|
26797
|
+
} catch (err) {
|
|
26741
26798
|
// HACK: case where a modal is using this module, which it has no biz on tree
|
|
26742
26799
|
}
|
|
26743
26800
|
|
|
@@ -26745,11 +26802,11 @@ RED.sidebar.azure = (function () {
|
|
|
26745
26802
|
// On select tab option
|
|
26746
26803
|
$('#exp-workspace').on(
|
|
26747
26804
|
'tree.dblclick',
|
|
26748
|
-
function(event) {
|
|
26749
|
-
|
|
26750
|
-
|
|
26751
|
-
|
|
26752
|
-
|
|
26805
|
+
function (event) {
|
|
26806
|
+
event.stopImmediatePropagation();
|
|
26807
|
+
if (event.node && event.node.path) {
|
|
26808
|
+
openProject(event.node.path)
|
|
26809
|
+
}
|
|
26753
26810
|
}
|
|
26754
26811
|
);
|
|
26755
26812
|
|
|
@@ -26763,15 +26820,15 @@ RED.sidebar.azure = (function () {
|
|
|
26763
26820
|
}
|
|
26764
26821
|
|
|
26765
26822
|
const createTabFn = (newTabName) => {
|
|
26766
|
-
try{
|
|
26823
|
+
try {
|
|
26767
26824
|
// RED.actions.invoke('core:deploy');
|
|
26768
|
-
RED.workspaces.add(undefined,
|
|
26825
|
+
RED.workspaces.add(undefined, undefined, undefined, newTabName);
|
|
26769
26826
|
RED.actions.invoke('core:deploy'); // save it so we can persist the tab straight away.
|
|
26770
26827
|
refresh();
|
|
26771
|
-
} catch(err){
|
|
26828
|
+
} catch (err) {
|
|
26772
26829
|
RED.notify(`<strong>Error</strong>: "${newTabName}" tab already exists.`, 'error');
|
|
26773
26830
|
}
|
|
26774
|
-
|
|
26831
|
+
|
|
26775
26832
|
}
|
|
26776
26833
|
|
|
26777
26834
|
const selectTab = (nodeId) => {
|
|
@@ -26783,14 +26840,14 @@ RED.sidebar.azure = (function () {
|
|
|
26783
26840
|
|
|
26784
26841
|
const refreshTabs = () => {
|
|
26785
26842
|
if (!RED.workspaces.tabs() || RED.workspaces.tabs().length === 0) return;
|
|
26786
|
-
|
|
26843
|
+
|
|
26787
26844
|
const tabs = RED.nodes.listWorkspaces();
|
|
26788
26845
|
const currentProjectName = RED.projectInfo.getWorkspaceInfo()[0].name;
|
|
26789
26846
|
let data = [
|
|
26790
26847
|
{
|
|
26791
|
-
|
|
26792
|
-
|
|
26793
|
-
|
|
26848
|
+
id: '__root__',
|
|
26849
|
+
name: currentProjectName,
|
|
26850
|
+
children: []
|
|
26794
26851
|
}
|
|
26795
26852
|
];
|
|
26796
26853
|
|
|
@@ -26799,39 +26856,52 @@ RED.sidebar.azure = (function () {
|
|
|
26799
26856
|
}
|
|
26800
26857
|
|
|
26801
26858
|
$('#exp-open-project').tree('loadData', data);
|
|
26859
|
+
// Add a tooltip to the current project name with the path that is located.
|
|
26860
|
+
RED.popover.tooltip(
|
|
26861
|
+
$('#exp-open-project').find('div').first(),
|
|
26862
|
+
RED.projectInfo.getWorkspaceInfo()[0].path
|
|
26863
|
+
);
|
|
26864
|
+
|
|
26802
26865
|
}
|
|
26803
26866
|
|
|
26804
|
-
const refreshWorkspaceProjects = () => {
|
|
26867
|
+
const refreshWorkspaceProjects = () => {
|
|
26805
26868
|
let projects = workspacePreferences.getWorkspaceProjects();
|
|
26806
26869
|
|
|
26807
26870
|
// Initialize the tree with empty data
|
|
26808
26871
|
let data = [
|
|
26809
26872
|
{
|
|
26810
|
-
|
|
26811
|
-
|
|
26812
|
-
|
|
26873
|
+
id: '__root__',
|
|
26874
|
+
name: 'WORKSPACE PROJECTS',
|
|
26875
|
+
children: []
|
|
26813
26876
|
}
|
|
26814
26877
|
];
|
|
26815
|
-
|
|
26816
|
-
|
|
26878
|
+
|
|
26879
|
+
|
|
26817
26880
|
// Update the data with info from workspace preferences
|
|
26818
|
-
if (projects){
|
|
26819
|
-
let projectsAZ = projects.sort((a,b)=> path.basename(a).localeCompare(path.basename(b)));
|
|
26881
|
+
if (projects) {
|
|
26882
|
+
let projectsAZ = projects.sort((a, b) => path.basename(a).localeCompare(path.basename(b)));
|
|
26820
26883
|
projectsAZ.forEach((project, index) => {
|
|
26821
26884
|
let projectName = path.basename(project);
|
|
26822
|
-
|
|
26885
|
+
|
|
26886
|
+
// Do not include in the list of workspaces the current project
|
|
26887
|
+
if (project === RED.projectInfo.getWorkspaceInfo()[0].path){
|
|
26888
|
+
data[0].children.push({ id: name, name: `${projectName} (current)`, path: project });
|
|
26889
|
+
} else {
|
|
26890
|
+
data[0].children.push({ id: name, name: projectName, path: project });
|
|
26891
|
+
}
|
|
26892
|
+
|
|
26823
26893
|
})
|
|
26824
26894
|
}
|
|
26825
|
-
|
|
26895
|
+
|
|
26826
26896
|
// Render the tree
|
|
26827
26897
|
$('#exp-workspace').tree('loadData', data);
|
|
26828
26898
|
|
|
26829
26899
|
// Hack to add style to the title if no projects are added. As this element is not considered a folder
|
|
26830
|
-
if (!projects || projects.length === 0){
|
|
26900
|
+
if (!projects || projects.length === 0) {
|
|
26831
26901
|
const elements = $('.jqtree-title-button-left');
|
|
26832
26902
|
const maxElements = elements.length;
|
|
26833
|
-
for(let i = 0; i < maxElements; i++){
|
|
26834
|
-
if ($(elements[i]).text() === 'WORKSPACE PROJECTS'){
|
|
26903
|
+
for (let i = 0; i < maxElements; i++) {
|
|
26904
|
+
if ($(elements[i]).text() === 'WORKSPACE PROJECTS') {
|
|
26835
26905
|
$(elements[i]).addClass('jqtree-title-emptyfolder');
|
|
26836
26906
|
break;
|
|
26837
26907
|
}
|
|
@@ -26840,8 +26910,8 @@ RED.sidebar.azure = (function () {
|
|
|
26840
26910
|
}
|
|
26841
26911
|
|
|
26842
26912
|
const refresh = () => {
|
|
26843
|
-
|
|
26844
|
-
|
|
26913
|
+
refreshTabs();
|
|
26914
|
+
refreshWorkspaceProjects();
|
|
26845
26915
|
}
|
|
26846
26916
|
|
|
26847
26917
|
return {
|
|
@@ -26849,7 +26919,7 @@ RED.sidebar.azure = (function () {
|
|
|
26849
26919
|
refresh,
|
|
26850
26920
|
selectTab
|
|
26851
26921
|
};
|
|
26852
|
-
|
|
26922
|
+
|
|
26853
26923
|
})();
|
|
26854
26924
|
;RED.palette.nodes = (function () {
|
|
26855
26925
|
var exclusion = ['config', 'unknown', 'deprecated'];
|
|
@@ -35428,7 +35498,7 @@ RED.notifications = (function() {
|
|
|
35428
35498
|
hide();
|
|
35429
35499
|
});
|
|
35430
35500
|
|
|
35431
|
-
$('#sidebar-separator').hide();
|
|
35501
|
+
// $('#sidebar-separator').hide();
|
|
35432
35502
|
indexWorkspace();
|
|
35433
35503
|
if (dialog === null) {
|
|
35434
35504
|
createDialog();
|
|
@@ -35690,7 +35760,7 @@ RED.notifications = (function() {
|
|
|
35690
35760
|
hide();
|
|
35691
35761
|
});
|
|
35692
35762
|
|
|
35693
|
-
$('#sidebar-separator').hide();
|
|
35763
|
+
// $('#sidebar-separator').hide();
|
|
35694
35764
|
if (dialog === null) {
|
|
35695
35765
|
createDialog();
|
|
35696
35766
|
}
|
|
@@ -35705,7 +35775,7 @@ RED.notifications = (function() {
|
|
|
35705
35775
|
$('#main-container').off('click');
|
|
35706
35776
|
RED.keyboard.remove('escape');
|
|
35707
35777
|
visible = false;
|
|
35708
|
-
$('#sidebar-separator').hide();
|
|
35778
|
+
// $('#sidebar-separator').hide();
|
|
35709
35779
|
if (dialog !== null) {
|
|
35710
35780
|
dialog.slideUp(200, function () {
|
|
35711
35781
|
// searchInput.searchBox('value', '');
|
|
@@ -44916,6 +44986,80 @@ RED.touch.radialMenu = (function() {
|
|
|
44916
44986
|
init: init,
|
|
44917
44987
|
};
|
|
44918
44988
|
})();
|
|
44989
|
+
;RED.modalRenameTab = (function () {
|
|
44990
|
+
const MAX_LENGTH_TAB_NAME = 22;
|
|
44991
|
+
let tabId;
|
|
44992
|
+
let oldTabName;
|
|
44993
|
+
|
|
44994
|
+
// Listening from the main process the list of the recent projects
|
|
44995
|
+
let ipcRenderer = window.__kumologica.electron.ipcRenderer;
|
|
44996
|
+
|
|
44997
|
+
ipcRenderer.on('receiveProps', (e, msg) => {
|
|
44998
|
+
tabId = msg.payload.tabId;
|
|
44999
|
+
oldTabName = msg.payload.oldTabName;
|
|
45000
|
+
|
|
45001
|
+
$('#newTabName').val(oldTabName);
|
|
45002
|
+
$('#newTabName').select();
|
|
45003
|
+
});
|
|
45004
|
+
|
|
45005
|
+
|
|
45006
|
+
function replaceSpacesWithDash() {
|
|
45007
|
+
let old = $('#newTabName').val();
|
|
45008
|
+
$('#newTabName').val(old.replace(/\s+/g, '-'));
|
|
45009
|
+
}
|
|
45010
|
+
|
|
45011
|
+
function maybeEnableSaveButton() {
|
|
45012
|
+
if ($('#newTabName').val() !== '' && $('#newTabName').val() !== oldTabName) {
|
|
45013
|
+
$('#btn-rename-tab-create').removeClass('disabled');
|
|
45014
|
+
} else {
|
|
45015
|
+
$('#btn-rename-tab-create').addClass('disabled');
|
|
45016
|
+
}
|
|
45017
|
+
}
|
|
45018
|
+
|
|
45019
|
+
function init() {
|
|
45020
|
+
// Put the focus on the new tab name input
|
|
45021
|
+
$('#newTabName').focus();
|
|
45022
|
+
// Attach listener to the new tab name input
|
|
45023
|
+
$('#newTabName').on('input', () => {
|
|
45024
|
+
maybeEnableSaveButton();
|
|
45025
|
+
replaceSpacesWithDash();
|
|
45026
|
+
|
|
45027
|
+
let currentLength = $('#newTabName').val().length;
|
|
45028
|
+
if (currentLength <= MAX_LENGTH_TAB_NAME) {
|
|
45029
|
+
$('#charLeftCounter').text(MAX_LENGTH_TAB_NAME - currentLength);
|
|
45030
|
+
}
|
|
45031
|
+
|
|
45032
|
+
});
|
|
45033
|
+
// Attach listener to cancel button
|
|
45034
|
+
$('#btn-rename-tab-cancel').on('click', () => {
|
|
45035
|
+
window.__kumologica.main.dispatch('open-rename-tab-dialog:close', null);
|
|
45036
|
+
});
|
|
45037
|
+
// Attach listener to create button
|
|
45038
|
+
$('#btn-rename-tab-create').on('click', () => {
|
|
45039
|
+
event.preventDefault();
|
|
45040
|
+
let $this = $(event.currentTarget);
|
|
45041
|
+
if ($this.hasClass('secondary')) {
|
|
45042
|
+
return;
|
|
45043
|
+
} else {
|
|
45044
|
+
window.__kumologica.main.dispatch('open-rename-tab-dialog:rename-tab', {
|
|
45045
|
+
tabId: tabId,
|
|
45046
|
+
newTabName: $('#newTabName').val()
|
|
45047
|
+
});
|
|
45048
|
+
}
|
|
45049
|
+
});
|
|
45050
|
+
$('#newTabName').on('keypress', function (e) {
|
|
45051
|
+
if (e.which == 13) {
|
|
45052
|
+
e.preventDefault();
|
|
45053
|
+
$('#btn-rename-tab-create').click();
|
|
45054
|
+
}
|
|
45055
|
+
});
|
|
45056
|
+
|
|
45057
|
+
}
|
|
45058
|
+
|
|
45059
|
+
return {
|
|
45060
|
+
init: init
|
|
45061
|
+
};
|
|
45062
|
+
})();
|
|
44919
45063
|
;RED.modalHome = (function () {
|
|
44920
45064
|
let recentProjects = [];
|
|
44921
45065
|
|