]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/lxc/DeviceEdit.js
1 Ext
.define('PVE.lxc.DeviceInputPanel', {
2 extend
: 'Proxmox.panel.InputPanel',
3 mixins
: ['Proxmox.Mixin.CBind'],
8 xclass
: 'Ext.app.ViewController',
11 setVMConfig: function(vmconfig
) {
13 me
.vmconfig
= vmconfig
;
16 PVE
.Utils
.forEachLxcDev((i
) => {
17 let name
= "dev" + i
.toString();
18 if (!Ext
.isDefined(vmconfig
[name
])) {
20 me
.down('field[name=devid]').setValue(i
);
28 onGetValues: function(values
) {
30 let confid
= me
.isCreate
? "dev" + values
.devid
: me
.confid
;
32 let val
= PVE
.Parser
.printPropertyString(values
, 'path');
40 xtype
: 'proxmoxintegerfield',
42 fieldLabel
: gettext('Passthrough ID'),
44 maxValue
: PVE
.Utils
.dev_count
- 1,
50 hidden
: '{!isCreate}',
51 disabled
: '{!isCreate}',
53 validator: function(value
) {
54 let view
= this.up('inputpanel');
58 if (Ext
.isDefined(view
.vmconfig
["dev" + value
])) {
59 return "Device passthrough is already in use.";
70 fieldLabel
: gettext('Device Path'),
71 emptyText
: '/dev/xyz',
73 validator: function(value
) {
74 if (value
.startsWith('/dev/')) {
78 return "Path has to start with /dev/";
85 xtype
: 'proxmoxintegerfield',
94 xtype
: 'proxmoxintegerfield',
109 fieldLabel
: gettext('Access Mode'),
112 validator: function(value
) {
113 if (/^0[0-7]{3}$|^$/i.test(value
)) {
117 return "Access mode has to be an octal number";
123 Ext
.define('PVE.lxc.DeviceEdit', {
124 extend
: 'Proxmox.window.Edit',
131 initComponent: function() {
134 me
.isCreate
= !me
.confid
;
136 let ipanel
= Ext
.create('PVE.lxc.DeviceInputPanel', {
138 isCreate
: me
.isCreate
,
139 pveSelNode
: me
.pveSelNode
,
144 subject
= gettext('Device');
146 subject
= gettext('Device') + ' (' + me
.confid
+ ')';
157 success: function(response
, options
) {
158 ipanel
.setVMConfig(response
.result
.data
);
163 let data
= PVE
.Parser
.parsePropertyString(response
.result
.data
[me
.confid
], 'path');
172 ipanel
.setValues(values
);