chef-server-webui 0.8.2

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.
Files changed (207) hide show
  1. data/LICENSE +201 -0
  2. data/README.rdoc +135 -0
  3. data/Rakefile +62 -0
  4. data/app/controllers/application.rb +281 -0
  5. data/app/controllers/clients.rb +120 -0
  6. data/app/controllers/cookbook_attributes.rb +41 -0
  7. data/app/controllers/cookbook_definitions.rb +41 -0
  8. data/app/controllers/cookbook_files.rb +39 -0
  9. data/app/controllers/cookbook_libraries.rb +41 -0
  10. data/app/controllers/cookbook_recipes.rb +40 -0
  11. data/app/controllers/cookbook_templates.rb +57 -0
  12. data/app/controllers/cookbooks.rb +78 -0
  13. data/app/controllers/databag_items.rb +102 -0
  14. data/app/controllers/databags.rb +83 -0
  15. data/app/controllers/exceptions.rb +19 -0
  16. data/app/controllers/main.rb +7 -0
  17. data/app/controllers/nodes.rb +138 -0
  18. data/app/controllers/openid_consumer.rb +154 -0
  19. data/app/controllers/roles.rb +144 -0
  20. data/app/controllers/search.rb +62 -0
  21. data/app/controllers/search_entries.rb +64 -0
  22. data/app/controllers/status.rb +39 -0
  23. data/app/controllers/users.rb +186 -0
  24. data/app/helpers/application_helper.rb +171 -0
  25. data/app/helpers/cookbook_attributes_helper.rb +7 -0
  26. data/app/helpers/cookbook_definitions_helper.rb +8 -0
  27. data/app/helpers/cookbook_files_helper.rb +8 -0
  28. data/app/helpers/cookbook_libraries_helper.rb +7 -0
  29. data/app/helpers/cookbook_recipes_helper.rb +8 -0
  30. data/app/helpers/cookbook_templates_helper.rb +8 -0
  31. data/app/helpers/exceptions_helper.rb +6 -0
  32. data/app/helpers/global_helpers.rb +35 -0
  33. data/app/helpers/nodes_helper.rb +41 -0
  34. data/app/helpers/openid_consumer_helper.rb +8 -0
  35. data/app/helpers/openid_register_helper.rb +8 -0
  36. data/app/helpers/openid_server_helper.rb +6 -0
  37. data/app/helpers/openid_server_helpers.rb +29 -0
  38. data/app/helpers/roles_helper.rb +5 -0
  39. data/app/helpers/search_entries_helper.rb +8 -0
  40. data/app/helpers/search_helper.rb +38 -0
  41. data/app/helpers/status_helper.rb +26 -0
  42. data/app/views/clients/_form.html.haml +22 -0
  43. data/app/views/clients/_navigation.html.haml +9 -0
  44. data/app/views/clients/edit.html.haml +6 -0
  45. data/app/views/clients/index.html.haml +21 -0
  46. data/app/views/clients/new.html.haml +6 -0
  47. data/app/views/clients/show.html.haml +20 -0
  48. data/app/views/cookbooks/index.html.haml +10 -0
  49. data/app/views/cookbooks/show.html.haml +40 -0
  50. data/app/views/databag_items/_form.html.haml +14 -0
  51. data/app/views/databag_items/_navigation.html.haml +9 -0
  52. data/app/views/databag_items/edit.html.haml +6 -0
  53. data/app/views/databag_items/index.html.haml +0 -0
  54. data/app/views/databag_items/new.html.haml +6 -0
  55. data/app/views/databag_items/show.html.haml +9 -0
  56. data/app/views/databags/_form.html.haml +12 -0
  57. data/app/views/databags/_item_navigation.html.haml +8 -0
  58. data/app/views/databags/_navigation.html.haml +9 -0
  59. data/app/views/databags/edit.html.haml +6 -0
  60. data/app/views/databags/index.html.haml +19 -0
  61. data/app/views/databags/new.html.haml +6 -0
  62. data/app/views/databags/show.html.haml +19 -0
  63. data/app/views/exceptions/bad_request.json.erb +1 -0
  64. data/app/views/exceptions/internal_server_error.html.erb +216 -0
  65. data/app/views/exceptions/not_acceptable.html.erb +63 -0
  66. data/app/views/exceptions/not_found.html.erb +47 -0
  67. data/app/views/exceptions/standard_error.html.erb +217 -0
  68. data/app/views/layout/_jsonedit.html.haml +82 -0
  69. data/app/views/layout/chef_server_webui.html.haml +56 -0
  70. data/app/views/layout/login.html.haml +36 -0
  71. data/app/views/main/index.html.erb +1 -0
  72. data/app/views/nodes/_action.html.haml +13 -0
  73. data/app/views/nodes/_form.html.haml +53 -0
  74. data/app/views/nodes/_navigation.html.haml +9 -0
  75. data/app/views/nodes/_resource.html.haml +22 -0
  76. data/app/views/nodes/edit.html.haml +7 -0
  77. data/app/views/nodes/index.html.haml +25 -0
  78. data/app/views/nodes/new.html.haml +6 -0
  79. data/app/views/nodes/show.html.haml +60 -0
  80. data/app/views/openid_consumer/index.html.haml +28 -0
  81. data/app/views/openid_consumer/start.html.haml +4 -0
  82. data/app/views/openid_login/index.html.haml +5 -0
  83. data/app/views/openid_register/index.html.haml +19 -0
  84. data/app/views/openid_register/show.html.haml +7 -0
  85. data/app/views/roles/_form.html.haml +53 -0
  86. data/app/views/roles/_navigation.html.haml +9 -0
  87. data/app/views/roles/edit.html.haml +6 -0
  88. data/app/views/roles/index.html.haml +21 -0
  89. data/app/views/roles/new.html.haml +6 -0
  90. data/app/views/roles/show.html.haml +54 -0
  91. data/app/views/search/_search_form.html.haml +6 -0
  92. data/app/views/search/index.html.haml +8 -0
  93. data/app/views/search/show.html.haml +13 -0
  94. data/app/views/search_entries/index.html.haml +8 -0
  95. data/app/views/search_entries/show.html.haml +7 -0
  96. data/app/views/status/index.html.haml +90 -0
  97. data/app/views/users/_form.html.haml +39 -0
  98. data/app/views/users/_navigation.html.haml +9 -0
  99. data/app/views/users/edit.html.haml +6 -0
  100. data/app/views/users/index.html.haml +20 -0
  101. data/app/views/users/login.html.haml +16 -0
  102. data/app/views/users/new.html.haml +27 -0
  103. data/app/views/users/show.html.haml +13 -0
  104. data/app/views/users/start.html.haml +4 -0
  105. data/config.ru +84 -0
  106. data/config/init.rb +49 -0
  107. data/config/router.rb +6 -0
  108. data/lib/chef-server-webui.rb +155 -0
  109. data/lib/chef-server-webui/merbtasks.rb +103 -0
  110. data/lib/chef-server-webui/slicetasks.rb +20 -0
  111. data/lib/chef-server-webui/spectasks.rb +53 -0
  112. data/public/facebox/README.txt +4 -0
  113. data/public/facebox/b.png +0 -0
  114. data/public/facebox/bl.png +0 -0
  115. data/public/facebox/br.png +0 -0
  116. data/public/facebox/closelabel.gif +0 -0
  117. data/public/facebox/facebox.css +95 -0
  118. data/public/facebox/facebox.js +319 -0
  119. data/public/facebox/loading.gif +0 -0
  120. data/public/facebox/tl.png +0 -0
  121. data/public/facebox/tr.png +0 -0
  122. data/public/images/avatar.png +0 -0
  123. data/public/images/black_big.png +0 -0
  124. data/public/images/indicator.gif +0 -0
  125. data/public/images/jsonedit/add2.png +0 -0
  126. data/public/images/jsonedit/build-button.png +0 -0
  127. data/public/images/jsonedit/bullet.gif +0 -0
  128. data/public/images/jsonedit/bullet_orange.png +0 -0
  129. data/public/images/jsonedit/cross.png +0 -0
  130. data/public/images/jsonedit/delete.png +0 -0
  131. data/public/images/jsonedit/deleted.png +0 -0
  132. data/public/images/jsonedit/json.jpg +0 -0
  133. data/public/images/jsonedit/label.gif +0 -0
  134. data/public/images/jsonedit/minus.gif +0 -0
  135. data/public/images/jsonedit/pixel.gif +0 -0
  136. data/public/images/jsonedit/plus.gif +0 -0
  137. data/public/images/jsonedit/saved.png +0 -0
  138. data/public/images/jsonedit/table_refresh.png +0 -0
  139. data/public/images/jsonedit/value.gif +0 -0
  140. data/public/images/merb.jpg +0 -0
  141. data/public/images/toggle-collapse-dark.png +0 -0
  142. data/public/images/toggle-collapse-light.png +0 -0
  143. data/public/images/toggle-collapse.gif +0 -0
  144. data/public/images/toggle-expand-dark.png +0 -0
  145. data/public/images/toggle-expand-light.png +0 -0
  146. data/public/images/toggle-expand.gif +0 -0
  147. data/public/images/treeBuilderImages/Thumbs.db +0 -0
  148. data/public/images/treeBuilderImages/doc.gif +0 -0
  149. data/public/images/treeBuilderImages/docNode.gif +0 -0
  150. data/public/images/treeBuilderImages/docNodeLast.gif +0 -0
  151. data/public/images/treeBuilderImages/docNodeLastFirst.gif +0 -0
  152. data/public/images/treeBuilderImages/folder.gif +0 -0
  153. data/public/images/treeBuilderImages/folderNode.gif +0 -0
  154. data/public/images/treeBuilderImages/folderNodeFirst.gif +0 -0
  155. data/public/images/treeBuilderImages/folderNodeLast.gif +0 -0
  156. data/public/images/treeBuilderImages/folderNodeLastFirst.gif +0 -0
  157. data/public/images/treeBuilderImages/folderNodeOpen.gif +0 -0
  158. data/public/images/treeBuilderImages/folderNodeOpenFirst.gif +0 -0
  159. data/public/images/treeBuilderImages/folderNodeOpenLast.gif +0 -0
  160. data/public/images/treeBuilderImages/folderNodeOpenLastFirst.gif +0 -0
  161. data/public/images/treeBuilderImages/folderOpen.gif +0 -0
  162. data/public/images/treeBuilderImages/vertLine.gif +0 -0
  163. data/public/javascripts/chef.js +160 -0
  164. data/public/javascripts/jquery-1.3.2.min.js +19 -0
  165. data/public/javascripts/jquery-ui-1.7.1.custom.min.js +65 -0
  166. data/public/javascripts/jquery.editinline.js +108 -0
  167. data/public/javascripts/jquery.jeditable.mini.js +30 -0
  168. data/public/javascripts/jquery.livequery.js +250 -0
  169. data/public/javascripts/jquery.localscroll.js +104 -0
  170. data/public/javascripts/jquery.scrollTo.js +150 -0
  171. data/public/javascripts/jquery.tools.min.js +17 -0
  172. data/public/javascripts/jquery.treeTable.min.js +165 -0
  173. data/public/javascripts/json.js +153 -0
  174. data/public/javascripts/jsonedit_main.js +675 -0
  175. data/public/javascripts/yetii-min.js +1 -0
  176. data/public/stylesheets/base.css +336 -0
  177. data/public/stylesheets/chef.css +157 -0
  178. data/public/stylesheets/images/ui-bg_diagonals-small_0_aaaaaa_40x40.png +0 -0
  179. data/public/stylesheets/images/ui-bg_diagonals-thick_15_444444_40x40.png +0 -0
  180. data/public/stylesheets/images/ui-bg_glass_100_f0f0f0_1x400.png +0 -0
  181. data/public/stylesheets/images/ui-bg_glass_50_99c2ff_1x400.png +0 -0
  182. data/public/stylesheets/images/ui-bg_glass_55_fbf5d0_1x400.png +0 -0
  183. data/public/stylesheets/images/ui-bg_glass_80_e6e6e6_1x400.png +0 -0
  184. data/public/stylesheets/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  185. data/public/stylesheets/images/ui-bg_highlight-hard_100_f9f9f9_1x100.png +0 -0
  186. data/public/stylesheets/images/ui-bg_highlight-soft_100_e7eef3_1x100.png +0 -0
  187. data/public/stylesheets/images/ui-icons_222222_256x240.png +0 -0
  188. data/public/stylesheets/images/ui-icons_2694e8_256x240.png +0 -0
  189. data/public/stylesheets/images/ui-icons_2e83ff_256x240.png +0 -0
  190. data/public/stylesheets/images/ui-icons_72a7cf_256x240.png +0 -0
  191. data/public/stylesheets/images/ui-icons_888888_256x240.png +0 -0
  192. data/public/stylesheets/images/ui-icons_cd0a0a_256x240.png +0 -0
  193. data/public/stylesheets/images/ui-icons_ffffff_256x240.png +0 -0
  194. data/public/stylesheets/jquery-ui-1.7.1.custom.css +404 -0
  195. data/public/stylesheets/jquery.treeTable.css +43 -0
  196. data/public/stylesheets/jsonedit_main.css +280 -0
  197. data/public/stylesheets/themes/bec-green/style.css +290 -0
  198. data/public/stylesheets/themes/bec/style.css +301 -0
  199. data/public/stylesheets/themes/blue/style.css +280 -0
  200. data/public/stylesheets/themes/default/style.css +267 -0
  201. data/public/stylesheets/themes/djime-cerulean/style.css +298 -0
  202. data/public/stylesheets/themes/kathleene/style.css +272 -0
  203. data/public/stylesheets/themes/orange/style.css +263 -0
  204. data/public/stylesheets/themes/reidb-greenish/style.css +301 -0
  205. data/stubs/app/controllers/application.rb +2 -0
  206. data/stubs/app/controllers/main.rb +2 -0
  207. metadata +399 -0
