chef-server-webui 0.8.16 → 0.9.0.a3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. data/Rakefile +14 -10
  2. data/app/controllers/application.rb +111 -128
  3. data/app/controllers/clients.rb +10 -10
  4. data/app/controllers/cookbook_attributes.rb +1 -1
  5. data/app/controllers/cookbook_definitions.rb +1 -1
  6. data/app/controllers/cookbook_files.rb +1 -1
  7. data/app/controllers/cookbook_libraries.rb +1 -1
  8. data/app/controllers/cookbook_recipes.rb +1 -1
  9. data/app/controllers/cookbook_templates.rb +1 -1
  10. data/app/controllers/cookbooks.rb +21 -3
  11. data/app/controllers/databag_items.rb +6 -6
  12. data/app/controllers/databags.rb +3 -3
  13. data/app/controllers/main.rb +1 -1
  14. data/app/controllers/nodes.rb +21 -21
  15. data/app/controllers/openid_consumer.rb +9 -9
  16. data/app/controllers/roles.rb +3 -3
  17. data/app/controllers/search.rb +1 -1
  18. data/app/controllers/search_entries.rb +1 -1
  19. data/app/controllers/status.rb +1 -1
  20. data/app/controllers/users.rb +7 -7
  21. data/app/helpers/application_helper.rb +1 -156
  22. data/app/helpers/global_helpers.rb +20 -16
  23. data/app/helpers/nodes_helper.rb +24 -22
  24. data/app/helpers/openid_server_helpers.rb +13 -10
  25. data/app/helpers/search_helper.rb +44 -38
  26. data/app/helpers/status_helper.rb +10 -3
  27. data/app/views/clients/_navigation.html.haml +5 -5
  28. data/app/views/clients/edit.html.haml +1 -1
  29. data/app/views/clients/index.html.haml +4 -4
  30. data/app/views/clients/new.html.haml +1 -1
  31. data/app/views/cookbooks/index.html.haml +1 -1
  32. data/app/views/cookbooks/show.html.haml +25 -16
  33. data/app/views/databag_items/_form.html.haml +1 -1
  34. data/app/views/databag_items/_navigation.html.haml +5 -5
  35. data/app/views/databag_items/edit.html.haml +1 -1
  36. data/app/views/databag_items/new.html.haml +1 -1
  37. data/app/views/databags/_item_navigation.html.haml +4 -4
  38. data/app/views/databags/_navigation.html.haml +5 -5
  39. data/app/views/databags/edit.html.haml +1 -1
  40. data/app/views/databags/index.html.haml +3 -3
  41. data/app/views/databags/new.html.haml +1 -1
  42. data/app/views/databags/show.html.haml +3 -3
  43. data/app/views/layout/{chef_server_webui.html.haml → application.html.haml} +11 -11
  44. data/app/views/layout/login.html.haml +1 -1
  45. data/app/views/nodes/_form.html.haml +1 -1
  46. data/app/views/nodes/_navigation.html.haml +5 -5
  47. data/app/views/nodes/edit.html.haml +1 -1
  48. data/app/views/nodes/index.html.haml +6 -6
  49. data/app/views/nodes/new.html.haml +1 -1
  50. data/app/views/nodes/show.html.haml +4 -5
  51. data/app/views/openid_consumer/index.html.haml +2 -2
  52. data/app/views/openid_register/index.html.haml +4 -4
  53. data/app/views/openid_register/show.html.haml +1 -1
  54. data/app/views/roles/_form.html.haml +1 -1
  55. data/app/views/roles/_navigation.html.haml +5 -5
  56. data/app/views/roles/edit.html.haml +1 -1
  57. data/app/views/roles/index.html.haml +4 -4
  58. data/app/views/roles/new.html.haml +1 -1
  59. data/app/views/roles/show.html.haml +3 -4
  60. data/app/views/search/_search_form.html.haml +1 -1
  61. data/app/views/search/index.html.haml +1 -1
  62. data/app/views/search/show.html.haml +1 -1
  63. data/app/views/status/index.html.haml +9 -12
  64. data/app/views/users/_form.html.haml +1 -1
  65. data/app/views/users/_navigation.html.haml +5 -5
  66. data/app/views/users/edit.html.haml +1 -1
  67. data/app/views/users/index.html.haml +3 -3
  68. data/app/views/users/login.html.haml +1 -1
  69. data/app/views/users/new.html.haml +1 -1
  70. data/bin/chef-server-webui +72 -0
  71. data/config.ru +10 -74
  72. data/config/init.rb +30 -11
  73. data/config/rack.rb +5 -0
  74. data/config/router.rb +62 -5
  75. data/lib/chef-server-webui.rb +2 -155
  76. data/lib/chef-server-webui/version.rb +3 -0
  77. data/public/javascripts/drop_down_menu.js +22 -0
  78. metadata +60 -48
  79. data/stubs/app/controllers/application.rb +0 -2
  80. data/stubs/app/controllers/main.rb +0 -2
