wakame-vdc-webui 11.06.0 → 11.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/Rakefile
CHANGED
@@ -12,7 +12,7 @@ desc "build gem packages"
|
|
12
12
|
task :gem do
|
13
13
|
require 'rubygems'
|
14
14
|
require 'rake/gempackagetask'
|
15
|
-
require 'dcmgr'
|
15
|
+
require 'dcmgr/version'
|
16
16
|
|
17
17
|
spec = Gem::Specification.new do |s|
|
18
18
|
s.platform = Gem::Platform::RUBY
|
@@ -20,8 +20,8 @@ task :gem do
|
|
20
20
|
s.authors = ['axsh Ltd.']
|
21
21
|
s.email = ['dev@axsh.net']
|
22
22
|
s.name = 'wakame-vdc-webui'
|
23
|
-
s.summary = "
|
24
|
-
s.description = ''
|
23
|
+
s.summary = "Wakame-VDC: UI frontend"
|
24
|
+
s.description = 'Datacenter Hypervisor'
|
25
25
|
s.required_ruby_version = '>= 1.8.7'
|
26
26
|
|
27
27
|
s.files = Dir['app/**/*.{rb,erb}','lib/**/*.rb',
|
@@ -32,13 +32,13 @@ task :gem do
|
|
32
32
|
'script/*', 'test/**/*.rb', 'doc/**/*.*'] +
|
33
33
|
%w(Rakefile config.ru LICENSE NOTICE INSTALL.txt INSTALL-API.txt tmp)
|
34
34
|
|
35
|
-
s.add_dependency "rails", '3.0.
|
35
|
+
s.add_dependency "rails", '3.0.11'
|
36
36
|
s.add_dependency 'mysql','2.8.1'
|
37
|
-
s.add_dependency 'sequel','3.
|
38
|
-
s.add_dependency 'json','1.
|
37
|
+
s.add_dependency 'sequel','3.27.0'
|
38
|
+
s.add_dependency 'json','1.6.3'
|
39
39
|
s.add_dependency 'oauth','0.4.1'
|
40
|
-
s.add_dependency 'i18n', '0.4.2'
|
41
40
|
s.add_dependency 'nokogiri', '1.4.4'
|
41
|
+
s.add_dependency 'thor', '0.14.6'
|
42
42
|
end
|
43
43
|
|
44
44
|
File.open("#{spec.name}.gemspec", 'w'){|f| f.write(spec.to_ruby) }
|
@@ -1,7 +1,9 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
3
|
class ApplicationController < ActionController::Base
|
4
|
-
|
4
|
+
# disable reqeust forgery check since some pages are missing to set
|
5
|
+
# the token on using POST.
|
6
|
+
#protect_from_forgery
|
5
7
|
include Authentication
|
6
8
|
before_filter :login_required
|
7
9
|
before_filter :set_locale
|
@@ -10,6 +12,7 @@ class ApplicationController < ActionController::Base
|
|
10
12
|
|
11
13
|
def set_application
|
12
14
|
@site = DCMGR_GUI_SITE
|
15
|
+
true
|
13
16
|
end
|
14
17
|
|
15
18
|
def dispatch(name, request)
|
@@ -55,6 +58,7 @@ class ApplicationController < ActionController::Base
|
|
55
58
|
|
56
59
|
@locales = get_locales
|
57
60
|
@locale = I18n.locale
|
61
|
+
true
|
58
62
|
end
|
59
63
|
|
60
64
|
def get_locales
|
@@ -9,7 +9,7 @@ class DialogController < ApplicationController
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def attach_volume
|
12
|
-
@
|
12
|
+
@volume_ids = params[:ids]
|
13
13
|
end
|
14
14
|
|
15
15
|
def detach_volume
|
@@ -45,7 +45,6 @@ class DialogController < ApplicationController
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def create_security_group
|
48
|
-
@uuid = ''
|
49
48
|
@description = ''
|
50
49
|
@rule = ''
|
51
50
|
render :create_and_edit_security_group
|
@@ -53,17 +52,15 @@ class DialogController < ApplicationController
|
|
53
52
|
|
54
53
|
def delete_security_group
|
55
54
|
@uuid = params[:ids][0]
|
56
|
-
@
|
57
|
-
@name = @netfilter_group['name']
|
55
|
+
@security_group = DcmgrResource::SecurityGroup.show(@uuid)
|
58
56
|
end
|
59
57
|
|
60
58
|
def edit_security_group
|
61
59
|
@uuid = params[:ids][0]
|
62
|
-
@
|
60
|
+
@security_group = DcmgrResource::SecurityGroup.show(@uuid)
|
63
61
|
|
64
|
-
@
|
65
|
-
@
|
66
|
-
@rule = @netfilter_group["rule"]
|
62
|
+
@description = @security_group["description"]
|
63
|
+
@rule = @security_group["rule"]
|
67
64
|
render :create_and_edit_security_group
|
68
65
|
end
|
69
66
|
|
@@ -11,7 +11,7 @@ class InstancesController < ApplicationController
|
|
11
11
|
:host_pool_id => params[:host_pool_id],
|
12
12
|
:host_name => params[:host_name],
|
13
13
|
:user_data => params[:user_data],
|
14
|
-
:
|
14
|
+
:security_groups => params[:security_groups],
|
15
15
|
:ssh_key => params[:ssh_key]
|
16
16
|
}
|
17
17
|
instance = DcmgrResource::Instance.create(params)
|
@@ -35,20 +35,38 @@ class InstancesController < ApplicationController
|
|
35
35
|
|
36
36
|
def terminate
|
37
37
|
instance_ids = params[:ids]
|
38
|
-
|
38
|
+
res = []
|
39
39
|
instance_ids.each do |instance_id|
|
40
|
-
|
40
|
+
res << DcmgrResource::Instance.destroy(instance_id)
|
41
41
|
end
|
42
|
-
render :json =>
|
42
|
+
render :json => res
|
43
43
|
end
|
44
44
|
|
45
45
|
def reboot
|
46
46
|
instance_ids = params[:ids]
|
47
|
-
|
47
|
+
res = []
|
48
48
|
instance_ids.each do |instance_id|
|
49
|
-
|
49
|
+
res << DcmgrResource::Instance.reboot(instance_id)
|
50
50
|
end
|
51
|
-
render :json =>
|
51
|
+
render :json => res
|
52
|
+
end
|
53
|
+
|
54
|
+
def start
|
55
|
+
instance_ids = params[:ids]
|
56
|
+
res = []
|
57
|
+
instance_ids.each do |instance_id|
|
58
|
+
res << DcmgrResource::Instance.start(instance_id)
|
59
|
+
end
|
60
|
+
render :json => res
|
61
|
+
end
|
62
|
+
|
63
|
+
def stop
|
64
|
+
instance_ids = params[:ids]
|
65
|
+
res = []
|
66
|
+
instance_ids.each do |instance_id|
|
67
|
+
res << DcmgrResource::Instance.stop(instance_id)
|
68
|
+
end
|
69
|
+
render :json => res
|
52
70
|
end
|
53
71
|
|
54
72
|
def total
|
@@ -27,12 +27,11 @@ class KeypairsController < ApplicationController
|
|
27
27
|
|
28
28
|
def create_ssh_keypair
|
29
29
|
data = {
|
30
|
-
:name => params[:name],
|
31
30
|
:download_once => params[:download_once]
|
32
31
|
}
|
33
32
|
|
34
|
-
@filename = params[:name] + ".pem"
|
35
33
|
@ssh_key_pair = DcmgrResource::SshKeyPair.create(data)
|
34
|
+
@filename = @ssh_key_pair.uuid + ".pem"
|
36
35
|
|
37
36
|
send_data(@ssh_key_pair.private_key,{
|
38
37
|
:filename => @filename,
|
@@ -54,7 +53,7 @@ class KeypairsController < ApplicationController
|
|
54
53
|
def prk_download
|
55
54
|
uuid = params[:id]
|
56
55
|
@ssh_key_pair = DcmgrResource::SshKeyPair.show(uuid)
|
57
|
-
@filename = @ssh_key_pair['
|
56
|
+
@filename = @ssh_key_pair['uuid'] + ".pem"
|
58
57
|
send_data(@ssh_key_pair['private_key'],{
|
59
58
|
:filename => @filename,
|
60
59
|
:type => 'application/pgp-encrypted',
|
@@ -10,31 +10,30 @@ class SecurityGroupsController < ApplicationController
|
|
10
10
|
:start => params[:start].to_i - 1,
|
11
11
|
:limit => params[:limit]
|
12
12
|
}
|
13
|
-
@
|
14
|
-
respond_with(@
|
13
|
+
@security_group = DcmgrResource::SecurityGroup.list(data)
|
14
|
+
respond_with(@security_group[0],:to => [:json])
|
15
15
|
end
|
16
16
|
|
17
17
|
# security_groups/detail/s-000001.json
|
18
18
|
def show
|
19
19
|
uuid = params[:id]
|
20
|
-
@
|
21
|
-
respond_with(@
|
20
|
+
@security_group = DcmgrResource::SecurityGroup.show(uuid)
|
21
|
+
respond_with(@security_group,:to => [:json])
|
22
22
|
end
|
23
23
|
|
24
24
|
def create
|
25
25
|
data = {
|
26
|
-
:name => params[:name],
|
27
26
|
:description => params[:description],
|
28
27
|
:rule => params[:rule]
|
29
28
|
}
|
30
|
-
@
|
31
|
-
render :json => @
|
29
|
+
@security_group = DcmgrResource::SecurityGroup.create(data)
|
30
|
+
render :json => @security_group
|
32
31
|
end
|
33
32
|
|
34
33
|
def destroy
|
35
34
|
uuid = params[:id]
|
36
|
-
@
|
37
|
-
render :json => @
|
35
|
+
@security_group = DcmgrResource::SecurityGroup.destroy(uuid)
|
36
|
+
render :json => @security_group
|
38
37
|
end
|
39
38
|
|
40
39
|
def update
|
@@ -43,17 +42,17 @@ class SecurityGroupsController < ApplicationController
|
|
43
42
|
:description => params[:description],
|
44
43
|
:rule => params[:rule]
|
45
44
|
}
|
46
|
-
@
|
47
|
-
render :json => @
|
45
|
+
@security_group = DcmgrResource::SecurityGroup.update(uuid,data)
|
46
|
+
render :json => @security_group
|
48
47
|
end
|
49
48
|
|
50
49
|
def show_groups
|
51
|
-
@
|
52
|
-
respond_with(@
|
50
|
+
@security_group = DcmgrResource::SecurityGroup.list
|
51
|
+
respond_with(@security_group[0],:to => [:json])
|
53
52
|
end
|
54
53
|
|
55
54
|
def total
|
56
|
-
total_resource = DcmgrResource::
|
55
|
+
total_resource = DcmgrResource::SecurityGroup.total_resource
|
57
56
|
render :json => total_resource
|
58
57
|
end
|
59
|
-
end
|
58
|
+
end
|
@@ -21,11 +21,11 @@ class SnapshotsController < ApplicationController
|
|
21
21
|
|
22
22
|
def destroy
|
23
23
|
snapshot_ids = params[:ids]
|
24
|
-
|
24
|
+
res = []
|
25
25
|
snapshot_ids.each do |snapshot_id|
|
26
|
-
|
26
|
+
res << DcmgrResource::VolumeSnapshot.delete(snapshot_id)
|
27
27
|
end
|
28
|
-
render :json =>
|
28
|
+
render :json => res
|
29
29
|
end
|
30
30
|
|
31
31
|
def list
|
@@ -8,14 +8,14 @@ class VolumesController < ApplicationController
|
|
8
8
|
def create
|
9
9
|
snapshot_ids = params[:ids]
|
10
10
|
if snapshot_ids
|
11
|
-
|
11
|
+
res = []
|
12
12
|
snapshot_ids.each do |snapshot_id|
|
13
13
|
data = {
|
14
14
|
:snapshot_id => snapshot_id
|
15
15
|
}
|
16
|
-
|
16
|
+
res << DcmgrResource::Volume.create(data)
|
17
17
|
end
|
18
|
-
render :json =>
|
18
|
+
render :json => res
|
19
19
|
else
|
20
20
|
# Convert to MB
|
21
21
|
size = case params[:unit]
|
@@ -40,11 +40,11 @@ class VolumesController < ApplicationController
|
|
40
40
|
|
41
41
|
def destroy
|
42
42
|
volume_ids = params[:ids]
|
43
|
-
|
43
|
+
res = []
|
44
44
|
volume_ids.each do |volume_id|
|
45
|
-
|
45
|
+
res << DcmgrResource::Volume.destroy(volume_id)
|
46
46
|
end
|
47
|
-
render :json =>
|
47
|
+
render :json => res
|
48
48
|
end
|
49
49
|
|
50
50
|
def list
|
@@ -64,19 +64,25 @@ class VolumesController < ApplicationController
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def attach
|
67
|
-
volume_id = params[:volume_id]
|
68
67
|
instance_id = params[:instance_id]
|
69
|
-
|
70
|
-
|
68
|
+
volume_ids = params[:volume_ids]
|
69
|
+
res = []
|
70
|
+
volume_ids.each do |volume_id|
|
71
|
+
data = {
|
72
|
+
:volume_id => volume_id
|
73
|
+
}
|
74
|
+
res << DcmgrResource::Volume.attach(volume_id, instance_id)
|
75
|
+
end
|
76
|
+
render :json => res
|
71
77
|
end
|
72
78
|
|
73
79
|
def detach
|
74
80
|
volume_ids = params[:ids]
|
75
|
-
|
81
|
+
res = []
|
76
82
|
volume_ids.each do |volume_id|
|
77
|
-
|
83
|
+
res << DcmgrResource::Volume.detach(volume_id)
|
78
84
|
end
|
79
|
-
render :json =>
|
85
|
+
render :json => res
|
80
86
|
end
|
81
87
|
|
82
88
|
def total
|
@@ -15,8 +15,8 @@ module DcmgrResource
|
|
15
15
|
instance.host_pool_id = params[:host_pool_id]
|
16
16
|
instance.host_name = params[:host_name]
|
17
17
|
instance.user_data = params[:user_data]
|
18
|
-
instance.
|
19
|
-
instance.
|
18
|
+
instance.security_groups = params[:security_groups]
|
19
|
+
instance.ssh_key_id = params[:ssh_key]
|
20
20
|
instance.save
|
21
21
|
instance
|
22
22
|
end
|
@@ -32,6 +32,22 @@ module DcmgrResource
|
|
32
32
|
self.collection_name = @collection
|
33
33
|
result.body
|
34
34
|
end
|
35
|
+
|
36
|
+
def self.start(instance_id)
|
37
|
+
@collection ||= self.collection_name
|
38
|
+
self.collection_name = File.join(@collection,instance_id)
|
39
|
+
result = self.put(:start)
|
40
|
+
self.collection_name = @collection
|
41
|
+
result.body
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.stop(instance_id)
|
45
|
+
@collection ||= self.collection_name
|
46
|
+
self.collection_name = File.join(@collection,instance_id)
|
47
|
+
result = self.put(:stop)
|
48
|
+
self.collection_name = @collection
|
49
|
+
result.body
|
50
|
+
end
|
35
51
|
|
36
52
|
end
|
37
53
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module DcmgrResource
|
2
|
+
class SecurityGroup < Base
|
3
|
+
|
4
|
+
def self.create(params)
|
5
|
+
security_group = self.new
|
6
|
+
security_group.description = params[:description]
|
7
|
+
security_group.rule = params[:rule]
|
8
|
+
security_group.save
|
9
|
+
security_group
|
10
|
+
end
|
11
|
+
|
12
|
+
# workaround for the bug:
|
13
|
+
# the value of the key "rule" is encoded to JSON wrongly by
|
14
|
+
# ActiveSupport::JSON encoder.
|
15
|
+
# "{\"security_group\":{\"description\":\"\",\"rule\":[[null,[],null]]}}"
|
16
|
+
# So it has to use the encoder from JSON library.
|
17
|
+
def to_json(options={})
|
18
|
+
require 'json'
|
19
|
+
{'security_group'=>@attributes}.to_json
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.list(params = {})
|
23
|
+
self.find(:all,:params => params)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.show(uuid)
|
27
|
+
self.get(uuid)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.update(uuid,params)
|
31
|
+
self.put(uuid,params).body
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.destroy(uuid)
|
35
|
+
self.delete(uuid).body
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -1,13 +1,9 @@
|
|
1
1
|
<div id="attach_volume_dialog">
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
<td><%= t("dialog.attach_volume.instance_id") %>:</td>
|
10
|
-
<td><input id="instance_id" type="text" value=""></td>
|
11
|
-
</tr>
|
12
|
-
</table>
|
2
|
+
<p><%= t("dialog.attach_volume.instance_id") %>: <input id="instance_id" type="text" value=""></p>
|
3
|
+
<br />
|
4
|
+
<ul id="attach_volumes">
|
5
|
+
<% @volume_ids.each do |volume_id| %>
|
6
|
+
<li><%= volume_id %></li>
|
7
|
+
<% end %>
|
8
|
+
</ul>
|
13
9
|
</div>
|
@@ -5,27 +5,25 @@
|
|
5
5
|
}
|
6
6
|
</style>
|
7
7
|
<div id="create_security_group_dialog">
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
<input type="hidden" id="security_group_id" value="<%= @uuid %>">
|
16
|
-
</div>
|
8
|
+
<div id="security_group_name_field">
|
9
|
+
<%- if @uuid -%>
|
10
|
+
<p>
|
11
|
+
UUID: <%= @uuid %>
|
12
|
+
</p>
|
13
|
+
<%- end -%>
|
14
|
+
<input type="hidden" id="security_group_id" value="<%= @uuid %>">
|
17
15
|
<div id="security_group_description_field">
|
18
16
|
<p>
|
19
17
|
<%= t("dialog.create_and_edit_security_group.description") %>
|
20
18
|
</p>
|
21
|
-
|
19
|
+
<input type="text" id="security_group_description" size="43" value="<%= @description %>">
|
22
20
|
</div>
|
23
21
|
<div id="security_group_rule_field">
|
24
22
|
<p>
|
25
23
|
<%= t("dialog.create_and_edit_security_group.rule") %> [<span rel="#rule_help" id="security_group_help" title="Rule Help" style="color:red">?</span>]
|
26
24
|
</p>
|
27
25
|
</div>
|
28
|
-
|
26
|
+
<textarea id="security_group_rule" rows="10" cols="10" style="width:442px;height:320px" ><%= @rule %></textarea>
|
29
27
|
<div id="rule_help">
|
30
28
|
<pre>
|
31
29
|
SYNOPSIS
|
@@ -58,7 +56,7 @@ PARAMETERS
|
|
58
56
|
ex. a-trustedx:default
|
59
57
|
|
60
58
|
source cidr:
|
61
|
-
ex. 0.0.0.0/0, 192.
|
59
|
+
ex. 0.0.0.0/0, ip4:192.0.2.0/24
|
62
60
|
|
63
61
|
</pre>
|
64
62
|
</div>
|