]> git.proxmox.com Git - proxmox-widget-toolkit.git/blobdiff - Toolkit.js
override Ext.Components 'validIdRe' to include '@'
[proxmox-widget-toolkit.git] / Toolkit.js
index 41be6ad1401af06599688e3aa93b64e2e6cf45a7..6956a8e14f5300b097ece5ff905d89c3568ddec3 100644 (file)
@@ -30,9 +30,9 @@ Ext.apply(Ext.form.field.VTypes, {
        var result = Proxmox.Utils.IP6_cidr_match.exec(v);
        // limits according to JSON Schema see
        // pve-common/src/PVE/JSONSchema.pm
-       return (result !== null && result[1] >= 8 && result[1] <= 120);
+       return (result !== null && result[1] >= 8 && result[1] <= 128);
     },
-    IP6CIDRAddressText:  gettext('Example') + ': 2001:DB8::42/64' + "<br>" + gettext('Valid CIDR Range') + ': 8-120',
+    IP6CIDRAddressText:  gettext('Example') + ': 2001:DB8::42/64' + "<br>" + gettext('Valid CIDR Range') + ': 8-128',
     IP6CIDRAddressMask:  /[A-Fa-f0-9:\/]/,
 
     IP6PrefixLength:  function(v) {
@@ -47,6 +47,22 @@ Ext.apply(Ext.form.field.VTypes, {
     IP64AddressText:  gettext('Example') + ': 192.168.1.1 2001:DB8::42',
     IP64AddressMask: /[A-Fa-f0-9\.:]/,
 
+    IP64CIDRAddress: function(v) {
+       var result = Proxmox.Utils.IP64_cidr_match.exec(v);
+       if (result === null) {
+           return false;
+       }
+       if (result[1] !== undefined) {
+           return result[1] >= 8 && result[1] <= 128;
+       } else if (result[2] !== undefined) {
+           return result[2] >= 8 && result[2] <= 32;
+       } else {
+           return false;
+       }
+    },
+    IP64CIDRAddressText: gettext('Example') + ': 192.168.1.1/24 2001:DB8::42/64',
+    IP64CIDRAddressMask: /[A-Fa-f0-9\.:\/]/,
+
     MacAddress: function(v) {
        return (/^([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}$/).test(v);
     },
@@ -57,7 +73,7 @@ Ext.apply(Ext.form.field.VTypes, {
        return (/^[a-f0-9][02468ace](?::[a-f0-9]{2}){0,2}:?$/i).test(v);
     },
     MacPrefixMask: /[a-fA-F0-9:]/,
-    MacPrefixText: gettext('Example') + ': 02:8f',
+    MacPrefixText: gettext('Example') + ': 02:8f - ' + gettext('only unicast addresses are allowed'),
 
     BridgeName: function(v) {
         return (/^vmbr\d{1,4}$/).test(v);
@@ -192,6 +208,46 @@ Ext.define('EXTJS_23846.Gesture', {
     }
 });
 
+Ext.define('EXTJS_18900.Pie', {
+    override: 'Ext.chart.series.Pie',
+
+    // from 6.0.2
+    betweenAngle: function (x, a, b) {
+        var pp = Math.PI * 2,
+            offset = this.rotationOffset;
+
+        if (a === b) {
+            return false;
+        }
+
+        if (!this.getClockwise()) {
+            x *= -1;
+            a *= -1;
+            b *= -1;
+            a -= offset;
+            b -= offset;
+        } else {
+            a += offset;
+            b += offset;
+        }
+
+        x -= a;
+        b -= a;
+
+        // Normalize, so that both x and b are in the [0,360) interval.
+        x %= pp;
+        b %= pp;
+        x += pp;
+        b += pp;
+        x %= pp;
+        b %= pp;
+
+        // Because 360 * n angles will be normalized to 0,
+        // we need to treat b === 0 as a special case.
+        return x < b || b === 0;
+    },
+});
+
 // we always want the number in x.y format and never in, e.g., x,y
 Ext.define('PVE.form.field.Number', {
     override: 'Ext.form.field.Number',
@@ -383,6 +439,12 @@ Ext.define(null, {
 
 });
 
+// add '@' to the valid id
+Ext.define('Proxmox.validIdReOverride', {
+    override: 'Ext.Component',
+    validIdRe: /^[a-z_][a-z0-9\-_\@]*$/i,
+});
+
 // force alert boxes to be rendered with an Error Icon
 // since Ext.Msg is an object and not a prototype, we need to override it
 // after the framework has been initiated