@@ -0,0 +1,171 @@
1
+ require 'chef/mixin/deep_merge'
2
+
3
+ module Merb
4
+ module ChefServerWebui
5
+ module ApplicationHelper
6
+
7
+ # @param *segments<Array[#to_s]> Path segments to append.
8
+ #
9
+ # @return <String>
10
+ # A path relative to the public directory, with added segments.
11
+ def image_path(*segments)
12
+ public_path_for(:image, *segments)
13
+ end
14
+
15
+ # @param *segments<Array[#to_s]> Path segments to append.
16
+ #
17
+ # @return <String>
18
+ # A path relative to the public directory, with added segments.
19
+ def javascript_path(*segments)
20
+ public_path_for(:javascript, *segments)
21
+ end
22
+
23
+ # @param *segments<Array[#to_s]> Path segments to append.
24
+ #
25
+ # @return <String>
26
+ # A path relative to the public directory, with added segments.
27
+ def stylesheet_path(*segments)
28
+ public_path_for(:stylesheet, *segments)
29
+ end
30
+
31
+ # Construct a path relative to the public directory
32
+ #
33
+ # @param <Symbol> The type of component.
34
+ # @param *segments<Array[#to_s]> Path segments to append.
35
+ #
36
+ # @return <String>
37
+ # A path relative to the public directory, with added segments.
38
+ def public_path_for(type, *segments)
39
+ ::ChefServerWebui.public_path_for(type, *segments)
40
+ end
41
+
42
+ # Construct an app-level path.
43
+ #
44
+ # @param <Symbol> The type of component.
45
+ # @param *segments<Array[#to_s]> Path segments to append.
46
+ #
47
+ # @return <String>
48
+ # A path within the host application, with added segments.
49
+ def app_path_for(type, *segments)
50
+ ::ChefServerWebui.app_path_for(type, *segments)
51
+ end
52
+
53
+ # Construct a slice-level path.
54
+ #
55
+ # @param <Symbol> The type of component.
56
+ # @param *segments<Array[#to_s]> Path segments to append.
57
+ #
58
+ # @return <String>
59
+ # A path within the slice source (Gem), with added segments.
60
+ def slice_path_for(type, *segments)
61
+ ::ChefServerWebui.slice_path_for(type, *segments)
62
+ end
63
+
64
+ def build_tree(name, node, default={}, override={})
65
+ node = Chef::Mixin::DeepMerge.merge(default, node)
66
+ node = Chef::Mixin::DeepMerge.merge(node, override)
67
+ html = "<table id='#{name}' class='tree table'>"
68
+ html << "<tr><th class='first'>Attribute</th><th class='last'>Value</th></tr>"
69
+ count = 0
70
+ parent = 0
71
+ append_tree(name, html, node, count, parent, override)
72
+ html << "</table>"
73
+ html
74
+ end
75
+
76
+ def append_tree(name, html, node, count, parent, override)
77
+ node.sort{ |a,b| a[0] <=> b[0] }.each do |key, value|
78
+ to_send = Array.new
79
+ count += 1
80
+ is_parent = false
81
+ local_html = ""
82
+ local_html << "<tr id='#{name}-#{count}' class='collapsed #{name}"
83
+ if parent != 0
84
+ local_html << " child-of-#{name}-#{parent}' style='display: none;'>"
85
+ else
86
+ local_html << "'>"
87
+ end
88
+ local_html << "<td class='table-key'><span toggle='#{name}-#{count}'/>#{key}</td>"
89
+ case value
90
+ when Hash
91
+ is_parent = true
92
+ local_html << "<td></td>"
93
+ p = count
94
+ to_send << Proc.new { append_tree(name, html, value, count, p, override) }
95
+ when Array
96
+ is_parent = true
97
+ local_html << "<td></td>"
98
+ as_hash = {}
99
+ value.each_index { |i| as_hash[i] = value[i] }
100
+ p = count
101
+ to_send << Proc.new { append_tree(name, html, as_hash, count, p, override) }
102
+ else
103
+ local_html << "<td><div class='json-attr'>#{value}</div></td>"
104
+ end
105
+ local_html << "</tr>"
106
+ local_html.sub!(/class='collapsed/, 'class=\'collapsed parent') if is_parent
107
+ local_html.sub!(/<span/, "<span class='expander'") if is_parent
108
+ html << local_html
109
+ to_send.each { |s| count = s.call }
110
+ count += to_send.length
111
+ end
112
+ count
113
+ end
114
+
115
+ def syntax_highlight(code)
116
+ tokens = File.exists?(code) ? CodeRay.scan_file(code, :ruby) : CodeRay.scan(code, :ruby)
117
+ CodeRay.encode_tokens(tokens, :span)
118
+ end
119
+
120
+ def get_file(uri)
121
+ r = Chef::REST.new(Chef::Config[:chef_server_url])
122
+ content = r.get_rest(uri)
123
+ a = Tempfile.new("cookbook_temp_file")
124
+ File.open(a.path, 'w'){|f| f.write(content)}
125
+ path = a.path
126
+ a.close
127
+ path
128
+ end
129
+
130
+ def str_to_bool(str)
131
+ str =~ /true/ ? true : false
132
+ end
133
+
134
+ #for showing search result
135
+ def determine_name(type, object)
136
+ case type
137
+ when :node, :role, :client
138
+ object.name
139
+ else
140
+ params[:id]
141
+ end
142
+ end
143
+
144
+ # Recursively build a tree of lists.
145
+ #def build_tree(node)
146
+ # list = "<dl>"
147
+ # list << "\n<!-- Beginning of Tree -->"
148
+ # walk = lambda do |key,value|
149
+ # case value
150
+ # when Hash, Array
151
+ # list << "\n<!-- Beginning of Enumerable obj -->"
152
+ # list << "\n<dt>#{key}</dt>"
153
+ # list << "<dd>"
154
+ # list << "\t<dl>\n"
155
+ # value.each(&walk)
156
+ # list << "\t</dl>\n"
157
+ # list << "</dd>"
158
+ # list << "\n<!-- End of Enumerable obj -->"
159
+ #
160
+ # else
161
+ # list << "\n<dt>#{key}</dt>"
162
+ # list << "<dd>#{value}</dd>"
163
+ # end
164
+ # end
165
+ # node.sort{ |a,b| a[0] <=> b[0] }.each(&walk)
166
+ # list << "</dl>"
167
+ #end
168
+
169
+ end
170
+ end
171
+ end
@@ -0,0 +1,7 @@
1
+ module Merb
2
+ module ChefServerWebui
3
+ module CookbookAttributesHelper
4
+
5
+ end
6
+ end
7
+ end # Merb
@@ -0,0 +1,8 @@
1
+ module Merb
2
+ module ChefServerWebui
3
+ module CookbookDefinitionsHelper
4
+
5
+ end
6
+
7
+ end
8
+ end # Merb
@@ -0,0 +1,8 @@
1
+ module Merb
2
+ module ChefServerWebui
3
+ module CookbookFilesHelper
4
+
5
+ end
6
+
7
+ end
8
+ end # Merb
@@ -0,0 +1,7 @@
1
+ module Merb
2
+ module ChefServerWebui
3
+ module CookbookLibrariesHelper
4
+
5
+ end
6
+ end
7
+ end # Merb
@@ -0,0 +1,8 @@
1
+ module Merb
2
+ module ChefServerWebui
3
+ module CookbookRecipesHelper
4
+
5
+ end
6
+
7
+ end
8
+ end # Merb
@@ -0,0 +1,8 @@
1
+ module Merb
2
+ module ChefServerWebui
3
+ module CookbookTemplatesHelper
4
+
5
+ end
6
+
7
+ end
8
+ end # Merb
@@ -0,0 +1,6 @@
1
+ module Merb
2
+ module ChefServerWebui
3
+ module ExceptionsHelper
4
+ end
5
+ end
6
+ end # Merb
@@ -0,0 +1,35 @@
1
+ #
2
+ # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ module Merb
20
+ module ChefServerWebui
21
+
22
+ module GlobalHelpers
23
+ # helpers defined here available to all views.
24
+ def resource_collection(collection)
25
+ html = "<ul>"
26
+ collection.each do |resource|
27
+ html << "<li><b>#{resource.class}</b></li>"
28
+ end
29
+ html << "</ul>"
30
+ html
31
+ end
32
+
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,41 @@
1
+ #
2
+ # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Author:: AJ Christensen (<aj@junglist.gen.nz>)
4
+ # Copyright:: Copyright (c) 2008 Opscode, Inc.
5
+ # License:: Apache License, Version 2.0
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ module Merb
21
+ module ChefServerWebui
22
+ module NodesHelper
23
+ def recipe_list(node)
24
+ response = ""
25
+ node.recipes.each do |recipe|
26
+ response << "<li>#{recipe}</li>\n"
27
+ end
28
+ response
29
+ end
30
+
31
+ def attribute_list(node)
32
+ response = ""
33
+ node.each_attribute do |k,v|
34
+ response << "<li><b>#{k}</b>: #{v}</li>\n"
35
+ end
36
+ response
37
+ end
38
+
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,8 @@
1
+ module Merb
2
+ module ChefServerWebui
3
+ module OpenidConsumerHelper
4
+
5
+ end
6
+ end
7
+
8
+ end # Merb
@@ -0,0 +1,8 @@
1
+ module Merb
2
+ module ChefServerWebui
3
+ module OpenidRegisterHelper
4
+
5
+ end
6
+ end
7
+
8
+ end # Merb
@@ -0,0 +1,6 @@
1
+ module Merb
2
+ module ChefServerWebui
3
+ module OpenidServerHelper
4
+ end
5
+ end
6
+ end # Merb
@@ -0,0 +1,29 @@
1
+ #
2
+ # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ module Merb
20
+ module ChefServerWebui
21
+ module OpenidServerHelper
22
+
23
+ def url_for_user
24
+ url(:openid_node, :username => session[:username])
25
+ end
26
+
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,5 @@
1
+ module Merb
2
+ module RolesHelper
3
+
4
+ end
5
+ end # Merb
@@ -0,0 +1,8 @@
1
+ module Merb
2
+ module ChefServerWebui
3
+ module SearchEntriesHelper
4
+
5
+ end
6
+ end
7
+
8
+ end # Merb
@@ -0,0 +1,38 @@
1
+ module Merb
2
+ module ChefServerWebui
3
+ module SearchHelper
4
+ def output_path(attributes)
5
+ res = Hash.new
6
+ attributes.each do |path|
7
+ parts = path.split("/")
8
+ unless parts[0].nil?
9
+ parts.shift if parts[0].length == 0
10
+ end
11
+ res[path] = ohai_walk(parts)
12
+ end
13
+ res
14
+ end
15
+
16
+ def ohai_walk(path)
17
+ unless path[0]
18
+ @@ohai.to_json
19
+ else
20
+ ohai_walk_r(@@ohai, path)
21
+ end
22
+ end
23
+
24
+ def ohai_walk_r(ohai, path)
25
+ hop = (ohai.is_a?(Array) ? path.shift.to_i : path.shift)
26
+ if ohai[hop]
27
+ if path[0]
28
+ ohai_walk_r(ohai[hop], path)
29
+ else
30
+ ohai[hop].to_json
31
+ end
32
+ else
33
+ nil
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end # Merb
@@ -0,0 +1,26 @@
1
+ #
2
+ # Author:: Joe Williams (joe@joetify.com)
3
+ # Copyright:: Copyright (c) 2009 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ require 'chef' / 'node'
19
+
20
+ module Merb
21
+ module ChefServerWebui
22
+ module StatusHelper
23
+ end
24
+
25
+ end
26
+ end