Skip to content

Commit

Permalink
Add form for running suite manually
Browse files Browse the repository at this point in the history
  • Loading branch information
bmarkons committed Jul 6, 2017
1 parent a049c85 commit 6920b62
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 3 deletions.
2 changes: 2 additions & 0 deletions app/services/manual_runner.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class ManualRunner
OPTIONS = ['20', '100', '200', '500', '750', '2000']

def initialize(repo)
raise "Repo doesn't exist" unless Repo.exists?(repo.id)
@repo = repo
Expand Down
2 changes: 2 additions & 0 deletions app/views/admin/home.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- content_for(:page_header) do
= "Dashboard"
12 changes: 12 additions & 0 deletions app/views/admin/repo.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- content_for(:page_header) do
= "#{@repo.name.capitalize} repo"

.row
.col-lg-8
.panel.panel-warning
.panel-body
= form_tag(admin_repo_run_path(@repo)) do
.form-group
= label_tag('Run last:')
= select_tag(:count, options_for_select(ManualRunner::OPTIONS, ManualRunner::OPTIONS.last), class: 'form-control')
= button_tag('Run', class: 'btn btn-default')
5 changes: 5 additions & 0 deletions app/views/layouts/admin.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@
= render 'layouts/admin/navbar'

#page-wrapper
.row
.col-lg-12
%h1.page-header
= yield(:page_header)
= yield
6 changes: 3 additions & 3 deletions app/views/layouts/admin/_navbar.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
%span.icon-bar
%span.icon-bar
%span.icon-bar
%a.navbar-brand{:href => '/admin'} RubyBench Admin
%a.navbar-brand RubyBench Admin

%ul.nav.navbar-top-links.navbar-right.pull-right
%li.dropdown
%a{:href => '/'}
%a{:href => "#{root_path}"}
%i.fa.fa-sign-out

.navbar-default.sidebar{:role => "navigation"}
.sidebar-nav.navbar-collapse
%ul#side-menu.nav.in
%li
%a{:href => "/"}
%a{:href => "#{admin_path}"}
%i.fa.fa-dashboard.fa-fw
Dashboard
- @repos.each do |repo|
Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@
get 'admin' => 'admin#home'
get 'admin/repos/:repo_name' => 'admin#repo', as: :admin_repo
get 'admin/toggle' => 'admin#toggle_admin'
post 'admin/repos/:repo_id/run' => 'admin#run', as: :admin_repo_run
end

0 comments on commit 6920b62

Please sign in to comment.