@@ -16,24 +16,24 @@
16
16
  %body
17
17
  #container
18
18
  #header
19
- %h1= link_to "Chef Server", slice_url(:top)
19
+ %h1= link_to "Chef Server", url(:top)
20
20
  #user-navigation
21
21
  %ul
22
22
  - if session[:user]
23
- %li= link_to "Logout #{h session[:user]} (#{session[:level].to_s})", slice_url(:users_logout), :method => "get", :confirm => "Are you sure you want to logout?"
23
+ %li= link_to "Logout #{h session[:user]} (#{session[:level].to_s})", url(:users_logout), :method => "get", :confirm => "Are you sure you want to logout?"
24
24
  - else
25
- %li= link_to "Login", slice_url(:users_login), :rel => "facebox"
25
+ %li= link_to "Login", url(:users_login), :rel => "facebox"
26
26
  .clear
27
27
  #main-navigation
28
28
  %ul
29
- %li= link_to "Search", slice_url(:searches)
30
- %li= link_to "Status", slice_url(:status)
31
- %li= link_to "Roles", slice_url(:roles)
32
- %li= link_to "Nodes", slice_url(:nodes)
33
- %li= link_to "Cookbooks", slice_url(:cookbooks)
34
- %li= link_to "Databags", slice_url(:databags)
35
- %li= link_to "Clients", slice_url(:clients)
36
- %li= link_to "Users", slice_url(:users)
29
+ %li= link_to "Search", url(:searches)
30
+ %li= link_to "Status", url(:status)
31
+ %li= link_to "Roles", url(:roles)
32
+ %li= link_to "Nodes", url(:nodes)
33
+ %li= link_to "Cookbooks", url(:cookbooks)
34
+ %li= link_to "Databags", url(:databags)
35
+ %li= link_to "Clients", url(:clients)
36
+ %li= link_to "Users", url(:users)
37
37
  .clear
38
38
  #wrapper
39
39
  #main
@@ -14,7 +14,7 @@
14
14
  %body
15
15
  #container
16
16
  #header
17
- %h1= link_to "Chef Server", slice_url(:top)
17
+ %h1= link_to "Chef Server", url(:top)
18
18
  #wrapper
19
19
  #main
20
20
  - unless message.empty?
@@ -42,7 +42,7 @@
42
42
 
43
43
  %div.group.form{:style => "position:relative;"}
44
44
  %label.label Attributes
45
- = partial '../layout/jsonedit', :json =>@node.attribute.to_json
45
+ = partial 'layout/jsonedit', :json =>@node.normal_attrs.to_json
46
46
  %div.group.form
47
47
  %span.description A JSON hash for default attributes for nodes of this node. These attributes will only be applied if the node does not already have a value for the attributes.
48
48
 
@@ -1,9 +1,9 @@
1
1
  .secondary-navigation
2
2
  %ul
