[pve-devel] [PATCH manager v2 3/5] ui: Utils: add helper functions for acme domains

Dominik Csapak d.csapak at proxmox.com
Wed May 6 16:31:10 CEST 2020


to convieniently add and remove domains from a parsed ACME object
they also make domains unique in the array

also add the count of configureable acmedomainX entries

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

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 872b7c29..31e262c0 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -1354,6 +1354,29 @@ Ext.define('PVE.Utils', { utilities: {
 	}
     },
 
+    acmedomain_count: 5,
+
+    add_domain_to_acme: function(acme, domain) {
+	if (acme.domains === undefined) {
+	    acme.domains = [domain];
+	} else {
+	    acme.domains.push(domain);
+	    acme.domains = acme.domains.filter((value, index, self) => {
+		return self.indexOf(value) === index;
+	    });
+	}
+	return acme;
+    },
+
+    remove_domain_from_acme: function(acme, domain) {
+	if (acme.domains !== undefined) {
+	    acme.domains = acme.domains.filter((value, index, self) => {
+		return self.indexOf(value) === index && value !== domain;
+	    });
+	}
+	return acme;
+    },
+
     handleStoreErrorOrMask: function(me, store, regex, callback) {
 
 	me.mon(store, 'load', function (proxy, response, success, operation) {
-- 
2.20.1





More information about the pve-devel mailing list