Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

show dj settings

  • Loading branch information...
commit 3a60ab53568afb3f267fdad5fb5b95c740210214 1 parent 2ee726e
@akshayrawat authored
View
4 app/assets/javascripts/dj_mon.js
@@ -29,8 +29,8 @@ $(function(){
});
$('a[rel=modal]').live('click', function(){
- var template = $('#last_error_template').html();
- var output = Mustache.render(template, { last_error: $(this).data('content') });
+ var template = $($(this).attr('href')).html();
+ var output = Mustache.render(template, { content: $(this).data('content') });
$(output).appendTo($('body')).show();
});
View
9 app/assets/stylesheets/dj_mon.css
@@ -4,15 +4,15 @@ body {
padding: 90px;
}
-table.table td, table.table th {
+table#jobs-table td, table#jobs-table th {
text-align: center;
}
-table.table td.date, table.table th.date {
+table#jobs-table td.date, table#jobs-table th.date {
text-align: left;
}
-table.table td.date {
+table#jobs-table td.date {
font-size: 80%;
}
@@ -24,6 +24,7 @@ code.block {
display: block;
word-wrap: break-word;
}
+
#dj-counts-view {
position: relative;
top: 12px;
@@ -33,4 +34,4 @@ code.block {
#dj-counts-view .badge {
float: right;
margin: 0 2px;
-}
+}
View
4 app/controllers/dj_mon/dj_reports_controller.rb
@@ -27,6 +27,10 @@ def queued
def dj_counts
respond_with DjReport.dj_counts
end
+
+ def settings
+ respond_with DjReport.settings
+ end
protected
View
17 app/models/dj_mon/dj_report.rb
@@ -1,7 +1,8 @@
module DjMon
class DjReport
+
attr_accessor :delayed_job
-
+
def initialize delayed_job
self.delayed_job = delayed_job
end
@@ -67,12 +68,22 @@ def dj_counts
}
end
+ def settings
+ {
+ destroy_failed_jobs: Delayed::Worker.destroy_failed_jobs,
+ sleep_delay: Delayed::Worker.sleep_delay,
+ max_attempts: Delayed::Worker.max_attempts,
+ max_run_time: Delayed::Worker.max_run_time,
+ read_ahead: Delayed::Worker.read_ahead,
+ delay_jobs: Delayed::Worker.delay_jobs
+ }
+ end
end
private
-
def l_datetime date
date.present? ? I18n.l(date) : ""
end
end
-end
+
+end
View
42 app/views/dj_mon/dj_reports/index.html.haml
@@ -1,24 +1,22 @@
-%header
- %p.lead Delayed Jobs
- .subnav
- %ul.nav.nav-tabs
- %li.active
- = link_to "All", "#all", "data-toggle" => "tab"
- %li
- = link_to "Failed", "#failed", "data-toggle" => "tab"
- %li
- = link_to "Queued", "#queued", "data-toggle" => "tab"
- %li
- = link_to "Active", "#active", "data-toggle" => "tab"
+%p.lead Delayed Jobs
+%ul.nav.nav-tabs
+ %li.active
+ = link_to "All", "#all", "data-toggle" => "tab"
+ %li
+ = link_to "Failed", "#failed", "data-toggle" => "tab"
+ %li
+ = link_to "Queued", "#queued", "data-toggle" => "tab"
+ %li
+ = link_to "Active", "#active", "data-toggle" => "tab"
- .tab-content
- .tab-pane#all.active{ 'data-url' => all_dj_reports_url }
- .tab-pane#failed{ 'data-url'=> failed_dj_reports_url }
- .tab-pane#active{ 'data-url'=> active_dj_reports_url }
- .tab-pane#queued{ 'data-url'=> queued_dj_reports_url }
+.tab-content
+ .tab-pane#all.active{ 'data-url' => all_dj_reports_url }
+ .tab-pane#failed{ 'data-url'=> failed_dj_reports_url }
+ .tab-pane#active{ 'data-url'=> active_dj_reports_url }
+ .tab-pane#queued{ 'data-url'=> queued_dj_reports_url }
%script#dj_reports_template{ :type=> "text/x-handlebars-template" }
- %table.table.table-striped
+ %table.table.table-striped#jobs-table
%thead
%tr
%th
@@ -50,7 +48,7 @@
%td
{{attempts}}
%td
- <a href="#" data-content="{{last_error}}" rel='modal' title='Last Error'> {{last_error_summary}} </a>
+ <a href="#last_error_template" data-content="{{last_error}}" rel='modal' title='Last Error'> {{last_error_summary}} </a>
%td.date
{{failed_at}}
%td.date
@@ -60,7 +58,7 @@
{{/.}}
%script#last_error_template{ :type=> "text/x-handlebars-template" }
- .modal.hide#last_error_modal
+ .modal.hide
.modal-header
%button{ type: "button", class: "close", 'data-dismiss' => "modal" }
×
@@ -68,6 +66,6 @@
Last Error
.modal-body
%code
- {{last_error}}
+ {{content}}
.modal-footer
- = link_to "Close", '#', class: 'btn btn-primary', 'data-dismiss'=> 'modal'
+ = link_to "Close", '#', class: 'btn btn-primary', 'data-dismiss'=> 'modal'
View
47 app/views/layouts/dj_mon.html.haml
@@ -12,6 +12,9 @@
.pull-left
= link_to "DJ Mon", dj_reports_url, class: "brand"
.pull-right
+ = link_to "Settings", "#dj_settings_template", rel: 'modal', 'data-content'=> "#{DjMon::DjReport.settings.to_json}", id: 'settings', class: 'btn btn-primary btn-mini'
+
+ .pull-right
#dj-counts-view
.container
@@ -27,3 +30,47 @@
{{active}} active
%span.badge.badge-warning
{{failed}} failed
+
+ %script#dj_settings_template{ :type=> "text/x-handlebars-template" }
+ .modal.hide
+ .modal-header
+ %button{ type: "button", class: "close", 'data-dismiss' => "modal" }
+ ×
+ %h3
+ Delayed Job Settings
+ .modal-body
+ %table.table.table-bordered.table-striped
+ %tr
+ %td
+ Destroy failed jobs:
+ %td
+ <code>{{content.destroy_failed_jobs}}</code>
+ %tr
+ %td
+ Sleep delay:
+ %td
+ <code>{{content.sleep_delay}}</code> seconds
+ %tr
+ %td
+ Max attempts:
+ %td
+ <code>{{content.max_attempts}}</code>
+ %tr
+ %td
+ Max run time:
+ %td
+ <code>{{content.max_run_time}}</code> seconds
+ %tr
+ %td
+ Read ahead:
+ %td
+ <code>{{content.read_ahead}}</code>
+ %tr
+ %td
+ Delay Jobs:
+ %td
+ <code>{{content.delay_jobs}}</code>
+
+ .modal-footer
+ = link_to "Close", '#', class: 'btn btn-primary', 'data-dismiss'=> 'modal'
+
View
1  config/routes.rb
@@ -7,6 +7,7 @@
get :active
get :queued
get :dj_counts
+ get :settings
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.