3
- %li{ :class => "first #{active == 'index' ? "active" : ''}"}= link_to('List', slice_url(:nodes))
4
- %li{ :class => (active == 'create' ? "active" : '')}= link_to('Create', slice_url(:new_node))
3
+ %li{ :class => "first #{active == 'index' ? "active" : ''}"}= link_to('List', url(:nodes))
4
+ %li{ :class => (active == 'create' ? "active" : '')}= link_to('Create', url(:new_node))
5
5
  - if active != 'create' && active != 'index'
6
- %li{ :class => (active == 'show' ? "active" : '')}= link_to('Show', slice_url(:node, @node.name))
7
- %li{ :class => (active == 'edit' ? "active" : '')}= link_to('Edit', slice_url(:edit_node, @node.name))
8
- %li= link_to('Delete', slice_url(:node, @node.name), :method => "delete", :confirm => "Really delete node #{@node.name}? There is no undo.")
6
+ %li{ :class => (active == 'show' ? "active" : '')}= link_to('Show', url(:node, @node.name))
7
+ %li{ :class => (active == 'edit' ? "active" : '')}= link_to('Edit', url(:edit_node, @node.name))
8
+ %li= link_to('Delete', url(:node, @node.name), :method => "delete", :confirm => "Really delete node #{@node.name}? There is no undo.")
9
9
  .clear
@@ -3,5 +3,5 @@
3
3
  %h2.title= "Node #{h @node.name}"
4
4
  .inner
5
5
  = partial('navigation', :active => 'edit')
6
- = partial('form', :header => "Edit Node #{@node.name}", :form_id => 'edit_node', :submit_name => "Save Node", :submit_id => "edit_node_button", :form_for => 'edit', :form_url => slice_url(:node, @node.name) )
6
+ = partial('form', :header => "Edit Node #{@node.name}", :form_id => 'edit_node', :submit_name => "Save Node", :submit_id => "edit_node_button", :form_for => 'edit', :form_url => url(:node, @node.name) )
7
7
 
@@ -12,14 +12,14 @@
12
12
  %th.last  
13
13
  - even = false
14
14
  - if @node_list.empty?
15
- %td{:colspan => 4}= "You appear to have no nodes - try connecting one, or creating or editing a #{link_to('client', slice_url(:clients))}"
15
+ %td{:colspan => 4}= "You appear to have no nodes - try connecting one, or creating or editing a #{link_to('client', url(:clients))}"
16
16
  - else
17
- - @node_list.each do |node, node_url|
17
+ - @node_list.each do |node|
18
18
  %tr{:class => even ? "even": "odd" }
19
- %td{:colspan => 2}= link_to node, slice_url(:node, { :id => node } )
19
+ %td{:colspan => 2}= link_to node, url(:node, { :id => node } )
20
20
  %td
21
- = link_to('Edit', slice_url(:edit_node, node))
21
+ = link_to('Edit', url(:edit_node, node))
22
22
  |
23
- = link_to('Delete', slice_url(:node, node), :method => "delete", :confirm => "Really delete Node #{node}? There is no undo.")
24
- - even ? even = false: even = true
23
+ = link_to('Delete', url(:node, node), :method => "delete", :confirm => "Really delete Node #{node}? There is no undo.")
24
+ - even = (not even)
25
25
 
@@ -3,4 +3,4 @@
3
3
  %h2.title= "Node"
4
4
  .inner
5
5
  = partial('navigation', :active => 'create')
6
- = partial('form', :header => "Create new Node", :form_id => 'create_node', :submit_name => "Create Node", :submit_id => "create_node_button", :form_for => 'create', :form_url => slice_url(:nodes))
6
+ = partial('form', :header => "Create new Node", :form_id => 'create_node', :submit_name => "Create Node", :submit_id => "create_node_button", :form_for => 'create', :form_url => url(:nodes))
@@ -17,12 +17,11 @@
17
17
  %tr
18
18
  %td{:colspan => 2} This node has no roles or recipes applied.
19
19
  - else
20
- -@node.run_list.each_index do |i|
21
- - type, name, fname = @node.run_list.parse_entry(@node.run_list[i])
20
+ -@node.run_list.each_with_index do |run_list_item, i|
22
21
  %tr
