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.csa...@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


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to