apiviewer: add api endpoint deeplink ability

use #/<endpoint> to deeplink to a specific endpoint

Signed-off-by: Tim Marx <t.marx@proxmox.com>
This commit is contained in:
Tim Marx 2019-12-11 12:58:22 +01:00 committed by Thomas Lamprecht
parent 88a31964c3
commit 16e6779d4c

View File

@ -368,6 +368,7 @@ Ext.onReady(function() {
return;
var rec = selections[0];
render_docu(rec.data);
location.hash = '#' + rec.data.path;
}
}
});
@ -389,4 +390,18 @@ Ext.onReady(function() {
]
});
var deepLink = function() {
var path = window.location.hash.substring(1);
var endpoint = store.findNode('path', path);
if (endpoint) {
tree.getSelectionModel().select(endpoint);
tree.expandPath(endpoint.getPath());
render_docu(endpoint.data);
}
}
window.onhashchange = deepLink;
deepLink();
});