wakame-vdc-webui 10.11.0 → 10.12.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/api/auth_server.rb +28 -0
- data/app/views/instances/index.html.erb +0 -1
- data/app/views/volumes/index.html.erb +0 -1
- data/config/application-api.rb +30 -0
- data/config/environment-api.rb +4 -0
- data/config/initializers/dcmgr_gui.rb +3 -2
- data/lib/tasks/dcmgr_api.rake +32 -0
- data/public/javascripts/dcmgr_gui/core.js +59 -5
- data/public/javascripts/dcmgr_gui/security_group_panel.js +0 -2
- data/public/stylesheets/common.css +2 -2
- data/public/stylesheets/jquery-ui-1.8.4.custom.css +1 -1
- metadata +7 -3
@@ -0,0 +1,28 @@
|
|
1
|
+
module DcmgrGui
|
2
|
+
class AuthServer < Sinatra::Base
|
3
|
+
use Rack::MethodOverride
|
4
|
+
|
5
|
+
def protected!
|
6
|
+
unless authorized?
|
7
|
+
response['WWW-Authenticate'] = %(Basic realm="Wakame dcmgr authorization.")
|
8
|
+
throw(:halt, [401, "Not authorized.\n"])
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def authorized?
|
13
|
+
@auth ||= Rack::Auth::Basic::Request.new(request.env)
|
14
|
+
(@auth.provided? && @auth.basic? && credentials = @auth.credentials) || ( return FALSE )
|
15
|
+
|
16
|
+
User.authenticate(credentials[0], credentials[1])
|
17
|
+
end
|
18
|
+
|
19
|
+
# Neither nginx nor this server removes '..' from the path...
|
20
|
+
get '/auth/*' do
|
21
|
+
protected!
|
22
|
+
command = /\/auth\/(.*)/.match(request.path_info)[1]
|
23
|
+
headers 'X-Accel-Redirect' => "/dcmgr_cmd/#{command}"
|
24
|
+
|
25
|
+
"auth response to '#{command}'"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -12,7 +12,6 @@ jQuery(function($){
|
|
12
12
|
<div class="controller clearfix">
|
13
13
|
<div id="instanceaction">Instance Actions</div>
|
14
14
|
<ul id="actionlist">
|
15
|
-
<li id="actionparent">Instance Actions</li>
|
16
15
|
<ul id="instanceaction">
|
17
16
|
<li class="terminate_instances"><a href="javascript:void(0);">Terminate</a></li>
|
18
17
|
<li class="reboot_instances" ><a href="javascript:void(0);">Reboot</a></li>
|
@@ -21,7 +21,6 @@ jQuery(function($){
|
|
21
21
|
<a href="javascript:void(0);" class="create_volume">Create Volume</a>
|
22
22
|
<div id="volumeaction">Volume Actions</div>
|
23
23
|
<ul id="volumelist">
|
24
|
-
<li><a href="javascript:void(0);">Volume Actions</a></li>
|
25
24
|
<li class="attach_volume"><a href="javascript:void(0);">Attach Volume</a></li>
|
26
25
|
<li class="detach_volume"><a href="javascript:void(0);">Detach Volume</a></li>
|
27
26
|
</ul>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
Bundler.require(:default, ENV['RACK_ENV']) if defined?(Bundler)
|
4
|
+
|
5
|
+
require 'app/models/schema'
|
6
|
+
|
7
|
+
# Clean up...
|
8
|
+
#require 'config/initializers/dcmgr_gui'
|
9
|
+
@dcmgr_config = YAML::load(ERB.new(IO.read(File.join(Dir.getwd, 'config', 'database.yml'))).result)[ENV['RACK_ENV']]
|
10
|
+
Schema.connect "#{@dcmgr_config['adapter']}://#{@dcmgr_config['host']}/#{@dcmgr_config['database']}?user=#{@dcmgr_config['user']}&password=#{@dcmgr_config['password']}"
|
11
|
+
|
12
|
+
require 'app/models/base_new'
|
13
|
+
require 'app/models/user'
|
14
|
+
|
15
|
+
require 'app/api/auth_server'
|
16
|
+
|
17
|
+
module DcmgrGui
|
18
|
+
|
19
|
+
# We need this in order to set 'DcmgrGui::Application.config.secret_token' used in 'user.rb'.
|
20
|
+
class ConfigHack
|
21
|
+
attr_accessor :secret_token
|
22
|
+
end
|
23
|
+
|
24
|
+
# Temp workaround:
|
25
|
+
class Application
|
26
|
+
def self.config
|
27
|
+
@config ||= ConfigHack.new
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -7,8 +7,9 @@ ActiveResource::Connection.class_eval do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
ActiveResource::Base.class_eval do
|
10
|
-
self.site = 'http://your.dcmgr.api.server/'
|
10
|
+
#self.site = 'http://your.dcmgr.api.server/'
|
11
|
+
self.site = 'http://localhost:9001/'
|
11
12
|
end
|
12
13
|
|
13
14
|
@dcmgr_config = YAML::load(ERB.new(IO.read(File.join(Rails.root, 'config', 'database.yml'))).result)[Rails.env]
|
14
|
-
Schema.connect "#{@dcmgr_config['adapter']}://#{@dcmgr_config['host']}/#{@dcmgr_config['database']}?user=#{@dcmgr_config['user']}&password=#{@dcmgr_config['password']}"
|
15
|
+
Schema.connect "#{@dcmgr_config['adapter']}://#{@dcmgr_config['host']}/#{@dcmgr_config['database']}?user=#{@dcmgr_config['user']}&password=#{@dcmgr_config['password']}"
|
@@ -0,0 +1,32 @@
|
|
1
|
+
namespace :api do
|
2
|
+
desc 'Create proxy configuration file.'
|
3
|
+
task :create_proxy_config => :environment do |t,args|
|
4
|
+
base_dir = Dir.getwd
|
5
|
+
filename = "./tmp/proxy.conf"
|
6
|
+
|
7
|
+
config_file = ERB.new File.new("./app/api/proxy_nginx.conf", "r").read
|
8
|
+
File.open(filename, "w+") { |f| f.write(config_file.result(binding)) }
|
9
|
+
|
10
|
+
puts "Created new proxy configuration file: '#{filename}'."
|
11
|
+
end
|
12
|
+
|
13
|
+
desc 'Start proxy server'
|
14
|
+
task :start_proxy => :environment do |t,args|
|
15
|
+
exec "sudo -u #{DcmgrGui::Application.config.proxy_root_user} nginx -c #{Dir.getwd}/tmp/proxy.conf"
|
16
|
+
|
17
|
+
puts "Nginx proxy server up and running."
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'Stop proxy server'
|
21
|
+
task :stop_proxy => :environment do |t,args|
|
22
|
+
exec "sudo -u #{DcmgrGui::Application.config.proxy_root_user} nginx -s stop -c #{Dir.getwd}/tmp/proxy.conf"
|
23
|
+
|
24
|
+
puts "Nginx proxy server shut down."
|
25
|
+
end
|
26
|
+
|
27
|
+
task :start_auth => :environment do |t,args|
|
28
|
+
exec "rackup -o localhost -p 8081 config-api.ru"
|
29
|
+
|
30
|
+
puts "Auth server up and runing"
|
31
|
+
end
|
32
|
+
end
|
@@ -53,6 +53,7 @@ DcmgrGUI.Converter.fromMBtoGB = function(data){
|
|
53
53
|
|
54
54
|
DcmgrGUI.Pagenate = DcmgrGUI.Class.create({
|
55
55
|
initialize: function(params) {
|
56
|
+
var self = this;
|
56
57
|
this.element = $('#pagenate');
|
57
58
|
this.view = $("#viewPagenate").text();
|
58
59
|
this.total = params.total;
|
@@ -61,8 +62,48 @@ DcmgrGUI.Pagenate = DcmgrGUI.Class.create({
|
|
61
62
|
this.row = params['row'];
|
62
63
|
this.start = this.getStartCount();
|
63
64
|
this.offset = this.getOffsetCount();
|
64
|
-
|
65
|
-
|
65
|
+
this.prev = DcmgrGUI.Util.createUIButton(this.element.find('.prev'),{
|
66
|
+
disabled : true,
|
67
|
+
text : false
|
68
|
+
});
|
69
|
+
|
70
|
+
this.next = DcmgrGUI.Util.createUIButton(this.element.find('.next'),{
|
71
|
+
text : false
|
72
|
+
});
|
73
|
+
|
74
|
+
this.prev.bind("click",{obj: this},function(event){
|
75
|
+
var self = event.data.obj;
|
76
|
+
if (self.prev.button("option","disabled")) {
|
77
|
+
return false
|
78
|
+
};
|
79
|
+
|
80
|
+
self.updatePage.call(this,event);
|
81
|
+
|
82
|
+
if (self.current_page === 1) {
|
83
|
+
self.prev.button("option", "disabled", true);
|
84
|
+
self.next.button("option", "disabled", false);
|
85
|
+
} else {
|
86
|
+
self.prev.button("option", "disabled", false);
|
87
|
+
self.next.button("option", "disabled", false);
|
88
|
+
}
|
89
|
+
});
|
90
|
+
|
91
|
+
this.next.bind("click",{obj: this},function(event){
|
92
|
+
var self = event.data.obj;
|
93
|
+
if (self.next.button("option","disabled")) {
|
94
|
+
return false
|
95
|
+
};
|
96
|
+
|
97
|
+
self.updatePage.call(this,event);
|
98
|
+
|
99
|
+
if (self.current_page === self.page_count) {
|
100
|
+
self.prev.button("option", "disabled", false);
|
101
|
+
self.next.button("option", "disabled", true);
|
102
|
+
} else {
|
103
|
+
self.prev.button("option", "disabled", false);
|
104
|
+
self.next.button("option", "disabled", false);
|
105
|
+
}
|
106
|
+
});
|
66
107
|
|
67
108
|
this.renderPagenate();
|
68
109
|
},
|
@@ -81,10 +122,9 @@ DcmgrGUI.Pagenate = DcmgrGUI.Class.create({
|
|
81
122
|
$("#viewPagenate").html(html+' '+this.view);
|
82
123
|
},
|
83
124
|
updatePage: function(event){
|
84
|
-
|
85
125
|
var self = event.data.obj;
|
86
|
-
var name = $(this).attr('class');
|
87
|
-
|
126
|
+
var name = $(this).attr('class').split(' ')[0];
|
127
|
+
|
88
128
|
if(self.current_page >= 1 && self.current_page < self.page_count) {
|
89
129
|
if(name === 'next'){
|
90
130
|
self.next_page = self.current_page +1;
|
@@ -268,6 +308,20 @@ DcmgrGUI.Util.getPagenateData = function(start,limit){
|
|
268
308
|
return "start=" + start + "&" + "limit=" + limit;
|
269
309
|
}
|
270
310
|
|
311
|
+
DcmgrGUI.Util.createUIButton = function(element,options){
|
312
|
+
return element
|
313
|
+
.button(options)
|
314
|
+
.removeClass("ui-state-default")
|
315
|
+
.removeClass("ui-button")
|
316
|
+
.removeClass("ui-corner-all")
|
317
|
+
.hover(function(){
|
318
|
+
element.removeClass("ui-state-hover");
|
319
|
+
})
|
320
|
+
.focus(function(){
|
321
|
+
element.removeClass("ui-state-focus");
|
322
|
+
});
|
323
|
+
}
|
324
|
+
|
271
325
|
DcmgrGUI.List = DcmgrGUI.Class.create(DcmgrGUI.ContentBase, {
|
272
326
|
initialize: function(params){
|
273
327
|
DcmgrGUI.ContentBase.prototype.initialize(params);
|
@@ -467,7 +467,7 @@ body{
|
|
467
467
|
}
|
468
468
|
|
469
469
|
#content #mainarea_wide ul#actionlist{
|
470
|
-
position:
|
470
|
+
position: absolute;
|
471
471
|
margin: 26px 0 0 7px;
|
472
472
|
/margin: 32px 0 0 -552px;
|
473
473
|
padding: 0;
|
@@ -1106,7 +1106,7 @@ body{
|
|
1106
1106
|
}
|
1107
1107
|
|
1108
1108
|
#content #mainarea_wide ul#volumelist{
|
1109
|
-
position:
|
1109
|
+
position: absolute;
|
1110
1110
|
margin: 26px 0 0 126px;
|
1111
1111
|
/margin: 32px 0 0 -552px;
|
1112
1112
|
padding: 0;
|
@@ -70,7 +70,7 @@
|
|
70
70
|
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #ffffff; text-decoration: none; }
|
71
71
|
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #327e04; background: #67b021 url(../images/ui-bg_highlight-soft_25_67b021_1x100.png) 50% 50% repeat-x; font-weight: bold; color: #ffffff; }
|
72
72
|
.ui-state-hover a, .ui-state-hover a:hover { color: #ffffff; text-decoration: none; }
|
73
|
-
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active {
|
73
|
+
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { background: #fafaf4 url(../images/ui-bg_highlight-hard_100_fafaf4_1x100.png) 50% 50% repeat-x; font-weight: bold; color: #459e00; }
|
74
74
|
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #459e00; text-decoration: none; }
|
75
75
|
.ui-widget :active { outline: none; }
|
76
76
|
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 10
|
7
|
-
-
|
7
|
+
- 12
|
8
8
|
- 0
|
9
|
-
version: 10.
|
9
|
+
version: 10.12.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- axsh Ltd.
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-12-24 00:00:00 +09:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -113,6 +113,7 @@ files:
|
|
113
113
|
- app/helpers/users_helper.rb
|
114
114
|
- app/helpers/storage_pools_helper.rb
|
115
115
|
- app/helpers/keypairs_helper.rb
|
116
|
+
- app/api/auth_server.rb
|
116
117
|
- app/models/information.rb
|
117
118
|
- app/models/user.rb
|
118
119
|
- app/models/schema.rb
|
@@ -171,6 +172,8 @@ files:
|
|
171
172
|
- config/environments/development.rb
|
172
173
|
- config/environments/production.rb
|
173
174
|
- config/environments/test.rb
|
175
|
+
- config/environment-api.rb
|
176
|
+
- config/application-api.rb
|
174
177
|
- config/boot.rb
|
175
178
|
- config/environment.rb
|
176
179
|
- config/routes.rb
|
@@ -326,6 +329,7 @@ files:
|
|
326
329
|
- public/stylesheets/jquery-ui-1.8.4.custom.css
|
327
330
|
- public/favicon.ico
|
328
331
|
- lib/tasks/dcmgr_gui.rake
|
332
|
+
- lib/tasks/dcmgr_api.rake
|
329
333
|
- test/unit/helpers/security_groups_helper_test.rb
|
330
334
|
- test/unit/helpers/snapshots_helper_test.rb
|
331
335
|
- test/unit/helpers/images_helper_test.rb
|