]>
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', | |
78fa6280 DM |
23 | value: me.groupId || '', |
24 | fieldLabel: 'ID', | |
25 | vtype: 'StorageId', | |
26 | allowBlank: false | |
27 | }, | |
28 | { | |
d46faa2c | 29 | xtype: 'pveNodeSelector', |
78fa6280 DM |
30 | name: 'nodes', |
31 | fieldLabel: gettext('Nodes'), | |
32 | allowBlank: false, | |
33 | multiSelect: true, | |
34 | autoSelect: false | |
35 | } | |
36 | ]; | |
37 | ||
38 | me.column2 = [ | |
39 | { | |
40 | xtype: 'pvecheckbox', | |
41 | name: 'restricted', | |
42 | uncheckedValue: 0, | |
185a77e5 | 43 | fieldLabel: 'restricted' |
78fa6280 DM |
44 | }, |
45 | { | |
46 | xtype: 'pvecheckbox', | |
47 | name: 'nofailback', | |
48 | uncheckedValue: 0, | |
185a77e5 | 49 | fieldLabel: 'nofailback' |
78fa6280 DM |
50 | }, |
51 | ]; | |
52 | ||
53 | me.columnB = [ | |
54 | { | |
55 | xtype: 'textfield', | |
56 | name: 'comment', | |
57 | fieldLabel: gettext('Comment') | |
58 | } | |
59 | ]; | |
60 | ||
61 | me.callParent(); | |
62 | } | |
63 | }); | |
64 | ||
65 | Ext.define('PVE.ha.GroupEdit', { | |
66 | extend: 'PVE.window.Edit', | |
67 | ||
68 | groupId: undefined, | |
69 | ||
70 | initComponent : function() { | |
71 | var me = this; | |
72 | ||
73 | me.create = !me.groupId; | |
74 | ||
75 | if (me.create) { | |
76 | me.url = '/api2/extjs/cluster/ha/groups'; | |
77 | me.method = 'POST'; | |
78 | } else { | |
79 | me.url = '/api2/extjs/cluster/ha/groups/' + me.groupId; | |
80 | me.method = 'PUT'; | |
81 | } | |
82 | ||
83 | var ipanel = Ext.create('PVE.ha.GroupInputPanel', { | |
84 | create: me.create, | |
85 | groupId: me.groupId | |
86 | }); | |
87 | ||
88 | Ext.apply(me, { | |
89 | subject: gettext('HA Group'), | |
90 | items: [ ipanel ] | |
91 | }); | |
92 | ||
93 | me.callParent(); | |
94 | ||
95 | if (!me.create) { | |
96 | me.load({ | |
97 | success: function(response, options) { | |
98 | var values = response.result.data; | |
99 | ||
100 | if (values.nodes) { | |
101 | values.nodes = values.nodes.split(','); | |
102 | } | |
103 | ||
104 | ipanel.setValues(values); | |
105 | } | |
106 | }); | |
107 | } | |
108 | } | |
109 | }); |