]> git.proxmox.com Git - pve-manager.git/blame - www/manager6/storage/IScsiEdit.js
ui: vm: allow to add socket backed serial devices
[pve-manager.git] / www / manager6 / storage / IScsiEdit.js
CommitLineData
208ba0c6
DM
1Ext.define('PVE.storage.IScsiScan', {
2 extend: 'Ext.form.field.ComboBox',
3 alias: 'widget.pveIScsiScan',
4
5 queryParam: 'portal',
c2317525
DC
6 valueField: 'target',
7 displayField: 'target',
8 matchFieldWidth: false,
9 listConfig: {
10 loadingText: gettext('Scanning...'),
11 width: 350
12 },
208ba0c6
DM
13 doRawQuery: function() {
14 },
15
16 onTriggerClick: function() {
17 var me = this;
18
19 if (!me.queryCaching || me.lastQuery !== me.portal) {
20 me.store.removeAll();
21 }
22
23 me.allQuery = me.portal;
24
25 me.callParent();
26 },
27
28 setPortal: function(portal) {
29 var me = this;
30
31 me.portal = portal;
32 },
33
34 initComponent : function() {
35 var me = this;
36
37 if (!me.nodename) {
38 me.nodename = 'localhost';
39 }
40
41 var store = Ext.create('Ext.data.Store', {
42 fields: [ 'target', 'portal' ],
43 proxy: {
56a353b9 44 type: 'proxmox',
208ba0c6
DM
45 url: '/api2/json/nodes/' + me.nodename + '/scan/iscsi'
46 }
47 });
48
9e9ab96f
WL
49 store.sort('target', 'ASC');
50
208ba0c6 51 Ext.apply(me, {
22f2f9d6 52 store: store
208ba0c6
DM
53 });
54
55 me.callParent();
56 }
57});
58
59Ext.define('PVE.storage.IScsiInputPanel', {
f28ec3e4 60 extend: 'PVE.panel.StorageBase',
208ba0c6
DM
61
62 onGetValues: function(values) {
63 var me = this;
64
208ba0c6
DM
65 values.content = values.luns ? 'images' : 'none';
66 delete values.luns;
67
9c1fe394 68 return me.callParent([values]);
f28ec3e4 69 },
177de3de 70
f28ec3e4
TL
71 setValues: function(values) {
72 values.luns = (values.content === 'images') ? true : false;
73 this.callParent();
208ba0c6
DM
74 },
75
76 initComponent : function() {
77 var me = this;
78
208ba0c6 79 me.column1 = [
208ba0c6 80 {
d5e771ce 81 xtype: me.isCreate ? 'textfield' : 'displayfield',
208ba0c6
DM
82 name: 'portal',
83 value: '',
84 fieldLabel: 'Portal',
85 allowBlank: false,
86 listeners: {
87 change: function(f, value) {
d5e771ce 88 if (me.isCreate) {
208ba0c6
DM
89 var exportField = me.down('field[name=target]');
90 exportField.setPortal(value);
91 exportField.setValue('');
92 }
93 }
94 }
95 },
96 {
d5e771ce
EK
97 readOnly: !me.isCreate,
98 xtype: me.isCreate ? 'pveIScsiScan' : 'displayfield',
208ba0c6
DM
99 name: 'target',
100 value: '',
101 fieldLabel: 'Target',
102 allowBlank: false
103 }
104 ];
105
106 me.column2 = [
208ba0c6
DM
107 {
108 xtype: 'checkbox',
109 name: 'luns',
110 checked: true,
111 fieldLabel: gettext('Use LUNs directly')
112 }
113 ];
114
115 me.callParent();
116 }
117});