X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=api-viewer%2FPVEAPI.js;h=835322fd094f76bfe630b1543e0a7ba51f54fb9b;hb=ba295265e6e2acfc92f6d50c5270beb7cdf4ccc2;hp=75168e6ea03a37da3db8de9066176ac43dfa507d;hpb=7f5866a309051fd3b06eb8ce2bb91688ebcf43d7;p=pve-docs.git diff --git a/api-viewer/PVEAPI.js b/api-viewer/PVEAPI.js index 75168e6..835322f 100644 --- a/api-viewer/PVEAPI.js +++ b/api-viewer/PVEAPI.js @@ -11,8 +11,8 @@ Ext.onReady(function() { Ext.define('pve-param-schema', { extend: 'Ext.data.Model', fields: [ - 'name', 'type', 'typetext', 'description', 'enum', - 'minimum', 'maximum', 'minLength', 'maxLength', + 'name', 'type', 'typetext', 'description', 'verbose_description', + 'enum', 'minimum', 'maximum', 'minLength', 'maxLength', 'pattern', 'title', 'requires', 'format', 'default', 'disallow', 'extends', 'links', { @@ -42,9 +42,13 @@ Ext.onReady(function() { }] }); - var render_text = function(value, metaData, record) { + 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); @@ -150,26 +154,33 @@ Ext.onReady(function() { stripeRows: true }, columns: [ - { + { header: 'Name', - dataIndex: '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: 1 + flex: 2 }, - { + { header: 'Description', dataIndex: 'description', - renderer: render_text, - flex: 2 + renderer: render_description, + flex: 6 } ] }); @@ -178,14 +189,27 @@ Ext.onReady(function() { if (info.returns) { - var rtype = info.returns.type; - if (!rtype && info.returns.items) + var retinf = info.returns; + var rtype = retinf.type; + if (!rtype && retinf.items) rtype = 'array'; if (!rtype) rtype = 'object'; + var returnhtml; + if (retinf.items) { + returnhtml = '
items: ' + JSON.stringify(retinf.items, null, 4) + ''; + } + + if (retinf.properties) { + returnhtml = returnhtml || ''; + returnhtml += '
properties:' + JSON.stringify(retinf.properties, null, 4); + } + sections.push({ - title: 'Returns: ' + rtype + title: 'Returns: ' + rtype, + bodyPadding: 10, + html: returnhtml }); } @@ -201,9 +225,9 @@ Ext.onReady(function() { if (info.permissions.user) { if (!info.permissions.description) { if (info.permissions.user === 'world') { - permhtml += "Accessible without any authententification."; + permhtml += "Accessible without any authentication."; } else if (info.permissions.user === 'all') { - permhtml += "Accessible by all authententicated users."; + permhtml += "Accessible by all authenticated users."; } else { permhtml += 'Onyl accessible by user "' + info.permissions.user + '"';