23
22
  %td.position= i
24
- %td= name
25
- %td= type
23
+ %td= run_list_item.name
24
+ %td= run_list_item.type
26
25
  .left.accordion
27
26
  %h3.head= link_to("Recipes", "#")
28
27
  - full_recipe_list, default_attrs, override_attrs = @node.run_list.expand()
@@ -56,5 +55,5 @@
56
55
 
57
56
  .left
58
57
  %h3 Attributes
59
- = build_tree('attrs', @node.attribute, default_attrs, override_attrs)
58
+ = build_tree('attrs', @node)
60
59
 
@@ -11,7 +11,7 @@
11
11
  .content
12
12
  %h2.title Login
13
13
  .inner
14
- %form.form{ :method => "get", "accept-charset" => "UTF-8", :action => slice_url(:openid_consumer_login) }
14
+ %form.form{ :method => "get", "accept-charset" => "UTF-8", :action => url(:openid_consumer_login) }
15
15
  .group
16
16
  .text_field= text_field :openid_identifier
17
17
  .group
@@ -23,6 +23,6 @@
23
23
  .group
24
24
  .check_box= check_box :name => "force_post", :label => "Force the transaction to POST", :value => "0"
25
25
  .group
26
- =link_to("Or, log in with username and password.", slice_url(:users_login))
26
+ =link_to("Or, log in with username and password.", url(:users_login))
27
27
  .group.navform
28
28
  .button= submit "Login →"
@@ -10,10 +10,10 @@
10
10
  %th.last  
11
11
  - @registered_nodes.sort{ |a,b| a.name.to_s <=> b.name.to_s }.each_with_index do |node, index|
12
12
  %tr{:class => "#{index % 2 == 1 ? 'odd' : 'even'}"}
13
- %td{:colspan => 2}= link_to(node.name, slice_url(:registration, { :id => node.name }))
13
+ %td{:colspan => 2}= link_to(node.name, url(:registration, { :id => node.name }))
14
14
  %td
15
- = link_to( (node.validated ? "Invalidate Registration" : "Validate Registration"), slice_url( :validate_registration, { :id => node.name} ), :method => "post", :confirm => "Are you sure you want to" + (node.validated ? " invalidate " : " validate ") + "this node's registration?")
15
+ = link_to( (node.validated ? "Invalidate Registration" : "Validate Registration"), url( :validate_registration, { :id => node.name} ), :method => "post", :confirm => "Are you sure you want to" + (node.validated ? " invalidate " : " validate ") + "this node's registration?")
16
16
  |
17
- = link_to((node.admin ? "Remove Admin Rights" : "Grant Admin Rights"), slice_url(:admin_registration, { :id => node.name}), :method => "post", :confirm => "Are you sure you want to" + (node.admin ? " remove administrator privileges from this node?" : " grant administrator privileges to this node?"))
17
+ = link_to((node.admin ? "Remove Admin Rights" : "Grant Admin Rights"), url(:admin_registration, { :id => node.name}), :method => "post", :confirm => "Are you sure you want to" + (node.admin ? " remove administrator privileges from this node?" : " grant administrator privileges to this node?"))
18
18
  |
19
- = link_to("Delete", slice_url(:registration, { :id => node.name} ), :method => "delete", :confirm => "Are you sure you want to delete this registration")
19
+ = link_to("Delete", url(:registration, { :id => node.name} ), :method => "delete", :confirm => "Are you sure you want to delete this registration")
@@ -2,6 +2,6 @@
2
2
  .content
3
3
  %h2.title= "Registration #{@registered_node.name}"
4
4
  .inner
5
- = link_to "OpenID URL", slice_url(:openid_node, { :id => @registered_node.name.gsub(/\./, "_")})
5
+ = link_to "OpenID URL", url(:openid_node, { :id => @registered_node.name.gsub(/\./, "_")})
6
6
  %br= "Validated: #{@registered_node.validated}"
