Skip to content

Commit

Permalink
Clarify request staging information
Browse files Browse the repository at this point in the history
  • Loading branch information
ncounter committed Mar 28, 2023
1 parent 7ffd60a commit 828f086
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 15 deletions.
22 changes: 15 additions & 7 deletions src/api/app/controllers/webui/request_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -509,13 +509,21 @@ def staging_status(request, target_project)
return nil unless (staging_review = request.reviews.staging(target_project).last)

if staging_review.for_project?
{ name: staging_review.project.name[target_project.name.length + 1..],
title: "staged in #{staging_review.project}",
url: staging_workflow_staging_project_path(target_project.name, staging_review.project.name) }
elsif staging_review.for_group?
{ name: staging_review.accepted? ? 'Staged' : 'Unstaged',
title: 'submitted against a staging project',
url: staging_workflow_path(@bs_request.target_project_name) }
staging_project = {
name: staging_review.project.name[target_project.name.length + 1..],
staging_url: staging_workflow_staging_project_path(target_project.name, staging_review.project.name)
}
end

{
staging_project: staging_project,
target_project:
{
name: request.target_project_name,
url: project_show_path(target_project),
staging_url: staging_workflow_path(request.target_project_name)
},
status: staging_review.accepted?
}
end
end
19 changes: 15 additions & 4 deletions src/api/app/views/webui/request/beta_show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,22 @@
= link_to "##{supersed['number']}", number: supersed['number']
-# staging statement
- if @staging_status
- staging_project = @staging_status[:staging_project]
- target_project = @staging_status[:target_project]
%li
%strong Staged
in
%mark.text-light.bg-staging.text-nowrap.text-decoration-underline
= link_to @staging_status[:title], @staging_status[:url]
= link_to target_project[:name], target_project[:url]
has a
%mark.text-light.bg-staging.text-nowrap.text-decoration-underline= link_to 'Staging Workflow', target_project[:staging_url]
\: this request is
- if staging_project
%strong staged
in
= link_to staging_project[:name], staging_project[:staging_url]
- elsif @staging_status[:status]
%strong staged
but not assigned to any staging project yet
- else
%strong not yet staged
-# auto-accept statement
- if @bs_request.accept_at.present?
%li
Expand Down
2 changes: 1 addition & 1 deletion src/api/spec/features/webui/requests/submissions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
expect(page).to have_text('Select Action')
expect(page).to have_text('Next')
expect(page).to have_text("(of #{bs_request.bs_request_actions.count})")
expect(page).to have_text('Staged in')
expect(page).to have_text('has a Staging Workflow')
end
end
end
Expand Down
7 changes: 4 additions & 3 deletions src/api/spec/features/webui/requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@
Flipper.enable(:request_show_redesign)
end

it 'does not set badge for submit request' do
it 'does not set stage information for submit request' do
login submitter
visit request_show_path(bs_request)
click_on('Add Reviewer')
Expand All @@ -395,7 +395,8 @@
fill_in 'Project', with: staging_project.name
click_button('Accept')
end
expect(page).not_to have_css('.badge-staging')
expect(page).not_to have_text('has a Staging Workflow')
expect(page).not_to have_css('.bg-staging')
end
end

Expand All @@ -421,7 +422,7 @@
fill_in 'Project', with: staging_project.name
click_button('Accept')
end
expect(page).to have_text('Staged in')
expect(page).to have_text('has a Staging Workflow')
expect(page).to have_css('.bg-staging')
end
end
Expand Down

0 comments on commit 828f086

Please sign in to comment.