lib/taskr/views.rb in taskr-0.2.1 vs lib/taskr/views.rb in taskr-0.3.0
- old
+ new
@@ -28,17 +28,10 @@
end
def view_task
@task.to_xml(:root => 'task')#, :include => [:task_actions])
end
-
- def create_task_result
- taskr_response_xml(@task.valid? ? 'success' : 'failure') do
- text @task.to_xml
- text @task.errors.to_xml unless @task.valid?
- end
- end
end
module HTML
include Taskr::Controllers
@@ -126,10 +119,16 @@
end
end
input :type => 'text', :name => 'schedule_when', :size => 30
end
+ p do
+ label 'description/memo'
+ br
+ textarea(:name => 'memo', :cols => '60', :rows => '4'){""}
+ end
+
action_form
p do
a(:id => 'add_action', :href => '#'){'Add another action'}
end
@@ -151,13 +150,16 @@
end
end
def view_task
html_scaffold do
- form(:method => 'delete', :style => 'display: inline') do
- button(:type => 'submit', :value => 'delete') {"Delete"}
+ form(:method => 'delete', :style => 'display: inline', :action => R(@task)) do
+ button(:type => 'submit', :value => 'delete', :onclick => 'return confirm("Are you sure you want to unschedule and delete this task?")') {"Delete"}
end
+ form(:method => 'put', :style => 'display: inline', :action => R(@task, 'run')) do
+ button(:type => 'submit', :value => 'run') {"Run Now!"}
+ end
br
a(:href => R(Tasks, :list)) {"Back to Task List"}
h1 "Task #{@task.id}"
table do
@@ -168,10 +170,14 @@
tr do
th "Schedule:"
td "#{@task.schedule_method} #{@task.schedule_when}"
end
tr do
+ th "Description/Memo:"
+ td "#{@task.memo}"
+ end
+ tr do
th "Job ID:"
td @task.scheduler_job_id
end
tr do
th "Triggered:"
@@ -213,10 +219,12 @@
tr do
th "Created On:"
td @task.created_on
end
end
+
+ iframe(:src => R(LogEntries, :list, :task_id => @task.id), :style => 'width: 100%; margin-top: 20px;')
end
end
def scheduler_status
s = Taskr.scheduler
@@ -274,9 +282,36 @@
div(:id => "parameters_#{@num}")
end
+ def log_entries_list
+ h2 "Log"
+ table do
+ @log_entries.each do |entry|
+ case entry.level.downcase.intern
+ when :error
+ bg_color = '#faa'
+ when :warn
+ bg_color = '#ffa'
+ when :info
+ bg_color = '#aaf'
+ when :debug
+ bg_color = '#eee'
+ else
+ bg_color = '#fff; '+entry.level.inspect
+ end
+ tr do
+ td(:style => "vertical-align: top; font-size: 9pt; white-space: nowrap; background: #{bg_color}") do
+ entry.timestamp
+ end
+ td(:style => "vertical-align: top; font-size: 9pt; background-color: #{bg_color}; font-size: 9pt; font-family: monospace") do
+ entry.data.gsub(/<\/?(html|body)>/, '').gsub(/\n/, "<br />")
+ end
+ end
+ end
+ end
+ end
end
default_format :HTML
end
\ No newline at end of file