[pve-devel] [PATCH manager v2 1/3] add render functions for Certificates

Dominik Csapak d.csapak at proxmox.com
Fri May 4 11:53:33 CEST 2018


this adds render_optional_url for a field which may contain a link
and render_san which simply displays the different values
in each line

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/Utils.js | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index b61e8b32..5a8f7427 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -721,6 +721,27 @@ Ext.define('PVE.Utils', { utilities: {
 	return PVE.Utils.render_size_usage(record.used, record.total);
     },
 
+    render_optional_url: function(value) {
+	var match;
+	if (value && (match = value.match(/^https?:\/\//)) !== null) {
+	    return '<a href="' + value + '">' + value + '</a>';
+	}
+	return value;
+    },
+
+    render_san: function(value) {
+	var names = [];
+	if (Ext.isArray(value)) {
+	    value.forEach(function(val) {
+		if (!Ext.isNumber(val)) {
+		    names.push(val);
+		}
+	    });
+	    return names.join('<br>');
+	}
+	return value;
+    },
+
     windowHostname: function() {
 	return window.location.hostname.replace(Proxmox.Utils.IP6_bracket_match,
             function(m, addr, offset, original) { return addr; });
-- 
2.11.0




More information about the pve-devel mailing list