7
7
  %br= "Admin: #{@registered_node.admin}"
@@ -45,7 +45,7 @@
45
45
 
46
46
  %div.group.form{:style => "position:relative;"}
47
47
  %label.label Default and Override Attributes
48
- = partial '../layout/jsonedit', :json => { :defaults => @role.default_attributes, :overrides => @role.override_attributes }.to_json
48
+ = partial 'layout/jsonedit', :json => { :defaults => @role.default_attributes, :overrides => @role.override_attributes }.to_json
49
49
  %span.description A JSON hash for default attributes for nodes of this role. These attributes will only be applied if the node does not already have a value for the attributes.
50
50
  = form(:action => form_url, :method => :post, :id => form_id, :class => 'form') do
51
51
  %div.group
@@ -1,9 +1,9 @@
1
1
  .secondary-navigation
2
2
  %ul
3
- %li{ :class => "first #{active == 'index' ? "active" : ''}"}= link_to('List', slice_url(:roles))
4
- %li{ :class => (active == 'create' ? "active" : '')}= link_to('Create', slice_url(:new_role))
3
+ %li{ :class => "first #{active == 'index' ? "active" : ''}"}= link_to('List', url(:roles))
4
+ %li{ :class => (active == 'create' ? "active" : '')}= link_to('Create', url(:new_role))
5
5
  - if active != 'create' && active != 'index'
6
- %li{ :class => (active == 'show' ? "active" : '')}= link_to('Show', slice_url(:role, @role.name))
7
- %li{ :class => (active == 'edit' ? "active" : '')}= link_to('Edit', slice_url(:edit_role, @role.name))
8
- %li= link_to('Delete', slice_url(:role, @role.name), :method => "delete", :confirm => "Really delete Role #{@role.name}? There is no undo.")
6
+ %li{ :class => (active == 'show' ? "active" : '')}= link_to('Show', url(:role, @role.name))
7
+ %li{ :class => (active == 'edit' ? "active" : '')}= link_to('Edit', url(:edit_role, @role.name))
8
+ %li= link_to('Delete', url(:role, @role.name), :method => "delete", :confirm => "Really delete Role #{@role.name}? There is no undo.")
9
9
  .clear
@@ -3,4 +3,4 @@
3
3
  %h2.title= "Role #{h @role.name}"
4
4
  .inner
5
5
  = partial('navigation', :active => 'edit')
6
- = partial('form', :header => "Edit Role #{@role.name}", :form_id => 'edit_role', :submit_name => "Save Role", :submit_id => "edit_role_button", :form_for => 'edit', :form_url => slice_url(:role, @role.name) )
6
+ = partial('form', :header => "Edit Role #{@role.name}", :form_id => 'edit_role', :submit_name => "Save Role", :submit_id => "edit_role_button", :form_for => 'edit', :form_url => url(:role, @role.name) )
@@ -13,9 +13,9 @@
13
13
  - even = false;
14
14
  - @role_list.each do |role|
15
15
  %tr{ :class => even ? "even" : "odd" }
16
- %td{:colspan => 2}= link_to(role[0], slice_url(:role, role[0]))
16
+ %td{:colspan => 2}= link_to(role[0], url(:role, role[0]))
17
17
  %td
18
- = link_to('Edit', slice_url(:edit_role, role[0]))
18
+ = link_to('Edit', url(:edit_role, role[0]))
19
19
  |
20
- = link_to('Delete', slice_url(:role, role[0]), :method => "delete", :confirm => "Really delete Role #{role[0]}? there is no undo.")
21
- - even ? even = false: even = true
20
+ = link_to('Delete', url(:role, role[0]), :method => "delete", :confirm => "Really delete Role #{role[0]}? there is no undo.")
21
+ - even = (not even)
@@ -3,4 +3,4 @@
3
3
  %h2.title= "Role"
4
4
  .inner
5
5
  = partial('navigation', :active => 'create')
