Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate monitor#old to Bootstrap #7672

Merged
merged 1 commit into from Jun 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/api/app/controllers/webui/monitor_controller.rb
Expand Up @@ -6,7 +6,9 @@ class Webui::MonitorController < Webui::WebuiController

DEFAULT_SEARCH_RANGE = 24

def old; end
def old
switch_to_webui2
end

def index
if request.post? && !params[:project].nil? && Project.valid_name?(params[:project])
Expand Down
@@ -1,3 +1,11 @@
= render partial: 'webui/main/breadcrumb_items'

%li.breadcrumb-item.active{ 'aria-current' => 'page' } Monitor
- case action_name
- when 'index'
%li.breadcrumb-item.active{ 'aria-current' => 'page' }
Monitor
- when 'old'
%li.breadcrumb-item
= link_to('Monitor', monitor_path)
%li.breadcrumb-item.active{ 'aria-current' => 'page' }
Detailed
32 changes: 32 additions & 0 deletions src/api/app/views/webui2/webui/monitor/_building.html.haml
@@ -0,0 +1,32 @@
- max_clients = worker_status['clients']
- build_count = worker_status.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', locals: { worker_status: worker_status, dead_line: dead_line, intervel_steps: interval_steps,
max_color: max_color, time_now: time_now, project_filter: project_filter }
%h5.mt-3 Job Time Legend
.clearfix
.float-left.mx-1
= distance_of_time_in_words(time_now, dead_line)
- max_color.downto(0) do |n|
- color = "rgb(255,#{n},0)"
-# haml-lint:disable InlineStyles
.m-0.float-left{ style: "background-color: #{color}; width: 3px ; height: 1em;" }  
-# haml-lint:enable InlineStyles
.float-left.ml-1
= distance_of_time_in_words(time_now, dead_line - (max_color * interval_steps * 60))
- 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!
54 changes: 54 additions & 0 deletions src/api/app/views/webui2/webui/monitor/_building_table.html.haml
@@ -0,0 +1,54 @@
#building-list
- if worker_status.key?('building')
.table-responsive
%table.table.table-sm.table-striped.table-bordered.w-100#building-table
%thead
%tr
%th Project
%th Package
%th Repository - Build Arch
%th Job Time
%th Build Host
%th Host Arch
%tbody
- worker_status.elements('building').sort { |a, b| b['starttime'] <=> a['starttime'] }.each do |building|
:ruby
project = building['project']
package = building['package']
repository = building['repository']
architecture = building['arch']
%tr
%td.project
- if project.include? '---'
\-------
- else
= link_to(project, project_show_path(project))
%td.package
- if package.include? '---'
\-------
- else
= link_to(package, package_show_path(project, package))
%td.repository.arch
- if repository.include? '---'
\-------
- else
= link_to(repository + ' - ' + architecture, package_live_build_log_path(project, package, repository, architecture))
- start_time = Time.at(building['starttime'].to_i)
- warning_style = nil
- if start_time < dead_line
:ruby
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);"
-# haml-lint:disable InlineStyles
%td.starttime{ style: warning_style, title: "start time: #{start_time.iso8601}" }
-# haml-lint:enable InlineStyles
%span.sorttime.d-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
initializeDataTable('#building-table', order: [[3, 'desc']]);
21 changes: 21 additions & 0 deletions src/api/app/views/webui2/webui/monitor/_idle.html.haml
@@ -0,0 +1,21 @@
- idle_hosts = worker_status.elements('idle')

.mt-3#idlehosts
%h2 Idle Hosts
- if idle_hosts.empty?
%p
None of the #{pluralize(worker_status['clients'], 'host')} idle.
- else
%p
= idle_hosts.size
of #{pluralize(worker_status['clients'], 'host')} idle.
%table.responsive.table.table-sm.table-striped.table-bordered
%thead
%tr
%th Host
%th Arch
%tbody
- idle_hosts.each do |idle_host|
%tr
%td= idle_host['workerid']
%td= idle_host['hostarch']
27 changes: 27 additions & 0 deletions src/api/app/views/webui2/webui/monitor/_stats.html.haml
@@ -0,0 +1,27 @@
- if worker_status.elements('waiting').empty?
%p
%i No scheduler statistics
- else
%table.responsive.table.table-sm.table-striped.table-bordered
%thead
%tr
%th Host Arch
%th Packages in waiting queue
%th Packages in blocked queue
%th Average Job time
%tbody
- worker_status.elements('waiting').sort_by { |a| a['arch'] }.each do |entrywaiting|
- outblocked = nil
- outbuildavg = nil
%tr
%td.arch= entrywaiting['arch']
%td.waiting= entrywaiting['jobs']
%td.blocked
- worker_status.elements('blocked') do |blocked|
- outblocked = blocked['jobs'] if blocked['arch'] == entrywaiting['arch']
= outblocked || ' - '
%td.avgjobtime
- worker_status.elements('buildavg') do |build_avg|
- if build_avg['arch'] == entrywaiting['arch']
- outbuildavg = distance_of_time_in_words(Time.at(build_avg['buildavg'].to_i), Time.at(0), include_seconds: true)
= outbuildavg || ' - '
9 changes: 9 additions & 0 deletions src/api/app/views/webui2/webui/monitor/old.html.haml
@@ -0,0 +1,9 @@
- @pagetitle = 'Build Status Monitor - Detailed'
- @metarobots = 'nofollow'
.card
.card-body
= render partial: 'building', locals: { worker_status: @workerstatus, configuration_title: @configuration['title'], time_now: @time_now,
dead_line: @dead_line, max_color: @max_color, interval_steps: @interval_steps,
project_filter: @project_filter }
= render partial: 'idle', locals: { worker_status: @workerstatus }
= render partial: 'stats', locals: { worker_status: @workerstatus }