wakame-vdc-webui 11.06.0 → 11.12.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +7 -7
- data/app/controllers/application_controller.rb +5 -1
- data/app/controllers/dialog_controller.rb +5 -8
- data/app/controllers/instances_controller.rb +25 -7
- data/app/controllers/keypairs_controller.rb +2 -3
- data/app/controllers/security_groups_controller.rb +14 -15
- data/app/controllers/sessions_controller.rb +4 -0
- data/app/controllers/snapshots_controller.rb +3 -3
- data/app/controllers/volumes_controller.rb +18 -12
- data/app/models/dcmgr_resource/instance.rb +18 -2
- data/app/models/dcmgr_resource/security_group.rb +38 -0
- data/app/models/dcmgr_resource/ssh_key_pair.rb +0 -1
- data/app/views/dialog/attach_volume.html.erb +7 -11
- data/app/views/dialog/create_and_edit_security_group.html.erb +10 -12
- data/app/views/dialog/create_ssh_keypair.html.erb +9 -14
- data/app/views/dialog/delete_security_group.html.erb +1 -1
- data/app/views/dialog/reboot_instances.html.erb +2 -2
- data/app/views/dialog/start_instances.html.erb +1 -1
- data/app/views/dialog/stop_instances.html.erb +2 -2
- data/app/views/instances/index.html.erb +114 -110
- data/app/views/keypairs/index.html.erb +4 -4
- data/app/views/layouts/login.html.erb +1 -1
- data/app/views/security_groups/index.html.erb +11 -11
- data/app/views/sessions/information.html.erb +0 -0
- data/app/views/sessions/new.html.erb +24 -31
- data/app/views/snapshots/index.html.erb +3 -0
- data/app/views/volumes/index.html.erb +0 -5
- data/config/application.rb +1 -1
- data/config/dcmgr_gui.yml +8 -0
- data/{app/api/config/environment.rb → config/environment-auth.rb} +1 -1
- data/config/environments/development.rb +1 -1
- data/config/environments/production.rb +38 -41
- data/config/environments/test.rb +1 -1
- data/config/initializers/site.rb +1 -1
- data/config/locales/en.yml +16 -7
- data/config/locales/ja.yml +6 -4
- data/config/routes.rb +3 -0
- data/db/migrations/0001_origin.rb +96 -0
- data/lib/cli/account.rb +43 -88
- data/lib/cli/user.rb +0 -37
- data/lib/tasks/dcmgr_gui.rake +2 -2
- data/public/i18n/Messages_en.properties +34 -0
- data/public/i18n/Messages_ja-JP.properties +0 -0
- data/public/i18n/Messages_ja.properties +32 -0
- data/public/javascripts/dcmgr_gui/application.js +7 -7
- data/public/javascripts/dcmgr_gui/core.js +33 -8
- data/public/javascripts/dcmgr_gui/image_panel.js +6 -8
- data/public/javascripts/dcmgr_gui/instance_panel.js +29 -29
- data/public/javascripts/dcmgr_gui/security_group_panel.js +8 -29
- data/public/javascripts/dcmgr_gui/sshkeypair_panel.js +2 -22
- data/public/javascripts/dcmgr_gui/volume_panel.js +16 -21
- data/public/javascripts/jquery-ui-1.8.4.custom.min.js +0 -0
- data/public/stylesheets/common.css +45 -0
- metadata +336 -332
- data/app/models/dcmgr_resource/netfilter_group.rb +0 -29
data/lib/cli/user.rb
CHANGED
@@ -7,41 +7,6 @@ require 'yaml'
|
|
7
7
|
module Cli
|
8
8
|
class UserCli < Base
|
9
9
|
namespace :user
|
10
|
-
|
11
|
-
#no_tasks {
|
12
|
-
#def before_task
|
13
|
-
## Setup DB connections and load paths for dcmgr_gui
|
14
|
-
#root_dir = File.expand_path('../../../', __FILE__)
|
15
|
-
|
16
|
-
##get the database details
|
17
|
-
##TODO:get this path in a less hard-coded way?
|
18
|
-
#content = File.new(File.expand_path('../../frontend/dcmgr_gui/config/database.yml', root_dir)).read
|
19
|
-
#settings = YAML::load content
|
20
|
-
|
21
|
-
##load the database variables
|
22
|
-
##TODO: get environment from RAILS_ENV
|
23
|
-
#db_environment = 'development'
|
24
|
-
#db_adapter = settings[db_environment]['adapter']
|
25
|
-
#db_host = settings[db_environment]['host']
|
26
|
-
#db_name = settings[db_environment]['database']
|
27
|
-
#db_user = settings[db_environment]['user']
|
28
|
-
#db_pwd = settings[db_environment]['password']
|
29
|
-
|
30
|
-
##Connect to the database
|
31
|
-
#url = "#{db_adapter}://#{db_host}/#{db_name}?user=#{db_user}&password=#{db_pwd}"
|
32
|
-
#db = Sequel.connect(url)
|
33
|
-
|
34
|
-
##load the cli environment
|
35
|
-
#$LOAD_PATH.unshift File.expand_path('../../frontend/dcmgr_gui/config', root_dir)
|
36
|
-
#$LOAD_PATH.unshift File.expand_path('../../frontend/dcmgr_gui/app/models', root_dir)
|
37
|
-
|
38
|
-
#require 'environment-cli'
|
39
|
-
#require 'user'
|
40
|
-
#require 'account'
|
41
|
-
#User.db = db
|
42
|
-
#Account.db = db
|
43
|
-
#end
|
44
|
-
#}
|
45
10
|
|
46
11
|
desc "add [options]", "Create a new user."
|
47
12
|
method_option :name, :type => :string, :required => true, :aliases => "-n", :desc => "The name for the new user." #Maximum size: 200
|
@@ -49,7 +14,6 @@ module Cli
|
|
49
14
|
method_option :login_id, :type => :string, :aliases => "-l", :desc => "Optional: The login_id for the new user." #Maximum size: 255
|
50
15
|
method_option :password, :type => :string, :required => true, :aliases => "-p", :desc => "The password for the new user." #Maximum size: 255
|
51
16
|
method_option :primary_account_id, :type => :string, :aliases => "-a", :desc => "Optional: The primary account to associate this user with." #Maximum size: 255
|
52
|
-
#method_option :verbose, :type => :boolean, :aliases => "-v", :desc => "Print feedback on what is happening."
|
53
17
|
def add
|
54
18
|
if options[:name].length > 200
|
55
19
|
Error.raise("User name can not be longer than 200 characters", 100)
|
@@ -140,7 +104,6 @@ __END
|
|
140
104
|
method_option :name, :type => :string, :aliases => "-n", :desc => "The new name for the user." #Maximum size: 200
|
141
105
|
method_option :login_id, :type => :string, :aliases => "-l", :desc => "The new login_id for the user." #Maximum size: 255
|
142
106
|
method_option :password, :type => :string, :aliases => "-p", :desc => "The new password for the user." #Maximum size: 255
|
143
|
-
#method_option :primary_account_id, :type => :string, :aliases => "-a", :desc => "The new primary account to associate this user with."
|
144
107
|
def modify(uuid)
|
145
108
|
Error.raise("User name can not be longer than 200 characters",100) if options[:name] != nil && options[:name].length > 200
|
146
109
|
Error.raise("User login_id can not be longer than 255 characters",100) if options[:login_id] != nil && options[:login_id].length > 255
|
data/lib/tasks/dcmgr_gui.rake
CHANGED
@@ -33,8 +33,8 @@ namespace :db do
|
|
33
33
|
DB['users_accounts'].with_sql(sql,2,2).first
|
34
34
|
|
35
35
|
publish_date = '2010-11-19 9:00:00'
|
36
|
-
title = "
|
37
|
-
description = "
|
36
|
+
title = "News1"
|
37
|
+
description = "New description."
|
38
38
|
|
39
39
|
Information.create(:title => title,
|
40
40
|
:description => description,
|
@@ -0,0 +1,34 @@
|
|
1
|
+
code_error_box = ErrorCode
|
2
|
+
stop_button = Stop
|
3
|
+
close_button = Close
|
4
|
+
delete_button = Yes, Delete
|
5
|
+
terminate_button = Terminate
|
6
|
+
refresh_button = Refresh
|
7
|
+
start_button = Start
|
8
|
+
attach_button = Yes, Attach
|
9
|
+
reboot_button = Reboot
|
10
|
+
create_button = Create
|
11
|
+
update_button = Update
|
12
|
+
launch_button = Launch
|
13
|
+
detach_button = Yes, Detach
|
14
|
+
loading_parts = Loading...
|
15
|
+
display_date = {0}-{1}-{2} {3}:{4}:{5}
|
16
|
+
launch_instance_header = Launch Instance
|
17
|
+
delete_security_group_header = Delete Security Group
|
18
|
+
stop_instances_header = Stop Instances
|
19
|
+
start_instances_header = Start Instances
|
20
|
+
delete_ssh_keypair_header = Delete SSH Key Pair
|
21
|
+
create_volume_from_snapshot_header = Create Volume
|
22
|
+
delete_snapshot_header = Delete Snapshot
|
23
|
+
terminate_instances_header = Terminate Instances
|
24
|
+
create_security_group_header = Create Security Group
|
25
|
+
delete_volume_header = Delete Volume
|
26
|
+
reboot_instances_header = Reboot Instances
|
27
|
+
create_snapshot_header = Create Snapshot
|
28
|
+
detach_volume_header = Detach Volume
|
29
|
+
create_ssh_keypair_header = Create SSH Key Pair
|
30
|
+
attach_volume_header = Attach Volume
|
31
|
+
create_volume_header = Create Volume
|
32
|
+
edit_security_group_header = Edit Security Group
|
33
|
+
total_pagenate = Total {0}
|
34
|
+
page_pagenate = {0} Page
|
File without changes
|
@@ -0,0 +1,32 @@
|
|
1
|
+
code_error_box = エラーコード
|
2
|
+
stop_button = 一時停止
|
3
|
+
close_button = 閉じる
|
4
|
+
delete_button = 削除
|
5
|
+
terminate_button = 停止
|
6
|
+
refresh_button = 更新
|
7
|
+
start_button = 再開
|
8
|
+
attach_button = アタッチ
|
9
|
+
reboot_button = 再起動
|
10
|
+
create_button = 作成
|
11
|
+
update_button = 更新
|
12
|
+
launch_button = 起動
|
13
|
+
detach_button = デタッチ
|
14
|
+
loading_parts = 読み込み中...
|
15
|
+
display_date = {0}年{1}月{2}日 {3}時{4}分{5}秒
|
16
|
+
launch_instance_header = インスタンスを起動
|
17
|
+
delete_security_group_header = セキュリティーグループを削除
|
18
|
+
delete_ssh_keypair_header = キーペアを削除
|
19
|
+
create_volume_from_snapshot_header = ボリュームを作成
|
20
|
+
delete_snapshot_header = スナップショットを削除
|
21
|
+
terminate_instances_header = インスタンスを停止
|
22
|
+
create_security_group_header = セキュリティグループを作成
|
23
|
+
delete_volume_header = ボリュームを削除
|
24
|
+
reboot_instances_header = インスタンスを再起動
|
25
|
+
create_snapshot_header = スナップショットを作成
|
26
|
+
detach_volume_header = ボリュームをデタッチ
|
27
|
+
create_ssh_keypair_header = キーペアを作成
|
28
|
+
attach_volume_header = ボリュームをアタッチ
|
29
|
+
create_volume_header = ボリュームを作成
|
30
|
+
edit_security_group_header = セキュリティグループを編集
|
31
|
+
total_pagenate = 全{0}件
|
32
|
+
page_pagenate = {0} ページ
|
@@ -9,7 +9,7 @@ jQuery(function($){
|
|
9
9
|
dcmgrGUI.initialize();
|
10
10
|
dcmgrGUI.notification = new DcmgrGUI.Notification;
|
11
11
|
|
12
|
-
|
12
|
+
//Toggle side menus.
|
13
13
|
var regionpos = 0;
|
14
14
|
$('#regionselect').click(function () {
|
15
15
|
if(regionpos==0){regionpos+=33;}else{regionpos=0;}
|
@@ -24,10 +24,10 @@ jQuery(function($){
|
|
24
24
|
$('#regionmenu').toggle();
|
25
25
|
});
|
26
26
|
|
27
|
-
//maincontent
|
27
|
+
//Toggle maincontent
|
28
28
|
$('.showhide').click(function(){
|
29
|
-
$(this).parent().next().toggle()
|
30
|
-
//background
|
29
|
+
$(this).parent().next().toggle();
|
30
|
+
//Swap background image.
|
31
31
|
var imgurl = $(this).css("background-image");
|
32
32
|
var img = imgurl.match(/.+\/images\/(btn_[a-z]+\.gif)/);
|
33
33
|
if(img[1] == "btn_hide.gif"){
|
@@ -39,7 +39,7 @@ jQuery(function($){
|
|
39
39
|
}
|
40
40
|
});
|
41
41
|
|
42
|
-
//InstanceActions
|
42
|
+
//Toggle InstanceActions menu.
|
43
43
|
var instancepos = 0;
|
44
44
|
$('#instanceaction').click(function () {
|
45
45
|
if(instancepos==0){instancepos+=26;}else{instancepos=0;}
|
@@ -54,7 +54,7 @@ jQuery(function($){
|
|
54
54
|
$('#actionlist').toggle();
|
55
55
|
});
|
56
56
|
|
57
|
-
//VolumeActions
|
57
|
+
//Toggle VolumeActions menu.
|
58
58
|
var volumepos = 0;
|
59
59
|
$('#volumeaction').click(function () {
|
60
60
|
if(volumepos==0){volumepos+=26;}else{volumepos=0;}
|
@@ -69,7 +69,7 @@ jQuery(function($){
|
|
69
69
|
$('#volumelist').toggle();
|
70
70
|
});
|
71
71
|
|
72
|
-
//ReservedInstances
|
72
|
+
//Toggle ReservedInstances menu.
|
73
73
|
var rsvinstancepos = 0;
|
74
74
|
$('#reservedinstance').click(function () {
|
75
75
|
if(rsvinstancepos==0){rsvinstancepos+=26;}else{rsvinstancepos=0;}
|
@@ -110,7 +110,7 @@ DcmgrGUI.date.parseISO8601 = function (str) {
|
|
110
110
|
_date = new Date;
|
111
111
|
|
112
112
|
_date.setUTCFullYear(Number(dateParts[0]));
|
113
|
-
_date.setUTCMonth(Number(dateParts[1]));
|
113
|
+
_date.setUTCMonth(Number(dateParts[1] - 1 ));
|
114
114
|
_date.setUTCDate(Number(dateParts[2]));
|
115
115
|
_date.setUTCHours(Number(timeHours));
|
116
116
|
_date.setUTCMinutes(Number(timeSubParts[1]));
|
@@ -133,11 +133,11 @@ DcmgrGUI.date.getI18n = function(date_str){
|
|
133
133
|
}
|
134
134
|
|
135
135
|
return $.i18n.prop('display_date', [date_str.getUTCFullYear(),
|
136
|
-
convert(date_str.
|
137
|
-
convert(date_str.
|
138
|
-
convert(date_str.
|
139
|
-
convert(date_str.
|
140
|
-
convert(date_str.
|
136
|
+
convert(date_str.getMonth() + 1),
|
137
|
+
convert(date_str.getDate()),
|
138
|
+
convert(date_str.getHours()),
|
139
|
+
convert(date_str.getMinutes()),
|
140
|
+
convert(date_str.getSeconds())
|
141
141
|
]);
|
142
142
|
};
|
143
143
|
|
@@ -455,6 +455,33 @@ DcmgrGUI.Util.createUIButton = function(element,options){
|
|
455
455
|
});
|
456
456
|
}
|
457
457
|
|
458
|
+
DcmgrGUI.Util.availableTextField = function(e){
|
459
|
+
|
460
|
+
var d = e.data;
|
461
|
+
var button = d.button;
|
462
|
+
var element_id = d.element_id;
|
463
|
+
|
464
|
+
if(e.type == 'paste') {
|
465
|
+
var el = $(this);
|
466
|
+
setTimeout(function() {
|
467
|
+
var text = $(el).val();
|
468
|
+
if(text) {
|
469
|
+
button.disabledButton(element_id, false);
|
470
|
+
} else {
|
471
|
+
button.disabledButton(element_id, true);
|
472
|
+
}
|
473
|
+
}, 100);
|
474
|
+
} else {
|
475
|
+
var text = $(this).val();
|
476
|
+
if(text) {
|
477
|
+
button.disabledButton(element_id, false);
|
478
|
+
} else {
|
479
|
+
button.disabledButton(element_id, true);
|
480
|
+
}
|
481
|
+
}
|
482
|
+
return true;
|
483
|
+
}
|
484
|
+
|
458
485
|
DcmgrGUI.Event = DcmgrGUI.Class.create({
|
459
486
|
|
460
487
|
initialize: function(){
|
@@ -538,13 +565,11 @@ DcmgrGUI.List = DcmgrGUI.Class.create(DcmgrGUI.ContentBase, {
|
|
538
565
|
|
539
566
|
if(data.item.created_at) {
|
540
567
|
data.item.created_at = DcmgrGUI.date.parseISO8601(data.item.created_at);
|
541
|
-
data.item.created_at = DcmgrGUI.date.setTimezoneOffset(data.item.created_at, dcmgrGUI.getConfig('time_zone_utc_offset'));
|
542
568
|
data.item.created_at = DcmgrGUI.date.getI18n(data.item.created_at);
|
543
569
|
}
|
544
570
|
|
545
571
|
if(data.item.updated_at) {
|
546
572
|
data.item.updated_at = DcmgrGUI.date.parseISO8601(data.item.updated_at);
|
547
|
-
data.item.updated_at = DcmgrGUI.date.setTimezoneOffset(data.item.updated_at, dcmgrGUI.getConfig('time_zone_utc_offset'));
|
548
573
|
data.item.updated_at = DcmgrGUI.date.getI18n(data.item.updated_at);
|
549
574
|
}
|
550
575
|
|
@@ -102,18 +102,17 @@ DcmgrGUI.prototype.imagePanel = function(){
|
|
102
102
|
var ssh_key_pair = $(this).find('#ssh_key_pair').find('option:selected').text();
|
103
103
|
var launch_in = $(this).find('#right_select_list').find('option');
|
104
104
|
var user_data = $(this).find('#user_data').val();
|
105
|
-
var
|
105
|
+
var security_groups = [];
|
106
106
|
$.each(launch_in,function(i){
|
107
|
-
|
107
|
+
security_groups.push("security_groups[]="+ $(this).text());
|
108
108
|
});
|
109
|
-
var nf_strings = nf_group.join('&');
|
110
109
|
|
111
110
|
var data = "image_id="+image_id
|
112
111
|
+"&host_pool_id="+host_pool_id
|
113
112
|
+"&instance_spec_id="+instance_spec_id
|
114
113
|
+"&host_name="+host_name
|
115
114
|
+"&user_data="+user_data
|
116
|
-
+"&"+
|
115
|
+
+"&" + security_groups.join('&')
|
117
116
|
+"&ssh_key="+ssh_key_pair;
|
118
117
|
|
119
118
|
request = new DcmgrGUI.Request;
|
@@ -221,9 +220,8 @@ DcmgrGUI.prototype.imagePanel = function(){
|
|
221
220
|
}
|
222
221
|
|
223
222
|
for (var i=0; i < size ; i++) {
|
224
|
-
var name = results[i].result.name;
|
225
223
|
var ssh_keypair_id = results[i].result.id;
|
226
|
-
var html = '<option id="'+ ssh_keypair_id +'" value="'+
|
224
|
+
var html = '<option id="'+ ssh_keypair_id +'" value="'+ ssh_keypair_id +'">'+ssh_keypair_id+'</option>'
|
227
225
|
select_keypair.append(html);
|
228
226
|
}
|
229
227
|
}
|
@@ -235,12 +233,12 @@ DcmgrGUI.prototype.imagePanel = function(){
|
|
235
233
|
"data": "",
|
236
234
|
success: function(json,status){
|
237
235
|
var data = [];
|
238
|
-
var results = json.
|
236
|
+
var results = json.security_group.results;
|
239
237
|
var size = results.length;
|
240
238
|
for (var i=0; i < size ; i++) {
|
241
239
|
data.push({
|
242
240
|
"value" : results[i].result.uuid,
|
243
|
-
"name" : results[i].result.
|
241
|
+
"name" : results[i].result.uuid,
|
244
242
|
});
|
245
243
|
}
|
246
244
|
|
@@ -102,29 +102,27 @@ DcmgrGUI.prototype.instancePanel = function(){
|
|
102
102
|
target:'.start_instances',
|
103
103
|
width:400,
|
104
104
|
height:200,
|
105
|
-
title
|
105
|
+
title:$.i18n.prop('start_instances_header'),
|
106
106
|
path:'/start_instances',
|
107
|
-
button:{
|
108
|
-
"Close": function() { $(this).dialog("close"); },
|
109
|
-
"Yes, Start": function() {
|
110
|
-
$(this).dialog("close");
|
111
|
-
}
|
112
|
-
}
|
107
|
+
button:{},
|
113
108
|
});
|
114
|
-
|
109
|
+
bt_instance_start.button[$.i18n.prop('close_button')]=function() { $(this).dialog("close"); };
|
110
|
+
bt_instance_start.button[$.i18n.prop('start_button')]=function() {
|
111
|
+
instance_action_helper.call(this,'start');
|
112
|
+
};
|
113
|
+
|
115
114
|
var bt_instance_stop = new DcmgrGUI.Dialog({
|
116
115
|
target:'.stop_instances',
|
117
116
|
width:400,
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
"Close": function() { $(this).dialog("close"); },
|
123
|
-
"Yes, Stop": function() {
|
124
|
-
$(this).dialog("close");
|
125
|
-
}
|
126
|
-
}
|
117
|
+
height:200,
|
118
|
+
title: $.i18n.prop('stop_instances_header'),
|
119
|
+
path:'/stop_instances',
|
120
|
+
button:{},
|
127
121
|
});
|
122
|
+
bt_instance_stop.button[$.i18n.prop('close_button')]=function() { $(this).dialog("close"); };
|
123
|
+
bt_instance_stop.button[$.i18n.prop('stop_button')]=function() {
|
124
|
+
instance_action_helper.call(this,'stop');
|
125
|
+
};
|
128
126
|
|
129
127
|
var instance_reboot_buttons = {};
|
130
128
|
instance_reboot_buttons[close_button_name] = function() { $(this).dialog("close"); }
|
@@ -154,14 +152,6 @@ DcmgrGUI.prototype.instancePanel = function(){
|
|
154
152
|
button: instance_terminate_buttons
|
155
153
|
});
|
156
154
|
|
157
|
-
bt_instance_start.target.bind('click',function(){
|
158
|
-
bt_instance_start.open(c_list.getCheckedInstanceIds());
|
159
|
-
});
|
160
|
-
|
161
|
-
bt_instance_stop.target.bind('click',function(){
|
162
|
-
bt_instance_stop.open(c_list.getCheckedInstanceIds());
|
163
|
-
});
|
164
|
-
|
165
155
|
bt_refresh.element.bind('dcmgrGUI.refresh',function(){
|
166
156
|
c_list.page = c_pagenate.current_page;
|
167
157
|
list_request.url = DcmgrGUI.Util.getPagePath('/instances/list/',c_list.page);
|
@@ -190,10 +180,20 @@ DcmgrGUI.prototype.instancePanel = function(){
|
|
190
180
|
style:'dropdown',
|
191
181
|
select: function(event){
|
192
182
|
var select_action = $(this).val()
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
183
|
+
var selected_ids = c_list.getCheckedInstanceIds();
|
184
|
+
switch(select_action) {
|
185
|
+
case 'terminate':
|
186
|
+
bt_instance_terminate.open(selected_ids);
|
187
|
+
break;
|
188
|
+
case 'reboot':
|
189
|
+
bt_instance_reboot.open(selected_ids);
|
190
|
+
break;
|
191
|
+
case 'start':
|
192
|
+
bt_instance_start.open(selected_ids);
|
193
|
+
break;
|
194
|
+
case 'stop':
|
195
|
+
bt_instance_stop.open(selected_ids);
|
196
|
+
break;
|
197
197
|
}
|
198
198
|
}
|
199
199
|
});
|
@@ -9,7 +9,6 @@ DcmgrGUI.prototype.securityGroupPanel = function(){
|
|
9
9
|
|
10
10
|
DcmgrGUI.List.prototype.getEmptyData = function(){
|
11
11
|
return [{
|
12
|
-
"name":'',
|
13
12
|
"description":''
|
14
13
|
}]
|
15
14
|
}
|
@@ -17,7 +16,6 @@ DcmgrGUI.prototype.securityGroupPanel = function(){
|
|
17
16
|
|
18
17
|
DcmgrGUI.Detail.prototype.getEmptyData = function(){
|
19
18
|
return {
|
20
|
-
"name" : "-",
|
21
19
|
"description" : "-",
|
22
20
|
"rule":''
|
23
21
|
}
|
@@ -50,13 +48,7 @@ DcmgrGUI.prototype.securityGroupPanel = function(){
|
|
50
48
|
'element': this
|
51
49
|
});
|
52
50
|
|
53
|
-
|
54
|
-
if( $(this).val() ) {
|
55
|
-
bt_create_security_group.disabledButton(1, false);
|
56
|
-
} else {
|
57
|
-
bt_create_security_group.disabledButton(1 ,true);
|
58
|
-
}
|
59
|
-
});
|
51
|
+
var params = { 'button': bt_create_security_group, 'element_id': 1 };
|
60
52
|
|
61
53
|
$(this).find('#rule_help').hide();
|
62
54
|
security_group_help.create(config_tooltip);
|
@@ -86,9 +78,9 @@ DcmgrGUI.prototype.securityGroupPanel = function(){
|
|
86
78
|
});
|
87
79
|
|
88
80
|
c_list.element.bind('dcmgrGUI.contentChange',function(event,params){
|
89
|
-
var
|
90
|
-
c_pagenate.changeTotal(
|
91
|
-
c_list.setData(
|
81
|
+
var security_group = params.data.security_group;
|
82
|
+
c_pagenate.changeTotal(security_group.owner_total);
|
83
|
+
c_list.setData(security_group.results);
|
92
84
|
c_list.singleCheckList(c_list.detail_template);
|
93
85
|
|
94
86
|
var edit_security_group_buttons = {};
|
@@ -115,7 +107,7 @@ DcmgrGUI.prototype.securityGroupPanel = function(){
|
|
115
107
|
var bt_edit_security_group = new DcmgrGUI.Dialog({
|
116
108
|
target:'.edit_security_group',
|
117
109
|
width:500,
|
118
|
-
height:
|
110
|
+
height:580,
|
119
111
|
title:$.i18n.prop('edit_security_group_header'),
|
120
112
|
path:'/edit_security_group',
|
121
113
|
button: edit_security_group_buttons,
|
@@ -123,7 +115,7 @@ DcmgrGUI.prototype.securityGroupPanel = function(){
|
|
123
115
|
});
|
124
116
|
|
125
117
|
bt_edit_security_group.target.bind('click',function(event){
|
126
|
-
var uuid = $(this).attr('id').replace(/edit_(
|
118
|
+
var uuid = $(this).attr('id').replace(/edit_(sg-[a-z0-9]+)/,'$1');
|
127
119
|
if( uuid ){
|
128
120
|
bt_edit_security_group.open({"ids":[uuid]});
|
129
121
|
}
|
@@ -164,23 +156,11 @@ DcmgrGUI.prototype.securityGroupPanel = function(){
|
|
164
156
|
var create_security_group_buttons = {};
|
165
157
|
create_security_group_buttons[close_button_name] = function() { $(this).dialog("close"); };
|
166
158
|
create_security_group_buttons[create_button_name] = function() {
|
167
|
-
var name = $(this).find('#security_group_name').val();
|
168
159
|
var description = $(this).find('#security_group_description').val();
|
169
160
|
var rule = $(this).find('#security_group_rule').val();
|
170
|
-
var data = '
|
171
|
-
+'&description=' + description
|
161
|
+
var data = 'description=' + description
|
172
162
|
+'&rule=' + rule;
|
173
163
|
|
174
|
-
if(!name){
|
175
|
-
$('#security_group_name').focus();
|
176
|
-
return false;
|
177
|
-
}
|
178
|
-
|
179
|
-
if(!name.match(/[a-z_]+/)){
|
180
|
-
$('#security_group_name').focus();
|
181
|
-
return false;
|
182
|
-
}
|
183
|
-
|
184
164
|
var request = new DcmgrGUI.Request;
|
185
165
|
request.post({
|
186
166
|
"url": '/security_groups.json',
|
@@ -196,7 +176,7 @@ DcmgrGUI.prototype.securityGroupPanel = function(){
|
|
196
176
|
var bt_create_security_group = new DcmgrGUI.Dialog({
|
197
177
|
target:'.create_security_group',
|
198
178
|
width:500,
|
199
|
-
height:
|
179
|
+
height:550,
|
200
180
|
title:$.i18n.prop('create_security_group_header'),
|
201
181
|
path:'/create_security_group',
|
202
182
|
button: create_security_group_buttons,
|
@@ -205,7 +185,6 @@ DcmgrGUI.prototype.securityGroupPanel = function(){
|
|
205
185
|
|
206
186
|
bt_create_security_group.target.bind('click',function(){
|
207
187
|
bt_create_security_group.open();
|
208
|
-
bt_create_security_group.disabledButton(1, true);
|
209
188
|
});
|
210
189
|
|
211
190
|
var delete_security_group_buttons = {};
|