6
- = partial('form', :header => "Create new Role", :form_id => 'create_role', :submit_name => "Create Role", :submit_id => "create_role_button", :form_for => 'create', :form_url => slice_url(:roles))
6
+ = partial('form', :header => "Create new Role", :form_id => 'create_role', :submit_name => "Create Role", :submit_id => "create_role_button", :form_for => 'create', :form_url => url(:roles))
@@ -20,12 +20,11 @@
20
20
  %tr
21
21
  %td{:colspan => 2} This role does not include any roles or recipes.
22
22
  - else
23
- -@role.run_list.each_index do |i|
24
- - type, name, fname = @role.run_list.parse_entry(@role.run_list[i])
23
+ -@role.run_list.each_with_index do |run_list_item, i|
25
24
  %tr
26
25
  %td.position= i
27
- %td= name
28
- %td= type
26
+ %td= run_list_item.name
27
+ %td= run_list_item.type
29
28
  .left.accordion
30
29
  %h3.head= link_to("Recipes", "#")
31
30
  - full_recipe_list, default_attrs, override_attrs = @role.run_list.expand()
@@ -1,4 +1,4 @@
1
- %form{ :method => "get", :action => slice_url(:search, { :id => index_name }) }
1
+ %form{ :method => "get", :action => url(:search, { :id => index_name }) }
2
2
  Q:
3
3
  %input{ :type => "text", :name => "q" }
4
4
  A:
@@ -3,6 +3,6 @@
3
3
  %h2.title Search Indexes
4
4
  .inner
5
5
  - @search_indexes.sort{ |a,b| a.to_s <=> b.to_s}.each do |index|
6
- %form.form{ :method => "get", "accept-charset" => "UTF-8", :action => slice_url(:search, { :id => index[0]})}
6
+ %form.form{ :method => "get", "accept-charset" => "UTF-8", :action => url(:search, { :id => index[0]})}
7
7
  .group.label= text_field :name => "q", :label => "Query (i.e. attribute:value, leave empty to search all) "
8
8
  .group= submit "Search #{index[0]}"
@@ -10,4 +10,4 @@
10
10
  - @results.each do |result|
11
11
  - result.each do |o|
12
12
  %tr
13
- %td= link_to(o.name, slice_url(@type.to_sym, determine_name(@type.to_sym, o)))
13
+ %td= link_to(o.name, url(@type.to_sym, determine_name(@type.to_sym, o)))
@@ -13,11 +13,11 @@
13
13
  %th.last Run List
14
14
  - if @status.empty?
15
15
  %tr
16
- %td{:colspan => 7}= "You appear to have no nodes - try connecting one, or creating or editing a #{link_to('client', slice_url(:clients))}"
16
+ %td{:colspan => 7}= "You appear to have no nodes - try connecting one, or creating or editing a #{link_to('client', url(:clients))}"
17
17
  - else
18
18
  - @status.sort.each_with_index do |node, index|
19
19
  %tr{:class => "#{index % 2 == 1 ? 'odd' : 'even'}"}
20
- %td= link_to(node[1].name, slice_url(:node, node[1].name))
20
+ %td= link_to(node[1].name, url(:node, node[1].name))
21
21
  %td= "#{node[1]["platform"]} #{node[1]["platform_version"]}"
22
22
  %td= node[1]["fqdn"]
23
23
  %td= node[1]["ipaddress"]
@@ -31,9 +31,9 @@
31
31
  %td= node[1]["uptime"]
32
32
 
33
33
  - unless node[1]["ohai_time"].nil?
34
- - current_time = DateTime.now
35
- - date = DateTime.parse(Time.at(node[1]["ohai_time"]).to_s)
36
- - hours, minutes, seconds, frac = DateTime.day_fraction_to_time(current_time - date)
34
+ - current_time = Time.now.to_f
35
+ - ohai_time = Time.at(node[1]["ohai_time"])
36
+ - hours, minutes, seconds = time_difference_in_hms(ohai_time)
37
37
  - hours_text = "#{hours} hour#{hours == 1 ? '' : 's'}"
