]>
git.proxmox.com Git - proxmox-backup.git/blob - www/form/NamespaceMaxDepth.js
1 Ext
.define('PBS.form.NamespaceMaxDepth', {
2 extend
: 'Proxmox.form.field.Integer',
3 alias
: 'widget.pbsNamespaceMaxDepth',
7 emptyText
: gettext('Full'),
8 fieldLabel
: gettext('Max. Depth'),
16 cls
: 'pmx-clear-trigger',
20 this.triggers
.clear
.setVisible(false);
27 change: function(field
, value
) {
28 let canClear
= value
!== '';
29 field
.triggers
.clear
.setVisible(canClear
);
34 Ext
.define('PBS.form.NamespaceMaxDepthReduced', {
35 extend
: 'PBS.form.NamespaceMaxDepth',
36 alias
: 'widget.pbsNamespaceMaxDepthReduced',
38 calcMaxPrefixLength: function(ns1
, ns2
) {
39 let maxPrefixLength
= 0;
40 if (ns1
!== undefined && ns1
!== null && typeof ns1
=== 'string') {
41 maxPrefixLength
= (ns1
.match(/[/]/g) || []).length
+ (ns1
=== '' ? 0 : 1);
43 if (ns2
!== undefined && ns2
!== null && typeof ns2
=== 'string') {
44 let ns2PrefixLength
= (ns2
.match(/[/]/g) || []).length
+ (ns2
=== '' ? 0 : 1);
45 if (ns2PrefixLength
> maxPrefixLength
) {
46 maxPrefixLength
= ns2PrefixLength
;
49 return maxPrefixLength
;
52 setLimit: function(ns1
, ns2
) {
54 let maxPrefixLength
= me
.calcMaxPrefixLength(ns1
, ns2
);
55 if (maxPrefixLength
!== undefined) {
56 me
.maxValue
= 7 - maxPrefixLength
;