public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup v2 0/4] use proxmox-widget-toolkit-dev for -docs
@ 2021-06-04 12:35 Dominik Csapak
  2021-06-04 12:35 ` [pbs-devel] [PATCH proxmox-backup v2 1/4] docs/prune-simulator: remove displayField for Calendar Field Dominik Csapak
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Dominik Csapak @ 2021-06-04 12:35 UTC (permalink / raw)
  To: pbs-devel

to be able to better reuse code across repositories
includes Toolkit fixes/overrides for extjs in lto-barcode and prune-simulator
also a single fix for ext7.0 is also included

changes from v1:
* inserted the dev-dependency into the list sorted
* rebased on master
* use new path to APIViewer.js (previously APIVIEWER.js)

Dominik Csapak (4):
  docs/prune-simulator: remove displayField for Calendar Field
  docs: add Toolkit.js to prune simulator
  docs: add Toolkit.js to lto-barcode
  docs: build api-viewer from widget-toolkit-dev

 debian/control                                |   1 +
 debian/debcargo.toml                          |   1 +
 docs/Makefile                                 |  45 +-
 docs/api-viewer/PBSAPI.js                     | 526 ------------------
 docs/lto-barcode/index.html                   |  12 +-
 docs/lto-barcode/lto-barcode.js               |   6 +-
 ...simulator.js => prune-simulator_source.js} |   7 +-
 src/bin/docgen.rs                             |   2 +-
 8 files changed, 41 insertions(+), 559 deletions(-)
 delete mode 100644 docs/api-viewer/PBSAPI.js
 rename docs/prune-simulator/{prune-simulator.js => prune-simulator_source.js} (98%)

-- 
2.20.1





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pbs-devel] [PATCH proxmox-backup v2 1/4] docs/prune-simulator: remove displayField for Calendar Field
  2021-06-04 12:35 [pbs-devel] [PATCH proxmox-backup v2 0/4] use proxmox-widget-toolkit-dev for -docs Dominik Csapak
@ 2021-06-04 12:35 ` Dominik Csapak
  2021-06-04 12:35 ` [pbs-devel] [PATCH proxmox-backup v2 2/4] docs: add Toolkit.js to prune simulator Dominik Csapak
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Dominik Csapak @ 2021-06-04 12:35 UTC (permalink / raw)
  To: pbs-devel

in extjs 7.0, specifying displayField overwrites the displayTpl,
which we want to use here, so remove it

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 docs/prune-simulator/prune-simulator.js | 1 -
 1 file changed, 1 deletion(-)

diff --git a/docs/prune-simulator/prune-simulator.js b/docs/prune-simulator/prune-simulator.js
index 6dcd65df..f1119f89 100644
--- a/docs/prune-simulator/prune-simulator.js
+++ b/docs/prune-simulator/prune-simulator.js
@@ -37,7 +37,6 @@ Ext.onReady(function() {
 
 	editable: true,
 
-	displayField: 'text',
 	valueField: 'value',
 	queryMode: 'local',
 
-- 
2.20.1





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pbs-devel] [PATCH proxmox-backup v2 2/4] docs: add Toolkit.js to prune simulator
  2021-06-04 12:35 [pbs-devel] [PATCH proxmox-backup v2 0/4] use proxmox-widget-toolkit-dev for -docs Dominik Csapak
  2021-06-04 12:35 ` [pbs-devel] [PATCH proxmox-backup v2 1/4] docs/prune-simulator: remove displayField for Calendar Field Dominik Csapak
@ 2021-06-04 12:35 ` Dominik Csapak
  2021-06-04 12:35 ` [pbs-devel] [PATCH proxmox-backup v2 3/4] docs: add Toolkit.js to lto-barcode Dominik Csapak
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Dominik Csapak @ 2021-06-04 12:35 UTC (permalink / raw)
  To: pbs-devel

from proxmox-widget-toolkit-dev and not as normal dependency,
else we would have to ship widget-toolkit on the wiki

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 debian/control                                            | 1 +
 debian/debcargo.toml                                      | 1 +
 docs/Makefile                                             | 8 ++++++++
 .../{prune-simulator.js => prune-simulator_source.js}     | 6 ++----
 4 files changed, 12 insertions(+), 4 deletions(-)
 rename docs/prune-simulator/{prune-simulator.js => prune-simulator_source.js} (99%)

