Skip to content

Commit

Permalink
List mentioned issues in the request show redesign
Browse files Browse the repository at this point in the history
  • Loading branch information
Dany Marcoux committed Nov 15, 2022
1 parent 87e7239 commit c5403b5
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
6 changes: 6 additions & 0 deletions src/api/app/assets/stylesheets/webui/collapsible-text.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
@include collapsible($maxHeight: 2.75em, $maxWidth: 'none', $moreButtonLabel: 'Expand name ', $lessButtonLabel: 'Shrink name ');
}

#mentioned-issues .list-group-item {
max-width: 75ch;
@include collapsible($maxHeight: 2.75em, $maxWidth: 75ch);
}

// TODO: Remove this when the request_show_redesign is removed
#issue-summary {
@include collapsible($maxHeight: 1.5em);
.obs-collapsible-textbox { @extend .pr-0; }
Expand Down
3 changes: 3 additions & 0 deletions src/api/app/controllers/webui/request_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ def show
@open_reviews_for_staging_projects = @bs_request.reviews.opened.for_staging_projects
@refresh = @action[:diff_not_cached]

# Collecting all issues in a hash. Each key is the issue name and the value is a hash containing all the issue details.
@issues = @action.fetch(:sourcediff, []).reduce({}) { |accumulator, sourcediff| accumulator.merge(sourcediff['issues']) }

# Handling build results
@staging_project = @bs_request.staging_project.name unless @bs_request.staging_project_id.nil?

Expand Down
12 changes: 9 additions & 3 deletions src/api/app/views/webui/request/beta_show.html.haml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
-# haml-lint:disable ViewLength
This will be fixed once the request workflow redesign leaves the beta, since the alert
at the top of the page will be removed.
:ruby
@pagetitle = "Request #{@bs_request.number}"
@pagetitle += ": #{@action[:name]}"
Expand Down Expand Up @@ -59,8 +62,10 @@
'aria-selected': 'false', 'data-toggle': 'tab', role: 'tab')
- if @action[:type].in?(actions_for_diff)
%li.nav-item.scrollable-tab-link{ role: 'presentation' }
= link_to('Mentioned Issues', '#mentioned-issues', class: 'nav-link text-nowrap', 'aria-controls': 'mentioned-issues',
'aria-selected': 'false', 'data-toggle': 'tab', role: 'tab')
= link_to('#mentioned-issues', class: 'nav-link text-nowrap', 'aria-controls': 'mentioned-issues',
'aria-selected': 'false', 'data-toggle': 'tab', role: 'tab') do
Mentioned Issues
%span.badge.badge-primary.align-text-top= @issues.size
.tab-content.p-4#request-tabs-content
.tab-pane.fade.p-2#conversation{ 'aria-labelledby': 'conversation-tab', role: 'tabpanel' }
= render partial: 'webui/request/beta_show_tabs/conversation', locals: { bs_request: @bs_request, can_add_reviews: @can_add_reviews,
Expand All @@ -84,7 +89,7 @@
.tab-pane.fade.p-2#changes{ 'aria-labelledby': 'changes-tab', role: 'tabpanel' }
= render partial: 'webui/request/beta_show_tabs/changes', locals: { bs_request: @bs_request, action: @action, refresh: @refresh }
.tab-pane.fade.p-2#mentioned-issues{ 'aria-labelledby': 'mentioned-issues-tab', role: 'tabpanel' }
= render partial: 'webui/request/beta_show_tabs/mentioned_issues'
= render partial: 'webui/request/beta_show_tabs/mentioned_issues', locals: { issues: @issues }

- content_for :ready_function do
:plain
Expand All @@ -98,3 +103,4 @@

document.location.hash = anchor;
}
-# haml-lint:enable ViewLength
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
%p
The mentioned issues aren't here yet, but they will be displayed here in the future.
- if issues.empty?
%p No issues are mentioned for this request action.
- else
%ul.list-group.list-group-flush
- issues.each do |issue_name, issue_details|
%li.list-group-item
= link_to(issue_name, issue_details[:url], target: '_blank', rel: 'noopener')
- if issue_details[:owner] && issue_details[:state]
%span.ml-3= issue_details[:state]&.capitalize
%span.ml-3= user_with_realname_and_icon issue_details[:owner], short: true

%p
%i The OBS team
- if issue_details[:summary]
= render partial: 'webui/shared/collapsible_text', locals: { text: issue_details[:summary], extra_css_classes: 'mt-2' }

0 comments on commit c5403b5

Please sign in to comment.