]>
git.proxmox.com Git - pve-manager.git/blob - www/manager/storage/IScsiEdit.js
bf72fcc1e6a9f67b1458717ab3d41f3835faa077
1 Ext
.define('PVE.storage.IScsiScan', {
2 extend
: 'Ext.form.field.ComboBox',
3 alias
: 'widget.pveIScsiScan',
7 doRawQuery: function() {
10 onTriggerClick: function() {
13 if (!me
.queryCaching
|| me
.lastQuery
!== me
.portal
) {
17 me
.allQuery
= me
.portal
;
22 setPortal: function(portal
) {
28 initComponent : function() {
32 me
.nodename
= 'localhost';
35 var store
= Ext
.create('Ext.data.Store', {
36 fields
: [ 'target', 'portal' ],
39 url
: '/api2/json/nodes/' + me
.nodename
+ '/scan/iscsi'
46 displayField
: 'target',
47 matchFieldWidth
: false,
49 loadingText
: 'Scanning...',
51 // hack: call setHeight to show scroll bars correctly
52 refresh: function(list
) {
53 var lh
= PVE
.Utils
.gridLineHeigh();
54 var count
= store
.getCount();
55 list
.setHeight(lh
* ((count
> 10) ? 10 : count
));
66 Ext
.define('PVE.storage.IScsiInputPanel', {
67 extend
: 'PVE.panel.InputPanel',
69 onGetValues: function(values
) {
73 values
.type
= 'iscsi';
75 delete values
.storage
;
78 values
.content
= values
.luns
? 'images' : 'none';
81 values
.disable
= values
.enable
? 0 : 1;
87 initComponent : function() {
93 xtype
: me
.create
? 'textfield' : 'displayfield',
95 height
: 22, // hack: set same height as text fields
96 value
: me
.storageId
|| '',
102 xtype
: me
.create
? 'textfield' : 'displayfield',
103 height
: 22, // hack: set same height as text fields
106 fieldLabel
: 'Portal',
109 change: function(f
, value
) {
111 var exportField
= me
.down('field[name=target]');
112 exportField
.setPortal(value
);
113 exportField
.setValue('');
119 readOnly
: !me
.create
,
120 xtype
: me
.create
? 'pveIScsiScan' : 'displayfield',
123 fieldLabel
: 'Target',
130 xtype
: 'PVE.form.NodeSelector',
132 fieldLabel
: gettext('Nodes'),
133 emptyText
: gettext('All') + ' (' +
134 gettext('No restrictions') +')',
139 xtype
: 'pvecheckbox',
143 fieldLabel
: gettext('Enable')
149 fieldLabel
: gettext('Use LUNs directly')
157 Ext
.define('PVE.storage.IScsiEdit', {
158 extend
: 'PVE.window.Edit',
160 initComponent : function() {
163 me
.create
= !me
.storageId
;
166 me
.url
= '/api2/extjs/storage';
169 me
.url
= '/api2/extjs/storage/' + me
.storageId
;
173 var ipanel
= Ext
.create('PVE.storage.IScsiInputPanel', {
175 storageId
: me
.storageId
179 subject
: 'iSCSI target',
188 success: function(response
, options
) {
189 var values
= response
.result
.data
;
190 var ctypes
= values
.content
|| '';
192 if (values
.storage
=== 'local') {
193 values
.content
= ctypes
.split(',');
196 values
.nodes
= values
.nodes
.split(',');
198 values
.enable
= values
.disable
? 0 : 1;
199 values
.luns
= (values
.content
=== 'images') ? true : false;
201 ipanel
.setValues(values
);