-
Notifications
You must be signed in to change notification settings - Fork 434
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Extract build status for architecture to a view component - Display many results in a row on large viewports and minimize content for small ones - Make help icon bigger but soberer - Set status color on a left border and remove color from status text - Sort results following the order given by the constant Buildresult::AVAIL_STATUS_VALUES in app/models/buildresult.rb. - Extend the popover trigger area to the whole box Co-authored-by: Daniel Donisa <daniel.donisa@suse.com> Co-authored-by: Dario Leidi <dleidi@suse.com>
- Loading branch information
1 parent
92670a1
commit 04d07b2
Showing
6 changed files
with
125 additions
and
32 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
src/api/app/assets/stylesheets/request_show_redesign/build_results.scss
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,29 @@ | ||
.build-result { | ||
// One element per row | ||
// The div width is 100% minus the sum of its margins: ml-2 + mr-2 = 0.5rem + 0.5rem = 1rem | ||
width: calc(100% - 1rem); | ||
border-left: thick solid $gray-300; | ||
cursor: help; | ||
|
||
&:hover { | ||
background-color: $gray-100; | ||
} | ||
|
||
@include media-breakpoint-up(sm) { | ||
// Up to 2 elements in a row | ||
// The div width is 50% minus the sum of its margins: ml-2 + mr-5 = 0.5rem + 3rem = 3.5rem | ||
width: calc(50% - 3.5rem); | ||
} | ||
|
||
@include media-breakpoint-up(lg) { | ||
// Up to 4 elements in a row | ||
// The div width is 25% minus the sum of its margins: ml-2 + mr-5 = 0.5rem + 3rem = 3.5rem | ||
width: calc(25% - 3.5rem); | ||
} | ||
|
||
@include media-breakpoint-up(xxl) { | ||
// Up to 5 elements in a row | ||
// The div width is 20% minus the sum of its margins: ml-2 + mr-5 = 0.5rem + 3rem = 3.5rem | ||
width: calc(20% - 3.5rem); | ||
} | ||
} |
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
22 changes: 22 additions & 0 deletions
22
src/api/app/components/build_result_for_architecture_component.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,22 @@ | ||
.build-result.p-2.pl-3.my-2.my-sm-4.mx-2.mr-sm-5{ class: "#{status_border_color(result_code)}", | ||
data: { placement: 'auto', | ||
toggle: 'popover', | ||
html: 'true', | ||
content: help, | ||
offset: 50 } } | ||
.d-flex.align-items-baseline.mb-2 | ||
%span.font-weight-bold | ||
= result.architecture | ||
.build-status.ml-3.d-inline.d-sm-none | ||
= build_status_icon_with_link | ||
.repository-status.ml-3.d-inline.d-sm-none | ||
= repository_status_icon | ||
%i.fa-regular.fa-lg.fa-question-circle.text-info.ml-3 | ||
.build-status.mr-3.d-none.d-sm-block | ||
= build_status_icon_with_link | ||
%span | ||
= build_status | ||
.repository-status.d-none.d-sm-block | ||
= repository_status_icon | ||
%span | ||
= result.state |
68 changes: 68 additions & 0 deletions
68
src/api/app/components/build_result_for_architecture_component.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,68 @@ | ||
class BuildResultForArchitectureComponent < ApplicationComponent | ||
attr_accessor :result, :project, :package | ||
|
||
def initialize(result, project, package) | ||
super | ||
|
||
@result = result | ||
@project = project | ||
@package = package | ||
end | ||
|
||
private | ||
|
||
def result_code | ||
result.code | ||
end | ||
|
||
def help | ||
help = "<p><strong>Package build ( #{build_status_icon} #{result_code} ):</strong> #{build_status_help}</p>" | ||
help += "<p><u>Details</u>: #{build_status_details}</p>" if build_status_details.present? | ||
help += "<p><strong>Repository status ( #{repository_status_icon} #{result.state} ): </strong>#{repository_status_help}</p>" | ||
help | ||
end | ||
|
||
def build_status_help | ||
Buildresult.status_description(result_code) | ||
end | ||
|
||
def build_status_details | ||
result.details | ||
end | ||
|
||
def repository_status_help | ||
result.is_repository_in_db ? helpers.repository_info(result.state) : 'This result is outdated' | ||
end | ||
|
||
def build_status_icon_with_link | ||
return build_status_icon if result_code.in?(['-', 'unresolvable', 'blocked', 'excluded', 'scheduled']) | ||
|
||
link_to(package_live_build_log_path(project: project.to_s, package: package, | ||
repository: result.repository, arch: result.architecture), rel: 'nofollow') do | ||
capture { build_status_icon } | ||
end | ||
end | ||
|
||
def build_status_icon | ||
tag.i(class: "fa #{helpers.build_status_icon(result_code)} text-gray-500") | ||
end | ||
|
||
def repository_status_icon | ||
helpers.repository_status_icon(status: result.state) | ||
end | ||
|
||
def status_border_color(status) | ||
build_result = Buildresult.new(status) | ||
return 'border-warning' if build_result.in_progress_status? | ||
return 'border-success' if build_result.successful_final_status? | ||
return 'border-danger' if build_result.unsuccessful_final_status? | ||
return 'border-gray-300' if build_result.refused_status? | ||
end | ||
|
||
def build_status | ||
return result_code if result_code.in?(['-', 'unresolvable', 'blocked', 'excluded', 'scheduled']) | ||
|
||
link_to(result_code, package_live_build_log_path(project: project.to_s, package: package, | ||
repository: result.repository, arch: result.architecture), rel: 'nofollow') | ||
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