1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Allow linking to individual flow via url hash

This commit is contained in:
Nick O'Leary 2016-09-24 22:57:41 +01:00
parent a0f91aa814
commit 1866c9c7ef
2 changed files with 7 additions and 0 deletions

View File

@ -72,9 +72,13 @@ var RED = (function() {
cache: false,
url: 'flows',
success: function(nodes) {
var currentHash = window.location.hash;
RED.nodes.import(nodes);
RED.nodes.dirty(false);
RED.view.redraw(true);
if (/^#flow\/.+$/.test(currentHash)) {
RED.workspaces.show(currentHash.substring(6));
}
RED.comms.subscribe("status/#",function(topic,msg) {
var parts = topic.split("/");
var node = RED.nodes.node(parts[1]);

View File

@ -137,6 +137,7 @@ RED.workspaces = (function() {
activeWorkspace = tab.id;
event.workspace = activeWorkspace;
RED.events.emit("workspace:change",event);
window.location.hash = 'flow/'+tab.id;
RED.sidebar.config.refresh();
},
ondblclick: function(tab) {
@ -222,6 +223,8 @@ RED.workspaces = (function() {
var sf = RED.nodes.subflow(id);
if (sf) {
addWorkspace({type:"subflow",id:id,icon:"red/images/subflow_tab.png",label:sf.name, closeable: true});
} else {
return;
}
}
workspace_tabs.activateTab(id);