]> git.proxmox.com Git - pve-docs.git/commitdiff
apiviewer: add api endpoint deeplink ability
authorTim Marx <t.marx@proxmox.com>
Wed, 11 Dec 2019 11:58:22 +0000 (12:58 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 11 Dec 2019 13:14:11 +0000 (14:14 +0100)
use #/<endpoint> to deeplink to a specific endpoint

Signed-off-by: Tim Marx <t.marx@proxmox.com>
api-viewer/PVEAPI.js

index d0da407d324238d9c748abca97175c9896642ac8..dd36fff5792a1f44bb9cbda663c8b9b6e5d14037 100644 (file)
@@ -368,6 +368,7 @@ Ext.onReady(function() {
                    return;
                var rec = selections[0];
                render_docu(rec.data);
                    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();
+
 });
 });