api-viewer: fix path for upgraded HTTP/2 proptocls

This commit is contained in:
Dietmar Maurer 2021-02-22 08:38:27 +01:00
parent aa30663ca5
commit 451856d21d
2 changed files with 11 additions and 8 deletions

View File

@ -106,6 +106,10 @@ Ext.onReady(function() {
return '';
};
var real_path = function(path) {
return path.replace(/^.*\/_upgrade_(\/)?/, "/");
};
var render_docu = function(data) {
var md = data.info;
@ -126,9 +130,8 @@ Ext.onReady(function() {
var usage = "";
usage += "<table><tr><td>HTTP:&nbsp;&nbsp;&nbsp;</td><td>" + method + " /api2/json" + data.path + "</td></tr><tr><td>&nbsp</td></tr>";
//usage += "<tr><td>CLI:</td><td>pvesh " + clicmdhash[method] + " " + data.path + "</td></tr></table>";
usage += "<table><tr><td>HTTP:&nbsp;&nbsp;&nbsp;</td><td>"
+ method + " " + real_path("/api2/json" + data.path) + "</td></tr>";
var sections = [
{
@ -378,7 +381,7 @@ Ext.onReady(function() {
});
var ct = Ext.getCmp('docview');
ct.setTitle("Path: " + data.path);
ct.setTitle("Path: " + real_path(data.path));
ct.removeAll(true);
ct.add(items);
ct.setActiveTab(0);

View File

@ -76,13 +76,13 @@ fn generate_api_tree() -> String {
tree.push(data);
let mut data = dump_api_schema(&api2::backup::BACKUP_API_ROUTER, ".");
data["path"] = "/".into();
let mut data = dump_api_schema(&api2::backup::BACKUP_API_ROUTER, "/backup/_upgrade_");
data["path"] = "/backup/_upgrade_".into();
data["text"] = "Backup API (HTTP/2)".into();
tree.push(data);
let mut data = dump_api_schema(&api2::reader::READER_API_ROUTER, ".");
data["path"] = "/".into();
let mut data = dump_api_schema(&api2::reader::READER_API_ROUTER, "/reader/_upgrade_");
data["path"] = "/reader/_upgrade_".into();
data["text"] = "Restore API (HTTP/2)".into();
tree.push(data);