]> git.proxmox.com Git - pve-manager.git/commitdiff
ui: Utils: add helper functions for acme domains
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 6 May 2020 14:31:10 +0000 (16:31 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 6 May 2020 15:49:35 +0000 (17:49 +0200)
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@proxmox.com>
www/manager6/Utils.js

index 872b7c2921e8e741dfe464795dbdd20eabce1b9f..31e262c0a9644e14aa703eee145fa37452e447b2 100644 (file)
@@ -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) {