mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Change tab hide button icon to an eye and add search option
This commit is contained in:
parent
d9f976baea
commit
dcea382b38
@ -59,6 +59,8 @@
|
|||||||
"hideOtherFlows": "Hide other flows",
|
"hideOtherFlows": "Hide other flows",
|
||||||
"showAllFlows": "Show all flows",
|
"showAllFlows": "Show all flows",
|
||||||
"hideAllFlows": "Hide all flows",
|
"hideAllFlows": "Hide all flows",
|
||||||
|
"hiddenFlows": "List __count__ hidden flow",
|
||||||
|
"hiddenFlows_plural": "List __count__ hidden flows",
|
||||||
"showLastHiddenFlow": "Show last hidden flow",
|
"showLastHiddenFlow": "Show last hidden flow",
|
||||||
"listFlows": "List flows",
|
"listFlows": "List flows",
|
||||||
"listSubflows": "List subflows",
|
"listSubflows": "List subflows",
|
||||||
@ -669,7 +671,8 @@
|
|||||||
"unusedConfigNodes": "Unused configuration nodes",
|
"unusedConfigNodes": "Unused configuration nodes",
|
||||||
"invalidNodes": "Invalid nodes",
|
"invalidNodes": "Invalid nodes",
|
||||||
"uknownNodes": "Unknown nodes",
|
"uknownNodes": "Unknown nodes",
|
||||||
"unusedSubflows": "Unused subflows"
|
"unusedSubflows": "Unused subflows",
|
||||||
|
"hiddenFlows": "Hidden flows"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"help": {
|
"help": {
|
||||||
|
@ -117,6 +117,8 @@ RED.tabs = (function() {
|
|||||||
menuOptions = options.menu()
|
menuOptions = options.menu()
|
||||||
} else if (Array.isArray(options.menu)) {
|
} else if (Array.isArray(options.menu)) {
|
||||||
menuOptions = options.menu;
|
menuOptions = options.menu;
|
||||||
|
} else if (typeof options.menu === 'function') {
|
||||||
|
menuOptions = options.menu();
|
||||||
}
|
}
|
||||||
menu = RED.menu.init({options: menuOptions});
|
menu = RED.menu.init({options: menuOptions});
|
||||||
menu.attr("id",options.id+"-menu");
|
menu.attr("id",options.id+"-menu");
|
||||||
@ -812,8 +814,9 @@ RED.tabs = (function() {
|
|||||||
}
|
}
|
||||||
if (tab.hideable) {
|
if (tab.hideable) {
|
||||||
li.addClass("red-ui-tabs-closeable")
|
li.addClass("red-ui-tabs-closeable")
|
||||||
var closeLink = $("<a/>",{href:"#",class:"red-ui-tab-close"}).appendTo(li);
|
var closeLink = $("<a/>",{href:"#",class:"red-ui-tab-close red-ui-tab-hide"}).appendTo(li);
|
||||||
closeLink.append('<i class="fa fa-times" />');
|
closeLink.append('<i class="fa fa-eye" />');
|
||||||
|
closeLink.append('<i class="fa fa-eye-slash" />');
|
||||||
closeLink.on("click",function(event) {
|
closeLink.on("click",function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
hideTab(tab.id);
|
hideTab(tab.id);
|
||||||
|
@ -105,6 +105,7 @@ RED.search = (function() {
|
|||||||
val = extractFlag(val,"unused",flags);
|
val = extractFlag(val,"unused",flags);
|
||||||
val = extractFlag(val,"config",flags);
|
val = extractFlag(val,"config",flags);
|
||||||
val = extractFlag(val,"subflow",flags);
|
val = extractFlag(val,"subflow",flags);
|
||||||
|
val = extractFlag(val,"hidden",flags);
|
||||||
// uses:<node-id>
|
// uses:<node-id>
|
||||||
val = extractValue(val,"uses",flags);
|
val = extractValue(val,"uses",flags);
|
||||||
|
|
||||||
@ -150,7 +151,15 @@ RED.search = (function() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (flags.hasOwnProperty("hidden")) {
|
||||||
|
// Only tabs can be hidden
|
||||||
|
if (node.node.type !== 'tab') {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if (!RED.workspaces.isHidden(node.node.id)) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
if (flags.hasOwnProperty("unused")) {
|
if (flags.hasOwnProperty("unused")) {
|
||||||
var isUnused = (node.node.type === 'subflow' && node.node.instances.length === 0) ||
|
var isUnused = (node.node.type === 'subflow' && node.node.instances.length === 0) ||
|
||||||
(isConfigNode && node.node.users.length === 0)
|
(isConfigNode && node.node.users.length === 0)
|
||||||
|
@ -274,6 +274,7 @@ RED.sidebar.info.outliner = (function() {
|
|||||||
{label:RED._("sidebar.info.search.invalidNodes"), value: "is:invalid"},
|
{label:RED._("sidebar.info.search.invalidNodes"), value: "is:invalid"},
|
||||||
{label:RED._("sidebar.info.search.uknownNodes"), value: "type:unknown"},
|
{label:RED._("sidebar.info.search.uknownNodes"), value: "type:unknown"},
|
||||||
{label:RED._("sidebar.info.search.unusedSubflows"), value:"is:subflow is:unused"},
|
{label:RED._("sidebar.info.search.unusedSubflows"), value:"is:subflow is:unused"},
|
||||||
|
{label:RED._("sidebar.info.search.hiddenFlows"), value:"is:hidden"},
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -218,55 +218,64 @@ RED.workspaces = (function() {
|
|||||||
scrollable: true,
|
scrollable: true,
|
||||||
addButton: "core:add-flow",
|
addButton: "core:add-flow",
|
||||||
addButtonCaption: RED._("workspace.addFlow"),
|
addButtonCaption: RED._("workspace.addFlow"),
|
||||||
menu: [
|
menu: function() {
|
||||||
{
|
var menuItems = [
|
||||||
id:"red-ui-tabs-menu-option-search-flows",
|
{
|
||||||
label: RED._("workspace.listFlows"),
|
id:"red-ui-tabs-menu-option-search-flows",
|
||||||
onselect: "core:list-flows"
|
label: RED._("workspace.listFlows"),
|
||||||
},
|
onselect: "core:list-flows"
|
||||||
{
|
},
|
||||||
id:"red-ui-tabs-menu-option-search-subflows",
|
{
|
||||||
label: RED._("workspace.listSubflows"),
|
id:"red-ui-tabs-menu-option-search-subflows",
|
||||||
onselect: "core:list-subflows"
|
label: RED._("workspace.listSubflows"),
|
||||||
},
|
onselect: "core:list-subflows"
|
||||||
null,
|
},
|
||||||
{
|
null,
|
||||||
id:"red-ui-tabs-menu-option-add-flow",
|
{
|
||||||
label: RED._("workspace.addFlow"),
|
id:"red-ui-tabs-menu-option-add-flow",
|
||||||
onselect: "core:add-flow"
|
label: RED._("workspace.addFlow"),
|
||||||
},
|
onselect: "core:add-flow"
|
||||||
{
|
},
|
||||||
id:"red-ui-tabs-menu-option-add-flow-right",
|
{
|
||||||
label: RED._("workspace.addFlowToRight"),
|
id:"red-ui-tabs-menu-option-add-flow-right",
|
||||||
onselect: "core:add-flow-to-right"
|
label: RED._("workspace.addFlowToRight"),
|
||||||
},
|
onselect: "core:add-flow-to-right"
|
||||||
null,
|
},
|
||||||
{
|
null,
|
||||||
id:"red-ui-tabs-menu-option-add-hide-flows",
|
{
|
||||||
label: RED._("workspace.hideFlow"),
|
id:"red-ui-tabs-menu-option-add-hide-flows",
|
||||||
onselect: "core:hide-flow"
|
label: RED._("workspace.hideFlow"),
|
||||||
},
|
onselect: "core:hide-flow"
|
||||||
{
|
},
|
||||||
id:"red-ui-tabs-menu-option-add-hide-other-flows",
|
{
|
||||||
label: RED._("workspace.hideOtherFlows"),
|
id:"red-ui-tabs-menu-option-add-hide-other-flows",
|
||||||
onselect: "core:hide-other-flows"
|
label: RED._("workspace.hideOtherFlows"),
|
||||||
},
|
onselect: "core:hide-other-flows"
|
||||||
{
|
},
|
||||||
id:"red-ui-tabs-menu-option-add-show-all-flows",
|
{
|
||||||
label: RED._("workspace.showAllFlows"),
|
id:"red-ui-tabs-menu-option-add-show-all-flows",
|
||||||
onselect: "core:show-all-flows"
|
label: RED._("workspace.showAllFlows"),
|
||||||
},
|
onselect: "core:show-all-flows"
|
||||||
{
|
},
|
||||||
id:"red-ui-tabs-menu-option-add-hide-all-flows",
|
{
|
||||||
label: RED._("workspace.hideAllFlows"),
|
id:"red-ui-tabs-menu-option-add-hide-all-flows",
|
||||||
onselect: "core:hide-all-flows"
|
label: RED._("workspace.hideAllFlows"),
|
||||||
},
|
onselect: "core:hide-all-flows"
|
||||||
{
|
},
|
||||||
id:"red-ui-tabs-menu-option-add-show-last-flow",
|
{
|
||||||
label: RED._("workspace.showLastHiddenFlow"),
|
id:"red-ui-tabs-menu-option-add-show-last-flow",
|
||||||
onselect: "core:show-last-hidden-flow"
|
label: RED._("workspace.showLastHiddenFlow"),
|
||||||
|
onselect: "core:show-last-hidden-flow"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
if (hideStack.length > 0) {
|
||||||
|
menuItems.unshift({
|
||||||
|
label: RED._("workspace.hiddenFlows",{count: hideStack.length}),
|
||||||
|
onselect: "core:list-hidden-flows"
|
||||||
|
})
|
||||||
}
|
}
|
||||||
]
|
return menuItems;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
workspaceTabCount = 0;
|
workspaceTabCount = 0;
|
||||||
}
|
}
|
||||||
@ -406,7 +415,9 @@ RED.workspaces = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
RED.actions.add("core:list-hidden-flows",function() {
|
||||||
|
RED.actions.invoke("core:search","is:hidden ");
|
||||||
|
})
|
||||||
RED.actions.add("core:list-flows",function() {
|
RED.actions.add("core:list-flows",function() {
|
||||||
RED.actions.invoke("core:search","type:tab ");
|
RED.actions.invoke("core:search","type:tab ");
|
||||||
})
|
})
|
||||||
@ -536,6 +547,9 @@ RED.workspaces = (function() {
|
|||||||
RED.settings.setLocal("hiddenTabs",JSON.stringify(hiddenTabs));
|
RED.settings.setLocal("hiddenTabs",JSON.stringify(hiddenTabs));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
isHidden: function(id) {
|
||||||
|
return hideStack.includes(id)
|
||||||
|
},
|
||||||
show: function(id,skipStack,unhideOnly) {
|
show: function(id,skipStack,unhideOnly) {
|
||||||
if (!workspace_tabs.contains(id)) {
|
if (!workspace_tabs.contains(id)) {
|
||||||
var sf = RED.nodes.subflow(id);
|
var sf = RED.nodes.subflow(id);
|
||||||
|
@ -389,7 +389,19 @@ i.red-ui-tab-icon {
|
|||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
.red-ui-tab-hide {
|
||||||
|
.fa-eye-slash {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
&:hover {
|
||||||
|
.fa-eye-slash {
|
||||||
|
display: inline
|
||||||
|
}
|
||||||
|
.fa-eye {
|
||||||
|
display: none
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
.red-ui-tab-close {
|
.red-ui-tab-close {
|
||||||
display: none;
|
display: none;
|
||||||
background: $tab-background-inactive;
|
background: $tab-background-inactive;
|
||||||
|
Loading…
Reference in New Issue
Block a user