wakame-vdc-webui 10.12.0 → 11.06.0
Sign up to get free protection for your applications and to get access to all the features.
- data/INSTALL-API.txt +14 -0
- data/Rakefile +5 -1
- data/app/api/config/environment.rb +9 -0
- data/app/controllers/accounts_controller.rb +39 -1
- data/app/controllers/application_controller.rb +73 -1
- data/app/controllers/instance_specs_controller.rb +11 -0
- data/app/controllers/instances_controller.rb +7 -3
- data/app/controllers/{images_controller.rb → machine_images_controller.rb} +2 -3
- data/app/controllers/sessions_controller.rb +6 -3
- data/app/controllers/snapshots_controller.rb +17 -6
- data/app/controllers/volumes_controller.rb +6 -2
- data/app/helpers/application_helper.rb +9 -5
- data/app/helpers/machine_images_helper.rb +2 -0
- data/app/models/account.rb +22 -4
- data/app/models/base_new.rb +11 -2
- data/app/models/dcmgr_resource/base.rb +13 -0
- data/app/models/dcmgr_resource/instance_spec.rb +7 -0
- data/app/models/dcmgr_resource/volume_snapshot.rb +6 -0
- data/app/models/information.rb +1 -1
- data/app/models/oauth_consumer.rb +15 -0
- data/app/models/oauth_token.rb +10 -0
- data/app/models/user.rb +34 -1
- data/app/views/accounts/index.html.erb +42 -67
- data/app/views/accounts/password.html.erb +35 -0
- data/app/views/dialog/attach_volume.html.erb +2 -2
- data/app/views/dialog/create_and_edit_security_group.html.erb +61 -28
- data/app/views/dialog/create_snapshot.html.erb +11 -4
- data/app/views/dialog/create_ssh_keypair.html.erb +2 -2
- data/app/views/dialog/create_volume.html.erb +3 -4
- data/app/views/dialog/create_volume_from_snapshot.html.erb +1 -1
- data/app/views/dialog/delete_security_group.html.erb +1 -1
- data/app/views/dialog/delete_snapshot.html.erb +1 -1
- data/app/views/dialog/delete_ssh_keypair.html.erb +1 -1
- data/app/views/dialog/delete_volume.html.erb +1 -1
- data/app/views/dialog/detach_volume.html.erb +1 -1
- data/app/views/dialog/launch_instance.html.erb +10 -14
- data/app/views/dialog/reboot_instances.html.erb +1 -1
- data/app/views/dialog/terminate_instances.html.erb +1 -1
- data/app/views/home/index.html.erb +11 -11
- data/app/views/host_pools/index.html.erb +87 -92
- data/app/views/instances/index.html.erb +50 -52
- data/app/views/keypairs/index.html.erb +16 -16
- data/app/views/layouts/_header.html.erb +6 -6
- data/app/views/layouts/_informationarea.html.erb +5 -5
- data/app/views/layouts/_login_header.erb +1 -1
- data/app/views/layouts/_sidemenu.html.erb +30 -28
- data/app/views/layouts/application.html.erb +19 -3
- data/app/views/layouts/login.html.erb +4 -4
- data/app/views/{images → machine_images}/index.html.erb +20 -39
- data/app/views/security_groups/index.html.erb +20 -23
- data/app/views/sessions/new.html.erb +10 -5
- data/app/views/snapshots/index.html.erb +28 -26
- data/app/views/storage_pools/index.html.erb +17 -22
- data/app/views/volumes/index.html.erb +32 -34
- data/config/application-cli.rb +33 -0
- data/config/{application-api.rb → cli_token.rb} +0 -0
- data/config/environment-cli.rb +4 -0
- data/config/environments/development.rb +19 -0
- data/config/initializers/dcmgr_gui.rb +8 -3
- data/config/initializers/sequel.rb +4 -0
- data/config/initializers/site.rb +8 -0
- data/config/locales/en.yml +307 -1
- data/config/locales/ja-JP.yml +4 -0
- data/config/locales/ja.yml +309 -0
- data/config/routes.rb +16 -9
- data/lib/cli/account.rb +264 -0
- data/lib/cli/base.rb +74 -0
- data/lib/cli/errors.rb +59 -0
- data/lib/cli/user.rb +226 -0
- data/lib/tasks/dcmgr_api.rake +65 -12
- data/lib/tasks/dcmgr_gui.rake +96 -4
- data/lib/tasks/dcmgr_oauth.rake +39 -0
- data/public/i18n/Messages.properties +0 -0
- data/public/images/Chevron.gif +0 -0
- data/public/images/ChevronOverlay.png +0 -0
- data/public/images/IconHome.gif +0 -0
- data/public/images/bg-box-body.gif +0 -0
- data/public/images/bg-box-body.png +0 -0
- data/public/images/bg-box-bottom.gif +0 -0
- data/public/images/bg-box-bottom.png +0 -0
- data/public/images/bg-box-top.gif +0 -0
- data/public/images/bg-box-top.png +0 -0
- data/public/images/cluetip/arrowdown.gif +0 -0
- data/public/images/cluetip/arrowleft.gif +0 -0
- data/public/images/cluetip/arrowright.gif +0 -0
- data/public/images/cluetip/arrowup.gif +0 -0
- data/public/images/cluetip/bl.gif +0 -0
- data/public/images/cluetip/bl.png +0 -0
- data/public/images/cluetip/br.gif +0 -0
- data/public/images/cluetip/br.png +0 -0
- data/public/images/cluetip/darrowdown.gif +0 -0
- data/public/images/cluetip/darrowleft.gif +0 -0
- data/public/images/cluetip/darrowright.gif +0 -0
- data/public/images/cluetip/darrowup.gif +0 -0
- data/public/images/cluetip/itunes.png +0 -0
- data/public/images/cluetip/rarrowdown.gif +0 -0
- data/public/images/cluetip/rarrowleft.gif +0 -0
- data/public/images/cluetip/rarrowright.gif +0 -0
- data/public/images/cluetip/rarrowup.gif +0 -0
- data/public/images/cluetip/tl.gif +0 -0
- data/public/images/cluetip/tl.png +0 -0
- data/public/images/cluetip/tr.gif +0 -0
- data/public/images/cluetip/tr.png +0 -0
- data/public/images/cluetip/wait.gif +0 -0
- data/public/images/dialog-error.png +0 -0
- data/public/images/dialog-help.png +0 -0
- data/public/images/dialog-information.png +0 -0
- data/public/images/dialog-warning.png +0 -0
- data/public/images/ui-bg_flat_55_fcf0ba_40x100.png +0 -0
- data/public/images/ui-bg_glass_10_136d76_1x400.png +0 -0
- data/public/images/ui-bg_glass_10_458845_1x400.png +0 -0
- data/public/images/ui-bg_highlight-hard_100_f5f3e5_1x100.png +0 -0
- data/public/images/ui-bg_highlight-hard_100_fafaf4_1x100.png +0 -0
- data/public/images/ui-bg_highlight-soft_50_136d76_1x100.png +0 -0
- data/public/images/ui-bg_inset-soft_15_386b3d_1x100.png +0 -0
- data/public/images/ui-icons_4c9052_256x240.png +0 -0
- data/public/images/ui-icons_847e71_256x240.png +0 -0
- data/public/javascripts/dcmgr_gui/account_panel.js +6 -0
- data/public/javascripts/dcmgr_gui/application.js +78 -5
- data/public/javascripts/dcmgr_gui/core.js +409 -102
- data/public/javascripts/dcmgr_gui/dashboard_panel.js +12 -3
- data/public/javascripts/dcmgr_gui/host_pool_panel.js +1 -1
- data/public/javascripts/dcmgr_gui/image_panel.js +119 -65
- data/public/javascripts/dcmgr_gui/instance_panel.js +86 -44
- data/public/javascripts/dcmgr_gui/security_group_panel.js +135 -77
- data/public/javascripts/dcmgr_gui/snapshot_panel.js +119 -61
- data/public/javascripts/dcmgr_gui/sshkeypair_panel.js +71 -47
- data/public/javascripts/dcmgr_gui/storage_pool_panel.js +10 -10
- data/public/javascripts/dcmgr_gui/volume_panel.js +311 -155
- data/public/javascripts/jquery.cluetip.min.js +33 -0
- data/public/javascripts/jquery.easing.1.3.js +205 -0
- data/public/javascripts/jquery.hoverIntent.js +114 -0
- data/public/javascripts/jquery.i18n.properties-min.js +7 -0
- data/public/javascripts/jquery.jBreadCrumb.1.1.js +240 -0
- data/public/javascripts/sexyalertbox.v1.2.jquery.js +414 -0
- data/public/javascripts/ui.selectmenu.js +541 -0
- data/public/stylesheets/BreadCrumb.css +109 -0
- data/public/stylesheets/common.css +146 -86
- data/public/stylesheets/dialog.css +7 -7
- data/public/stylesheets/jquery-ui-1.8.4.custom.css +41 -40
- data/public/stylesheets/jquery.cluetip.css +179 -0
- data/public/stylesheets/sexyalertbox.css +67 -0
- data/public/stylesheets/ui.selectmenu.css +24 -0
- data/test/functional/{images_controller_test.rb → machine_images_controller_test.rb} +1 -1
- data/test/unit/helpers/machine_images_helper_test.rb +4 -0
- metadata +350 -221
- data/README +0 -256
- data/app/api/auth_server.rb +0 -28
- data/app/helpers/images_helper.rb +0 -2
- data/app/views/information/index.html.erb +0 -25
- data/app/views/layouts/_service_health.erb +0 -27
- data/test/unit/helpers/images_helper_test.rb +0 -4
@@ -14,11 +14,19 @@ DcmgrGUI.prototype.dashboardPanel = function(){
|
|
14
14
|
|
15
15
|
parallel({
|
16
16
|
total_instance: $.getJSON('/instances/total.json'),
|
17
|
-
total_image: $.getJSON('/
|
17
|
+
total_image: $.getJSON('/machine_images/total.json'),
|
18
18
|
total_volume: $.getJSON('/volumes/total.json'),
|
19
19
|
total_snapshot: $.getJSON('/snapshots/total.json'),
|
20
20
|
total_security_group: $.getJSON('/security_groups/total.json'),
|
21
21
|
total_keypair: $.getJSON('/keypairs/total.json')
|
22
|
+
}).error(function (e) {
|
23
|
+
this.cancel();
|
24
|
+
$("#total_instance").empty().html('');
|
25
|
+
$("#total_image").empty().html('');
|
26
|
+
$("#total_volume").empty().html('');
|
27
|
+
$("#total_snapshot").empty().html('');
|
28
|
+
$("#total_security_group").empty().html('');
|
29
|
+
$("#total_keypair").empty().html('');
|
22
30
|
}).next(function(results) {
|
23
31
|
$('#total_instance').html(results.total_instance);
|
24
32
|
$('#total_image').html(results.total_image);
|
@@ -29,6 +37,7 @@ DcmgrGUI.prototype.dashboardPanel = function(){
|
|
29
37
|
});
|
30
38
|
|
31
39
|
});
|
32
|
-
|
40
|
+
|
41
|
+
$(bt_refresh.target).button({ disabled: false });
|
33
42
|
bt_refresh.element.trigger('dcmgrGUI.refresh');
|
34
|
-
}
|
43
|
+
}
|
@@ -3,7 +3,7 @@ DcmgrGUI.prototype.imagePanel = function(){
|
|
3
3
|
var maxrow = 10;
|
4
4
|
var page = 1;
|
5
5
|
var list_request = {
|
6
|
-
"url":DcmgrGUI.Util.getPagePath('/
|
6
|
+
"url":DcmgrGUI.Util.getPagePath('/machine_images/list/',page),
|
7
7
|
"data" : DcmgrGUI.Util.getPagenateData(page,maxrow)
|
8
8
|
}
|
9
9
|
|
@@ -37,6 +37,10 @@ DcmgrGUI.prototype.imagePanel = function(){
|
|
37
37
|
"state_reason":"-"
|
38
38
|
}
|
39
39
|
}
|
40
|
+
|
41
|
+
var close_button_name = $.i18n.prop('close_button');
|
42
|
+
var launch_button_name = $.i18n.prop('launch_button');
|
43
|
+
|
40
44
|
var c_pagenate = new DcmgrGUI.Pagenate({
|
41
45
|
row:maxrow,
|
42
46
|
total:total
|
@@ -51,7 +55,7 @@ DcmgrGUI.prototype.imagePanel = function(){
|
|
51
55
|
|
52
56
|
c_list.setDetailTemplate({
|
53
57
|
template_id:'#imagesDetailTemplate',
|
54
|
-
detail_path:'/
|
58
|
+
detail_path:'/machine_images/show/'
|
55
59
|
});
|
56
60
|
|
57
61
|
c_list.element.bind('dcmgrGUI.contentChange',function(event,params){
|
@@ -65,7 +69,7 @@ DcmgrGUI.prototype.imagePanel = function(){
|
|
65
69
|
|
66
70
|
bt_refresh.element.bind('dcmgrGUI.refresh',function(){
|
67
71
|
c_list.page = c_pagenate.current_page;
|
68
|
-
list_request.url = DcmgrGUI.Util.getPagePath('/
|
72
|
+
list_request.url = DcmgrGUI.Util.getPagePath('/machine_images/list/',c_pagenate.current_page);
|
69
73
|
list_request.data = DcmgrGUI.Util.getPagenateData(c_pagenate.start,c_pagenate.row);
|
70
74
|
c_list.element.trigger('dcmgrGUI.updateList',{request:list_request})
|
71
75
|
|
@@ -77,7 +81,7 @@ DcmgrGUI.prototype.imagePanel = function(){
|
|
77
81
|
|
78
82
|
//update
|
79
83
|
c_list.checked_list[check_id].c_detail.update({
|
80
|
-
url:DcmgrGUI.Util.getPagePath('/
|
84
|
+
url:DcmgrGUI.Util.getPagePath('/machine_images/show/',check_id)
|
81
85
|
},true);
|
82
86
|
});
|
83
87
|
});
|
@@ -88,11 +92,46 @@ DcmgrGUI.prototype.imagePanel = function(){
|
|
88
92
|
bt_refresh.element.trigger('dcmgrGUI.refresh');
|
89
93
|
});
|
90
94
|
|
95
|
+
var launch_instance_buttons = {};
|
96
|
+
launch_instance_buttons[close_button_name] = function() { $(this).dialog("close"); };
|
97
|
+
launch_instance_buttons[launch_button_name] = function() {
|
98
|
+
var image_id = $(this).find('#image_id').val();
|
99
|
+
var host_pool_id = $(this).find('#host_pool').find('option:selected').val();
|
100
|
+
var host_name = $(this).find('#host_name').val();
|
101
|
+
var instance_spec_id = $(this).find('#instance_specs').val();
|
102
|
+
var ssh_key_pair = $(this).find('#ssh_key_pair').find('option:selected').text();
|
103
|
+
var launch_in = $(this).find('#right_select_list').find('option');
|
104
|
+
var user_data = $(this).find('#user_data').val();
|
105
|
+
var nf_group = [];
|
106
|
+
$.each(launch_in,function(i){
|
107
|
+
nf_group.push("nf_group[]="+ $(this).text());
|
108
|
+
});
|
109
|
+
var nf_strings = nf_group.join('&');
|
110
|
+
|
111
|
+
var data = "image_id="+image_id
|
112
|
+
+"&host_pool_id="+host_pool_id
|
113
|
+
+"&instance_spec_id="+instance_spec_id
|
114
|
+
+"&host_name="+host_name
|
115
|
+
+"&user_data="+user_data
|
116
|
+
+"&"+nf_strings
|
117
|
+
+"&ssh_key="+ssh_key_pair;
|
118
|
+
|
119
|
+
request = new DcmgrGUI.Request;
|
120
|
+
request.post({
|
121
|
+
"url": '/instances',
|
122
|
+
"data": data,
|
123
|
+
success: function(json,status){
|
124
|
+
bt_refresh.element.trigger('dcmgrGUI.refresh');
|
125
|
+
}
|
126
|
+
});
|
127
|
+
$(this).dialog("close");
|
128
|
+
}
|
129
|
+
|
91
130
|
var bt_launch_instance = new DcmgrGUI.Dialog({
|
92
131
|
target:'.launch_instance',
|
93
132
|
width:583,
|
94
133
|
height:600,
|
95
|
-
title
|
134
|
+
title:$.i18n.prop('launch_instance_header'),
|
96
135
|
path:'/launch_instance',
|
97
136
|
callback: function(){
|
98
137
|
var self = this;
|
@@ -100,16 +139,32 @@ DcmgrGUI.prototype.imagePanel = function(){
|
|
100
139
|
var loading_image = DcmgrGUI.Util.getLoadingImage('boxes');
|
101
140
|
$(this).find('#select_host_pool').empty().html(loading_image);
|
102
141
|
$(this).find('#select_ssh_key_pair').empty().html(loading_image);
|
103
|
-
$(this).find("#left_select_list").mask(
|
142
|
+
$(this).find("#left_select_list").mask($.i18n.prop('loading_parts'));
|
104
143
|
|
144
|
+
var request = new DcmgrGUI.Request;
|
145
|
+
var is_ready = {
|
146
|
+
'host_pool': false,
|
147
|
+
'instance_spec': false,
|
148
|
+
'ssh_keypair': false,
|
149
|
+
'security_groups': false
|
150
|
+
};
|
151
|
+
|
152
|
+
var ready = function(data) {
|
153
|
+
if(data['host_pool'] == true &&
|
154
|
+
data['instance_spec'] == true &&
|
155
|
+
data['ssh_keypair'] == true &&
|
156
|
+
data['security_groups'] == true) {
|
157
|
+
bt_launch_instance.disabledButton(1, false);
|
158
|
+
} else {
|
159
|
+
bt_launch_instance.disabledButton(1, true);
|
160
|
+
}
|
161
|
+
}
|
162
|
+
|
105
163
|
parallel({
|
106
164
|
//get host_pools
|
107
165
|
host_pools:
|
108
|
-
|
109
|
-
"type": "GET",
|
110
|
-
"async": true,
|
166
|
+
request.get({
|
111
167
|
"url": '/host_pools/show_host_pools.json',
|
112
|
-
"dataType": "json",
|
113
168
|
success: function(json,status){
|
114
169
|
var select_html = '<select id="host_pool" name="host_pool"></select>';
|
115
170
|
$(self).find('#select_host_pool').empty().html(select_html);
|
@@ -117,28 +172,54 @@ DcmgrGUI.prototype.imagePanel = function(){
|
|
117
172
|
var results = json.host_pool.results;
|
118
173
|
var size = results.length;
|
119
174
|
var select_host_pool = $(self).find('#host_pool');
|
175
|
+
for (var i=0; i < size ; i++) {
|
176
|
+
if(results[i].result.status == 'online') {
|
177
|
+
is_ready['host_pool'] = true;
|
178
|
+
var uuid = results[i].result.uuid;
|
179
|
+
var html = '<option value="'+ uuid +'">'+uuid+'</option>';
|
180
|
+
select_host_pool.append(html);
|
181
|
+
}
|
182
|
+
}
|
183
|
+
}
|
184
|
+
}),
|
185
|
+
//get instance_specs
|
186
|
+
instance_specs:
|
187
|
+
request.get({
|
188
|
+
"url": '/instance_specs/all.json',
|
189
|
+
success: function(json,status){
|
190
|
+
var select_html = '<select id="instance_specs" name="instance_specs"></select>';
|
191
|
+
$(self).find('#select_instance_specs').empty().html(select_html);
|
192
|
+
|
193
|
+
var results = json.instance_spec.results;
|
194
|
+
var size = results.length;
|
195
|
+
var select_instance_specs = $(self).find('#instance_specs');
|
196
|
+
if(size > 0) {
|
197
|
+
is_ready['instance_spec'] = true;
|
198
|
+
}
|
199
|
+
|
120
200
|
for (var i=0; i < size ; i++) {
|
121
201
|
var uuid = results[i].result.uuid;
|
122
202
|
var html = '<option value="'+ uuid +'">'+uuid+'</option>';
|
123
|
-
|
203
|
+
select_instance_specs.append(html);
|
124
204
|
}
|
125
205
|
}
|
126
206
|
}),
|
127
207
|
//get ssh key pairs
|
128
208
|
ssh_keypairs:
|
129
|
-
|
130
|
-
"type": "GET",
|
131
|
-
"async": true,
|
209
|
+
request.get({
|
132
210
|
"url": '/keypairs/all.json',
|
133
|
-
"dataType": "json",
|
134
211
|
"data": "",
|
135
212
|
success: function(json,status){
|
136
213
|
var select_html = '<select id="ssh_key_pair" name="host_pool"></select>';
|
137
214
|
$(self).find('#select_ssh_key_pair').empty().html(select_html);
|
138
|
-
|
215
|
+
|
139
216
|
var results = json.ssh_key_pair.results;
|
140
217
|
var size = results.length;
|
141
218
|
var select_keypair = $(self).find('#ssh_key_pair');
|
219
|
+
if(size > 0) {
|
220
|
+
is_ready['ssh_keypair'] = true;
|
221
|
+
}
|
222
|
+
|
142
223
|
for (var i=0; i < size ; i++) {
|
143
224
|
var name = results[i].result.name;
|
144
225
|
var ssh_keypair_id = results[i].result.id;
|
@@ -149,16 +230,13 @@ DcmgrGUI.prototype.imagePanel = function(){
|
|
149
230
|
}),
|
150
231
|
//get security groups
|
151
232
|
security_groups:
|
152
|
-
|
153
|
-
"type": "GET",
|
154
|
-
"async": true,
|
233
|
+
request.get({
|
155
234
|
"url": '/security_groups/all.json',
|
156
|
-
"dataType": "json",
|
157
235
|
"data": "",
|
158
236
|
success: function(json,status){
|
159
237
|
var data = [];
|
160
238
|
var results = json.netfilter_group.results;
|
161
|
-
var size = results.length
|
239
|
+
var size = results.length;
|
162
240
|
for (var i=0; i < size ; i++) {
|
163
241
|
data.push({
|
164
242
|
"value" : results[i].result.uuid,
|
@@ -169,74 +247,50 @@ DcmgrGUI.prototype.imagePanel = function(){
|
|
169
247
|
var security_group = new DcmgrGUI.ItemSelector({
|
170
248
|
'left_select_id' : '#left_select_list',
|
171
249
|
'right_select_id' : "#right_select_list",
|
172
|
-
"data" : data
|
250
|
+
"data" : data,
|
251
|
+
'target' : self
|
173
252
|
});
|
253
|
+
|
254
|
+
var on_ready = function(size){
|
255
|
+
if(size > 0) {
|
256
|
+
is_ready['security_groups'] = true;
|
257
|
+
ready(is_ready);
|
258
|
+
} else {
|
259
|
+
is_ready['security_groups'] = false;
|
260
|
+
ready(is_ready);
|
261
|
+
}
|
262
|
+
}
|
174
263
|
|
175
264
|
$(self).find('#right_button').click(function(){
|
176
265
|
security_group.leftToRight();
|
266
|
+
on_ready(security_group.getRightSelectionCount());
|
177
267
|
});
|
178
268
|
|
179
269
|
$(self).find('#left_button').click(function(){
|
180
270
|
security_group.rightToLeft();
|
271
|
+
on_ready(security_group.getRightSelectionCount());
|
181
272
|
});
|
182
273
|
}
|
183
274
|
})
|
184
275
|
}).next(function(results) {
|
185
|
-
bt_launch_instance.disabledButton('Launch',false);
|
186
276
|
$("#left_select_list").unmask();
|
187
277
|
});
|
188
278
|
},
|
189
|
-
button:
|
190
|
-
"Launch": function() {
|
191
|
-
var image_id = $(this).find('#image_id').val();
|
192
|
-
var host_pool_id = $(this).find('#host_pool').find('option:selected').val();
|
193
|
-
var host_name = $(this).find('#host_name').val();
|
194
|
-
var instance_spec = $(this).find('#instance_spec').val();
|
195
|
-
var ssh_key_pair = $(this).find('#ssh_key_pair').find('option:selected').text();
|
196
|
-
var launch_in = $(this).find('#right_select_list').find('option');
|
197
|
-
var user_data = $(this).find('#user_data').val();
|
198
|
-
var nf_group = [];
|
199
|
-
$.each(launch_in,function(i){
|
200
|
-
nf_group.push("nf_group[]="+ $(this).text());
|
201
|
-
});
|
202
|
-
var nf_strings = nf_group.join('&');
|
203
|
-
|
204
|
-
var data = "image_id="+image_id
|
205
|
-
+"&host_pool_id="+host_pool_id
|
206
|
-
+"&instance_spec_id="+instance_spec
|
207
|
-
+"&host_name="+host_name
|
208
|
-
+"&user_data="+user_data
|
209
|
-
+"&"+nf_strings
|
210
|
-
+"&ssh_key="+ssh_key_pair;
|
211
|
-
|
212
|
-
$.ajax({
|
213
|
-
"type": "POST",
|
214
|
-
"async": true,
|
215
|
-
"url": '/instances',
|
216
|
-
"dataType": "json",
|
217
|
-
"data": data,
|
218
|
-
success: function(json,status){
|
219
|
-
bt_refresh.element.trigger('dcmgrGUI.refresh');
|
220
|
-
}
|
221
|
-
});
|
222
|
-
$(this).dialog("close");
|
223
|
-
}
|
224
|
-
}
|
225
|
-
});
|
226
|
-
|
227
|
-
bt_launch_instance.element.bind('dialogopen',function(){
|
228
|
-
bt_launch_instance.disabledButton('Launch',true);
|
279
|
+
button: launch_instance_buttons
|
229
280
|
});
|
230
281
|
|
231
282
|
bt_launch_instance.target.bind('click',function(){
|
232
283
|
var id = c_list.currentChecked();
|
233
284
|
if( id ){
|
234
285
|
bt_launch_instance.open({"ids":[id]});
|
286
|
+
bt_launch_instance.disabledButton(1, true);
|
235
287
|
}
|
236
288
|
return false;
|
237
289
|
});
|
238
|
-
|
290
|
+
|
291
|
+
$(bt_launch_instance.target).button({ disabled: false });
|
292
|
+
$(bt_refresh.target).button({ disabled: false });
|
239
293
|
//list
|
240
294
|
c_list.setData(null);
|
241
295
|
c_list.update(list_request,true);
|
242
|
-
}
|
296
|
+
}
|
@@ -30,6 +30,10 @@ DcmgrGUI.prototype.instancePanel = function(){
|
|
30
30
|
"owner":'-'
|
31
31
|
}
|
32
32
|
}
|
33
|
+
|
34
|
+
var close_button_name = $.i18n.prop('close_button');
|
35
|
+
var terminate_button_name = $.i18n.prop('terminate_button');
|
36
|
+
var reboot_button_name = $.i18n.prop('reboot_button');
|
33
37
|
|
34
38
|
var c_pagenate = new DcmgrGUI.Pagenate({
|
35
39
|
row:maxrow,
|
@@ -43,16 +47,9 @@ DcmgrGUI.prototype.instancePanel = function(){
|
|
43
47
|
page:page
|
44
48
|
});
|
45
49
|
|
46
|
-
var detail_filter = new DcmgrGUI.Filter();
|
47
|
-
detail_filter.add(function(data){
|
48
|
-
data.item.memory_size = data.item.memory_size + 'MB';
|
49
|
-
return data;
|
50
|
-
});
|
51
|
-
|
52
50
|
c_list.setDetailTemplate({
|
53
51
|
template_id:'#instancesDetailTemplate',
|
54
|
-
detail_path:'/instances/show/'
|
55
|
-
filter: detail_filter
|
52
|
+
detail_path:'/instances/show/'
|
56
53
|
});
|
57
54
|
|
58
55
|
c_list.element.bind('dcmgrGUI.contentChange',function(event,params){
|
@@ -66,11 +63,16 @@ DcmgrGUI.prototype.instancePanel = function(){
|
|
66
63
|
var results = data.instance.results;
|
67
64
|
var size = results.length;
|
68
65
|
for(var i = 0; i < size; i++) {
|
69
|
-
results[i].result.memory_size = results[i].result.memory_size
|
66
|
+
results[i].result.memory_size = DcmgrGUI.Converter.unit(results[i].result.memory_size, 'megabyte');
|
70
67
|
}
|
71
68
|
return data;
|
72
69
|
});
|
73
70
|
|
71
|
+
c_list.detail_filter.add(function(data){
|
72
|
+
data.item.memory_size = DcmgrGUI.Converter.unit(data.item.memory_size, 'megabyte');
|
73
|
+
return data;
|
74
|
+
});
|
75
|
+
|
74
76
|
var bt_refresh = new DcmgrGUI.Refresh();
|
75
77
|
|
76
78
|
var instance_action_helper = function(action){
|
@@ -84,16 +86,14 @@ DcmgrGUI.prototype.instancePanel = function(){
|
|
84
86
|
|
85
87
|
var data = $.param({ids:ids});
|
86
88
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
}
|
96
|
-
});
|
89
|
+
var request = new DcmgrGUI.Request;
|
90
|
+
request.post({
|
91
|
+
"url": '/instances/'+ action,
|
92
|
+
"data": data,
|
93
|
+
success: function(json, status) {
|
94
|
+
bt_refresh.element.trigger('dcmgrGUI.refresh');
|
95
|
+
}
|
96
|
+
});
|
97
97
|
|
98
98
|
$(this).dialog("close");
|
99
99
|
};
|
@@ -126,32 +126,32 @@ DcmgrGUI.prototype.instancePanel = function(){
|
|
126
126
|
}
|
127
127
|
});
|
128
128
|
|
129
|
+
var instance_reboot_buttons = {};
|
130
|
+
instance_reboot_buttons[close_button_name] = function() { $(this).dialog("close"); }
|
131
|
+
instance_reboot_buttons[reboot_button_name] = function() {
|
132
|
+
instance_action_helper.call(this,'reboot');
|
133
|
+
}
|
129
134
|
var bt_instance_reboot = new DcmgrGUI.Dialog({
|
130
135
|
target:'.reboot_instances',
|
131
136
|
width:400,
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
"Close": function() { $(this).dialog("close"); },
|
137
|
-
"Yes, Reboot": function() {
|
138
|
-
instance_action_helper.call(this,'reboot');
|
139
|
-
}
|
140
|
-
}
|
137
|
+
height:200,
|
138
|
+
title:$.i18n.prop('reboot_instances_header'),
|
139
|
+
path:'/reboot_instances',
|
140
|
+
button: instance_reboot_buttons
|
141
141
|
});
|
142
142
|
|
143
|
+
var instance_terminate_buttons = {};
|
144
|
+
instance_terminate_buttons[close_button_name] = function() { $(this).dialog("close"); };
|
145
|
+
instance_terminate_buttons[terminate_button_name] = function() {
|
146
|
+
instance_action_helper.call(this,'terminate');
|
147
|
+
}
|
143
148
|
var bt_instance_terminate = new DcmgrGUI.Dialog({
|
144
149
|
target:'.terminate_instances',
|
145
150
|
width:400,
|
146
151
|
height:200,
|
147
|
-
title
|
152
|
+
title:$.i18n.prop('terminate_instances_header'),
|
148
153
|
path:'/terminate_instances',
|
149
|
-
button:
|
150
|
-
"Close": function() { $(this).dialog("close"); },
|
151
|
-
"Yes, Terminate": function() {
|
152
|
-
instance_action_helper.call(this,'terminate');
|
153
|
-
}
|
154
|
-
}
|
154
|
+
button: instance_terminate_buttons
|
155
155
|
});
|
156
156
|
|
157
157
|
bt_instance_start.target.bind('click',function(){
|
@@ -162,14 +162,6 @@ DcmgrGUI.prototype.instancePanel = function(){
|
|
162
162
|
bt_instance_stop.open(c_list.getCheckedInstanceIds());
|
163
163
|
});
|
164
164
|
|
165
|
-
bt_instance_reboot.target.bind('click',function(){
|
166
|
-
bt_instance_reboot.open(c_list.getCheckedInstanceIds());
|
167
|
-
});
|
168
|
-
|
169
|
-
bt_instance_terminate.target.bind('click',function(){
|
170
|
-
bt_instance_terminate.open(c_list.getCheckedInstanceIds());
|
171
|
-
});
|
172
|
-
|
173
165
|
bt_refresh.element.bind('dcmgrGUI.refresh',function(){
|
174
166
|
c_list.page = c_pagenate.current_page;
|
175
167
|
list_request.url = DcmgrGUI.Util.getPagePath('/instances/list/',c_list.page);
|
@@ -191,7 +183,57 @@ DcmgrGUI.prototype.instancePanel = function(){
|
|
191
183
|
bt_refresh.element.trigger('dcmgrGUI.refresh');
|
192
184
|
});
|
193
185
|
|
186
|
+
var selectmenu = $('#instance_action').selectmenu({
|
187
|
+
width: 150,
|
188
|
+
menuWidth: 150,
|
189
|
+
handleWidth: 26,
|
190
|
+
style:'dropdown',
|
191
|
+
select: function(event){
|
192
|
+
var select_action = $(this).val()
|
193
|
+
if (select_action == "terminate") {
|
194
|
+
bt_instance_terminate.open(c_list.getCheckedInstanceIds());
|
195
|
+
}else if(select_action == "reboot") {
|
196
|
+
bt_instance_reboot.open(c_list.getCheckedInstanceIds());
|
197
|
+
}
|
198
|
+
}
|
199
|
+
});
|
200
|
+
$(bt_refresh.target).button({ disabled: false });
|
201
|
+
selectmenu.data('selectmenu').disableButton();
|
202
|
+
|
203
|
+
var actions = {};
|
204
|
+
actions.changeButtonState = function() {
|
205
|
+
var ids = c_list.currentMultiChecked()['ids'];
|
206
|
+
var is_running = false;
|
207
|
+
var is_shutting_down = false;
|
208
|
+
var flag = true;
|
209
|
+
$.each(ids, function(key, uuid){
|
210
|
+
var row_id = '#row-'+uuid;
|
211
|
+
var state = $(row_id).find('.state').text();
|
212
|
+
if(state == 'running') {
|
213
|
+
is_running = true;
|
214
|
+
} else if(state =='shuttingdown') {
|
215
|
+
is_shutting_down = true;
|
216
|
+
} else{
|
217
|
+
flag = false;
|
218
|
+
}
|
219
|
+
});
|
220
|
+
|
221
|
+
if (flag == true){
|
222
|
+
if(is_running == true || is_shutting_down) {
|
223
|
+
selectmenu.data('selectmenu').enableButton();
|
224
|
+
} else {
|
225
|
+
selectmenu.data('selectmenu').disableButton();
|
226
|
+
}
|
227
|
+
} else{
|
228
|
+
selectmenu.data('selectmenu').disableButton();
|
229
|
+
}
|
230
|
+
}
|
231
|
+
|
232
|
+
dcmgrGUI.notification.subscribe('checked_box', actions, 'changeButtonState');
|
233
|
+
dcmgrGUI.notification.subscribe('unchecked_box', actions, 'changeButtonState');
|
234
|
+
dcmgrGUI.notification.subscribe('change_pagenate', selectmenu.data('selectmenu'), 'disableButton');
|
235
|
+
|
194
236
|
//list
|
195
237
|
c_list.setData(null);
|
196
238
|
c_list.update(list_request,true);
|
197
|
-
}
|
239
|
+
}
|