]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/storage/RBDEdit.js
1 /*jslint confusion: true*/
2 Ext
.define('PVE.storage.RBDInputPanel', {
3 extend
: 'PVE.panel.StorageBase',
14 xclass
: 'Ext.app.ViewController',
17 afterrender
: 'queryMonitors'
19 'textfield[name=username]': {
22 'displayfield[name=monhost]': {
23 enable
: 'queryMonitors'
25 'textfield[name=monhost]': {
26 disable
: 'resetField',
30 resetField: function(field
) {
33 queryMonitors: function(field
, newVal
, oldVal
) {
34 // we get called with two signatures, the above one for a field
35 // change event and the afterrender from the view, this check only
36 // can be true for the field change one and omit the API request if
37 // pveceph got unchecked - as it's not needed there.
38 if (field
&& !newVal
&& oldVal
) {
41 var view
= this.getView();
42 var vm
= this.getViewModel();
43 if (!(view
.isCreate
|| vm
.get('pveceph'))) {
44 return; // only query on create or if editing a pveceph store
47 var monhostField
= this.lookupReference('monhost');
49 Proxmox
.Utils
.API2Request({
50 url
: '/api2/json/nodes/localhost/ceph/mon',
53 callback: function(options
, success
, response
) {
54 var data
= response
.result
.data
;
55 if (response
.status
=== 200) {
56 if (data
.length
> 0) {
57 var monhost
= Ext
.Array
.pluck(data
, 'name').sort().join(',');
58 monhostField
.setValue(monhost
);
59 monhostField
.resetOriginalValue();
61 vm
.set('pvecephPossible', true);
64 vm
.set('pveceph', false);
67 vm
.set('pveceph', false);
68 vm
.set('pvecephPossible', false);
75 setValues: function(values
) {
77 this.viewModel
.set('pveceph', false);
78 this.lookupReference('pvecephRef').setValue(false);
79 this.lookupReference('pvecephRef').resetOriginalValue();
81 this.callParent([values
]);
84 initComponent : function() {
88 me
.nodename
= 'localhost';
92 var getBinds = function (activeIfPVECeph
, hide
) {
94 disabled
: activeIfPVECeph
? '{!pveceph}' : '{pveceph}'
97 // displayfield has no submitValue and bind mixin cannot handle that
99 bind
.submitValue
= activeIfPVECeph
? '{pveceph}' : '{!pveceph}';
102 bind
.hidden
= activeIfPVECeph
? '{!pveceph}' : '{pveceph}';
110 xtype
: me
.isCreate
? 'pveCephPoolSelector' : 'displayfield',
111 nodename
: me
.nodename
,
113 bind
: getBinds(true, true),
114 fieldLabel
: gettext('Pool'),
118 xtype
: me
.isCreate
? 'textfield' : 'displayfield',
121 bind
: getBinds(false, true),
122 fieldLabel
: gettext('Pool'),
129 bind
: getBinds(false, true),
131 fieldLabel
: 'Monitor(s)',
135 xtype
: 'displayfield',
136 reference
: 'monhost',
138 disabled
: '{!pveceph}',
142 fieldLabel
: 'Monitor(s)'
145 xtype
: me
.isCreate
? 'textfield' : 'displayfield',
147 bind
: me
.isCreate
? getBinds(false) : {},
149 fieldLabel
: gettext('User name'),
156 xtype
: 'pveContentTypeSelector',
157 cts
: ['images', 'rootdir'],
158 fieldLabel
: gettext('Content'),
165 xtype
: 'proxmoxcheckbox',
173 xtype
: 'proxmoxcheckbox',
175 reference
: 'pvecephRef',
177 disabled
: '{!pvecephPossible}',
183 hidden
: !me
.isCreate
,
184 boxLabel
: gettext('Use Proxmox VE managed hyper-converged ceph pool')