]> git.proxmox.com Git - pve-manager.git/blob - www/manager6/lxc/FeaturesEdit.js
drop jslint lines
[pve-manager.git] / www / manager6 / lxc / FeaturesEdit.js
1 Ext.define('PVE.lxc.FeaturesInputPanel', {
2 extend: 'Proxmox.panel.InputPanel',
3 xtype: 'pveLxcFeaturesInputPanel',
4
5 // used to save the mounts fstypes until sending
6 mounts: [],
7
8 fstypes: ['nfs', 'cifs'],
9
10 viewModel: {
11 parent: null,
12 data: {
13 unprivileged: false
14 },
15 formulas: {
16 privilegedOnly: function(get) {
17 return (get('unprivileged') ? gettext('privileged only') : '');
18 },
19 unprivilegedOnly: function(get) {
20 return (!get('unprivileged') ? gettext('unprivileged only') : '');
21 }
22 }
23 },
24
25 items: [
26 {
27 xtype: 'proxmoxcheckbox',
28 fieldLabel: gettext('keyctl'),
29 name: 'keyctl',
30 bind: {
31 disabled: '{!unprivileged}',
32 boxLabel: '{unprivilegedOnly}'
33 }
34 },
35 {
36 xtype: 'proxmoxcheckbox',
37 fieldLabel: gettext('Nesting'),
38 name: 'nesting'
39 },
40 {
41 xtype: 'proxmoxcheckbox',
42 name: 'nfs',
43 fieldLabel: 'NFS',
44 bind: {
45 disabled: '{unprivileged}',
46 boxLabel: '{privilegedOnly}'
47 }
48 },
49 {
50 xtype: 'proxmoxcheckbox',
51 name: 'cifs',
52 fieldLabel: 'CIFS',
53 bind: {
54 disabled: '{unprivileged}',
55 boxLabel: '{privilegedOnly}'
56 }
57 },
58 {
59 xtype: 'proxmoxcheckbox',
60 name: 'fuse',
61 fieldLabel: 'FUSE'
62 },
63 {
64 xtype: 'proxmoxcheckbox',
65 name: 'mknod',
66 fieldLabel: gettext('Create Device Nodes'),
67 boxLabel: gettext('Experimental'),
68 },
69 ],
70
71 onGetValues: function(values) {
72 var me = this;
73 var mounts = me.mounts;
74 me.fstypes.forEach(function(fs) {
75 if (values[fs]) {
76 mounts.push(fs);
77 }
78 delete values[fs];
79 });
80
81 if (mounts.length) {
82 values.mount = mounts.join(';');
83 }
84
85 var featuresstring = PVE.Parser.printPropertyString(values, undefined);
86 if (featuresstring == '') {
87 return { 'delete': 'features' };
88 }
89 return { features: featuresstring };
90 },
91
92 setValues: function(values) {
93 var me = this;
94
95 me.viewModel.set('unprivileged', values.unprivileged);
96
97 if (values.features) {
98 var res = PVE.Parser.parsePropertyString(values.features);
99 me.mounts = [];
100 if (res.mount) {
101 res.mount.split(/[; ]/).forEach(function(item) {
102 if (me.fstypes.indexOf(item) === -1) {
103 me.mounts.push(item);
104 } else {
105 res[item] = 1;
106 }
107 });
108 }
109 this.callParent([res]);
110 }
111 }
112 });
113
114 Ext.define('PVE.lxc.FeaturesEdit', {
115 extend: 'Proxmox.window.Edit',
116 xtype: 'pveLxcFeaturesEdit',
117
118 subject: gettext('Features'),
119 autoLoad: true,
120 width: 350,
121
122 items: [{
123 xtype: 'pveLxcFeaturesInputPanel'
124 }],
125 });