]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/storage/Base.js
1 Ext
.define('PVE.panel.StorageBase', {
2 extend
: 'Proxmox.panel.InputPanel',
3 controller
: 'storageEdit',
7 onGetValues: function(values
) {
11 values
.type
= me
.type
;
13 delete values
.storage
;
16 values
.disable
= values
.enable
? 0 : 1;
22 initComponent: function() {
26 xtype
: me
.isCreate
? 'textfield' : 'displayfield',
28 value
: me
.storageId
|| '',
34 me
.column2
= me
.column2
|| [];
37 xtype
: 'pveNodeSelector',
39 reference
: 'storageNodeRestriction',
40 disabled
: me
.storageId
=== 'local',
41 fieldLabel
: gettext('Nodes'),
42 emptyText
: gettext('All') + ' (' + gettext('No restrictions') +')',
47 xtype
: 'proxmoxcheckbox',
51 fieldLabel
: gettext('Enable'),
55 const qemuImgStorageTypes
= ['dir', 'btrfs', 'nfs', 'cifs', 'glusterfs'];
57 if (qemuImgStorageTypes
.includes(me
.type
)) {
58 const preallocSelector
= {
59 xtype
: 'pvePreallocationSelector',
60 name
: 'preallocation',
61 fieldLabel
: gettext('Preallocation'),
63 deleteEmpty
: !me
.isCreate
,
67 me
.advancedColumn1
= me
.advancedColumn1
|| [];
68 me
.advancedColumn2
= me
.advancedColumn2
|| [];
69 if (me
.advancedColumn2
.length
< me
.advancedColumn1
.length
) {
70 me
.advancedColumn2
.unshift(preallocSelector
);
72 me
.advancedColumn1
.unshift(preallocSelector
);
80 Ext
.define('PVE.storage.BaseEdit', {
81 extend
: 'Proxmox.window.Edit',
83 apiCallDone: function(success
, response
, options
) {
85 if (typeof me
.ipanel
.apiCallDone
=== "function") {
86 me
.ipanel
.apiCallDone(success
, response
, options
);
90 initComponent: function() {
93 me
.isCreate
= !me
.storageId
;
96 me
.url
= '/api2/extjs/storage';
99 me
.url
= '/api2/extjs/storage/' + me
.storageId
;
103 me
.ipanel
= Ext
.create(me
.paneltype
, {
104 title
: gettext('General'),
106 isCreate
: me
.isCreate
,
107 storageId
: me
.storageId
,
111 subject
: PVE
.Utils
.format_storage_type(me
.type
),
122 xtype
: 'pveBackupJobPrunePanel',
123 title
: gettext('Backup Retention'),
124 hasMaxProtected
: true,
125 isCreate
: me
.isCreate
,
126 keepAllDefaultForCreate
: true,
127 showPBSHint
: me
.ipanel
.isPBS
,
128 fallbackHintHtml
: gettext('Without any keep option, the node\'s vzdump.conf or `keep-all` is used as fallback for backup jobs'),
134 if (me
.ipanel
.extraTabs
) {
135 me
.ipanel
.extraTabs
.forEach(panel
=> {
136 panel
.isCreate
= me
.isCreate
;
137 me
.items
.items
.push(panel
);
143 if (!me
.canDoBackups
) {
144 // cannot mask now, not fully rendered until activated
145 me
.down('pmxPruneInputPanel').needMask
= true;
150 success: function(response
, options
) {
151 let values
= response
.result
.data
;
152 let ctypes
= values
.content
|| '';
154 values
.content
= ctypes
.split(',');
157 values
.nodes
= values
.nodes
.split(',');
159 values
.enable
= values
.disable
? 0 : 1;
160 if (values
['prune-backups']) {
161 let retention
= PVE
.Parser
.parsePropertyString(values
['prune-backups']);
162 delete values
['prune-backups'];
163 Object
.assign(values
, retention
);
164 } else if (values
.maxfiles
!== undefined) {
165 if (values
.maxfiles
> 0) {
166 values
['keep-last'] = values
.maxfiles
;
168 delete values
.maxfiles
;
171 me
.query('inputpanel').forEach(panel
=> {
172 panel
.setValues(values
);