-
Notifications
You must be signed in to change notification settings - Fork 436
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3059 from DavidKang/show-job-history
[webui][api] Show jobhistory
- Loading branch information
Showing
28 changed files
with
2,612 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,3 +69,8 @@ table.repostatus td { | |
overflow-y: auto; | ||
} | ||
} | ||
|
||
.subtitle { | ||
font-size: 1em; | ||
margin-top: 0; | ||
} |
38 changes: 38 additions & 0 deletions
38
src/api/app/controllers/webui/packages/job_history_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module Webui | ||
module Packages | ||
class JobHistoryController < WebuiController | ||
before_action :set_project | ||
before_action :set_package | ||
before_action :set_repository | ||
before_action :set_architecture | ||
|
||
def index | ||
@jobshistory = @package.jobhistory_list(@project, @repository.name, @architecture.name) | ||
end | ||
|
||
private | ||
|
||
def set_package | ||
@package = ::Package.get_by_project_and_name( @project.to_param, params[:package_name], | ||
{use_source: false, follow_project_links: true, follow_multibuild: true} ) | ||
rescue APIException | ||
flash[:error] = "Package \"#{params[:package_name]}\" not found in project \"#{params[:project]}\"" | ||
redirect_to project_show_path(project: @project, nextstatus: 404) | ||
end | ||
|
||
def set_repository | ||
@repository = @project.repositories.find_by(name: params[:repository]) | ||
return @repository if @repository | ||
flash[:error] = "Couldn't find repository '#{params[:repository]}'." | ||
redirect_to(package_binaries_path(package: @package.name, project: @project.name, repository: params[:repository])) | ||
end | ||
|
||
def set_architecture | ||
@architecture = ::Architecture.archcache[params[:arch]] | ||
return @architecture if @architecture | ||
flash[:error] = "Couldn't find architecture '#{params[:arch]}'." | ||
redirect_to(package_binaries_path(package: @package.name, project: @project.name, repository: params[:repository])) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class LocalJobHistory | ||
include ActiveModel::Model | ||
attr_accessor :revision, :build_counter, :worker_id, :host_arch, :reason, :ready_time, :start_time, :end_time, :total_time, :code | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/api/app/views/webui/packages/job_history/_tabs.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<%= content_for :ready_function do %> | ||
$("#advanced_tabs_trigger").click(function() { | ||
$("#advanced_tabs").show(); | ||
$("#advanced_list_item").hide(); | ||
}); | ||
<% end %> | ||
|
||
<div class="box-header header-tabs" id="package_tabs"> | ||
<ul> | ||
<% if @package.name == "patchinfo" %> | ||
<%= tab 'details', 'Details', :controller => '/webui/patchinfo', :action => 'show' %> | ||
<% end %> | ||
<%= tab 'overview', 'Overview', :controller => '/webui/package', :action => 'show' %> | ||
<% unless @spider_bot -%> | ||
<%= tab 'repositories', 'Repositories', :controller => '/webui/repositories', :action => 'index' %> | ||
<%= tab 'revisions', 'Revisions', :controller => '/webui/package', :action => 'revisions' %> | ||
<%= tab 'requests', "Requests", :controller => '/webui/package', :action => 'requests' %> | ||
<%= tab 'users', 'Users', :controller => '/webui/package', :action => 'users' %> | ||
<% end -%> | ||
<% if is_advanced_tab? %> | ||
<%= content_for :ready_function do %> | ||
$("#advanced_tabs").show(); | ||
<% end %> | ||
<% else %> | ||
<li id="advanced_list_item"><a href="#" id="advanced_tabs_trigger">Advanced</a></li> | ||
<% end %> | ||
</ul> | ||
<% unless @spider_bot -%> | ||
<div id="advanced_tabs" class="hidden"> | ||
<ul> | ||
<%= tab 'attributes', 'Attributes', controller: '/webui/attribute', :package => @package, :project => @project, :action => 'index' %> | ||
<%= tab 'meta', 'Meta', :controller => '/webui/package', :action => 'meta' %> | ||
</ul> | ||
</div> | ||
<% end -%> | ||
</div> |
40 changes: 40 additions & 0 deletions
40
src/api/app/views/webui/packages/job_history/index.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
:ruby | ||
@pagetitle = "Job history of #{@project} / #{@package}" | ||
@metarobots = 'index,nofollow' | ||
|
||
= render partial: 'tabs' | ||
|
||
%h3= @pagetitle | ||
%h6.subtitle | ||
Repository / Architecture: #{params[:repository]} / #{params[:arch]} | ||
|
||
%table#jobhistory-table | ||
%thead | ||
%th Revision | ||
%th Time | ||
%th Reason | ||
%th Status Code | ||
%th Build Time | ||
%th Worker | ||
%th | ||
%tbody | ||
- @jobshistory.each do |jobhistory| | ||
%tr | ||
%td | ||
= jobhistory.revision | ||
%td | ||
= time_tag(Time.at(jobhistory.ready_time)) | ||
%td | ||
= jobhistory.reason | ||
%td | ||
= jobhistory.code | ||
%td | ||
= humanize_time(jobhistory.total_time) | ||
%td | ||
= jobhistory.worker_id | ||
%td | ||
- title = "Package:#{@package.name} | revision:#{jobhistory.revision}" | ||
= link_to sprite_tag('req-showdiff', title: title), | ||
package_show_path(project: @project, | ||
package: @package, | ||
rev: jobhistory.revision) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
159 changes: 159 additions & 0 deletions
159
src/api/spec/cassettes/Package/_jobhistory_list/when_response_fails/1_14_2_1.yml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.