]> git.proxmox.com Git - pve-manager.git/blame - www/manager6/lxc/FeaturesEdit.js
ui: eslint: fix trailing comma and comma related whitespaces errors
[pve-manager.git] / www / manager6 / lxc / FeaturesEdit.js
CommitLineData
a88fcb7d
DC
1Ext.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
7bf152bf
WB
10 viewModel: {
11 parent: null,
12 data: {
f6710aac 13 unprivileged: false,
7bf152bf
WB
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') : '');
f6710aac
TL
21 },
22 },
7bf152bf
WB
23 },
24
a88fcb7d
DC
25 items: [
26 {
27 xtype: 'proxmoxcheckbox',
28 fieldLabel: gettext('keyctl'),
7bf152bf
WB
29 name: 'keyctl',
30 bind: {
31 disabled: '{!unprivileged}',
f6710aac
TL
32 boxLabel: '{unprivilegedOnly}',
33 },
a88fcb7d
DC
34 },
35 {
36 xtype: 'proxmoxcheckbox',
37 fieldLabel: gettext('Nesting'),
f6710aac 38 name: 'nesting',
a88fcb7d
DC
39 },
40 {
41 xtype: 'proxmoxcheckbox',
42 name: 'nfs',
7bf152bf
WB
43 fieldLabel: 'NFS',
44 bind: {
45 disabled: '{unprivileged}',
f6710aac
TL
46 boxLabel: '{privilegedOnly}',
47 },
a88fcb7d
DC
48 },
49 {
50 xtype: 'proxmoxcheckbox',
51 name: 'cifs',
7bf152bf
WB
52 fieldLabel: 'CIFS',
53 bind: {
54 disabled: '{unprivileged}',
f6710aac
TL
55 boxLabel: '{privilegedOnly}',
56 },
7c48f7f7
WB
57 },
58 {
59 xtype: 'proxmoxcheckbox',
60 name: 'fuse',
f6710aac 61 fieldLabel: 'FUSE',
acddfb9b
TL
62 },
63 {
64 xtype: 'proxmoxcheckbox',
65 name: 'mknod',
66 fieldLabel: gettext('Create Device Nodes'),
67 boxLabel: gettext('Experimental'),
68 },
a88fcb7d
DC
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
68c86905 95 me.viewModel.set('unprivileged', values.unprivileged);
a88fcb7d
DC
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 }
d8cb744d
DC
111 },
112
113 initComponent: function() {
114 let me = this;
115 me.mounts = []; // reset state
116 me.callParent();
117 },
a88fcb7d
DC
118});
119
120Ext.define('PVE.lxc.FeaturesEdit', {
121 extend: 'Proxmox.window.Edit',
122 xtype: 'pveLxcFeaturesEdit',
123
124 subject: gettext('Features'),
68c86905
TL
125 autoLoad: true,
126 width: 350,
a88fcb7d
DC
127
128 items: [{
f6710aac 129 xtype: 'pveLxcFeaturesInputPanel',
a88fcb7d 130 }],
a88fcb7d 131});