Skip to content

Commit 0002e3d

Browse files
committed
fix html page at root for chef-server-api
1 parent 77d94fc commit 0002e3d

7 files changed

Lines changed: 62 additions & 39 deletions

File tree

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
class Main < Application
22

3-
before :authenticate_every
43
provides :html, :json
54

65
def index
7-
display(
8-
{
9-
absolute_url(:nodes) => "Manage Nodes",
10-
absolute_url(:roles) => "Manage Roles",
11-
absolute_url(:cookbooks) => "Manage Cookbooks",
12-
absolute_url(:data) => "Manage Data Bags",
13-
absolute_url(:search) => "Search"
14-
}
15-
)
6+
case content_type
7+
when :json
8+
display absolute_url(:nodes) => "Manage Nodes",
9+
absolute_url(:roles) => "Manage Roles",
10+
absolute_url(:cookbooks) => "Manage Cookbooks",
11+
absolute_url(:data) => "Manage Data Bags",
12+
absolute_url(:search) => "Search"
13+
else
14+
@webui_host_with_port = request.host[/(.*):4000/, 1] << ':4040'
15+
render
16+
end
1617
end
1718

1819
end
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?xml version='1.0' encoding='utf-8' ?>
2+
<!DOCTYPE html>
3+
<html>
4+
<head>
5+
<meta content='text/html; charset=utf-8' http-equiv='content-type' />
6+
<title>Chef Server</title>
7+
<link href="/stylesheets/base.css" type="text/css" rel="Stylesheet" charset="utf-8" media="all" />
8+
<link href="/stylesheets/themes/djime-cerulean/style.css" type="text/css" rel="Stylesheet" charset="utf-8" media="all" />
9+
<link href="/stylesheets/chef.css" type="text/css" rel="Stylesheet" charset="utf-8" media="all" />
10+
</head>
11+
<body>
12+
<div id='container'>
13+
<div id='header'>
14+
<h1><a href="<%= absolute_url(:top) -%>">Chef REST API</a></h1>
15+
</div>
16+
<div id='main-navigation'>
17+
<div class='clear'></div>
18+
</div>
19+
<div id='wrapper'>
20+
<div id='main'>
21+
<div class='block' id='block-text'>
22+
<div class='content'>
23+
<h2 class='title'>The REST API</h2>
24+
<div class='inner'>
25+
This is the Chef API Server. <a href="<%= absolute_url(:top, :host => @webui_host_with_port) -%>">If you are running the WebUI with the default configuration, you can access it on port 4040.</a>
26+
</div>
27+
<div class='inner'>
28+
For more information about Chef, head on over to the <a href="http://wiki.opscode.com/">wiki.</a>
29+
</div>
30+
</div>
31+
</div>
32+
<div id='footer'>
33+
<div class='block'>
34+
<p>Copyright &copy; 2009-2011 Opscode, Inc.</p>
35+
</div>
36+
</div>
37+
</div>
38+
<div id='sidebar'>
39+
<div class='block notice' id='sidebar_block_notice'></div>
40+
<div class='block' id='sidebar_block'></div>
41+
</div>
42+
<div class='clear'></div>
43+
</div>
44+
</div>
45+
</body>
46+
</html>

‎chef-server-api/app/views/layout/chef_server_api.html.haml‎

Lines changed: 0 additions & 23 deletions
This file was deleted.

‎chef-server-api/app/views/main/index.html.erb‎

Whitespace-only changes.

‎chef-server-api/app/views/main/index.html.haml‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎chef-server-api/config/rack.rb‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,8 @@
1919
# Correctly set a content length.
2020
use Rack::ContentLength
2121

22+
# Serve assets for the html page from /public
23+
use Merb::Rack::Static, Merb.dir_for(:public)
24+
2225
# this is our main merb application
2326
run Merb::Rack::Application.new

‎chef-server-api/config/router.rb‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,15 @@
5252

5353
# Search
5454
resources :search
55+
match('/search', :method => 'get').to(:controller => 'search', :action => 'index').name(:search)
5556
match('/search/reindex', :method => 'post').to(:controller => "search", :action => "reindex")
5657

5758
# Cookbooks
5859
match('/nodes/:id/cookbooks', :method => 'get').to(:controller => "nodes", :action => "cookbooks")
5960

6061
match("/cookbooks",
6162
:method => 'get'
62-
).to(:controller => "cookbooks", :action => "index")
63+
).to(:controller => "cookbooks", :action => "index").name(:cookbooks)
6364

6465
match("/cookbooks/_latest", :method=>'get').to(:controller=>'cookbooks',:action=>'index_latest')
6566

0 commit comments

Comments
 (0)