summaryrefslogtreecommitdiff
path: root/lib/oxidized/api/web
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oxidized/api/web')
-rw-r--r--lib/oxidized/api/web/views/default.haml4
-rw-r--r--lib/oxidized/api/web/views/head.haml5
-rw-r--r--lib/oxidized/api/web/views/node.haml6
-rw-r--r--lib/oxidized/api/web/views/nodes.haml34
-rw-r--r--lib/oxidized/api/web/views/oxidized.sass51
-rw-r--r--lib/oxidized/api/web/webapp.rb104
6 files changed, 0 insertions, 204 deletions
diff --git a/lib/oxidized/api/web/views/default.haml b/lib/oxidized/api/web/views/default.haml
deleted file mode 100644
index 1ff1f4b..0000000
--- a/lib/oxidized/api/web/views/default.haml
+++ /dev/null
@@ -1,4 +0,0 @@
-%html
- !=haml :head
- %body
- =@data
diff --git a/lib/oxidized/api/web/views/head.haml b/lib/oxidized/api/web/views/head.haml
deleted file mode 100644
index f8c41f8..0000000
--- a/lib/oxidized/api/web/views/head.haml
+++ /dev/null
@@ -1,5 +0,0 @@
-%head
- %title oxidized
- %script{:src=>'//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js'}
- %script{:src=>'//cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.13.3/jquery.tablesorter.min.js'}
- %link{:rel=>'stylesheet', :href=>'/stylesheets/oxidized.css'}
diff --git a/lib/oxidized/api/web/views/node.haml b/lib/oxidized/api/web/views/node.haml
deleted file mode 100644
index 6c68e07..0000000
--- a/lib/oxidized/api/web/views/node.haml
+++ /dev/null
@@ -1,6 +0,0 @@
-%html
- !=haml :head
- %body
- -out='';PP.pp(@data,out)
- %pre
- =out
diff --git a/lib/oxidized/api/web/views/nodes.haml b/lib/oxidized/api/web/views/nodes.haml
deleted file mode 100644
index 336a4c2..0000000
--- a/lib/oxidized/api/web/views/nodes.haml
+++ /dev/null
@@ -1,34 +0,0 @@
-%html
- !=haml :head
- %body
- %table{:id=>'nodesTable', :class=>'center tablesorter'}
- %thead
- %tr
- %th Name
- %th IP
- %th Group
- %th Last Status
- %th Last Time
- %th Config
- %th Update
- %tbody
- -trclass = %w(even odd)
- -@data.sort_by{|e|e[:name]}.each do |node|
- -klass = trclass.rotate!.first
- %tr{:class=>klass}
- %td
- %a(href="/node/show/#{node[:name]}") #{node[:name]}
- %td= node[:ip]
- %td= node[:group]
- %td= node[:status]
- %td= node[:time]
- %td
- %a(href="/node/fetch/#{node[:full_name]}") config
- %td
- %a(href="/node/next/#{node[:full_name]}") update
- %p{:class=>'center'}
- %a(href="/reload") reload list of nodes
- :javascript
- $(function(){
- $("#nodesTable").tablesorter();
- });
diff --git a/lib/oxidized/api/web/views/oxidized.sass b/lib/oxidized/api/web/views/oxidized.sass
deleted file mode 100644
index 39d090f..0000000
--- a/lib/oxidized/api/web/views/oxidized.sass
+++ /dev/null
@@ -1,51 +0,0 @@
-$font-stack: Helvetica, sans-serif
-$base03: #002b36
-$base02: #073642
-$base01: #586e75
-$base00: #657b83
-$base0: #839496
-$base1: #93a1a1
-$base2: #eee8d5
-$base3: #fdf6e3
-$yellow: #b58900
-$orange: #cb4b16
-$red: #dc322f
-$magenta: #d33682
-$violet: #6c71c4
-$blue: #268bd2
-$cyan: #2aa198
-$green: #859900
-
-body
- font: 100% $font-stack
- color: $base03
- background: $base3
-
-a:link
- color: $red
- text-decoration: none
-
-// a:visited
-// a:active
-
-a:hover
- color: $magenta
- text-decoration: underline
-
-.center
- margin-left: auto
- margin-right: auto
- text-align: center
-
-th
- color: $cyan
-
-tr.odd
- background: $base2
-
-tr.even
- background: $base3
-
-tr:hover
- background: $base01
- color: $base3
diff --git a/lib/oxidized/api/web/webapp.rb b/lib/oxidized/api/web/webapp.rb
deleted file mode 100644
index 751a4c7..0000000
--- a/lib/oxidized/api/web/webapp.rb
+++ /dev/null
@@ -1,104 +0,0 @@
-require 'sinatra/base'
-require 'sinatra/json'
-require 'haml'
-require 'sass'
-require 'pp'
-module Oxidized
- module API
- class WebApp < Sinatra::Base
-
- get '/' do
- redirect '/nodes'
- end
-
- get '/nodes.?:format?' do
- @data = nodes.list.map do |node|
- node[:status] = 'never'
- node[:time] = 'never'
- node[:group] = 'default' unless node[:group]
- if node[:last]
- node[:status] = node[:last][:status]
- node[:time] = node[:last][:end]
- end
- node
- end
- out :nodes
- end
-
- get '/reload.?:format?' do
- nodes.load
- @data = 'reloaded list of nodes'
- out
- end
-
-
- get '/node/fetch/:node' do
- node, @json = route_parse :node
- @data = nodes.fetch node, nil
- out :text
- end
-
- get '/node/fetch/:group/:node' do
- node, @json = route_parse :node
- @data = nodes.fetch node, params[:group]
- out :text
- end
-
-
- get '/node/next/:node' do
- node, @json = route_parse :node
- nodes.next node
- redirect '/nodes' unless @json
- @data = 'ok'
- out
- end
-
- # use this to attach author/email/message to commit
- put '/node/next/:node' do
- node, @json = route_parse :node
- opt = JSON.load request.body.read
- nodes.next node, opt
- redirect '/nodes' unless @json
- @data = 'ok'
- out
- end
-
- get '/node/show/:node' do
- node, @json = route_parse :node
- @data = nodes.show node
- out :node
- end
-
- get '/stylesheets/*.css' do
- sass params[:splat].first.to_sym
- end
-
- private
-
- def out template=:default
- if @json or params[:format] == 'json'
- json @data
- elsif template == :text
- content_type :text
- @data
- else
- haml template
- end
- end
-
- def nodes
- settings.nodes
- end
-
- def route_parse param
- json = false
- e = params[param].split '.'
- if e.last == 'json'
- e.pop
- json = true
- end
- [e.join('.'), json]
- end
- end
- end
-end