From a1aaad3e41d9a45b018213ec202573bb6ec0a2b6 Mon Sep 17 00:00:00 2001 From: Graham Pengelly Date: Thu, 25 Jan 2024 18:01:19 +0000 Subject: [PATCH] Upgrade govuk-components to 5.0 * upgrade govuk-components * upgrade related gems form builder etc --- Gemfile | 4 +- Gemfile.lock | 26 +++++---- .../flash_message_component.html.erb | 2 +- .../journeys_performance_table_component.rb | 36 ++++++------- ...rn_requests_performance_table_component.rb | 40 +++++++------- ...te_requests_performance_table_component.rb | 22 ++++---- app/helpers/application_helper.rb | 18 +++---- app/views/performance/index.html.erb | 53 ++++++++++--------- .../support_interface/staff/index.html.erb | 24 ++++----- .../trn_requests/index.html.erb | 42 +++++++-------- .../support_interface/users/index.html.erb | 24 ++++----- .../validation_errors/index.html.erb | 16 +++--- .../validation_errors/show.html.erb | 38 ++++++------- .../support_interface/zendesk/index.html.erb | 40 +++++++------- ...quests_performance_table_component_spec.rb | 7 +-- 15 files changed, 197 insertions(+), 195 deletions(-) diff --git a/Gemfile b/Gemfile index d7b7a30b6..7e55dd78c 100644 --- a/Gemfile +++ b/Gemfile @@ -17,7 +17,7 @@ gem "dfe-autocomplete", github: "DFE-Digital/dfe-autocomplete" gem "faraday", "~> 2.9" gem "gds_zendesk" -gem "govuk-components", "~> 3.3.0" +gem "govuk-components", "~> 5.0.0" gem "govuk_design_system_formbuilder" gem "govuk_markdown", "~> 2.0" gem "jsbundling-rails" @@ -26,7 +26,6 @@ gem "mail-notify" gem "okcomputer", "~> 1.18" gem "omniauth-oauth2", "~> 1.8" gem "omniauth-rails_csrf_protection" -gem "pagy" gem "pg", "~> 1.5" gem "puma", "~> 6.4" gem "rack-attack" @@ -36,7 +35,6 @@ gem "sidekiq" gem "sidekiq-cron", "~> 1.10" gem "sprockets-rails" gem "tzinfo-data", platforms: %i[mingw mswin x64_mingw jruby] -gem "view_component" # Use Redis adapter to run Action Cable in production # gem "redis", "~> 4.0" diff --git a/Gemfile.lock b/Gemfile.lock index 7f06721e0..90a7e093d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -186,15 +186,15 @@ GEM zendesk_api (~> 1.27) globalid (1.2.1) activesupport (>= 6.1) - govuk-components (3.3.0) - html-attributes-utils (~> 0.9, >= 0.9.2) - pagy (~> 5.10.1) - view_component (~> 2.74.1) - govuk_design_system_formbuilder (3.3.0) + govuk-components (5.0.2) + html-attributes-utils (~> 1.0.0, >= 1.0.0) + pagy (~> 6.0) + view_component (>= 3.9, < 3.10) + govuk_design_system_formbuilder (5.0.0) actionview (>= 6.1) activemodel (>= 6.1) activesupport (>= 6.1) - html-attributes-utils (~> 0.9, >= 0.9.2) + html-attributes-utils (~> 1) govuk_markdown (2.0.1) activesupport redcarpet @@ -204,7 +204,7 @@ GEM tilt hashdiff (1.0.1) hashie (5.0.0) - html-attributes-utils (0.9.2) + html-attributes-utils (1.0.2) activesupport (>= 6.1.4.4) i18n (1.14.1) concurrent-ruby (~> 1.0) @@ -287,8 +287,7 @@ GEM actionpack (>= 4.2) omniauth (~> 2.0) orm_adapter (0.5.0) - pagy (5.10.1) - activesupport + pagy (6.4.3) parallel (1.23.0) parser (3.2.2.3) ast (~> 2.4.1) @@ -492,8 +491,8 @@ GEM uri (0.13.0) vcr (6.2.0) version_gem (1.1.1) - view_component (2.74.1) - activesupport (>= 5.0.0, < 8.0) + view_component (3.9.0) + activesupport (>= 5.2.0, < 8.0) concurrent-ruby (~> 1.0) method_source (~> 1.0) warden (1.2.9) @@ -525,6 +524,7 @@ GEM PLATFORMS arm64-darwin-21 + arm64-darwin-23 x86_64-darwin-21 x86_64-linux @@ -548,7 +548,7 @@ DEPENDENCIES faraday (~> 2.9) foreman (~> 0.87.2) gds_zendesk - govuk-components (~> 3.3.0) + govuk-components (~> 5.0.0) govuk_design_system_formbuilder govuk_markdown (~> 2.0) jsbundling-rails @@ -557,7 +557,6 @@ DEPENDENCIES okcomputer (~> 1.18) omniauth-oauth2 (~> 1.8) omniauth-rails_csrf_protection - pagy pg (~> 1.5) prettier_print (~> 1.2.1) puma (~> 6.4) @@ -582,7 +581,6 @@ DEPENDENCIES syntax_tree-rbs (~> 1.0.0) tzinfo-data vcr (~> 6.2) - view_component web-console webmock (~> 3.18) diff --git a/app/components/flash_message_component.html.erb b/app/components/flash_message_component.html.erb index 0c86f1c24..62227cae4 100644 --- a/app/components/flash_message_component.html.erb +++ b/app/components/flash_message_component.html.erb @@ -3,6 +3,6 @@ classes: classes, html_attributes: { role: role }, ) do |notification_banner| %> - <% notification_banner.heading(text: heading) %> + <% notification_banner.with_heading(text: heading) %> <%= body %> <% end %> diff --git a/app/components/journeys_performance_table_component.rb b/app/components/journeys_performance_table_component.rb index 8d9e9b191..b04074395 100644 --- a/app/components/journeys_performance_table_component.rb +++ b/app/components/journeys_performance_table_component.rb @@ -9,23 +9,23 @@ def initialize(which_questions_were_needed) def call govuk_table(classes: "app-performance-table") do |table| - table.caption( + table.with_caption( size: "m", text: "Journeys through Find a lost TRN (today and the last 7 days)", ) - table.head do |head| - head.row do |row| - row.cell(header: true, text: "Number of questions asked") - row.cell(header: true, text: "Number of users") + table.with_head do |head| + head.with_row do |row| + row.with_cell(header: true, text: "Number of questions asked") + row.with_cell(header: true, text: "Number of users") end end - table.body do |body| - body.row do |row| - row.cell do + table.with_body do |body| + body.with_row do |row| + row.with_cell do '3 questions
Email address, name and date of birth'.html_safe end - row.cell do + row.with_cell do number_with_percentage_cell( @which_questions_were_needed, :three_questions, @@ -33,11 +33,11 @@ def call ) end end - body.row do |row| - row.cell do + body.with_row do |row| + row.with_cell do '4 questions
+ National Insurance number'.html_safe end - row.cell do + row.with_cell do number_with_percentage_cell( @which_questions_were_needed, :four_questions, @@ -45,11 +45,11 @@ def call ) end end - body.row do |row| - row.cell do + body.with_row do |row| + row.with_cell do '5 questions (with a match)
+ ITT provider'.html_safe end - row.cell do + row.with_cell do number_with_percentage_cell( @which_questions_were_needed, :five_questions_matched, @@ -57,11 +57,11 @@ def call ) end end - body.row do |row| - row.cell do + body.with_row do |row| + row.with_cell do '5 questions (without a match)
+ ITT provider'.html_safe end - row.cell do + row.with_cell do number_with_percentage_cell( @which_questions_were_needed, :five_questions_nomatch, diff --git a/app/components/trn_requests_performance_table_component.rb b/app/components/trn_requests_performance_table_component.rb index 20dcc237c..fa92ed718 100644 --- a/app/components/trn_requests_performance_table_component.rb +++ b/app/components/trn_requests_performance_table_component.rb @@ -11,60 +11,60 @@ def initialize(grouped_request_counts:, total_grouped_requests:, since:) def call govuk_table(classes: "app-performance-table") do |table| - table.head do |head| - head.row do |row| - row.cell( + table.with_head do |head| + head.with_row do |row| + row.with_cell( header: true, text: "Date", classes: "app-performance-table-column-divider app-performance-table-date-column", ) - row.cell(header: true, text: "TRN found") - row.cell(header: true, text: "No match") - row.cell( + row.with_cell(header: true, text: "TRN found") + row.with_cell(header: true, text: "No match") + row.with_cell( header: true, text: "Did not finish", classes: "app-performance-table-column-divider", ) - row.cell( + row.with_cell( header: true, text: "Total", classes: "govuk-!-padding-left-2", ) end end - table.body do |body| + table.with_body do |body| @grouped_request_counts.map do |period_label, counts| - body.row do |row| - row.cell(classes: "app-performance-table-column-divider") do + body.with_row do |row| + row.with_cell(classes: "app-performance-table-column-divider") do period_label end - row.cell { number_with_percentage_cell(counts, :cnt_trn_found) } - row.cell { number_with_percentage_cell(counts, :cnt_no_match) } - row.cell(classes: "app-performance-table-column-divider") do + row.with_cell { number_with_percentage_cell(counts, :cnt_trn_found) } + row.with_cell { number_with_percentage_cell(counts, :cnt_no_match) } + row.with_cell(classes: "app-performance-table-column-divider") do number_with_percentage_cell(counts, :cnt_did_not_finish) end - row.cell { "#{number_with_delimiter(counts[:total])} requests" } + row.with_cell { "#{number_with_delimiter(counts[:total])} requests" } end end - body.row(classes: "app-performance-table-total-row") do |row| - row.cell( + body.with_row(classes: "app-performance-table-total-row") do |row| + row.with_cell( header: true, classes: "app-performance-table-column-divider", ) { "Total (#{@since})" } - row.cell do + row.with_cell do number_with_percentage_cell(@total_grouped_requests, :cnt_trn_found) end - row.cell do + row.with_cell do number_with_percentage_cell(@total_grouped_requests, :cnt_no_match) end - row.cell(classes: "app-performance-table-column-divider") do + row.with_cell(classes: "app-performance-table-column-divider") do number_with_percentage_cell( @total_grouped_requests, :cnt_did_not_finish, ) end - row.cell do + row.with_cell do "#{number_with_delimiter(@total_grouped_requests[:total])} requests" end end diff --git a/app/components/zendesk_delete_requests_performance_table_component.rb b/app/components/zendesk_delete_requests_performance_table_component.rb index a80f0cc11..d0e5f514d 100644 --- a/app/components/zendesk_delete_requests_performance_table_component.rb +++ b/app/components/zendesk_delete_requests_performance_table_component.rb @@ -6,39 +6,39 @@ class ZendeskDeleteRequestsPerformanceTableComponent < ViewComponent::Base def call govuk_table(classes: "app-performance-table") do |table| - table.head do |head| - head.row do |row| - row.cell( + table.with_head do |head| + head.with_row do |row| + row.with_cell( header: true, text: "Date", classes: "app-performance-table-column-divider app-performance-table-date-column", ) - row.cell( + row.with_cell( header: true, text: "Total", classes: "govuk-!-padding-left-2", ) end end - table.body do |body| + table.with_body do |body| grouped_request_counts.map do |period_label, counts| - body.row do |row| - row.cell(classes: "app-performance-table-column-divider") do + body.with_row do |row| + row.with_cell(classes: "app-performance-table-column-divider") do period_label end - row.cell do + row.with_cell do "#{number_with_delimiter(counts[:total])} delete requests" end end end - body.row(classes: "app-performance-table-total-row") do |row| - row.cell( + body.with_row(classes: "app-performance-table-total-row") do |row| + row.with_cell( header: true, classes: "app-performance-table-column-divider", ) { "Total (#{since})" } - row.cell do + row.with_cell do "#{number_with_delimiter(total_grouped_requests[:total])} delete requests" end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c5dc11a9c..b78570aa5 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -42,47 +42,47 @@ def custom_header ) do |header| case try(:current_namespace) when "support_interface" - header.navigation_item( + header.with_navigation_item( active: current_page?(support_interface_trn_requests_path), href: support_interface_trn_requests_path, text: "TRNs", ) - header.navigation_item( + header.with_navigation_item( active: current_page?(support_interface_features_path), href: support_interface_features_path, text: "Features", ) - header.navigation_item( + header.with_navigation_item( active: request.path.start_with?("/support/identity") || request.path.start_with?("/support/dqt_record"), href: support_interface_identity_user_index_path, text: "Identity", ) - header.navigation_item( + header.with_navigation_item( active: request.path.start_with?("/support/staff"), href: support_interface_staff_index_path, text: "Staff", ) - header.navigation_item( + header.with_navigation_item( active: false, href: support_interface_sidekiq_web_path, text: "Sidekiq", ) - header.navigation_item( + header.with_navigation_item( active: current_page?(support_interface_validation_errors_path), href: support_interface_validation_errors_path, text: "Validations", ) - header.navigation_item( + header.with_navigation_item( active: request.path.start_with?("/support/zendesk"), href: support_interface_zendesk_path, text: "Zendesk", ) if current_staff - header.navigation_item(href: staff_sign_out_path, text: "Sign out") + header.with_navigation_item(href: staff_sign_out_path, text: "Sign out") else - header.navigation_item(href: new_staff_session_path, text: "Sign in") + header.with_navigation_item(href: new_staff_session_path, text: "Sign in") end end end diff --git a/app/views/performance/index.html.erb b/app/views/performance/index.html.erb index 62cd1794d..6e9f4a750 100644 --- a/app/views/performance/index.html.erb +++ b/app/views/performance/index.html.erb @@ -63,31 +63,36 @@
<%= govuk_table(classes: 'app-performance-table') do |table| - table.caption(size: 'm', text: "How quickly did users get their TRN (today and the previous 7 days)") - - table.head do |head| - head.row do |row| - row.cell(header: true, text: 'Date') - row.cell(header: true) { '90% of users
got their TRN within'.html_safe } - row.cell(header: true) { '75% of users
got their TRN within'.html_safe } - row.cell(header: true) { '50% of users
got their TRN within'.html_safe } - - end; end; table.body do |body| - @duration_usage.each do |data_row| - body.row do |row| - row.cell { data_row[0] } - row.cell { data_row[1] } - row.cell { data_row[2] } - row.cell { data_row[3] } - end + table.with_caption(size: 'm', text: "How quickly did users get their TRN (today and the previous 7 days)") + + table.head do |head| + head.with_row do |row| + row.with_cell(header: true, text: 'Date') + row.with_cell(header: true) { '90% of users
got their TRN within'.html_safe } + row.with_cell(header: true) { '75% of users
got their TRN within'.html_safe } + row.with_cell(header: true) { '50% of users
got their TRN within'.html_safe } + + end; + end; + + table.with_body do |body| + @duration_usage.each do |data_row| + body.with_row do |row| + row.with_cell { data_row[0] } + row.with_cell { data_row[1] } + row.with_cell { data_row[2] } + row.with_cell { data_row[3] } end - body.row(classes: 'app-performance-table-total-row') do |row| - row.cell(header: true) { 'Average (today and the last 7 days)' } - row.cell { @duration_averages[0] } - row.cell { @duration_averages[1] } - row.cell { @duration_averages[2] } - end - end; end %> + end + + body.with_row(classes: 'app-performance-table-total-row') do |row| + row.with_cell(header: true) { 'Average (today and the last 7 days)' } + row.with_cell { @duration_averages[0] } + row.with_cell { @duration_averages[1] } + row.with_cell { @duration_averages[2] } + end + end; + end %>
diff --git a/app/views/support_interface/staff/index.html.erb b/app/views/support_interface/staff/index.html.erb index fb87b8093..f509629f2 100644 --- a/app/views/support_interface/staff/index.html.erb +++ b/app/views/support_interface/staff/index.html.erb @@ -10,16 +10,16 @@

<%= staff.email %>

<%= govuk_summary_list do |summary_list| - summary_list.row do |row| - row.key { 'Created at' } - row.value { staff.created_at.to_s } + summary_list.with_row do |row| + row.with_key { 'Created at' } + row.with_value { staff.created_at.to_s } end if staff.created_by_invite? - summary_list.row do |row| - row.key { 'Invitation status' } + summary_list.with_row do |row| + row.with_key { 'Invitation status' } - row.value do + row.with_value do if staff.invitation_accepted? govuk_tag(text: "Accepted", colour: "green") else @@ -28,15 +28,15 @@ end end - summary_list.row do |row| - row.key { 'Invited at' } - row.value { staff.invitation_sent_at.to_s } + summary_list.with_row do |row| + row.with_key { 'Invited at' } + row.with_value { staff.invitation_sent_at.to_s } end end - summary_list.row do |row| - row.key { 'Last signed in at' } - row.value { staff.last_sign_in_at.to_s } + summary_list.with_row do |row| + row.with_key { 'Last signed in at' } + row.with_value { staff.last_sign_in_at.to_s } end end %> <% end %> diff --git a/app/views/support_interface/trn_requests/index.html.erb b/app/views/support_interface/trn_requests/index.html.erb index 479312f1c..bd1974bfa 100644 --- a/app/views/support_interface/trn_requests/index.html.erb +++ b/app/views/support_interface/trn_requests/index.html.erb @@ -13,19 +13,19 @@ <% @trn_requests.each do |trn_request| %>

TRN Request #<%= trn_request.id %>

<%= govuk_summary_list do |summary_list| - summary_list.row do |row| - row.key(text: 'Created at') - row.value(text: trn_request.created_at) + summary_list.with_row do |row| + row.with_key(text: 'Created at') + row.with_value(text: trn_request.created_at) end - summary_list.row do |row| - row.key(text: 'Updated at') - row.value(text: trn_request.updated_at) + summary_list.with_row do |row| + row.with_key(text: 'Updated at') + row.with_value(text: trn_request.updated_at) end - summary_list.row do |row| - row.key(text: 'Submitted at') - row.value do + summary_list.with_row do |row| + row.with_key(text: 'Submitted at') + row.with_value do if trn_request.checked_at trn_request.checked_at.to_s else @@ -35,9 +35,9 @@ end if trn_request.checked_at - summary_list.row do |row| - row.key(text: 'TRN') - row.value do + summary_list.with_row do |row| + row.with_key(text: 'TRN') + row.with_value do if trn_request.trn govuk_tag(colour: 'green', text: 'Found 🎉') else @@ -47,26 +47,26 @@ end if !trn_request.zendesk_ticket_id && !trn_request.trn - summary_list.row do |row| - row.key(text: 'Zendesk ticket') - row.value do + summary_list.with_row do |row| + row.with_key(text: 'Zendesk ticket') + row.with_value do govuk_tag(colour: 'grey', text: 'Not submitted') end end end if trn_request.zendesk_ticket_id - summary_list.row do |row| - row.key(text: 'Zendesk ticket') - row.value do + summary_list.with_row do |row| + row.with_key(text: 'Zendesk ticket') + row.with_value do tag.a "Ticket #{trn_request.zendesk_ticket_id}", class: 'govuk-link', href: "#{ENV["ZENDESK_URL"]}/agent/tickets/#{trn_request.zendesk_ticket_id}" end end unless trn_request.trn - summary_list.row do |row| - row.key(text: 'Actions') - row.value do + summary_list.with_row do |row| + row.with_key(text: 'Actions') + row.with_value do govuk_button_to("Sync from Zendesk", [:support_interface, trn_request, :zendesk_sync], secondary: true, class: 'govuk-!-margin-bottom-0') end end diff --git a/app/views/support_interface/users/index.html.erb b/app/views/support_interface/users/index.html.erb index 9a4f8ea4c..22581bc91 100644 --- a/app/views/support_interface/users/index.html.erb +++ b/app/views/support_interface/users/index.html.erb @@ -16,36 +16,36 @@

No users.

<% else %> <%= govuk_table do |table| - table.head do |head| - head.row do |row| - row.cell(header: true, width: 'one-quarter') do + table.with_head do |head| + head.with_row do |row| + row.with_cell(header: true, width: 'one-quarter') do tag.span("Name") end - row.cell(header: true, width: 'one-quarter') do + row.with_cell(header: true, width: 'one-quarter') do tag.span("Email") end - row.cell(header: true, width: 'one-quarter') do + row.with_cell(header: true, width: 'one-quarter') do tag.span("DQT record") end - row.cell(header: true, width: 'one-quarter') do + row.with_cell(header: true, width: 'one-quarter') do tag.span("TRN") end end end - table.body do |body| + table.with_body do |body| @users.each do |user| - body.row do |row| - row.cell do + body.with_row do |row| + row.with_cell do user_info_link(user) end - row.cell do + row.with_cell do user.email end - row.cell do + row.with_cell do user_dqt_record_status(user) end - row.cell do + row.with_cell do tag.span(user.trn) end end diff --git a/app/views/support_interface/validation_errors/index.html.erb b/app/views/support_interface/validation_errors/index.html.erb index db8543959..eebe9e38a 100644 --- a/app/views/support_interface/validation_errors/index.html.erb +++ b/app/views/support_interface/validation_errors/index.html.erb @@ -11,18 +11,18 @@
<%= govuk_table do |table| - table.head do |head| - head.row do |row| - row.cell(header: true, text: 'Form') - row.cell(header: true, text: 'Error count') + table.with_head do |head| + head.with_row do |row| + row.with_cell(header: true, text: 'Form') + row.with_cell(header: true, text: 'Error count') end end - table.body do |body| + table.with_body do |body| @validation_errors.each do |form_name, count| - body.row do |row| - row.cell(text: link_to(form_name, support_interface_validation_error_path(form_name))) - row.cell(text: count) + body.with_row do |row| + row.with_cell(text: link_to(form_name, support_interface_validation_error_path(form_name))) + row.with_cell(text: count) end end end diff --git a/app/views/support_interface/validation_errors/show.html.erb b/app/views/support_interface/validation_errors/show.html.erb index 8b0b6e70c..0d00c607a 100644 --- a/app/views/support_interface/validation_errors/show.html.erb +++ b/app/views/support_interface/validation_errors/show.html.erb @@ -9,35 +9,35 @@ <%= govuk_table do |table| - table.head do |head| - head.row do |row| - row.cell(header: true, text: 'Time', width: 'one-quarter') - row.cell(header: true, text: 'TRN Request ID') - row.cell(header: true, text: 'Errors') + table.with_head do |head| + head.with_row do |row| + row.with_cell(header: true, text: 'Time', width: 'one-quarter') + row.with_cell(header: true, text: 'TRN Request ID') + row.with_cell(header: true, text: 'Errors') end end - table.body do |body| + table.with_body do |body| @validation_errors.each do |validation_error| - body.row do |row| - row.cell(text: validation_error.created_at.to_fs(:long_ordinal_uk)) - row.cell(text: validation_error.trn_request.id) - row.cell(classes: ['app-p0']) do + body.with_row do |row| + row.with_cell(text: validation_error.created_at.to_fs(:long_ordinal_uk)) + row.with_cell(text: validation_error.trn_request.id) + row.with_cell(classes: ['app-p0']) do validation_error.messages.map do |error, details| govuk_summary_list(actions: false) do |summary_list| - summary_list.row do |row| - row.key { 'Attribute' } - row.value { error } + summary_list.with_row do |row| + row.with_key { 'Attribute' } + row.with_value { error } end - summary_list.row do |row| - row.key { 'Value' } - row.value { details['value'].inspect } + summary_list.with_row do |row| + row.with_key { 'Value' } + row.with_value { details['value'].inspect } end - summary_list.row do |row| - row.key { 'Errors' } - row.value { details['messages'].map { |s| ERB::Util.html_escape(s) }.join('
').html_safe } + summary_list.with_row do |row| + row.with_key { 'Errors' } + row.with_value { details['messages'].map { |s| ERB::Util.html_escape(s) }.join('
').html_safe } end end end.join.html_safe diff --git a/app/views/support_interface/zendesk/index.html.erb b/app/views/support_interface/zendesk/index.html.erb index baff7437e..5ba5c42ed 100644 --- a/app/views/support_interface/zendesk/index.html.erb +++ b/app/views/support_interface/zendesk/index.html.erb @@ -41,37 +41,37 @@

No tickets need to be deleted.

<% else %> <%= govuk_table do |table| - table.head do |head| - head.row do |row| - row.cell(header: true, width: 'one-quarter') do + table.with_head do |head| + head.with_row do |row| + row.with_cell(header: true, width: 'one-quarter') do tag.span("Ticket link") + tag.span("Group name", class: 'govuk-caption-m') end - row.cell(header: true, width: 'one-third') do + row.with_cell(header: true, width: 'one-third') do tag.span("Closed at") + tag.span("Received at", class: 'govuk-caption-m') end - row.cell(header: true) do + row.with_cell(header: true) do tag.span("Tag: Enquiry type") + tag.span("Tag: No action required", class: 'govuk-caption-m') end end end - table.body do |body| + table.with_body do |body| @zendesk_tickets.each do |ticket| - body.row do |row| - row.cell do + body.with_row do |row| + row.with_cell do tag.a("Ticket #{ticket.ticket_id}", class: 'govuk-link', href: "#{ENV["ZENDESK_URL"]}/agent/tickets/#{ticket.ticket_id}") + tag.span(ticket.group_name, class: 'govuk-caption-m') end - row.cell do + row.with_cell do tag.span(ticket.closed_at, class: 'app-!-font-tabular') + tag.span(ticket.received_at, class: 'app-!-font-tabular govuk-caption-m') end - row.cell do + row.with_cell do tag.code(ticket.enquiry_type, class: 'app-!-word-break-all') + tag.span(ticket.no_action_required, class: 'govuk-caption-m') end @@ -101,37 +101,37 @@ <%= govuk_pagination(pagy: @pagy) %> <%= govuk_table do |table| - table.head do |head| - head.row do |row| - row.cell(header: true, width: 'one-quarter') do + table.with_head do |head| + head.with_row do |row| + row.with_cell(header: true, width: 'one-quarter') do tag.span("Ticket link") + tag.span("Group name", class: 'govuk-caption-m') end - row.cell(header: true, width: 'one-third') do + row.with_cell(header: true, width: 'one-third') do tag.span("Closed at") + tag.span("Received at", class: 'govuk-caption-m') end - row.cell(header: true) do + row.with_cell(header: true) do tag.span("Tag: Enquiry type") + tag.span("Tag: No action required", class: 'govuk-caption-m') end end end - table.body do |body| + table.with_body do |body| @zendesk_delete_requests.each do |ticket| - body.row do |row| - row.cell do + body.with_row do |row| + row.with_cell do tag.a("Ticket #{ticket.ticket_id}", class: 'govuk-link', href: "#{ENV["ZENDESK_URL"]}/agent/tickets/#{ticket.ticket_id}") + tag.span(ticket.group_name, class: 'govuk-caption-m') end - row.cell do + row.with_cell do tag.span(ticket.closed_at, class: 'app-!-font-tabular') + tag.span(ticket.received_at, class: 'app-!-font-tabular govuk-caption-m') end - row.cell do + row.with_cell do tag.code(ticket.enquiry_type, class: 'app-!-word-break-all') + tag.span(ticket.no_action_required, class: 'govuk-caption-m') end diff --git a/spec/components/trn_requests_performance_table_component_spec.rb b/spec/components/trn_requests_performance_table_component_spec.rb index 9ca113e21..9520976e4 100644 --- a/spec/components/trn_requests_performance_table_component_spec.rb +++ b/spec/components/trn_requests_performance_table_component_spec.rb @@ -27,16 +27,17 @@ it "renders a row per period" do expect(rendered_result_text).to include( - "2 June\n 1 (33%) \n 1 (33%) \n 1 (33%) \n 3 requests", + "2 June1 (33%) 1 (33%) 1 (33%) 3 requests" ) expect(rendered_result_text).to include( - "1 June\n 1 (33%) \n 1 (33%) \n 1 (33%) \n 3 requests", + "1 June1 (33%) 1 (33%) 1 (33%) 3 requests" ) + end it "renders the totals row" do expect(rendered_result_text).to include( - "Total (last 7 days)\n 2 (33%) \n 2 (33%) \n 2 (33%) \n 6 requests", + "Total (last 7 days)2 (33%) 2 (33%) 2 (33%) 6 requests" ) end