]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/window/PCIMapEdit.js
1 Ext
.define('PVE.window.PCIMapEditWindow', {
2 extend
: 'Proxmox.window.Edit',
4 mixins
: ['Proxmox.Mixin.CBind'],
8 subject
: gettext('PCI mapping'),
10 onlineHelp
: 'resource_mapping',
14 cbindData: function(initialConfig
) {
16 me
.isCreate
= !me
.name
|| !me
.nodename
;
17 me
.method
= me
.name
? 'PUT' : 'POST';
20 nodename
: me
.nodename
,
24 submitUrl: function(_url
, data
) {
26 let name
= me
.method
=== 'PUT' ? me
.name
: '';
27 return `/cluster/mapping/pci/${name}`;
31 xclass
: 'Ext.app.ViewController',
33 onGetValues: function(values
) {
35 let view
= me
.getView();
36 if (view
.method
=== "POST") {
40 if (values
.iommugroup
=== -1) {
41 delete values
.iommugroup
;
44 let nodename
= values
.node
?? view
.nodename
;
47 let otherMaps
= PVE
.Parser
48 .filterPropertyStringList(me
.originalMap
, (e
) => e
.node
!== nodename
);
49 if (otherMaps
.length
) {
50 values
.map
= values
.map
.concat(otherMaps
);
57 onSetValues: function(values
) {
59 let view
= me
.getView();
60 me
.originalMap
= [...values
.map
];
61 values
.map
= PVE
.Parser
.filterPropertyStringList(values
.map
, (e
) => e
.node
=== view
.nodename
);
65 checkIommu: function(store
, records
, success
) {
67 if (!success
|| !records
.length
) {
70 me
.lookup('iommu_warning').setVisible(
71 records
.every((val
) => val
.data
.iommugroup
=== -1),
75 mdevChange: function(mdevField
, value
) {
76 this.lookup('pciselector').setMdev(value
);
79 nodeChange: function(_field
, value
) {
80 this.lookup('pciselector').setNodename(value
);
83 pciChange: function(_field
, value
) {
85 me
.lookup('multiple_warning').setVisible(Ext
.isArray(value
) && value
.length
> 1);
95 'pveMultiPCISelector': {
104 onGetValues: function(values
) {
105 return this.up('window').getController().onGetValues(values
);
108 onSetValues: function(values
) {
109 return this.up('window').getController().onSetValues(values
);
114 xtype
: 'displayfield',
115 reference
: 'iommu_warning',
119 value
: 'No IOMMU detected, please activate it.' +
120 'See Documentation for further information.',
124 xtype
: 'displayfield',
125 reference
: 'multiple_warning',
129 value
: 'When multiple devices are selected, the first free one will be chosen' +
134 xtype
: 'displayfield',
135 reference
: 'group_warning',
139 itemId
: 'iommuwarning',
140 value
: 'The selected Device is not in a seperate IOMMU group, make sure this is intended.',
147 xtype
: 'pmxDisplayEditField',
148 fieldLabel
: gettext('Name'),
153 submitValue
: '{isCreate}',
159 xtype
: 'pmxDisplayEditField',
160 fieldLabel
: gettext('Mapping on Node'),
164 xtype
: 'pveNodeSelector',
167 editable
: '{!nodename}',
177 xtype
: 'displayfield',
180 xtype
: 'proxmoxcheckbox',
181 fieldLabel
: gettext('Mediated Devices'),
186 deleteEmpty
: '{!isCreate}',
193 xtype
: 'pveMultiPCISelector',
194 fieldLabel
: gettext('Device'),
197 reference
: 'pciselector',
200 nodename
: '{nodename}',
203 onLoadCallBack
: 'checkIommu',
207 xtype
: 'proxmoxtextfield',
208 fieldLabel
: gettext('Comment'),
213 deleteEmpty
: '{!isCreate}',