Skip to content

Commit

Permalink
Merge pull request #2690 from mdeniz/erb2haml_4
Browse files Browse the repository at this point in the history
Convert webui/monitor views to HAML. Get rid of unused partials
  • Loading branch information
Ana06 committed Feb 16, 2017
2 parents 0e59d1e + 09d982b commit 8b24a4a
Show file tree
Hide file tree
Showing 21 changed files with 418 additions and 510 deletions.
7 changes: 0 additions & 7 deletions src/api/app/views/webui/monitor/_average.html.erb

This file was deleted.

6 changes: 0 additions & 6 deletions src/api/app/views/webui/monitor/_blocked.html.erb

This file was deleted.

39 changes: 0 additions & 39 deletions src/api/app/views/webui/monitor/_building.html.erb

This file was deleted.

31 changes: 31 additions & 0 deletions src/api/app/views/webui/monitor/_building.html.haml
@@ -0,0 +1,31 @@
- max_clients = @workerstatus['clients']
- build_count = @workerstatus.elements('building').length
#building_all
%h2 Building
- if build_count > 0
%p.info Hover the job time field to see the start time.
%p.info
= @configuration['title']
reports #{build_count} running jobs.
= render partial: 'building_table'
%h3 Legend
%div
%div{ style: "float: left; margin-left: 10px; margin-right: 10px" }
= distance_of_time_in_words(@time_now, @dead_line)
- @max_color.downto(0) do |n|
- color = "rgb(255,#{n},0)"
%div{ style: "background-color: #{color}; margin: 0px; width: 3px ; height: 1em; float: left;" }  
%div{ style: "float: left; margin-left: 10px" }
= distance_of_time_in_words(@time_now, @dead_line - (@max_color * @interval_steps * 60))
.clear
- else
.info
%p
- if max_clients
- if @project_filter
No package of the "#{@project_filter}" project is building. Maybe remove the filter?:)
- else
All #{max_clients} hosts are idle!
- else
Nothing to do here!
.clear
72 changes: 0 additions & 72 deletions src/api/app/views/webui/monitor/_building_table.html.erb

This file was deleted.

58 changes: 58 additions & 0 deletions src/api/app/views/webui/monitor/_building_table.html.haml
@@ -0,0 +1,58 @@
#building_list
- if @workerstatus.has_key? 'building'
%table#building_table.building
%thead
%tr
%th Project
%th Package
%th Repository - Build Arch
%th Job time
%th Build Host
%th Host Arch
%tbody
- @workerstatus.elements("building").sort {|a,b| b["starttime"] <=> a["starttime"] }.each do |building|
- project = building["project"]
- package = building["package"]
- repository = building["repository"]
- architecture = building["arch"]
%tr
%td.project
- if project.include? "---"
\-------
- else
= link_to project, controller: 'project', action: 'show', project: project
%td.package
- if package.include? "---"
\-------
- else
= link_to package, controller: 'package', action: 'show', project: project, package: package
%td.repository.arch
- if repository.include? "---"
\-------
- else
= link_to repository + ' - ' + architecture, controller: 'package', action: 'live_build_log',
project: project, package: package, repository: repository, arch: architecture
- start_time = Time.at(building["starttime"].to_i)
- warning_style = nil
- if start_time < @dead_line
- n = ((start_time - @dead_line).abs/60/@interval_steps).round
- n = (@max_color < n) ? 0 : @max_color - n
- warning_style = "background-color: rgb(255,#{n},0);"
%td.starttime{ style: warning_style, title: "start time: #{start_time.iso8601}" }
%span.sorttime{ style: "display: none" }
= building[starttime].to_i
= distance_of_time_in_words(@time_now, start_time)
%td.uri= building[workerid]
%td.hostarch= building[hostarch]

= content_for :ready_function do
:plain
$('#building_table').dataTable({
'aaSorting': [[3, 'desc']],
'bInfo': false,
'bPaginate': false,
'oSearch': {'sSearch': '#{@project_filter}', 'bRegex': false, 'bSmart': false},
});
- else
%p
%i No build jobs
127 changes: 0 additions & 127 deletions src/api/app/views/webui/monitor/_events.html.erb

This file was deleted.

0 comments on commit 8b24a4a

Please sign in to comment.