diff --git a/debian/control b/debian/control
index 5bf595b4..f0eaea95 100644
--- a/debian/control
+++ b/debian/control
@@ -96,6 +96,7 @@ Build-Depends: debhelper (>= 11),
  graphviz <!nodoc>,
  latexmk <!nodoc>,
  patchelf,
+ proxmox-widget-toolkit-dev <!nodoc>,
  pve-eslint (>= 7.18.0-1),
  python3-docutils,
  python3-pygments,
diff --git a/debian/debcargo.toml b/debian/debcargo.toml
index da1a90a4..2b8ec883 100644
--- a/debian/debcargo.toml
+++ b/debian/debcargo.toml
@@ -17,6 +17,7 @@ build_depends = [
   "graphviz <!nodoc>",
   "latexmk <!nodoc>",
   "patchelf",
+  "proxmox-widget-toolkit-dev <!nodoc>",
   "pve-eslint (>= 7.18.0-1)",
   "python3-docutils",
   "python3-pygments",
diff --git a/docs/Makefile b/docs/Makefile
index 722c0c3e..a416ce1f 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -46,6 +46,10 @@ PRUNE_SIMULATOR_FILES := 					\
 	prune-simulator/clear-trigger.png			\
 	prune-simulator/prune-simulator.js
 
+PRUNE_SIMULATOR_JS_SOURCE :=						\
+	/usr/share/javascript/proxmox-widget-toolkit-dev/Toolkit.js	\
+	prune-simulator/prune-simulator_source.js
+
 LTO_BARCODE_FILES :=						\
 	lto-barcode/index.html					\
 	lto-barcode/code39.js					\
@@ -199,6 +203,10 @@ api-viewer/apidata.js: ${COMPILEDIR}/docgen
 api-viewer/apidoc.js: api-viewer/apidata.js api-viewer/PBSAPI.js
 	cat api-viewer/apidata.js api-viewer/PBSAPI.js >$@
 
+prune-simulator/prune-simulator.js: ${PRUNE_SIMULATOR_JS_SOURCE}
+	cat ${PRUNE_SIMULATOR_JS_SOURCE} >$@.tmp
+	mv $@.tmp $@
+
 .PHONY: html
 html: ${GENERATED_SYNOPSIS} images/proxmox-logo.svg custom.css conf.py ${PRUNE_SIMULATOR_FILES} ${LTO_BARCODE_FILES} ${API_VIEWER_SOURCES}
 	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
diff --git a/docs/prune-simulator/prune-simulator.js b/docs/prune-simulator/prune-simulator_source.js
similarity index 99%
rename from docs/prune-simulator/prune-simulator.js
rename to docs/prune-simulator/prune-simulator_source.js
index f1119f89..0964178c 100644
--- a/docs/prune-simulator/prune-simulator.js
+++ b/docs/prune-simulator/prune-simulator_source.js
@@ -1,7 +1,5 @@
-// FIXME: HACK! Makes scrolling in number spinner work again. fixed in ExtJS >= 6.1
-if (Ext.isFirefox) {
-    Ext.$eventNameMap.DOMMouseScroll = 'DOMMouseScroll';
-}
+// for Toolkit.js
+function gettxt(val) { return val; };
 
 Ext.onReady(function() {
     const NOW = new Date();
-- 
2.20.1





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pbs-devel] [PATCH proxmox-backup v2 3/4] docs: add Toolkit.js to lto-barcode
  2021-06-04 12:35 [pbs-devel] [PATCH proxmox-backup v2 0/4] use proxmox-widget-toolkit-dev for -docs Dominik Csapak
  2021-06-04 12:35 ` [pbs-devel] [PATCH proxmox-backup v2 1/4] docs/prune-simulator: remove displayField for Calendar Field Dominik Csapak
  2021-06-04 12:35 ` [pbs-devel] [PATCH proxmox-backup v2 2/4] docs: add Toolkit.js to prune simulator Dominik Csapak
@ 2021-06-04 12:35 ` Dominik Csapak
  2021-06-04 12:35 ` [pbs-devel] [PATCH proxmox-backup v2 4/4] docs: build api-viewer from widget-toolkit-dev Dominik Csapak
  2021-06-28 12:30 ` [pbs-devel] applied-series: [PATCH proxmox-backup v2 0/4] use proxmox-widget-toolkit-dev for -docs Thomas Lamprecht
  4 siblings, 0 replies; 6+ messages in thread
From: Dominik Csapak @ 2021-06-04 12:35 UTC (permalink / raw)
  To: pbs-devel

and generate a single js file for it

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 docs/Makefile                                 | 28 ++++++++++++-------
 docs/lto-barcode/index.html                   | 12 +-------
 docs/lto-barcode/lto-barcode.js               |  6 ++--
 .../prune-simulator/prune-simulator_source.js |  2 +-
 4 files changed, 22 insertions(+), 26 deletions(-)

diff --git a/docs/Makefile b/docs/Makefile
index a416ce1f..231400ac 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -50,18 +50,22 @@ PRUNE_SIMULATOR_JS_SOURCE :=						\
 	/usr/share/javascript/proxmox-widget-toolkit-dev/Toolkit.js	\
 	prune-simulator/prune-simulator_source.js
 
+LTO_BARCODE_JS_SOURCE :=						\
+	/usr/share/javascript/proxmox-widget-toolkit-dev/Toolkit.js	\
+	lto-barcode/code39.js						\
+	lto-barcode/prefix-field.js					\
+	lto-barcode/label-style.js					\
+	lto-barcode/tape-type.js					\
+	lto-barcode/paper-size.js					\
+	lto-barcode/page-layout.js					\
+	lto-barcode/page-calibration.js					\
+	lto-barcode/label-list.js					\
+	lto-barcode/label-setup.js					\
+	lto-barcode/lto-barcode.js
+
 LTO_BARCODE_FILES :=						\
 	lto-barcode/index.html					\
-	lto-barcode/code39.js					\
-	lto-barcode/prefix-field.js				\
-	lto-barcode/label-style.js				\
-	lto-barcode/tape-type.js				\
-	lto-barcode/paper-size.js				\
-	lto-barcode/page-layout.js				\
-	lto-barcode/page-calibration.js				\
-	lto-barcode/label-list.js				\
-	lto-barcode/label-setup.js				\
-	lto-barcode/lto-barcode.js
+	lto-barcode/lto-barcode-generator.js
 
 API_VIEWER_SOURCES=				\
 	api-viewer/index.html			\
@@ -207,6 +211,10 @@ prune-simulator/prune-simulator.js: ${PRUNE_SIMULATOR_JS_SOURCE}
 	cat ${PRUNE_SIMULATOR_JS_SOURCE} >$@.tmp
 	mv $@.tmp $@
 
+lto-barcode/lto-barcode-generator.js: ${LTO_BARCODE_JS_SOURCE}
+	cat ${LTO_BARCODE_JS_SOURCE} >$@.tmp
+	mv $@.tmp $@
+
 .PHONY: html
 html: ${GENERATED_SYNOPSIS} images/proxmox-logo.svg custom.css conf.py ${PRUNE_SIMULATOR_FILES} ${LTO_BARCODE_FILES} ${API_VIEWER_SOURCES}
 	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
diff --git a/docs/lto-barcode/index.html b/docs/lto-barcode/index.html
index c47798c9..4afbf213 100644
--- a/docs/lto-barcode/index.html
+++ b/docs/lto-barcode/index.html
@@ -34,17 +34,7 @@
   </style>
   <link rel="stylesheet" type="text/css" href="font-awesome/css/font-awesome.css"/>
   <script type="text/javascript" src="extjs/ext-all.js"></script>
-  
-  <script type="text/javascript" src="code39.js"></script>
-  <script type="text/javascript" src="prefix-field.js"></script>
-  <script type="text/javascript" src="label-style.js"></script>
-  <script type="text/javascript" src="tape-type.js"></script>
-  <script type="text/javascript" src="paper-size.js"></script>
-  <script type="text/javascript" src="page-layout.js"></script>
-  <script type="text/javascript" src="page-calibration.js"></script>
-  <script type="text/javascript" src="label-list.js"></script>
-  <script type="text/javascript" src="label-setup.js"></script>
-  <script type="text/javascript" src="lto-barcode.js"></script>
+  <script type="text/javascript" src="lto-barcode-generator.js"></script>
 </head>
 <body>
 </body>
diff --git a/docs/lto-barcode/lto-barcode.js b/docs/lto-barcode/lto-barcode.js
index d6cb8506..2aeaba1b 100644
--- a/docs/lto-barcode/lto-barcode.js
+++ b/docs/lto-barcode/lto-barcode.js
@@ -1,7 +1,5 @@
-// FIXME: HACK! Makes scrolling in number spinner work again. fixed in ExtJS >= 6.1
-if (Ext.isFirefox) {
-    Ext.$eventNameMap.DOMMouseScroll = 'DOMMouseScroll';
-}
+// for toolkit.js
+function gettext(val) { return val; };
 
 function draw_labels(target_id, label_list, page_layout, calibration) {
     let max_labels = compute_max_labels(page_layout);
diff --git a/docs/prune-simulator/prune-simulator_source.js b/docs/prune-simulator/prune-simulator_source.js
index 0964178c..84d3461c 100644
--- a/docs/prune-simulator/prune-simulator_source.js
+++ b/docs/prune-simulator/prune-simulator_source.js
@@ -1,5 +1,5 @@
 // for Toolkit.js
-function gettxt(val) { return val; };
+function gettext(val) { return val; };
 
 Ext.onReady(function() {
     const NOW = new Date();
-- 
2.20.1





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pbs-devel] [PATCH proxmox-backup v2 4/4] docs: build api-viewer from widget-toolkit-dev
  2021-06-04 12:35 [pbs-devel] [PATCH proxmox-backup v2 0/4] use proxmox-widget-toolkit-dev for -docs Dominik Csapak
                   ` (2 preceding siblings ...)
  2021-06-04 12:35 ` [pbs-devel] [PATCH proxmox-backup v2 3/4] docs: add Toolkit.js to lto-barcode Dominik Csapak
@ 2021-06-04 12:35 ` Dominik Csapak
  2021-06-28 12:30 ` [pbs-devel] applied-series: [PATCH proxmox-backup v2 0/4] use proxmox-widget-toolkit-dev for -docs Thomas Lamprecht
  4 siblings, 0 replies; 6+ messages in thread
From: Dominik Csapak @ 2021-06-04 12:35 UTC (permalink / raw)
  To: pbs-devel

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 docs/Makefile             |   9 +-
 docs/api-viewer/PBSAPI.js | 526 --------------------------------------
 src/bin/docgen.rs         |   2 +-
 3 files changed, 8 insertions(+), 529 deletions(-)
 delete mode 100644 docs/api-viewer/PBSAPI.js

diff --git a/docs/Makefile b/docs/Makefile
index 231400ac..21d1eb4a 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -71,6 +71,10 @@ API_VIEWER_SOURCES=				\
 	api-viewer/index.html			\
 	api-viewer/apidoc.js
 
+API_VIEWER_FILES :=							\
+	api-viewer/apidata.js						\
+	/usr/share/javascript/proxmox-widget-toolkit-dev/APIViewer.js	\
+
 # Sphinx documentation setup
 SPHINXOPTS    =
 SPHINXBUILD   = sphinx-build
@@ -204,8 +208,9 @@ onlinehelpinfo:
 api-viewer/apidata.js: ${COMPILEDIR}/docgen
 	${COMPILEDIR}/docgen apidata.js >$@
 
-api-viewer/apidoc.js: api-viewer/apidata.js api-viewer/PBSAPI.js
-	cat api-viewer/apidata.js api-viewer/PBSAPI.js >$@
+api-viewer/apidoc.js: ${API_VIEWER_FILES}
+	cat ${API_VIEWER_FILES} >$@.tmp
+	mv $@.tmp $@
 
 prune-simulator/prune-simulator.js: ${PRUNE_SIMULATOR_JS_SOURCE}
 	cat ${PRUNE_SIMULATOR_JS_SOURCE} >$@.tmp
diff --git a/docs/api-viewer/PBSAPI.js b/docs/api-viewer/PBSAPI.js
deleted file mode 100644
index d56f5e55..00000000
--- a/docs/api-viewer/PBSAPI.js
+++ /dev/null
@@ -1,526 +0,0 @@
-// avoid errors when running without development tools
-if (!Ext.isDefined(Ext.global.console)) {
-    var console = {
-        dir: function() {},
-        log: function() {}
-    };
-}
-
-Ext.onReady(function() {
-
-    Ext.define('pve-param-schema', {
-        extend: 'Ext.data.Model',
-        fields:  [
-	    'name', 'type', 'typetext', 'description', 'verbose_description',
-	    'enum', 'minimum', 'maximum', 'minLength', 'maxLength',
-	    'pattern', 'title', 'requires', 'format', 'default',
-	    'disallow', 'extends', 'links',
-	    {
-		name: 'optional',
-		type: 'boolean'
-	    }
-	]
-    });
-
-    var store = Ext.define('pve-updated-treestore', {
-	extend: 'Ext.data.TreeStore',
-	model: Ext.define('pve-api-doc', {
-            extend: 'Ext.data.Model',
-            fields:  [
-		'path', 'info', 'text',
-	    ]
-	}),
-        proxy: {
-            type: 'memory',
-            data: pbsapi
-        },
-        sorters: [{
-            property: 'leaf',
-            direction: 'ASC'
-        }, {
-            property: 'text',
-            direction: 'ASC'
-	}],
-	filterer: 'bottomup',
-	doFilter: function(node) {
-	    this.filterNodes(node, this.getFilters().getFilterFn(), true);
-	},
-
-	filterNodes: function(node, filterFn, parentVisible) {
-	    var me = this,
-		bottomUpFiltering = me.filterer === 'bottomup',
-		match = filterFn(node) && parentVisible || (node.isRoot() && !me.getRootVisible()),
-		childNodes = node.childNodes,
-		len = childNodes && childNodes.length, i, matchingChildren;
-
-	    if (len) {
-		for (i = 0; i < len; ++i) {
-		    matchingChildren = me.filterNodes(childNodes[i], filterFn, match || bottomUpFiltering) || matchingChildren;
-		}
-		if (bottomUpFiltering) {
-		    match = matchingChildren || match;
-		}
-	    }
-
-	    node.set("visible", match, me._silentOptions);
-	    return match;
-	},
-
-    }).create();
-
-    var render_description = function(value, metaData, record) {
-	var pdef = record.data;
-
-	value = pdef.verbose_description || value;
-
-	// TODO: try to render asciidoc correctly
-
-	metaData.style = 'white-space:pre-wrap;'
-
-	return Ext.htmlEncode(value);
-    };
-
-    var render_type = function(value, metaData, record) {
-	var pdef = record.data;
-
-	return pdef['enum'] ? 'enum' : (pdef.type || 'string');
-    };
-
-    let render_simple_format = function(pdef, type_fallback) {
-	if (pdef.typetext)
-	    return pdef.typetext;
-
-	if (pdef['enum'])
-	    return pdef['enum'].join(' | ');
-
-	if (pdef.format)
-	    return pdef.format;
-
-	if (pdef.pattern)
-	    return pdef.pattern;
-
-	if (pdef.type === 'boolean')
-	    return `<true|false>`;
-
-	if (type_fallback && pdef.type)
-	    return `<${pdef.type}>`;
-
-	return;
-    };
-
-    let render_format = function(value, metaData, record) {
-	let pdef = record.data;
-
-	metaData.style = 'white-space:normal;'
-
-	if (pdef.type === 'array' && pdef.items) {
-	    let format = render_simple_format(pdef.items, true);
-	    return `[${Ext.htmlEncode(format)}, ...]`;
-	}
-
-	return Ext.htmlEncode(render_simple_format(pdef) || '');
-    };
-
-    var real_path = function(path) {
-	return path.replace(/^.*\/_upgrade_(\/)?/, "/");
-    };
-
-    var permission_text = function(permission) {
-	let permhtml = "";
-
-	if (permission.user) {
-	    if (!permission.description) {
-		if (permission.user === 'world') {
-		    permhtml += "Accessible without any authentication.";
-		} else if (permission.user === 'all') {
-		    permhtml += "Accessible by all authenticated users.";
-		} else {
-		    permhtml += 'Onyl accessible by user "' +
-			permission.user + '"';
-		}
-	    }
-	} else if (permission.check) {
-	    permhtml += "<pre>Check: " +
-		Ext.htmlEncode(Ext.JSON.encode(permission.check))  + "</pre>";
-	} else if (permission.userParam) {
-	    permhtml += `<div>Check if user matches parameter '${permission.userParam}'`;
-	} else if (permission.or) {
-	    permhtml += "<div>Or<div style='padding-left: 10px;'>";
-	    Ext.Array.each(permission.or, function(sub_permission) {
-		permhtml += permission_text(sub_permission);
-	    })
-	    permhtml += "</div></div>";
-	} else if (permission.and) {
-	    permhtml += "<div>And<div style='padding-left: 10px;'>";
-	    Ext.Array.each(permission.and, function(sub_permission) {
-		permhtml += permission_text(sub_permission);
-	    })
-	    permhtml += "</div></div>";
-	} else {
-	    //console.log(permission);
-	    permhtml += "Unknown syntax!";
-	}
-
-	return permhtml;
-    };
-
-    var render_docu = function(data) {
-	var md = data.info;
-
-	// console.dir(data);
-
-	var items = [];
-
-	var clicmdhash = {
-	    GET: 'get',
-	    POST: 'create',
-	    PUT: 'set',
-	    DELETE: 'delete'
-	};
-
-	Ext.Array.each(['GET', 'POST', 'PUT', 'DELETE'], function(method) {
-	    var info = md[method];
-	    if (info) {
-
-		var usage = "";
-
-		usage += "<table><tr><td>HTTP:&nbsp;&nbsp;&nbsp;</td><td>"
-		    + method + " " + real_path("/api2/json" + data.path) + "</td></tr>";
-
-		var sections = [
-		    {
-			title: 'Description',
-			html: Ext.htmlEncode(info.description),
-			bodyPadding: 10
-		    },
-		    {
-			title: 'Usage',
-			html: usage,
-			bodyPadding: 10
-		    }
-		];
-
-		if (info.parameters && info.parameters.properties) {
-
-		    var pstore = Ext.create('Ext.data.Store', {
-			model: 'pve-param-schema',
-			proxy: {
-			    type: 'memory'
-			},
-			groupField: 'optional',
-			sorters: [
-			    {
-				property: 'name',
-				direction: 'ASC'
-			    }
-			]
-		    });
-
-		    Ext.Object.each(info.parameters.properties, function(name, pdef) {
-			pdef.name = name;
-			pstore.add(pdef);
-		    });
-
-		    pstore.sort();
-
-		    var groupingFeature = Ext.create('Ext.grid.feature.Grouping',{
-			enableGroupingMenu: false,
-			groupHeaderTpl: '<tpl if="groupValue">Optional</tpl><tpl if="!groupValue">Required</tpl>'
-		    });
-
-		    sections.push({
-			xtype: 'gridpanel',
-			title: 'Parameters',
-			features: [groupingFeature],
-			store: pstore,
-			viewConfig: {
-			    trackOver: false,
-			    stripeRows: true
-			},
-			columns: [
-			    {
-				header: 'Name',
-				dataIndex: 'name',
-				flex: 1
-			    },
-			    {
-				header: 'Type',
-				dataIndex: 'type',
-				renderer: render_type,
-				flex: 1
-			    },
-			    {
-				header: 'Default',
-				dataIndex: 'default',
-				flex: 1
-			    },
-			    {
-				header: 'Format',
-				dataIndex: 'type',
-				renderer: render_format,
-				flex: 2
-			    },
-			    {
-				header: 'Description',
-				dataIndex: 'description',
-				renderer: render_description,
-				flex: 6
-			    }
-			]
-		    });
-
-		}
-
-		if (info.returns) {
-
-		    var retinf = info.returns;
-		    var rtype = retinf.type;
-		    if (!rtype && retinf.items)
-			rtype = 'array';
-		    if (!rtype)
-			rtype = 'object';
-
-		    var rpstore = Ext.create('Ext.data.Store', {
-			model: 'pve-param-schema',
-			proxy: {
-			    type: 'memory'
-			},
-			groupField: 'optional',
-			sorters: [
-			    {
-				property: 'name',
-				direction: 'ASC'
-			   }
-			]
-		    });
-
-		    var properties;
-		    if (rtype === 'array' && retinf.items.properties) {
-			properties = retinf.items.properties;
-		    }
-
-		    if (rtype === 'object' && retinf.properties) {
-			properties = retinf.properties;
-		    }
-
-		    Ext.Object.each(properties, function(name, pdef) {
-			pdef.name = name;
-			rpstore.add(pdef);
-		    });
-
-		    rpstore.sort();
-
-		    var groupingFeature = Ext.create('Ext.grid.feature.Grouping',{
-			enableGroupingMenu: false,
-			groupHeaderTpl: '<tpl if="groupValue">Optional</tpl><tpl if="!groupValue">Obligatory</tpl>'
-		    });
-		    var returnhtml;
-		    if (retinf.items) {
-			returnhtml = '<pre>items: ' + Ext.htmlEncode(JSON.stringify(retinf.items, null, 4)) + '</pre>';
-		    }
-
-		    if (retinf.properties) {
-			returnhtml = returnhtml || '';
-			returnhtml += '<pre>properties:' + Ext.htmlEncode(JSON.stringify(retinf.properties, null, 4)) + '</pre>';
-		    }
-
-		    var rawSection = Ext.create('Ext.panel.Panel', {
-			bodyPadding: '0px 10px 10px 10px',
-			html: returnhtml,
-			hidden: true
-		    });
-
-		    sections.push({
-			xtype: 'gridpanel',
-			title: 'Returns: ' + rtype,
-			features: [groupingFeature],
-			store: rpstore,
-			viewConfig: {
-			    trackOver: false,
-			    stripeRows: true
-			},
-		    columns: [
-			{
-			    header: 'Name',
-			    dataIndex: 'name',
-			    flex: 1
-			},
-			{
-			    header: 'Type',
-			    dataIndex: 'type',
-			    renderer: render_type,
-			    flex: 1
-			},
-			{
-			    header: 'Default',
-			    dataIndex: 'default',
-			    flex: 1
-			},
-			{
-			    header: 'Format',
-			    dataIndex: 'type',
-			    renderer: render_format,
-			    flex: 2
-			},
-			{
-			    header: 'Description',
-			    dataIndex: 'description',
-			    renderer: render_description,
-			    flex: 6
-			}
-		    ],
-		    bbar: [
-			{
-			    xtype: 'button',
-			    text: 'Show RAW',
-			    handler: function(btn) {
-				rawSection.setVisible(!rawSection.isVisible());
-				btn.setText(rawSection.isVisible() ? 'Hide RAW' : 'Show RAW');
-			    }}
-		    ]
-		});
-
-		sections.push(rawSection);
-
-
-		}
-
-		if (!data.path.match(/\/_upgrade_/)) {
-		    var permhtml = '';
-
-		    if (!info.permissions) {
-			permhtml = "Root only.";
-		    } else {
-			if (info.permissions.description) {
-			    permhtml += "<div style='white-space:pre-wrap;padding-bottom:10px;'>" +
-				Ext.htmlEncode(info.permissions.description) + "</div>";
-			}
-			permhtml += permission_text(info.permissions);
-		    }
-
-		    // we do not have this information for PBS api
-		    //if (!info.allowtoken) {
-		    //    permhtml += "<br />This API endpoint is not available for API tokens."
-		    //}
-
-		    sections.push({
-			title: 'Required permissions',
-			bodyPadding: 10,
-			html: permhtml
-		    });
-		}
-
-		items.push({
-		    title: method,
-		    autoScroll: true,
-		    defaults: {
-			border: false
-		    },
-		    items: sections
-		});
-	    }
-	});
-
-	var ct = Ext.getCmp('docview');
-	ct.setTitle("Path: " +  real_path(data.path));
-	ct.removeAll(true);
-	ct.add(items);
-	ct.setActiveTab(0);
-    };
-
-    Ext.define('Ext.form.SearchField', {
-	extend: 'Ext.form.field.Text',
-	alias: 'widget.searchfield',
-
-	emptyText: 'Search...',
-
-	flex: 1,
-
-	inputType: 'search',
-	listeners: {
-	    'change': function(){
-
-		var value = this.getValue();
-		if (!Ext.isEmpty(value)) {
-		    store.filter({
-			property: 'path',
-			value: value,
-			anyMatch: true
-		    });
-		} else {
-		    store.clearFilter();
-		}
-	    }
-	}
-    });
-
-    var tree = Ext.create('Ext.tree.Panel', {
-	title: 'Resource Tree',
-	tbar: [
-	    {
-		xtype: 'searchfield',
-	    }
-	],
-	tools: [
-	    {
-		type: 'expand',
-		tooltip: 'Expand all',
-		tooltipType: 'title',
-		callback: (tree) => tree.expandAll(),
-	    },
-	    {
-		type: 'collapse',
-		tooltip: 'Collapse all',
-		tooltipType: 'title',
-		callback: (tree) => tree.collapseAll(),
-	    },
-	],
-        store: store,
-	width: 200,
-        region: 'west',
-        split: true,
-        margins: '5 0 5 5',
-        rootVisible: false,
-	listeners: {
-	    selectionchange: function(v, selections) {
-		if (!selections[0])
-		    return;
-		var rec = selections[0];
-		render_docu(rec.data);
-		location.hash = '#' + rec.data.path;
-	    }
-	}
-    });
-
-    Ext.create('Ext.container.Viewport', {
-	layout: 'border',
-	renderTo: Ext.getBody(),
-	items: [
-	    tree,
-	    {
-		xtype: 'tabpanel',
-		title: 'Documentation',
-		id: 'docview',
-		region: 'center',
-		margins: '5 5 5 0',
-		layout: 'fit',
-		items: []
-	    }
-	]
-    });
-
-    var deepLink = function() {
-	var path = window.location.hash.substring(1).replace(/\/\s*$/, '')
-	var endpoint = store.findNode('path', path);
-
-	if (endpoint) {
-	    tree.getSelectionModel().select(endpoint);
-	    tree.expandPath(endpoint.getPath());
-	    render_docu(endpoint.data);
-	}
-    }
-    window.onhashchange = deepLink;
-
-    deepLink();
-
-});
diff --git a/src/bin/docgen.rs b/src/bin/docgen.rs
index 9df9f33b..3a387e1c 100644
--- a/src/bin/docgen.rs
+++ b/src/bin/docgen.rs
@@ -92,7 +92,7 @@ fn generate_api_tree() -> String {
     data["text"] = "Restore API (HTTP/2)".into();
     tree.push(data);
 
-    format!("var pbsapi = {};", serde_json::to_string_pretty(&tree).unwrap())
+    format!("var apiSchema = {};", serde_json::to_string_pretty(&tree).unwrap())
 }
 
 pub fn dump_schema(schema: &Schema) -> Value {
-- 
2.20.1





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pbs-devel] applied-series: [PATCH proxmox-backup v2 0/4] use proxmox-widget-toolkit-dev for -docs
  2021-06-04 12:35 [pbs-devel] [PATCH proxmox-backup v2 0/4] use proxmox-widget-toolkit-dev for -docs Dominik Csapak
                   ` (3 preceding siblings ...)
  2021-06-04 12:35 ` [pbs-devel] [PATCH proxmox-backup v2 4/4] docs: build api-viewer from widget-toolkit-dev Dominik Csapak
@ 2021-06-28 12:30 ` Thomas Lamprecht
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Lamprecht @ 2021-06-28 12:30 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Dominik Csapak

On 04.06.21 14:35, Dominik Csapak wrote:
> to be able to better reuse code across repositories
> includes Toolkit fixes/overrides for extjs in lto-barcode and prune-simulator
> also a single fix for ext7.0 is also included
> 
> changes from v1:
> * inserted the dev-dependency into the list sorted
> * rebased on master
> * use new path to APIViewer.js (previously APIVIEWER.js)
> 
> Dominik Csapak (4):
>   docs/prune-simulator: remove displayField for Calendar Field
>   docs: add Toolkit.js to prune simulator
>   docs: add Toolkit.js to lto-barcode
>   docs: build api-viewer from widget-toolkit-dev
> 
>  debian/control                                |   1 +
>  debian/debcargo.toml                          |   1 +
>  docs/Makefile                                 |  45 +-
>  docs/api-viewer/PBSAPI.js                     | 526 ------------------
>  docs/lto-barcode/index.html                   |  12 +-
>  docs/lto-barcode/lto-barcode.js               |   6 +-
>  ...simulator.js => prune-simulator_source.js} |   7 +-
>  src/bin/docgen.rs                             |   2 +-
>  8 files changed, 41 insertions(+), 559 deletions(-)
>  delete mode 100644 docs/api-viewer/PBSAPI.js
>  rename docs/prune-simulator/{prune-simulator.js => prune-simulator_source.js} (98%)
> 



applied series, thanks!




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-06-28 12:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-04 12:35 [pbs-devel] [PATCH proxmox-backup v2 0/4] use proxmox-widget-toolkit-dev for -docs Dominik Csapak
2021-06-04 12:35 ` [pbs-devel] [PATCH proxmox-backup v2 1/4] docs/prune-simulator: remove displayField for Calendar Field Dominik Csapak
2021-06-04 12:35 ` [pbs-devel] [PATCH proxmox-backup v2 2/4] docs: add Toolkit.js to prune simulator Dominik Csapak
2021-06-04 12:35 ` [pbs-devel] [PATCH proxmox-backup v2 3/4] docs: add Toolkit.js to lto-barcode Dominik Csapak
2021-06-04 12:35 ` [pbs-devel] [PATCH proxmox-backup v2 4/4] docs: build api-viewer from widget-toolkit-dev Dominik Csapak
2021-06-28 12:30 ` [pbs-devel] applied-series: [PATCH proxmox-backup v2 0/4] use proxmox-widget-toolkit-dev for -docs Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal