chef-server-webui 0.9.0.a4 → 0.9.0.a6
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/app/controllers/application.rb +9 -27
- data/app/controllers/cookbooks.rb +5 -2
- data/app/controllers/nodes.rb +4 -2
- data/app/views/cookbooks/show.html.haml +16 -16
- data/bin/chef-server-webui +1 -10
- data/lib/chef-server-webui/version.rb +1 -1
- data/public/stylesheets/chef.css +26 -6
- metadata +3 -3
@@ -209,19 +209,15 @@ class Application < Merb::Controller
|
|
209
209
|
count
|
210
210
|
end
|
211
211
|
|
212
|
-
def syntax_highlight(
|
213
|
-
|
214
|
-
CodeRay.encode_tokens(tokens, :span)
|
215
|
-
end
|
216
|
-
|
217
|
-
def get_file(uri)
|
212
|
+
def syntax_highlight(file_url)
|
213
|
+
Chef::Log.debug("fetching file from '#{file_url}' for highlighting")
|
218
214
|
r = Chef::REST.new(Chef::Config[:chef_server_url])
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
215
|
+
highlighted_file = nil
|
216
|
+
r.fetch(file_url) do |tempfile|
|
217
|
+
tokens = CodeRay.scan_file(tempfile.path, :ruby)
|
218
|
+
highlighted_file = CodeRay.encode_tokens(tokens, :span)
|
219
|
+
end
|
220
|
+
highlighted_file
|
225
221
|
end
|
226
222
|
|
227
223
|
def str_to_bool(str)
|
@@ -240,21 +236,7 @@ class Application < Merb::Controller
|
|
240
236
|
|
241
237
|
def get_available_recipes
|
242
238
|
r = Chef::REST.new(Chef::Config[:chef_server_url])
|
243
|
-
|
244
|
-
cookbooks = r.get_rest("cookbooks")
|
245
|
-
cookbooks.keys.sort.each do |key|
|
246
|
-
cb = r.get_rest(cookbooks[key])
|
247
|
-
cb["recipes"].each do |recipe|
|
248
|
-
recipe["name"] =~ /(.+)\.rb/
|
249
|
-
r_name = $1;
|
250
|
-
if r_name == "default"
|
251
|
-
result << key
|
252
|
-
else
|
253
|
-
result << "#{key}::#{r_name}"
|
254
|
-
end
|
255
|
-
end
|
256
|
-
end
|
257
|
-
result
|
239
|
+
r.get_rest('cookbooks/_recipes')
|
258
240
|
end
|
259
241
|
|
260
242
|
def convert_newline_to_br(string)
|
@@ -18,11 +18,12 @@
|
|
18
18
|
# limitations under the License.
|
19
19
|
#
|
20
20
|
|
21
|
-
require 'chef
|
21
|
+
require 'chef/cookbook_loader'
|
22
|
+
require 'chef/cookbook_version'
|
22
23
|
|
23
24
|
class Cookbooks < Application
|
24
25
|
|
25
|
-
provides :html
|
26
|
+
provides :html
|
26
27
|
before :login_required
|
27
28
|
before :params_helper
|
28
29
|
|
@@ -58,6 +59,8 @@ class Cookbooks < Application
|
|
58
59
|
# by default always show the largest version number (assuming largest means most recent)
|
59
60
|
@other_versions = versions - [version]
|
60
61
|
raise NotFound unless @cookbook
|
62
|
+
|
63
|
+
@manifest = @cookbook.manifest
|
61
64
|
display @cookbook
|
62
65
|
rescue => e
|
63
66
|
Chef::Log.error("#{e}\n#{e.backtrace.join("\n")}")
|
data/app/controllers/nodes.rb
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
# limitations under the License.
|
19
19
|
#
|
20
20
|
|
21
|
-
require 'chef
|
21
|
+
require 'chef/node'
|
22
22
|
|
23
23
|
class Nodes < Application
|
24
24
|
|
@@ -29,7 +29,9 @@ class Nodes < Application
|
|
29
29
|
def index
|
30
30
|
begin
|
31
31
|
node_hash = Chef::Node.list
|
32
|
-
|
32
|
+
require 'pp'
|
33
|
+
pp node_hash
|
34
|
+
@node_list = node_hash.keys.sort
|
33
35
|
rescue => e
|
34
36
|
Chef::Log.error("#{e}\n#{e.backtrace.join("\n")}")
|
35
37
|
@_message = {:error => "Could not list nodes"}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
.content
|
4
4
|
%h2
|
5
5
|
.title
|
6
|
-
= "Cookbook: #{h @
|
6
|
+
= "Cookbook: #{h @manifest["name"]}"
|
7
7
|
- unless @other_versions.nil? || @other_versions.empty?
|
8
8
|
%select{:name => "choice", :onchange => "jump(this)", :size => "1"}
|
9
9
|
%option{:value => ""} Other Versions
|
@@ -12,38 +12,38 @@
|
|
12
12
|
%option{:value => url(:show_specific_version_cookbook, :cookbook_id => @cookbook_id, :cb_version => v)} "#{v}"
|
13
13
|
.inner
|
14
14
|
.accordion
|
15
|
-
- unless @
|
15
|
+
- unless @manifest["libraries"].empty?
|
16
16
|
%h2.head= link_to "Library Files", "JavaScript:void(0);"
|
17
17
|
.files
|
18
|
-
- @
|
18
|
+
- @manifest["libraries"].each do |f|
|
19
19
|
.code
|
20
20
|
%h4.head= link_to File.basename(f["name"]), "JavaScript:void(0);"
|
21
|
-
%pre.ruby= syntax_highlight(
|
22
|
-
- unless @
|
21
|
+
%pre.ruby= syntax_highlight(f["url"])
|
22
|
+
- unless @manifest["attributes"].empty?
|
23
23
|
%h2.head= link_to "Attribute Files", "JavaScript:void(0);"
|
24
24
|
.files
|
25
|
-
- @
|
25
|
+
- @manifest["attributes"].each do |f|
|
26
26
|
.code
|
27
27
|
%h4.head= link_to File.basename(f["name"]), "JavaScript:void(0);"
|
28
|
-
%pre.ruby= syntax_highlight(
|
29
|
-
- unless @
|
28
|
+
%pre.ruby= syntax_highlight(f["url"])
|
29
|
+
- unless @manifest["definitions"].empty?
|
30
30
|
%h2.head= link_to "Definition Files", "JavaScript:void(0);"
|
31
31
|
.files
|
32
|
-
- @
|
32
|
+
- @manifest["definitions"].each do |f|
|
33
33
|
.code
|
34
34
|
%h4.head= link_to File.basename(f["name"]), "JavaScript:void(0);"
|
35
|
-
%pre.ruby= syntax_highlight(
|
36
|
-
- unless @
|
35
|
+
%pre.ruby= syntax_highlight(f["url"])
|
36
|
+
- unless @manifest["recipes"].empty?
|
37
37
|
%h2.head= link_to "Recipe Files", "JavaScript:void(0);"
|
38
38
|
.files
|
39
|
-
- @
|
39
|
+
- @manifest["recipes"].each do |f|
|
40
40
|
.code
|
41
41
|
%h4.head= link_to File.basename(f["name"]), "JavaScript:void(0);"
|
42
|
-
%pre.ruby= syntax_highlight(
|
43
|
-
- unless @
|
42
|
+
%pre.ruby= syntax_highlight(f["url"])
|
43
|
+
- unless @manifest["templates"].empty?
|
44
44
|
%h2.head= link_to "Template Files", "JavaScript:void(0);"
|
45
45
|
.files
|
46
|
-
- @
|
46
|
+
- @manifest["templates"].each do |f|
|
47
47
|
.code
|
48
48
|
%h4.head= link_to File.basename(f["name"]), "JavaScript:void(0);"
|
49
|
-
%pre.ruby= syntax_highlight(
|
49
|
+
%pre.ruby= syntax_highlight(f["url"])
|
data/bin/chef-server-webui
CHANGED
@@ -27,21 +27,12 @@ require "rubygems"
|
|
27
27
|
require "merb-core"
|
28
28
|
|
29
29
|
# Load chef and chef-server-api from source rather than gem, if present
|
30
|
-
$:.unshift(File.expand_path(File.dirname(__FILE__) + '/../../chef/lib
|
30
|
+
$:.unshift(File.expand_path(File.dirname(__FILE__) + '/../../chef/lib'))
|
31
31
|
$:.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
|
32
32
|
|
33
33
|
require 'chef'
|
34
34
|
require 'chef-server-webui'
|
35
35
|
|
36
|
-
# Ensure the chef gem we load is the same version as the chef server
|
37
|
-
unless defined?(Chef)
|
38
|
-
gem "chef", "=" + CHEF_SERVER_WEBUI_VERSION
|
39
|
-
require 'chef'
|
40
|
-
end
|
41
|
-
|
42
|
-
#Dir.chdir File.join(File.dirname(__FILE__),"..")
|
43
|
-
#__DIR__ = Dir.getwd
|
44
|
-
|
45
36
|
if ARGV[0] && ARGV[0] =~ /^[^-]/
|
46
37
|
ARGV.push "-H"
|
47
38
|
end
|
data/public/stylesheets/chef.css
CHANGED
@@ -51,22 +51,27 @@ dl dt { font-weight: bold; }
|
|
51
51
|
|
52
52
|
div.sortable {
|
53
53
|
height: 200px;
|
54
|
-
width:
|
54
|
+
width: 350px;
|
55
55
|
margin-right: 10px;
|
56
56
|
border: 1px solid black;
|
57
|
-
overflow: scroll;
|
57
|
+
overflow-y: scroll;
|
58
58
|
background: #777777;
|
59
59
|
}
|
60
60
|
|
61
61
|
div.sortable.run-list {
|
62
62
|
height: 430px;
|
63
|
-
width:
|
63
|
+
width: 350px;
|
64
64
|
margin-right: 10px;
|
65
65
|
border: 1px solid black;
|
66
|
-
overflow: scroll;
|
66
|
+
overflow-y: scroll;
|
67
67
|
background: #777777;
|
68
68
|
}
|
69
69
|
|
70
|
+
div.run-list ul.ui-sortable#for_node, div.run-list ul.ui-sortable#for_role {
|
71
|
+
min-height: 420px;
|
72
|
+
}
|
73
|
+
|
74
|
+
|
70
75
|
div.clear {
|
71
76
|
clear: left;
|
72
77
|
}
|
@@ -125,9 +130,24 @@ div.editor {
|
|
125
130
|
border: 1px solid black;
|
126
131
|
}
|
127
132
|
|
128
|
-
#node_available_roles, #node_available_recipes, #for_node, #for_role, #available_recipes {
|
133
|
+
#node_available_roles, #node_available_recipes, #for_node, #for_role, #available_recipes {
|
134
|
+
list-style-type: none;
|
135
|
+
margin: 0;
|
136
|
+
padding: 0;
|
137
|
+
float: left;
|
138
|
+
margin-right: 10px;
|
139
|
+
background: #eee;
|
140
|
+
padding: 5px;
|
141
|
+
width: 325px;
|
142
|
+
min-height:200px;
|
143
|
+
}
|
129
144
|
|
130
|
-
#node_available_roles li, #node_available_recipes li, #for_node li, #for_role li, #available_recipes li {
|
145
|
+
#node_available_roles li, #node_available_recipes li, #for_node li, #for_role li, #available_recipes li {
|
146
|
+
margin: 0 5px 5px 5px;
|
147
|
+
padding: 5px;
|
148
|
+
width: 310px;
|
149
|
+
overflow:hidden;
|
150
|
+
}
|
131
151
|
|
132
152
|
#sidebar_block {
|
133
153
|
display: none;
|
metadata
CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
|
|
6
6
|
- 0
|
7
7
|
- 9
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.9.0.
|
9
|
+
- a6
|
10
|
+
version: 0.9.0.a6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Opscode
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-06-
|
18
|
+
date: 2010-06-07 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|