mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add list-flows action and button
This commit is contained in:
parent
b27da3d1a0
commit
43f21fc7aa
@ -24,6 +24,7 @@
|
||||
"delete": "Are you sure you want to delete '__label__'?",
|
||||
"dropFlowHere": "Drop the flow here",
|
||||
"addFlow": "Add Flow",
|
||||
"listFlows": "List Flows",
|
||||
"status": "Status",
|
||||
"enabled": "Enabled",
|
||||
"disabled":"Disabled",
|
||||
|
@ -2,6 +2,7 @@
|
||||
"*": {
|
||||
"ctrl-shift-p":"core:manage-palette",
|
||||
"ctrl-f": "core:search",
|
||||
"ctrl-shift-f": "core:list-flows",
|
||||
"ctrl-=": "core:zoom-in",
|
||||
"ctrl--": "core:zoom-out",
|
||||
"ctrl-0": "core:zoom-reset",
|
||||
|
@ -36,7 +36,7 @@ RED.tabs = (function() {
|
||||
}
|
||||
if (options.addButton) {
|
||||
wrapper.addClass("red-ui-tabs-add");
|
||||
var addButton = $('<div class="red-ui-tab-button"><a href="#"><i class="fa fa-plus"></i></a></div>').appendTo(wrapper);
|
||||
var addButton = $('<div class="red-ui-tab-button red-ui-tabs-add"><a href="#"><i class="fa fa-plus"></i></a></div>').appendTo(wrapper);
|
||||
addButton.find('a').click(function(evt) {
|
||||
evt.preventDefault();
|
||||
if (typeof options.addButton === 'function') {
|
||||
@ -69,7 +69,25 @@ RED.tabs = (function() {
|
||||
RED.actions.invoke(options.addButton,{index:targetIndex});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
if (options.searchButton) {
|
||||
wrapper.addClass("red-ui-tabs-search");
|
||||
var searchButton = $('<div class="red-ui-tab-button red-ui-tabs-search"><a href="#"><i class="fa fa-list-ul"></i></a></div>').appendTo(wrapper);
|
||||
searchButton.find('a').click(function(evt) {
|
||||
evt.preventDefault();
|
||||
if (typeof options.searchButton === 'function') {
|
||||
options.searchButton()
|
||||
} else if (typeof options.searchButton === 'string') {
|
||||
RED.actions.invoke(options.searchButton);
|
||||
}
|
||||
})
|
||||
if (typeof options.searchButton === 'string') {
|
||||
var l = options.searchButton;
|
||||
if (options.searchButtonCaption) {
|
||||
l = options.searchButtonCaption
|
||||
}
|
||||
RED.popover.tooltip(searchButton,l,options.searchButton);
|
||||
}
|
||||
|
||||
}
|
||||
var scrollLeft;
|
||||
|
@ -82,9 +82,18 @@ RED.search = (function() {
|
||||
|
||||
function search(val) {
|
||||
searchResults.editableList('empty');
|
||||
var typeFilter;
|
||||
var m = /(?:^| )type:([^ ]+)/.exec(val);
|
||||
if (m) {
|
||||
val = val.replace(/(?:^| )type:[^ ]+/,"");
|
||||
typeFilter = m[1];
|
||||
}
|
||||
|
||||
val = val.trim();
|
||||
|
||||
selected = -1;
|
||||
results = [];
|
||||
if (val.length > 0) {
|
||||
if (val.length > 0 || typeFilter) {
|
||||
val = val.toLowerCase();
|
||||
var i;
|
||||
var j;
|
||||
@ -96,8 +105,10 @@ RED.search = (function() {
|
||||
if (kpos > -1) {
|
||||
for (j=0;j<index[key].length;j++) {
|
||||
var node = index[key][j];
|
||||
nodes[node.node.id] = nodes[node.node.id] = node;
|
||||
nodes[node.node.id].index = Math.min(nodes[node.node.id].index||Infinity,kpos);
|
||||
if (!typeFilter || node.node.type === typeFilter) {
|
||||
nodes[node.node.id] = nodes[node.node.id] = node;
|
||||
nodes[node.node.id].index = Math.min(nodes[node.node.id].index||Infinity,kpos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -309,7 +309,9 @@ RED.workspaces = (function() {
|
||||
minimumActiveTabWidth: 150,
|
||||
scrollable: true,
|
||||
addButton: "core:add-flow",
|
||||
addButtonCaption: RED._("workspace.addFlow")
|
||||
addButtonCaption: RED._("workspace.addFlow"),
|
||||
searchButton: "core:list-flows",
|
||||
searchButtonCaption: RED._("workspace.listFlows")
|
||||
});
|
||||
workspaceTabCount = 0;
|
||||
}
|
||||
@ -343,6 +345,10 @@ RED.workspaces = (function() {
|
||||
RED.actions.add("core:edit-flow",editWorkspace);
|
||||
RED.actions.add("core:remove-flow",removeWorkspace);
|
||||
|
||||
RED.actions.add("core:list-flows",function() {
|
||||
RED.actions.invoke("core:search","type:tab ");
|
||||
})
|
||||
|
||||
hideWorkspace();
|
||||
}
|
||||
|
||||
|
@ -133,6 +133,10 @@
|
||||
&.red-ui-tabs-add.red-ui-tabs-scrollable {
|
||||
padding-right: 59px;
|
||||
}
|
||||
&.red-ui-tabs-add.red-ui-tabs-search.red-ui-tabs-scrollable {
|
||||
padding-right: 95px;
|
||||
}
|
||||
|
||||
&.red-ui-tabs-collapsible {
|
||||
li:not(.active) {
|
||||
display: none;
|
||||
@ -285,6 +289,14 @@
|
||||
right: 38px;
|
||||
}
|
||||
|
||||
.red-ui-tabs.red-ui-tabs-add.red-ui-tabs-search .red-ui-tab-scroll-right {
|
||||
right: 76px;
|
||||
}
|
||||
.red-ui-tabs.red-ui-tabs-add.red-ui-tabs-search .red-ui-tabs-add {
|
||||
right: 38px;
|
||||
}
|
||||
|
||||
|
||||
img.red-ui-tab-icon {
|
||||
margin-left: -8px;
|
||||
margin-right: 3px;
|
||||
|
Loading…
Reference in New Issue
Block a user