]>
Commit | Line | Data |
---|---|---|
78fa6280 DM |
1 | Ext.define('PVE.ha.GroupInputPanel', { |
2 | extend: 'PVE.panel.InputPanel', | |
3 | ||
4 | groupId: undefined, | |
5 | ||
6 | onGetValues: function(values) { | |
7 | var me = this; | |
8 | ||
9 | if (me.create) { | |
10 | values.type = 'group'; | |
11 | } | |
12 | ||
13 | return values; | |
14 | }, | |
15 | ||
16 | initComponent : function() { | |
17 | var me = this; | |
18 | ||
19 | me.column1 = [ | |
20 | { | |
21 | xtype: me.create ? 'textfield' : 'displayfield', | |
22 | name: 'group', | |
23 | height: 22, // hack: set same height as text fields | |
24 | value: me.groupId || '', | |
25 | fieldLabel: 'ID', | |
26 | vtype: 'StorageId', | |
27 | allowBlank: false | |
28 | }, | |
29 | { | |
d46faa2c | 30 | xtype: 'pveNodeSelector', |
78fa6280 DM |
31 | name: 'nodes', |
32 | fieldLabel: gettext('Nodes'), | |
33 | allowBlank: false, | |
34 | multiSelect: true, | |
35 | autoSelect: false | |
36 | } | |
37 | ]; | |
38 | ||
39 | me.column2 = [ | |
40 | { | |
41 | xtype: 'pvecheckbox', | |
42 | name: 'restricted', | |
43 | uncheckedValue: 0, | |
44 | fieldLabel: gettext('restricted') | |
45 | }, | |
46 | { | |
47 | xtype: 'pvecheckbox', | |
48 | name: 'nofailback', | |
49 | uncheckedValue: 0, | |
50 | fieldLabel: gettext('nofailback') | |
51 | }, | |
52 | ]; | |
53 | ||
54 | me.columnB = [ | |
55 | { | |
56 | xtype: 'textfield', | |
57 | name: 'comment', | |
58 | fieldLabel: gettext('Comment') | |
59 | } | |
60 | ]; | |
61 | ||
62 | me.callParent(); | |
63 | } | |
64 | }); | |
65 | ||
66 | Ext.define('PVE.ha.GroupEdit', { | |
67 | extend: 'PVE.window.Edit', | |
68 | ||
69 | groupId: undefined, | |
70 | ||
71 | initComponent : function() { | |
72 | var me = this; | |
73 | ||
74 | me.create = !me.groupId; | |
75 | ||
76 | if (me.create) { | |
77 | me.url = '/api2/extjs/cluster/ha/groups'; | |
78 | me.method = 'POST'; | |
79 | } else { | |
80 | me.url = '/api2/extjs/cluster/ha/groups/' + me.groupId; | |
81 | me.method = 'PUT'; | |
82 | } | |
83 | ||
84 | var ipanel = Ext.create('PVE.ha.GroupInputPanel', { | |
85 | create: me.create, | |
86 | groupId: me.groupId | |
87 | }); | |
88 | ||
89 | Ext.apply(me, { | |
90 | subject: gettext('HA Group'), | |
91 | items: [ ipanel ] | |
92 | }); | |
93 | ||
94 | me.callParent(); | |
95 | ||
96 | if (!me.create) { | |
97 | me.load({ | |
98 | success: function(response, options) { | |
99 | var values = response.result.data; | |
100 | ||
101 | if (values.nodes) { | |
102 | values.nodes = values.nodes.split(','); | |
103 | } | |
104 | ||
105 | ipanel.setValues(values); | |
106 | } | |
107 | }); | |
108 | } | |
109 | } | |
110 | }); |