]> git.proxmox.com Git - proxmox-backup.git/blobdiff - www/Utils.js
faq: fix typo
[proxmox-backup.git] / www / Utils.js
index bd585c96513bfd70041e6b5cda6589812b5361cd..7bcf1ba613fb6d0c52d7d862ba0d0264f1b738c0 100644 (file)
@@ -13,6 +13,45 @@ Ext.define('PBS.Utils', {
 
     dataStorePrefix: 'DataStore-',
 
+    cryptmap: [
+       'none',
+       'mixed',
+       'sign-only',
+       'encrypt',
+    ],
+
+    cryptText: [
+       Proxmox.Utils.noText,
+       gettext('Mixed'),
+       gettext('Signed'),
+       gettext('Encrypted'),
+    ],
+
+    cryptIconCls: [
+       '',
+       '',
+       'lock faded',
+       'lock good',
+    ],
+
+    calculateCryptMode: function(data) {
+       let mixed = data.mixed;
+       let encrypted = data.encrypt;
+       let signed = data['sign-only'];
+       let files = data.count;
+       if (mixed > 0) {
+           return PBS.Utils.cryptmap.indexOf('mixed');
+       } else if (files === encrypted && encrypted > 0) {
+           return PBS.Utils.cryptmap.indexOf('encrypt');
+       } else if (files === signed && signed > 0) {
+           return PBS.Utils.cryptmap.indexOf('sign-only');
+       } else if ((signed+encrypted) === 0) {
+           return PBS.Utils.cryptmap.indexOf('none');
+       } else {
+           return PBS.Utils.cryptmap.indexOf('mixed');
+       }
+    },
+
     getDataStoreFromPath: function(path) {
        return path.slice(PBS.Utils.dataStorePrefix.length);
     },