38
38
  - minutes_text = "#{minutes} minute#{minutes == 1 ? '' : 's'}"
39
39
  %td.flash
@@ -57,7 +57,7 @@
57
57
  %table.table.tooltip
58
58
  %tr
59
59
  %td
60
- = date
60
+ = ohai_time
61
61
  %br
62
62
  - if hours == 0
63
63
  = "#{minutes_text} ago"
@@ -79,12 +79,9 @@
79
79
  %tr
80
80
  %td{:colspan => 2} This node has no roles or recipes applied.
81
81
  - else
82
- - rl = Chef::RunList.new
83
- - rl.reset!(node[1].run_list)
84
- -rl.each_index do |i|
85
- - type, name, fname = rl.parse_entry(rl[i])
82
+ -node[1].run_list.each_with_index do |run_list_item, i|
86
83
  %tr
87
84
  %td.position= i
88
- %td= name
89
- %td= type
85
+ %td= run_list_item.name
86
+ %td= run_list_item.type
90
87
 
@@ -8,7 +8,7 @@
8
8
  %div.group
9
9
  .text_field= password_field :id=> "password", :name => "password", :label=>"Password: ", :class => "password_field"
10
10
  %br
11
- =link_to("Or, log in with OpenID if you have one associated with an existing user account.", slice_url(:openid_consumer))
11
+ =link_to("Or, log in with OpenID if you have one associated with an existing user account.", url(:openid_consumer))
12
12
  %br
13
13
 
14
14
  - if form_for == "edit"
@@ -1,9 +1,9 @@
1
1
  .secondary-navigation
2
2
  %ul
3
- %li{ :class => "first #{active == 'index' ? "active" : ''}"}= link_to('List', slice_url(:users))
4
- %li{ :class => (active == 'create' ? "active" : '')}= link_to('Create', slice_url(:users_new))
3
+ %li{ :class => "first #{active == 'index' ? "active" : ''}"}= link_to('List', url(:users))
4
+ %li{ :class => (active == 'create' ? "active" : '')}= link_to('Create', url(:users_new))
5
5
  - if active != 'create' && active != 'index'
6
- %li{ :class => (active == 'show' ? "active" : '')}= link_to('Show', slice_url(:users_show))
7
- %li{ :class => (active == 'edit' ? "active" : '')}= link_to('Edit', slice_url(:users_edit, :user_id => params[:user_id]))
8
- %li= link_to('Delete', slice_url(:users_delete, :user_id => params[:user_id]), :method => "delete", :confirm => "Really delete user #{params[:user_id]}? There is no undo.")
6
+ %li{ :class => (active == 'show' ? "active" : '')}= link_to('Show', url(:users_show))
7
+ %li{ :class => (active == 'edit' ? "active" : '')}= link_to('Edit', url(:users_edit, :user_id => params[:user_id]))
8
+ %li= link_to('Delete', url(:users_delete, :user_id => params[:user_id]), :method => "delete", :confirm => "Really delete user #{params[:user_id]}? There is no undo.")
9
9
  .clear
@@ -3,4 +3,4 @@
3
3
  %h2.title= "User: #{h @user.name}"
4
4
  .inner
5
5
  = partial('navigation', :active => 'edit')
6
- = partial('form', :header => "Edit User #{@user.name}", :form_id => 'edit_user', :submit_name => "Save User", :submit_id => "edit_user_button", :form_for => 'edit', :form_url => slice_url(:users_update, @user.name) )
6
+ = partial('form', :header => "Edit User #{@user.name}", :form_id => 'edit_user', :submit_name => "Save User", :submit_id => "edit_user_button", :form_for => 'edit', :form_url => url(:users_update, @user.name) )
@@ -13,8 +13,8 @@
13
13
  - even = false
14
14
  - @users.sort.each do |user, user_url|
15
15
  %tr{:class => even ? "even": "odd" }
