]> git.proxmox.com Git - proxmox-widget-toolkit.git/blobdiff - Utils.js
button/Button.js: imported from pve-manager
[proxmox-widget-toolkit.git] / Utils.js
index 80526cddd1145dd562581072caf5f6eb6026e527..1aff39f64f33fde078a62c8463fea8cfee5b6888 100644 (file)
--- a/Utils.js
+++ b/Utils.js
@@ -75,6 +75,20 @@ Ext.define('Proxmox.Utils', { utilities: {
        return !value ? Proxmox.Utils.yesText : Proxmox.Utils.noText;
     },
 
+    format_enabled_toggle: function(value) {
+       return value ? Proxmox.Utils.enabledText : Proxmox.Utils.disabledText;
+    },
+
+    compute_min_label_width: function(text, width) {
+
+       if (width === undefined) { width = 100; }
+
+       var tm = new Ext.util.TextMetrics();
+       var min = tm.getWidth(text + ':');
+
+       return min < width ? width : min;
+    },
+
     authOK: function() {
        return (Proxmox.UserName !== '') && Ext.util.Cookies.get(Proxmox.Setup.auth_cookie_name);
     },