Skip to content

Commit

Permalink
Create skeleton for the request show page redesign
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Donisa <daniel.donisa@suse.com>
Co-authored-by: Dany Marcoux <dmarcoux@suse.com>
Co-authored-by: Eduardo Navarro <enavarro@suse.com>
Co-authored-by: Rubhan Azeem <rubhan.azeem@suse.com>
  • Loading branch information
5 people authored and Dany Marcoux committed Jul 21, 2022
1 parent 349e41e commit 9ada20b
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/api/app/controllers/webui/request_controller.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
class Webui::RequestController < Webui::WebuiController
helper 'webui/package'

before_action :require_login, except: [:show, :sourcediff, :diff, :request_action]
# TODO: remove the beta_show action when the request_show_redesign feature is finished.
before_action :require_login, except: [:show, :beta_show, :sourcediff, :diff, :request_action]
# requests do not really add much value for our page rank :)
before_action :lockout_spiders
before_action :require_request, only: [:changerequest, :show, :request_action]
# TODO: remove the beta_show action when the request_show_redesign feature is finished.
before_action :require_request, only: [:changerequest, :show, :beta_show, :request_action]
before_action :set_superseded_request, only: [:show, :request_action]
before_action :check_ajax, only: :sourcediff

Expand Down Expand Up @@ -141,6 +143,15 @@ def show
end
end

def beta_show
# TODO: Remove this once request_show_redesign is rolled out
raise NotFoundError unless Flipper.enabled?(:request_show_redesign, User.session)

@diff_limit = params[:full_diff] ? 0 : nil
@diff_to_superseded_id = params[:diff_to_superseded]
@actions = @bs_request.webui_actions(filelimit: @diff_limit, tarlimit: @diff_limit, diff_to_superseded: @diff_to_superseded, diffs: false)
end

def request_action
@diff_limit = params[:full_diff] ? 0 : nil
@index = params[:index].to_i
Expand Down
33 changes: 33 additions & 0 deletions src/api/app/views/webui/request/beta_show.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
:ruby
@pagetitle = "Request #{@bs_request.number}"
@pagetitle += ": #{@actions.first[:name]}" if @actions.count == 1

.card
.card-body
%h3
= @pagetitle
%span.badge.ml-1{ class: "badge-#{request_badge_color(@bs_request.state)}" }
= @bs_request.state

%ul.nav.nav-tabs.scrollable-tabs.pl-0#request-tabs{ role: 'tablist' }
%li.nav-item
= link_to('Overview', '#overview', class: 'nav-link scrollable-tab-link text-nowrap active', 'aria-controls': 'overview',
'aria-selected': 'true', 'data-toggle': 'tab', role: 'tab')
%li.nav-item
= link_to('Build Results', '#build-results', class: 'nav-link scrollable-tab-link text-nowrap', 'aria-controls': 'build-results',
'aria-selected': 'false', 'data-toggle': 'tab', role: 'tab')
%li.nav-item
= link_to('Changes', '#changes', class: 'nav-link scrollable-tab-link text-nowrap', 'aria-controls': 'changes', 'aria-selected': 'false',
'data-toggle': 'tab', role: 'tab')
%li.nav-item
= link_to('Mentioned Issues', '#mentioned-issues', class: 'nav-link scrollable-tab-link text-nowrap', 'aria-controls': 'mentioned-issues',
'aria-selected': 'false', 'data-toggle': 'tab', role: 'tab')
.tab-content#request-tabs-content
.tab-pane.fade.show.p-2.active#overview{ 'aria-labelledby': 'overview-tab', role: 'tabpanel' }
= render partial: 'webui/request/beta_show_tabs/overview'
.tab-pane.fade.p-2#build-results{ 'aria-labelledby': 'build-results-tab', role: 'tabpanel' }
= render partial: 'webui/request/beta_show_tabs/build_results'
.tab-pane.fade.p-2#changes{ 'aria-labelledby': 'changes-tab', role: 'tabpanel' }
= render partial: 'webui/request/beta_show_tabs/changes'
.tab-pane.fade.p-2#mentioned-issues{ 'aria-labelledby': 'mentioned-issues-tab', role: 'tabpanel' }
= render partial: 'webui/request/beta_show_tabs/mentioned_issues'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Build results
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Changes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Mentioned issues
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Overview
2 changes: 2 additions & 0 deletions src/api/config/routes/webui_routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@
post 'request/add_reviewer' => :add_reviewer
post 'request/modify_review' => :modify_review
get 'request/show/:number' => :show, as: 'request_show', constraints: cons
# Remove this route when the request_show_redesign feature is finished.
get 'request/beta/show/:number' => :beta_show, as: 'request_beta_show', constraints: cons
post 'request/sourcediff' => :sourcediff
post 'request/changerequest' => :changerequest
get 'request/diff/:number' => :diff
Expand Down

0 comments on commit 9ada20b

Please sign in to comment.