16
- %td{:colspan => 2}= link_to user, slice_url(:users_show, :user_id => user)
16
+ %td{:colspan => 2}= link_to user, url(:users_show, :user_id => user)
17
17
  %td
18
- = link_to('Edit', slice_url(:users_edit, :user_id => user))
18
+ = link_to('Edit', url(:users_edit, :user_id => user))
19
19
  |
20
- = link_to('Delete', slice_url(:users_delete, :user_id => user), :method => "delete", :confirm => "Really delete User #{user}? There is no undo.")
20
+ = link_to('Delete', url(:users_delete, :user_id => user), :method => "delete", :confirm => "Really delete User #{user}? There is no undo.")
@@ -11,6 +11,6 @@
11
11
  .content
12
12
  %h2.title Login
13
13
  .inner
14
- = partial('form', :header => "Login", :form_id => 'login', :submit_name => "login", :submit_id => "login_button", :form_for => 'login', :form_url => slice_url(:users_login_exec) )
14
+ = partial('form', :header => "Login", :form_id => 'login', :submit_name => "login", :submit_id => "login_button", :form_for => 'login', :form_url => url(:users_login_exec) )
15
15
 
16
16
 
@@ -5,7 +5,7 @@
5
5
  = partial('navigation', :active => 'create')
6
6
  .content
7
7
  .inner
8
- %form.form{ :method => "get", "accept-charset" => "UTF-8", :action => slice_url(:users_create) }
8
+ %form.form{ :method => "get", "accept-charset" => "UTF-8", :action => url(:users_create) }
9
9
  %table.table
10
10
  %tr
11
11
  %td= "Username"
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # ./chef-server - Serving up piping hot infrastructure!
4
+ #
5
+ # Author:: Adam Jacob (<adam@opscode.com>)
6
+ # Copyright:: Copyright (c) 2008 Opscode, Inc.
7
+ # License:: Apache License, Version 2.0
8
+ #
9
+ # Licensed under the Apache License, Version 2.0 (the "License");
10
+ # you may not use this file except in compliance with the License.
11
+ # You may obtain a copy of the License at
12
+ #
13
+ # http://www.apache.org/licenses/LICENSE-2.0
14
+ #
15
+ # Unless required by applicable law or agreed to in writing, software
16
+ # distributed under the License is distributed on an "AS IS" BASIS,
17
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+
21
+ # Based on the 'merb' command, by Ezra
22
+
23
+ # Add chef and chef-server-slice lib dirs to the load path
24
+ # Load chef and chef-server slice from source rather than gem, if present
25
+
26
+ require "rubygems"
27
+ require "merb-core"
28
+
29
+ # Load chef and chef-server-api from source rather than gem, if present
30
+ $:.unshift(File.expand_path(File.dirname(__FILE__) + '/../../chef/lib/chef'))
31
+ $:.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
32
+
33
+ require 'chef'
34
+ require 'chef-server-webui'
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
+ if ARGV[0] && ARGV[0] =~ /^[^-]/
46
+ ARGV.push "-H"
47
+ end
48
+ unless %w[-a --adapter -i --irb-console -r --script-runner].any? { |o| ARGV.index(o) }
49
+ ARGV.push *%w[-a thin]
50
+ end
51
+ unless %w[-p --port].any? { |o| ARGV.index(o) }
52
+ ARGV.push *%w[-p 4040]
53
+ end
54
+
55
+ # Tell merb where to root
56
+ ARGV.push *[ "-m", CHEF_SERVER_WEBUI_ROOT]
57
+
58
+ if index = ARGV.index("-C")
59
+ config = ARGV[index+1]
60
+ ARGV.delete("-C")
61
+ ARGV.delete(config)
62
+ Chef::Config.from_file(File.expand_path(config))
63
+ else
64
+ Chef::Config.from_file(
65
+ File.join("/etc", "chef", "server.rb")
66
+ )
67
+ end
68
+
69
+ Chef::Log.init(Chef::Config[:log_location])
70
+ Chef::Log.level = Chef::Config[:log_level]
71
+
72
+ Merb.start