|
15 | 15 | // specific language governing permissions and limitations |
16 | 16 | // under the License. |
17 | 17 | (function(cloudStack) { |
18 | | - cloudStack.sections.affinityGroups = { |
19 | | - title: 'label.affinity.groups', |
20 | | - listView: { |
21 | | - id: 'affinityGroups', |
22 | | - fields: { |
23 | | - name: { label: 'label.name' }, |
24 | | - type: { label: 'label.type' } |
25 | | - }, |
26 | | - dataProvider: function(args) { |
27 | | - var data = {}; |
28 | | - if (args.context != null) { |
29 | | - if ("instances" in args.context) { |
30 | | - $.extend(data, { |
31 | | - virtualmachineid: args.context.instances[0].id |
32 | | - }); |
33 | | - } |
34 | | - } |
35 | | - $.ajax({ |
36 | | - url: createURL('listAffinityGroups'), |
37 | | - data: data, |
38 | | - success: function(json) { |
39 | | - var items = json.listaffinitygroupsresponse.affinitygroup; |
40 | | - args.response.success({data: items}); |
41 | | - } |
42 | | - }); |
43 | | - }, |
44 | | - actions: { |
45 | | - add: { |
46 | | - label: 'label.add.affinity.group', |
47 | | - |
48 | | - messages: { |
49 | | - notification: function(args) { |
50 | | - return 'label.add.affinity.group'; |
51 | | - } |
52 | | - }, |
53 | | - |
54 | | - createForm: { |
55 | | - title: 'label.add.affinity.group', |
| 18 | + cloudStack.sections.affinityGroups = { |
| 19 | + title: 'label.affinity.groups', |
| 20 | + listView: { |
| 21 | + id: 'affinityGroups', |
56 | 22 | fields: { |
57 | | - name: { |
58 | | - label: 'label.name', |
59 | | - validation: { required: true } |
60 | | - }, |
61 | | - description: { |
62 | | - label: 'label.description' |
63 | | - }, |
64 | | - type: { |
65 | | - label: 'label.type', |
66 | | - select: function(args) { |
67 | | - $.ajax({ |
68 | | - url: createURL('listAffinityGroupTypes'), |
69 | | - success: function(json) { |
70 | | - var types = []; |
71 | | - var items = json.listaffinitygrouptypesresponse.affinityGroupType; |
72 | | - if(items != null) { |
73 | | - for(var i = 0; i < items.length; i++) { |
74 | | - types.push({id: items[i].type, description: items[i].type}); |
75 | | - } |
76 | | - } |
77 | | - args.response.success({data: types}) |
78 | | - } |
79 | | - }); |
| 23 | + name: { |
| 24 | + label: 'label.name' |
| 25 | + }, |
| 26 | + type: { |
| 27 | + label: 'label.type' |
80 | 28 | } |
81 | | - } |
82 | | - } |
83 | | - }, |
| 29 | + }, |
| 30 | + dataProvider: function(args) { |
| 31 | + var data = {}; |
| 32 | + if (args.context != null) { |
| 33 | + if ("instances" in args.context) { |
| 34 | + $.extend(data, { |
| 35 | + virtualmachineid: args.context.instances[0].id |
| 36 | + }); |
| 37 | + } |
| 38 | + } |
| 39 | + $.ajax({ |
| 40 | + url: createURL('listAffinityGroups'), |
| 41 | + data: data, |
| 42 | + success: function(json) { |
| 43 | + var items = json.listaffinitygroupsresponse.affinitygroup; |
| 44 | + args.response.success({ |
| 45 | + data: items |
| 46 | + }); |
| 47 | + } |
| 48 | + }); |
| 49 | + }, |
| 50 | + actions: { |
| 51 | + add: { |
| 52 | + label: 'label.add.affinity.group', |
84 | 53 |
|
85 | | - action: function(args) { |
86 | | - var data = { |
87 | | - name: args.data.name, |
88 | | - type: args.data.type |
89 | | - }; |
90 | | - if(args.data.description != null && args.data.description.length > 0) |
91 | | - $.extend(data, {description: args.data.description}); |
92 | | - |
93 | | - $.ajax({ |
94 | | - url: createURL('createAffinityGroup'), |
95 | | - data: data, |
96 | | - success: function(json) { |
97 | | - var jid = json.createaffinitygroupresponse.jobid; |
98 | | - args.response.success( |
99 | | - {_custom: |
100 | | - {jobId: jid, |
101 | | - getUpdatedItem: function(json) { |
102 | | - return json.queryasyncjobresultresponse.jobresult.affinitygroup; |
103 | | - } |
104 | | - } |
105 | | - } |
106 | | - ); |
107 | | - } |
108 | | - }); |
109 | | - }, |
| 54 | + messages: { |
| 55 | + notification: function(args) { |
| 56 | + return 'label.add.affinity.group'; |
| 57 | + } |
| 58 | + }, |
110 | 59 |
|
111 | | - notification: { |
112 | | - poll: pollAsyncJobResult |
113 | | - } |
114 | | - } |
115 | | - }, |
116 | | - detailView: { |
117 | | - actions: { |
118 | | - remove: { |
119 | | - label: 'label.delete.affinity.group', |
120 | | - messages: { |
121 | | - confirm: function(args) { |
122 | | - return 'message.delete.affinity.group'; |
123 | | - }, |
124 | | - notification: function(args) { |
125 | | - return 'label.delete.affinity.group'; |
126 | | - } |
127 | | - }, |
128 | | - action: function(args) { |
129 | | - $.ajax({ |
130 | | - url: createURL('deleteAffinityGroup'), |
131 | | - data: { |
132 | | - id: args.context.affinityGroups[0].id |
133 | | - }, |
134 | | - success: function(json) { |
135 | | - var jid = json.deleteaffinitygroupresponse.jobid; |
136 | | - args.response.success({ |
137 | | - _custom:{ |
138 | | - jobId: jid |
139 | | - } |
140 | | - }); |
141 | | - } |
142 | | - }); |
| 60 | + createForm: { |
| 61 | + title: 'label.add.affinity.group', |
| 62 | + fields: { |
| 63 | + name: { |
| 64 | + label: 'label.name', |
| 65 | + validation: { |
| 66 | + required: true |
| 67 | + } |
| 68 | + }, |
| 69 | + description: { |
| 70 | + label: 'label.description' |
| 71 | + }, |
| 72 | + type: { |
| 73 | + label: 'label.type', |
| 74 | + select: function(args) { |
| 75 | + $.ajax({ |
| 76 | + url: createURL('listAffinityGroupTypes'), |
| 77 | + success: function(json) { |
| 78 | + var types = []; |
| 79 | + var items = json.listaffinitygrouptypesresponse.affinityGroupType; |
| 80 | + if (items != null) { |
| 81 | + for (var i = 0; i < items.length; i++) { |
| 82 | + types.push({ |
| 83 | + id: items[i].type, |
| 84 | + description: items[i].type |
| 85 | + }); |
| 86 | + } |
| 87 | + } |
| 88 | + args.response.success({ |
| 89 | + data: types |
| 90 | + }) |
| 91 | + } |
| 92 | + }); |
| 93 | + } |
| 94 | + } |
| 95 | + } |
| 96 | + }, |
| 97 | + |
| 98 | + action: function(args) { |
| 99 | + var data = { |
| 100 | + name: args.data.name, |
| 101 | + type: args.data.type |
| 102 | + }; |
| 103 | + if (args.data.description != null && args.data.description.length > 0) |
| 104 | + $.extend(data, { |
| 105 | + description: args.data.description |
| 106 | + }); |
| 107 | + |
| 108 | + $.ajax({ |
| 109 | + url: createURL('createAffinityGroup'), |
| 110 | + data: data, |
| 111 | + success: function(json) { |
| 112 | + var jid = json.createaffinitygroupresponse.jobid; |
| 113 | + args.response.success({ |
| 114 | + _custom: { |
| 115 | + jobId: jid, |
| 116 | + getUpdatedItem: function(json) { |
| 117 | + return json.queryasyncjobresultresponse.jobresult.affinitygroup; |
| 118 | + } |
| 119 | + } |
| 120 | + }); |
| 121 | + } |
| 122 | + }); |
| 123 | + }, |
| 124 | + |
| 125 | + notification: { |
| 126 | + poll: pollAsyncJobResult |
| 127 | + } |
| 128 | + } |
143 | 129 | }, |
144 | | - notification: { |
145 | | - poll: pollAsyncJobResult |
146 | | - } |
147 | | - } |
148 | | - }, |
| 130 | + detailView: { |
| 131 | + actions: { |
| 132 | + remove: { |
| 133 | + label: 'label.delete.affinity.group', |
| 134 | + messages: { |
| 135 | + confirm: function(args) { |
| 136 | + return 'message.delete.affinity.group'; |
| 137 | + }, |
| 138 | + notification: function(args) { |
| 139 | + return 'label.delete.affinity.group'; |
| 140 | + } |
| 141 | + }, |
| 142 | + action: function(args) { |
| 143 | + $.ajax({ |
| 144 | + url: createURL('deleteAffinityGroup'), |
| 145 | + data: { |
| 146 | + id: args.context.affinityGroups[0].id |
| 147 | + }, |
| 148 | + success: function(json) { |
| 149 | + var jid = json.deleteaffinitygroupresponse.jobid; |
| 150 | + args.response.success({ |
| 151 | + _custom: { |
| 152 | + jobId: jid |
| 153 | + } |
| 154 | + }); |
| 155 | + } |
| 156 | + }); |
| 157 | + }, |
| 158 | + notification: { |
| 159 | + poll: pollAsyncJobResult |
| 160 | + } |
| 161 | + } |
| 162 | + }, |
149 | 163 |
|
150 | | - viewAll: { path: 'instances', label: 'label.instances' }, |
151 | | - |
152 | | - tabs: { |
153 | | - details: { |
154 | | - title: 'label.details', |
155 | | - fields: [ |
156 | | - { |
157 | | - name: { label: 'label.name' } |
158 | | - }, |
159 | | - { |
160 | | - description: { label: 'label.description' }, |
161 | | - type: { label: 'label.type' }, |
162 | | - id: { label: 'label.id' } |
163 | | - } |
164 | | - ], |
| 164 | + viewAll: { |
| 165 | + path: 'instances', |
| 166 | + label: 'label.instances' |
| 167 | + }, |
165 | 168 |
|
166 | | - dataProvider: function(args) { |
167 | | - $.ajax({ |
168 | | - url: createURL('listAffinityGroups'), |
169 | | - data: { |
170 | | - id: args.context.affinityGroups[0].id |
171 | | - }, |
172 | | - success: function(json) { |
173 | | - var item = json.listaffinitygroupsresponse.affinitygroup[0]; |
174 | | - args.response.success({data: item}); |
175 | | - } |
176 | | - }); |
| 169 | + tabs: { |
| 170 | + details: { |
| 171 | + title: 'label.details', |
| 172 | + fields: [{ |
| 173 | + name: { |
| 174 | + label: 'label.name' |
| 175 | + } |
| 176 | + }, { |
| 177 | + description: { |
| 178 | + label: 'label.description' |
| 179 | + }, |
| 180 | + type: { |
| 181 | + label: 'label.type' |
| 182 | + }, |
| 183 | + id: { |
| 184 | + label: 'label.id' |
| 185 | + } |
| 186 | + }], |
| 187 | + |
| 188 | + dataProvider: function(args) { |
| 189 | + $.ajax({ |
| 190 | + url: createURL('listAffinityGroups'), |
| 191 | + data: { |
| 192 | + id: args.context.affinityGroups[0].id |
| 193 | + }, |
| 194 | + success: function(json) { |
| 195 | + var item = json.listaffinitygroupsresponse.affinitygroup[0]; |
| 196 | + args.response.success({ |
| 197 | + data: item |
| 198 | + }); |
| 199 | + } |
| 200 | + }); |
| 201 | + } |
| 202 | + } |
| 203 | + } |
177 | 204 | } |
178 | | - } |
179 | 205 | } |
180 | | - } |
181 | | - } |
182 | | - }; |
| 206 | + }; |
183 | 207 | })(cloudStack); |
0 commit comments