From dbc33fa08527ed48b85057ceddacd1e4fabb175d Mon Sep 17 00:00:00 2001 From: josemigallas Date: Tue, 27 Jun 2023 16:41:35 +0200 Subject: [PATCH 01/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20activedocs=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api_docs/base/_active_docs_table.slim | 46 ++++++++++--------- .../service_api_docs_controller_test.rb | 6 +-- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/app/views/admin/api_docs/base/_active_docs_table.slim b/app/views/admin/api_docs/base/_active_docs_table.slim index b161765e1c..59e81af44a 100644 --- a/app/views/admin/api_docs/base/_active_docs_table.slim +++ b/app/views/admin/api_docs/base/_active_docs_table.slim @@ -1,22 +1,26 @@ -table class="data" - thead - th Name - th System Name - th State - - if service.blank? - th API - th Swagger Version - th class='operations' = link_to('Create a new spec', new_api_docs_service_path(service), class: 'action add') - tbody - - for api_docs in api_docs_services - tr - td = link_to api_docs.name, preview_admin_api_docs_service_path(api_docs), title: 'Preview service spec' - td = api_docs.system_name - td = api_docs.published? ? 'visible' : 'hidden' +div class="pf-c-card" + table class="pf-c-table pf-m-grid-lg" role="grid" aria-label="Active docs table" + thead + tr role="row" + th role="columnheader" scope="col" Name + th role="columnheader" scope="col" System Name + th role="columnheader" scope="col" State - if service.blank? - td = api_docs.service&.name - td - => api_docs.swagger_version - - if api_docs.needs_swagger_update? - = link_to t('admin.api_docs.base.index.update_link_text'), t('admin.api_docs.base.index.update_link', docs_base_url: docs_base_url), class: 'is-inline' - td class='operations' = link_to 'Edit', edit_admin_api_docs_service_path(api_docs), class: 'action edit' + th role="columnheader" scope="col" API + th role="columnheader" scope="col" Swagger Version + th role="columnheader" scope="col" class="operations pf-c-table__action pf-m-width-20" + = link_to('Create a new spec', new_api_docs_service_path(service), class: 'action add') + tbody role="rowgroup" + - for api_docs in api_docs_services + tr role="row" + td role="cell" data-label="Name" = link_to api_docs.name, preview_admin_api_docs_service_path(api_docs), title: 'Preview service spec' + td role="cell" data-label="System Name" = api_docs.system_name + td role="cell" data-label="State" = api_docs.published? ? 'visible' : 'hidden' + - if service.blank? + td role="cell" data-label="API" = api_docs.service&.name + td role="cell" data-label="Swagger Version" + => api_docs.swagger_version + - if api_docs.needs_swagger_update? + = link_to t('admin.api_docs.base.index.update_link_text'), t('admin.api_docs.base.index.update_link', docs_base_url: docs_base_url), class: 'is-inline' + td role="cell" class="operations pf-c-table__action" + = link_to 'Edit', edit_admin_api_docs_service_path(api_docs), class: 'action edit' diff --git a/test/integration/admin/api_docs/service_api_docs_controller_test.rb b/test/integration/admin/api_docs/service_api_docs_controller_test.rb index ff660b5858..4dd50e0d28 100644 --- a/test/integration/admin/api_docs/service_api_docs_controller_test.rb +++ b/test/integration/admin/api_docs/service_api_docs_controller_test.rb @@ -20,9 +20,9 @@ class Admin::ApiDocs::ServiceApiDocsControllerTest < ActionDispatch::Integration assert_service_active_docs_menus page = Nokogiri::HTML4::Document.parse(response.body) - assert_equal 1, page.xpath(".//table[@class='data']/tbody//tr").count - assert_match api_docs_service.name, page.xpath(".//table[@class='data']/tbody").text - assert_not_match other_api_docs_service.name, page.xpath(".//table[@class='data']/tbody").text + assert_equal 1, page.xpath(".//table/tbody//tr").count + assert_match api_docs_service.name, page.xpath(".//table/tbody").text + assert_not_match other_api_docs_service.name, page.xpath(".//table/tbody").text end test 'new works under the service scope' do From 0545fead4e40a21c08faca763f30aed7eef7f479 Mon Sep 17 00:00:00 2001 From: josemigallas Date: Wed, 28 Jun 2023 08:46:19 +0200 Subject: [PATCH 02/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20api=20alerts=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/stylesheets/provider/_alerts.scss | 9 -- app/assets/stylesheets/provider/_theme.scss | 1 - app/views/api/alerts/index.html.erb | 134 ++++++++++--------- 3 files changed, 71 insertions(+), 73 deletions(-) delete mode 100644 app/assets/stylesheets/provider/_alerts.scss diff --git a/app/assets/stylesheets/provider/_alerts.scss b/app/assets/stylesheets/provider/_alerts.scss deleted file mode 100644 index 66243a01c2..0000000000 --- a/app/assets/stylesheets/provider/_alerts.scss +++ /dev/null @@ -1,9 +0,0 @@ -.data .events .alert { - &.unread, &[data-state='unread'] { - font-weight: $font-weight-bold; - - .action { - font-weight: $font-weight-normal; - } - } -} diff --git a/app/assets/stylesheets/provider/_theme.scss b/app/assets/stylesheets/provider/_theme.scss index bbaa055db2..59fc2acead 100644 --- a/app/assets/stylesheets/provider/_theme.scss +++ b/app/assets/stylesheets/provider/_theme.scss @@ -40,7 +40,6 @@ @import 'provider/bulk_operations'; @import 'provider/fields_definitions'; -@import 'provider/alerts'; @import 'provider/tables'; @import 'provider/utilization'; @import 'provider/forms'; diff --git a/app/views/api/alerts/index.html.erb b/app/views/api/alerts/index.html.erb index 27dd510aa8..ce9a15ebbb 100644 --- a/app/views/api/alerts/index.html.erb +++ b/app/views/api/alerts/index.html.erb @@ -4,66 +4,74 @@ <% content_for :page_header_title, @service ? 'Alerts' : 'Alerts for all services' %> -
- - - - - - - - - - - - - <%= search_form do |s| %> - - - - <% end %> - - - - <%- @alerts.each do |alert| -%> - <%= content_tag :tr, :id => dom_id(alert), :'data-state' => alert.state, :class => :alert do %> - - <%- cinstance = alert.cinstance %> - - - - - - - <%- end -%> - <%- end -%> - <%- if @alerts.empty? -%> - - - - <%- end -%> - -
AccountApplicationMessage<%= sortable 'level', 'Level'%><%= sortable 'timestamp', 'Time (UTC)'%> - <%= action_link_to 'Delete all', polymorphic_path([:purge, :admin, @service, :alerts]), :method => :delete, data: {confirm: "Do you really want to delete all alerts and violations?"} %> - - <%= action_link_to 'Mark all as read', polymorphic_path([:all_read, :admin, @service, :alerts]), :method => :put %> -
- <%- if account = alert.cinstance.try(:user_account) -%> - <%= link_to account.org_name, admin_buyers_account_path(account) -%> - <%- else -%> - <%= account_name(account) -%> - <% end-%> - <%= link_to cinstance.name, provider_admin_application_path(cinstance) %><%= h alert.message %><%= colorize_utilization(alert.level) %><%= l alert.timestamp %> - <%= delete_button_for polymorphic_path([:admin, @service, alert]), :remote => true, :method => :delete, data: {:confirm => "Do you really want to delete this alert?"} %> - - <%= action_link_to :read, polymorphic_path([:read, :admin, @service, alert]), :remote => true, :method => :put, :class => 'mark-as-read', data: {disable_with: "Marking..."}, :title => 'Mark as read' if alert.unread? %> -
There are no recent alerts or violations.
- <%= will_paginate @alerts %> -
+ + + + + + + <%= th_sortable 'level', 'Level'%> + <%= th_sortable 'timestamp', 'Time (UTC)'%> + + + + + <%= search_form do |s| %> + + + + <% end %> + + + + <%- @alerts.each do |alert| -%> + <%- state = alert.state %> + <%= content_tag :tr, id: dom_id(alert), :'data-state' => state, role: "row" do %> + + <%- cinstance = alert.cinstance %> + + + + + + + <%- end -%> + <%- end -%> + <%- if @alerts.empty? -%> + + + + <%- end -%> + +
AccountApplicationMessage + <%= action_link_to 'Delete all', polymorphic_path([:purge, :admin, @service, :alerts]), :method => :delete, data: {confirm: "Do you really want to delete all alerts and violations?"} %> + + <%= action_link_to 'Mark all as read', polymorphic_path([:all_read, :admin, @service, :alerts]), :method => :put %> +
+ <%= content_tag(state == 'unread' ? :b : :span) do %> + <%- if account = alert.cinstance.try(:user_account) -%> + <%= link_to account.org_name, admin_buyers_account_path(account) -%> + <%- else -%> + <%= account_name(account) -%> + <% end-%> + <% end %> + + <%= link_to cinstance.name, provider_admin_application_path(cinstance) %> + + <%= h alert.message %> + + <%= colorize_utilization(alert.level) %> + + <%= l alert.timestamp %> + + <%= delete_button_for polymorphic_path([:admin, @service, alert]), :remote => true, :method => :delete, data: {:confirm => "Do you really want to delete this alert?"} %> + + <%= action_link_to :read, polymorphic_path([:read, :admin, @service, alert]), :remote => true, :method => :put, :class => 'mark-as-read', data: {disable_with: "Marking..."}, :title => 'Mark as read' if alert.unread? %> +
There are no recent alerts or violations.
+<%= will_paginate @alerts %> From 9deeee545d6c44ad2c77b6b06726f354b3d1e3ee Mon Sep 17 00:00:00 2001 From: josemigallas Date: Wed, 28 Jun 2023 10:49:56 +0200 Subject: [PATCH 03/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20buyers=20service=20contracts=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../buyers/service_contracts/index.html.slim | 211 +++++++++--------- .../bulk_operations/change_plans.feature | 2 +- .../bulk_operations/change_states.feature | 6 +- .../old/services/subscriptions/search.feature | 6 +- .../service_contracts_controller_test.rb | 2 +- 5 files changed, 117 insertions(+), 110 deletions(-) diff --git a/app/views/buyers/service_contracts/index.html.slim b/app/views/buyers/service_contracts/index.html.slim index 804d3c7a9d..eb69e4bca8 100644 --- a/app/views/buyers/service_contracts/index.html.slim +++ b/app/views/buyers/service_contracts/index.html.slim @@ -27,111 +27,118 @@ div id="bulk-operations" style="display: none;" = javascript_include_tag 'bulk_operations.js' = javascript_include_tag 'vendor/jquery.tipsy.js' -table.data - thead - tr - th.select - = bulk_select_all - - unless @account - th - = sortable('accounts.org_name', 'Account') - - if @multiservice - th - label for="search_service_id" - | Service - th - = sortable('plans.name', 'Plan') - th - = sortable('cinstances.state', 'State') - th - | Paid? - th colspan="3" - = sortable('cinstances.created_at', 'Created On') - - - unless @account - tr class="search" - = form_for @search, as: :search, url: search_path, html: { method: :get, class: :search } do |s| - th - th - = s.text_field :account_query, size: 15 - +div class="pf-l-flex pf-m-column" + div class="pf-l-flex__item" + table class="pf-c-table pf-m-grid-lg" role="grid" aria-label="Service subscriptions table" + thead + tr role="row" + td role="columnheader" scope="col" class="select pf-c-table__check" + label + = bulk_select_all + - unless @account + = th_sortable('accounts.org_name', 'Account') - if @multiservice - th - = s.collection_select :service_id, @services, :id, :name, - { include_blank: true }, - { disabled: @service } - th - = s.grouped_collection_select :plan_id, @services, - :service_plans, :name, :id, :name, - { include_blank: true }, - { disabled: @plan } - th - = s.select :state, @states, include_blank: true, selected: @search.state - th - = s.select :plan_type, [ ['free'], ['paid'] ], - { include_blank: true}, - { disabled: @plan } - th colspan="3" - = s.submit 'Search', name: nil + th role="columnheader" scope="col" + label for="search_service_id" + | Service + = th_sortable('plans.name', 'Plan') + = th_sortable('cinstances.state', 'State') + th role="columnheader" scope="col" + | Paid? + = th_sortable('cinstances.created_at', 'Created On') + td colspan="2" - tbody - - @service_contracts.each do |contract| - - service = contract.service - tr id=dom_id(contract) - td.select - = bulk_select_one contract - unless @account - td - = link_to_buyer_or_deleted contract.account - - if @multiservice - td - = link_to service.name, admin_service_path(service) - td.plan - = link_to contract.plan.name, edit_polymorphic_path([:admin, contract.plan]), - :title => "Edit #{contract.plan.class.model_name.human} '#{contract.plan.name}'" - td.state - = contract.state - td.paid_or_free - = plan_free_or_paid contract.plan - td - = time_tag_with_title contract.created_at - td.action - - if contract - - if contract.pending? - = action_link_to 'approve', approve_admin_buyers_account_service_contract_path(contract.account, contract), method: :post - - else - = action_link_to :delete, admin_buyers_account_service_contract_path(contract.account, contract), - 'data-confirm': "Are you sure? Unsubscribing will delete all this account's applications that subscribe to this service (applications need to be suspended beforehand)", 'data-method': :delete, - label: 'Unsubscribe' - -else - = admin_subscribe_service_link contract.account, service, contract - td.action - = admin_change_service_plan_link contract.account, service, contract if contract - - if @service_contracts.empty? - - if @account - tr.no_results - td colspan="6" - | No Service Subscriptions - - else - = no_search_results(@multiservice ? 7 : 6) + tr role="row" class="search" + = form_for @search, as: :search, url: search_path, html: { method: :get, class: :search } do |s| + th role="columnheader" scope="col" + th role="columnheader" scope="col" + = s.text_field :account_query, size: 15 + + - if @multiservice + th role="columnheader" scope="col" + = s.collection_select :service_id, @services, :id, :name, + { include_blank: true }, + { disabled: @service } + th role="columnheader" scope="col" + = s.grouped_collection_select :plan_id, @services, + :service_plans, :name, :id, :name, + { include_blank: true }, + { disabled: @plan } + th role="columnheader" scope="col" + = s.select :state, @states, include_blank: true, selected: @search.state + th role="columnheader" scope="col" + = s.select :plan_type, [ ['free'], ['paid'] ], + { include_blank: true}, + { disabled: @plan } + th role="columnheader" scope="col" colspan="3" + = s.submit 'Search', name: nil -= will_paginate @service_contracts + tbody role="rowgroup" + - @service_contracts.each do |contract| + - service = contract.service + tr role="row" id=dom_id(contract) + td class="pf-c-table__check select" role="cell" id=contract.id + label + = bulk_select_one contract + - unless @account + td role="cell" data-label="Account" + = link_to_buyer_or_deleted contract.account + - if @multiservice + td role="cell" data-label="Service" + = link_to service.name, admin_service_path(service) + td role="cell" data-label="Plan" class="plan" + = link_to contract.plan.name, edit_polymorphic_path([:admin, contract.plan]), + :title => "Edit #{contract.plan.class.model_name.human} '#{contract.plan.name}'" + td role="cell" data-label="State" class="state" + = contract.state + td role="cell" data-label="Paid?" class="paid_or_free" + = plan_free_or_paid contract.plan + td role="cell" data-label="Created On" + = time_tag_with_title contract.created_at + td role="cell" class="pf-c-table__action" + div class="pf-c-overflow-menu" + div class="pf-c-overflow-menu__content" + div class="pf-c-overflow-menu__group pf-m-button-group" + div class="pf-c-overflow-menu__item" + - if contract + - if contract.pending? + = action_link_to 'approve', approve_admin_buyers_account_service_contract_path(contract.account, contract), method: :post + - else + = action_link_to :delete, admin_buyers_account_service_contract_path(contract.account, contract), + 'data-confirm': "Are you sure? Unsubscribing will delete all this account's applications that subscribe to this service (applications need to be suspended beforehand)", 'data-method': :delete, + label: 'Unsubscribe' + - else + = admin_subscribe_service_link contract.account, service, contract + - if contract + div class="pf-c-overflow-menu__item" + = admin_change_service_plan_link contract.account, service, contract + - if @service_contracts.empty? + - if @account + tr.no_results + td colspan="6" + | No Service Subscriptions + - else + = no_search_results(@multiservice ? 7 : 6) -br -br + = will_paginate @service_contracts -- if @account && current_account.services_without_contracts(@account).any? - h2 - | Available service subscriptions - table.data - thead - tr - th colspan="2" - | Service - tbody - - current_account.services_without_contracts(@account).each do |service| - tr id=dom_id(service) - td - = h service.name - td.action - = admin_subscribe_service_link @account, service + - if @account && current_account.services_without_contracts(@account).any? + div class="pf-l-flex__item" + h2 Available service subscriptions + table class="pf-c-table pf-m-grid-lg" role="grid" + thead + tr role="row" + th role="columnheader" scope="col" Service + td + tbody + - current_account.services_without_contracts(@account).each do |service| + tr role="row" id=dom_id(service) + td role="cell" data-label="Service" + = h service.name + td role="cell" class="pf-c-table__action" + div class="pf-c-overflow-menu" + div class="pf-c-overflow-menu__content" + div class="pf-c-overflow-menu__group pf-m-button-group" + div class="pf-c-overflow-menu__item" + = admin_subscribe_service_link @account, service diff --git a/features/old/services/subscriptions/bulk_operations/change_plans.feature b/features/old/services/subscriptions/bulk_operations/change_plans.feature index a99ac61132..e34bb50638 100644 --- a/features/old/services/subscriptions/bulk_operations/change_plans.feature +++ b/features/old/services/subscriptions/bulk_operations/change_plans.feature @@ -49,7 +49,7 @@ Feature: Bulk operations Then I should see following table: - | Account ▲ | Plan | + | Account | Plan | | bob | Basic | | bob | Unpublished | | jane | Basic | diff --git a/features/old/services/subscriptions/bulk_operations/change_states.feature b/features/old/services/subscriptions/bulk_operations/change_states.feature index 1b9e1a30df..27214a82ae 100644 --- a/features/old/services/subscriptions/bulk_operations/change_states.feature +++ b/features/old/services/subscriptions/bulk_operations/change_states.feature @@ -48,7 +48,7 @@ Feature: Bulk operations # there is no transition suspended => live Then I should see following table: - | Account ▲ | State | + | Account | State | | bob | live | | bob | live | | jane | live | @@ -73,7 +73,7 @@ Feature: Bulk operations # pending cannot be changed to suspended Then I should see following table: - | Account ▲ | State | + | Account | State | | bob | pending | | bob | pending | | jane | suspended | @@ -98,7 +98,7 @@ Feature: Bulk operations # resume = suspended => live Then I should see following table: - | Account ▲ | State | + | Account | State | | bob | pending | | bob | pending | | jane | live | diff --git a/features/old/services/subscriptions/search.feature b/features/old/services/subscriptions/search.feature index ebcde44788..3a3726421b 100644 --- a/features/old/services/subscriptions/search.feature +++ b/features/old/services/subscriptions/search.feature @@ -24,7 +24,7 @@ Feature: Providers's subscription searching, sorting and filtering | Basic | free | live | And I follow "Account" within table header Then I should see following table: - | Account ▲ | + | Account | | bob | | jane | @@ -36,7 +36,7 @@ Feature: Providers's subscription searching, sorting and filtering | Basic | And I follow "Account" within table header And I should see following table: - | Account ▲ | + | Account | | bob | | jane | @@ -46,7 +46,7 @@ Feature: Providers's subscription searching, sorting and filtering | Plan | Paid? | State | | Unpublished | free | live | And I follow "" within table header - Then I should see " ▲" + Then I should see "" Examples: | order by | diff --git a/test/integration/buyers/service_contracts_controller_test.rb b/test/integration/buyers/service_contracts_controller_test.rb index 4f32c08f31..85bcb4acb5 100644 --- a/test/integration/buyers/service_contracts_controller_test.rb +++ b/test/integration/buyers/service_contracts_controller_test.rb @@ -132,7 +132,7 @@ class ProviderMemberTest < self get admin_buyers_service_contracts_path assert_response :success page = Nokogiri::HTML4::Document.parse(response.body) - service_contract_ids = page.xpath("//table[@class='data']/tbody/tr/@id").map { |id| id.text[/\d+/].to_i } + service_contract_ids = page.xpath("//table/tbody/tr/@id").map { |id| id.text[/\d+/].to_i } assert_includes service_contract_ids, service_contract.id assert_not_includes service_contract_ids, forbidden_service_contract.id end From 2f7ecad397bd1cc526185e8246d4369c304ee04d Mon Sep 17 00:00:00 2001 From: josemigallas Date: Wed, 28 Jun 2023 11:54:40 +0200 Subject: [PATCH 04/37] =?UTF-8?q?=20=F0=9F=A6=8B=20applies=20basic=20PF4?= =?UTF-8?q?=20to=20applications=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/stylesheets/provider/_forms.scss | 21 ++- app/helpers/column_sorting_helper.rb | 5 +- .../shared/applications/_listing.html.slim | 158 ++++++++++-------- .../bulk_operations/change_plans.feature | 2 +- .../bulk_operations/change_states.feature | 6 +- .../applications/providers/managing.feature | 2 +- .../old/applications/providers/search.feature | 8 +- 7 files changed, 107 insertions(+), 95 deletions(-) diff --git a/app/assets/stylesheets/provider/_forms.scss b/app/assets/stylesheets/provider/_forms.scss index dc5d272cb8..1adb5a0436 100644 --- a/app/assets/stylesheets/provider/_forms.scss +++ b/app/assets/stylesheets/provider/_forms.scss @@ -57,7 +57,7 @@ textarea { } // TODO: where is this applied and why isn't it wrapper around form? -button:not(.pf-c-button, .pf-c-nav__link, .pf-c-dropdown__menu-item) { +button:not(.pf-c-button, .pf-c-nav__link, .pf-c-dropdown__menu-item, .pf-c-select__menu-item) { min-width: line-height-times(2); width: auto; } @@ -76,16 +76,15 @@ td.delta input[type='text'] { min-width: 0; } -th input[type='text'], -th select, -td input[type='text'], -td select { - //max-width: calc(100% - #{line-height-times(2)}); - min-width: line-height-times(4); - - &#search_month_number, - &#search_year { - width: calc(50% - #{line-height-times(2)}); +table tr.search { + th input[type='text'], + th select, + td input[type='text'], + td select { + &#search_month_number, + &#search_year { + width: 45%; + } } } diff --git a/app/helpers/column_sorting_helper.rb b/app/helpers/column_sorting_helper.rb index 4acf70f1df..a8c2c7fc68 100644 --- a/app/helpers/column_sorting_helper.rb +++ b/app/helpers/column_sorting_helper.rb @@ -31,12 +31,13 @@ def sortable(column, title = nil, path = :url_for) { :class => css_class } end - def th_sortable(column, title = nil, path = :url_for) + # This smells of :reek:DataClump but it is what it is + def th_sortable(column, title = nil, path = :url_for, opts: {}) title ||= column.titleize is_current_column = column.to_s == sort_column.to_s - th_class = "pf-c-table__sort#{is_current_column ? ' pf-m-selected' : ''}" + th_class = "pf-c-table__sort#{is_current_column ? ' pf-m-selected' : ''} #{opts[:class]}" icon_class = 'fas fa-arrows-alt-v' if is_current_column diff --git a/app/views/shared/applications/_listing.html.slim b/app/views/shared/applications/_listing.html.slim index 516af11e7d..d13e29fe03 100644 --- a/app/views/shared/applications/_listing.html.slim +++ b/app/views/shared/applications/_listing.html.slim @@ -20,89 +20,101 @@ div id="bulk-operations" style="display: none;" / FIXME: The first condition does not make any sense but application_plans used to be accessible_plans, now it's accessible_plans.stock - show_application_plans = application_plans.size > 0 && !master_on_premises? - service_column_visible = service.nil? && current_account.multiservice? +div class="pf-c-card" + table class="pf-c-table pf-m-grid-lg" role="grid" aria-label="Applications table" + thead + tr role="row" + td role="columnheader" scope="col" class="select pf-c-table__check" + label + = bulk_select_all + = th_sortable('cinstances.name', 'Name') + = th_sortable('cinstances.state', 'State') + - unless account + = th_sortable('accounts.org_name', 'Account') + - if service_column_visible + th role="columnheader" scope="col" + | Service + - if show_application_plans + = th_sortable('plans.name', 'Plan') + - if current_account.settings.finance.allowed? + th role="columnheader" scope="col" + | Paid? + = th_sortable('cinstances.created_at', 'Created on') + = th_sortable('cinstances.first_daily_traffic_at', 'Traffic on') + td + + - if applications.present? || account.nil? + tr role="row" class="search" + th class="select" + = form_for search, as: :search, url: search_path, html: { method: :get, class: :search } do |s| + th + = s.text_field :name, size: 15 -table class="data" - thead - tr - th class="select" = bulk_select_all - th = sortable('cinstances.name', 'Name') - th = sortable('cinstances.state', 'State') - - unless account - th = sortable('accounts.org_name', 'Account') - - if service_column_visible - th Service - - if show_application_plans - th = sortable('plans.name', 'Plan') - - if current_account.settings.finance.allowed? - th - ' Paid? + th + = s.select :state, states, include_blank: 'All', selected: search.state - th = sortable('cinstances.created_at', 'Created on') - th = sortable('cinstances.first_daily_traffic_at', 'Traffic on') + - unless account + th class="small" + = s.text_field :account_query, size: 7 - - if applications.present? || account.nil? - tr class="search" - th class="select" - = form_for search, as: :search, url: search_path, html: { method: :get, class: :search } do |s| - th - = s.text_field :name, size: 15 + - if service_column_visible + th + = s.collection_select :service_id, accessible_services, :id, :name, + { include_blank: true }, + { disabled: service } - th - = s.select :state, states, include_blank: 'All', selected: search.state + - if show_application_plans + - if service_column_visible + th = s.grouped_collection_select :plan_id, accessible_services, + :application_plans, :name, :id, :name, + { include_blank: true }, + { disabled: plan } + - else + th = s.collection_select :plan_id, application_plans, :id, :name, + { include_blank: true }, + { disabled: plan } - - unless account - th class="small" - = s.text_field :account_query, size: 7 + - if current_account.settings.finance.allowed? + th = s.select :plan_type, [ ['free'], ['paid'] ], {include_blank: true}, { disabled: plan } - - if service_column_visible th - = s.collection_select :service_id, accessible_services, :id, :name, - { include_blank: true }, - { disabled: service } + th + td class="pf-m-fit-content" + = s.button 'Search', name: nil, data: { disable_with: 'Searching...' }, class: 'pf-c-button pf-m-primary' + tbody role="rowgroup" class="cinstances" + - applications.each do |cinstance| + tr role="row" id=dom_id(cinstance) + td class="pf-c-table__check select" role="cell" id=cinstance.id + label + = bulk_select_one cinstance + td role="cell" data-label="Name" + = link_to cinstance.display_name, provider_admin_application_path(cinstance) + td role="cell" data-label="State" class="state" + => cinstance.state + - if cinstance.trial? + = remaining_trial_days(cinstance) + - unless account + td role="cell" data-label="Account" + = link_to_buyer_or_deleted cinstance.account, :admin_buyers_account_path + - if service_column_visible + td role="cell" data-label="Service" + = link_to_service cinstance.service - if show_application_plans - - if service_column_visible - th = s.grouped_collection_select :plan_id, accessible_services, - :application_plans, :name, :id, :name, - { include_blank: true }, - { disabled: plan } - - else - th = s.collection_select :plan_id, application_plans, :id, :name, - { include_blank: true }, - { disabled: plan } - + td role="cell" data-label="Plan" class="plan" + = link_to_plan_edit cinstance.plan - if current_account.settings.finance.allowed? - th = s.select :plan_type, [ ['free'], ['paid'] ], {include_blank: true}, { disabled: plan } - - th - th - th - = s.button 'Search', name: nil, data: { disable_with: 'Searching...' }, class: 'pf-c-button pf-m-primary' - - tbody class="cinstances" - - applications.each do |cinstance| - tr id=dom_id(cinstance) - td class="select" = bulk_select_one cinstance - td = link_to cinstance.display_name, provider_admin_application_path(cinstance) - td class="state" - => cinstance.state - - if cinstance.trial? - = remaining_trial_days(cinstance) - - unless account - td = link_to_buyer_or_deleted cinstance.account, :admin_buyers_account_path - - if service_column_visible - td = link_to_service cinstance.service - - if show_application_plans - td class="plan" = link_to_plan_edit cinstance.plan - - if current_account.settings.finance.allowed? - td class="free_or_paid" = plan_free_or_paid cinstance.plan - td = time_tag_with_title cinstance.created_at - td = last_traffic(cinstance) - td - - if applications.empty? - tr class="no_results" - td colspan=(service_column_visible ? 10 : 9) - | No applications + td role="cell" data-label="Paid?" class="free_or_paid" + = plan_free_or_paid cinstance.plan + td role="cell" data-label="Created on" + = time_tag_with_title cinstance.created_at + td role="cell" data-label="Traffic on" + = last_traffic(cinstance) + td + - if applications.empty? + tr class="no_results" + td colspan=(service_column_visible ? 10 : 9) + | No applications = will_paginate applications diff --git a/features/old/applications/providers/bulk_operations/change_plans.feature b/features/old/applications/providers/bulk_operations/change_plans.feature index f94e54d9d3..6c9137ed39 100644 --- a/features/old/applications/providers/bulk_operations/change_plans.feature +++ b/features/old/applications/providers/bulk_operations/change_plans.feature @@ -36,7 +36,7 @@ Feature: Bulk operations And close the colorbox When I follow "Name" Then I should see following table: - | Name ▲ | Plan | + | Name | Plan | | BobApp | Advanced | | JaneApp | Advanced | | MikeApp | Basic | diff --git a/features/old/applications/providers/bulk_operations/change_states.feature b/features/old/applications/providers/bulk_operations/change_states.feature index b10c18271b..313005d8cc 100644 --- a/features/old/applications/providers/bulk_operations/change_states.feature +++ b/features/old/applications/providers/bulk_operations/change_states.feature @@ -37,7 +37,7 @@ Feature: Bulk operations And I follow "Name" # there is no transision suspended => live Then I should see following table: - | Name ▲ | State | + | Name | State | | LiveApp | live | | PendingApp | live | | SuspendedApp | suspended | @@ -55,7 +55,7 @@ Feature: Bulk operations And I follow "Name" # pending cannot be changed to suspended Then I should see following table: - | Name ▲ | State | + | Name | State | | LiveApp | suspended | | PendingApp | pending | | SuspendedApp | suspended | @@ -73,7 +73,7 @@ Feature: Bulk operations And I follow "Name" # resume = suspended => live Then I should see following table: - | Name ▲ | State | + | Name | State | | LiveApp | live | | PendingApp | pending | | SuspendedApp | live | diff --git a/features/old/applications/providers/managing.feature b/features/old/applications/providers/managing.feature index 4d849bac82..d3070809c6 100644 --- a/features/old/applications/providers/managing.feature +++ b/features/old/applications/providers/managing.feature @@ -46,7 +46,7 @@ Feature: Applications management When I follow "2 Applications" And I follow "Name" Then I should see following table: - | Name ▲ | State | + | Name | State | | ComplicatedApp | live | | SimpleApp | live | diff --git a/features/old/applications/providers/search.feature b/features/old/applications/providers/search.feature index eafdc51ca9..66c054103a 100644 --- a/features/old/applications/providers/search.feature +++ b/features/old/applications/providers/search.feature @@ -30,7 +30,7 @@ Feature: Providers's applications searching, sorting and filtering | bob | Cheap | free | live | And I follow "Name" within table header Then I should see following table: - | Name ▲ | Account | + | Name | Account | | BobApp | bob | Scenario: Search scoped by service @@ -45,7 +45,7 @@ Feature: Providers's applications searching, sorting and filtering | bob | Cheap | free | live | And I follow "Name" within table header Then I should see following table: - | Name ▲ | Account | + | Name | Account | | BobApp | bob | Scenario: Listing @@ -59,7 +59,7 @@ Feature: Providers's applications searching, sorting and filtering | Cheap | And I follow "Account" within table header And I should see following table: - | Account ▲ | + | Account | | bob | | jane | @@ -69,7 +69,7 @@ Feature: Providers's applications searching, sorting and filtering | Name | Plan | Paid? | State | | bob | Cheap | free | live | And I follow "" within table header - Then I should see " ▲" + Then I should see "" Examples: | order by | From 346752e7e171b460301bacd43f6078591ba22e1f Mon Sep 17 00:00:00 2001 From: josemigallas Date: Wed, 28 Jun 2023 14:44:04 +0200 Subject: [PATCH 05/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20mapping=20rules=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../proxy_rules/_body_section.html.slim | 90 ++++++++++--------- .../mapping_rules_controller_test.rb | 4 +- 2 files changed, 50 insertions(+), 44 deletions(-) diff --git a/app/views/shared/proxy_rules/_body_section.html.slim b/app/views/shared/proxy_rules/_body_section.html.slim index 982bea6b05..47783d3925 100644 --- a/app/views/shared/proxy_rules/_body_section.html.slim +++ b/app/views/shared/proxy_rules/_body_section.html.slim @@ -1,44 +1,50 @@ -table#mapping_rules.data - thead - tr - th = sortable('proxy_rules.http_method', 'Verb') - th = sortable('proxy_rules.pattern', 'Pattern') - - if local_assigns[:include_redirect] - th Redirect - th title="increment" + - th = sortable('metrics.friendly_name', 'Metric or method') - th = sortable('proxy_rules.last', 'Last?') - th = sortable('proxy_rules.position', 'Position') - th - tr.search - = search_form do |s| - th - th colspan="3" - = s.text_field :query, size: 20, class: :query, placeholder: 'Search for pattern' - th colspan="4" - = s.button 'Search', name: 'commit', data: { disable_with: 'Searching...' }, class: 'pf-c-button pf-m-primary' - tbody - - proxy_rules.each do |rule| - tr - td.http_method - = rule.http_method - td.pattern - = rule.pattern - - if rule.pattern == '/' - span.fa.fa-exclamation-triangle.disabled#catch-all-warning title=(t('api.integrations.proxy.proxy_rule_catch_all_warning')) +div class="pf-c-card" + table id="mapping_rules" class="pf-c-table pf-m-grid-lg" role="grid" aria-label="Mapping rules table" + thead + tr role="row" + = th_sortable('proxy_rules.http_method', 'Verb') + = th_sortable('proxy_rules.pattern', 'Pattern') - if local_assigns[:include_redirect] - td.redirect_url - = rule.redirect_url - td.delta - = rule.delta - td.metric - = rule.metric.friendly_name - td.last_called_and_position - = rule.last - td.position - = rule.position - td.actions - = link_to '', proxy_rule_path_for(rule, edit: true), class: 'action edit' - = link_to '', proxy_rule_path_for(rule), class: 'action delete', data: {confirm: 'Are you sure?'}, method: :delete + td role="columnheader" scope="col" Redirect + td role="columnheader" scope="col" title="increment" + + = th_sortable('metrics.friendly_name', 'Metric or method') + = th_sortable('proxy_rules.last', 'Last?') + = th_sortable('proxy_rules.position', 'Position') + th + tr role="row" class="search" + = search_form do |s| + th + th colspan="3" + = s.text_field :query, size: 20, class: :query, placeholder: 'Search for pattern' + th colspan="4" + = s.button 'Search', name: 'commit', data: { disable_with: 'Searching...' }, class: 'pf-c-button pf-m-primary' + tbody role="rowgroup" + - proxy_rules.each do |rule| + tr role="row" + td role="cell" data-label="Verb" class="http_method" + = rule.http_method + td role="cell" data-label="Pattern" class="pattern" + = rule.pattern + - if rule.pattern == '/' + span.fa.fa-exclamation-triangle.disabled#catch-all-warning title=(t('api.integrations.proxy.proxy_rule_catch_all_warning')) + - if local_assigns[:include_redirect] + td role="cell" data-label="Redirect" class="redirect_url" + = rule.redirect_url + td role="cell" data-label="+" class="delta" + = rule.delta + td role="cell" data-label="Metric or method" class="metric" + = rule.metric.friendly_name + td role="cell" data-label="Last?" class="last_called_and_position" + = rule.last + td role="cell" data-label="Position" class="position" + = rule.position + td role="cell" class="pf-c-table__action" + div class="pf-c-overflow-menu" + div class="pf-c-overflow-menu__content" + div class="pf-c-overflow-menu__group pf-m-button-group" + div class="pf-c-overflow-menu__item" + = link_to '', proxy_rule_path_for(rule, edit: true), class: 'action edit' + div class="pf-c-overflow-menu__item" + = link_to '', proxy_rule_path_for(rule), class: 'action delete', data: {confirm: 'Are you sure?'}, method: :delete -= will_paginate(@proxy_rules) + = will_paginate(@proxy_rules) diff --git a/test/integration/provider/admin/backend_apis/mapping_rules_controller_test.rb b/test/integration/provider/admin/backend_apis/mapping_rules_controller_test.rb index a02dbd0ca7..ae6e727da8 100644 --- a/test/integration/provider/admin/backend_apis/mapping_rules_controller_test.rb +++ b/test/integration/provider/admin/backend_apis/mapping_rules_controller_test.rb @@ -18,8 +18,8 @@ class Provider::Admin::BackendApis::MappingRulesControllerTest < ActionDispatch: get provider_admin_backend_api_mapping_rules_path(backend_api) assert_response :success - assert_select 'table.data tr', count: @backend_api.mapping_rules.count+2 - @backend_api.mapping_rules.each { |rule| assert_select 'table.data tr td', text: rule.pattern } + assert_select 'table tr', count: @backend_api.mapping_rules.count+2 + @backend_api.mapping_rules.each { |rule| assert_select 'table tr td', text: rule.pattern } end test 'it cannot operate under non-accessible backend api' do From 73c2a8842c221b644b9f33d749a7a1353aba26a6 Mon Sep 17 00:00:00 2001 From: josemigallas Date: Wed, 28 Jun 2023 16:10:14 +0200 Subject: [PATCH 06/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20integration=20errors=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/stylesheets/provider/_forms.scss | 5 +++ .../stylesheets/provider/stats/_base.scss | 1 + app/javascript/packs/provider.scss | 1 + app/views/api/errors/index.html.erb | 42 ++++++++++--------- 4 files changed, 29 insertions(+), 20 deletions(-) diff --git a/app/assets/stylesheets/provider/_forms.scss b/app/assets/stylesheets/provider/_forms.scss index 1adb5a0436..0c0120bb0b 100644 --- a/app/assets/stylesheets/provider/_forms.scss +++ b/app/assets/stylesheets/provider/_forms.scss @@ -39,6 +39,11 @@ form.formtastic fieldset.inputs input[type='password'] { } } +// HACK: overrides form.button-to min height so that it fits pf-c-table +.pf-c-table form.button-to button.unset-min-height { + height: unset; +} + .error input[type='text'], .error textarea, .error select, diff --git a/app/assets/stylesheets/provider/stats/_base.scss b/app/assets/stylesheets/provider/stats/_base.scss index d60cd74e01..a953c43a14 100644 --- a/app/assets/stylesheets/provider/stats/_base.scss +++ b/app/assets/stylesheets/provider/stats/_base.scss @@ -262,6 +262,7 @@ $stats-chart-tooltip-color: $label-color; z-index: 9999 !important; } +// TODO: Remove when integration errors empty state implemented (https://issues.redhat.com/browse/THREESCALE-9808) div[id^="transaction_errors_container_"] { @include white-box-shadow; padding: line-height-times(1); diff --git a/app/javascript/packs/provider.scss b/app/javascript/packs/provider.scss index ca25f33752..47ff5dad61 100644 --- a/app/javascript/packs/provider.scss +++ b/app/javascript/packs/provider.scss @@ -13,3 +13,4 @@ @import '~@patternfly/patternfly/components/Table/table.css'; @import '~@patternfly/patternfly/components/OverflowMenu/overflow-menu.css'; @import '~@patternfly/patternfly/components/EmptyState/empty-state.css'; +@import '~@patternfly/patternfly/components/Card/card.css'; diff --git a/app/views/api/errors/index.html.erb b/app/views/api/errors/index.html.erb index f7bb296b02..264daac73d 100644 --- a/app/views/api/errors/index.html.erb +++ b/app/views/api/errors/index.html.erb @@ -8,28 +8,30 @@ documentation section on using 3scale's Service Management API. <% end %> -
- <% if @errors.empty? %> +<% if @errors.empty? %> +
<%= render :partial => 'no_errors' %> - <% else %> -
<%= fancy_button_to 'Purge', admin_service_errors_path(@service), - :method => :delete, :class => 'delete', :remote => true %>
- - - - - + +<% else %> +
Time (UTC)Error
+ + + + + - - + + <% @errors.each do |error| %> - - - + + + + <% end %> - -
Time (UTC)Error + <%= fancy_button_to 'Purge', admin_service_errors_path(@service), method: :delete, class: 'delete unset-min-height', remote: true %> +
<%= error.timestamp %><%= h error.message %>
<%= error.timestamp %><%= h error.message %>
- <%= will_paginate(@errors) %> - <% end %> -
+ + + <%= will_paginate(@errors) %> +<% end %> From 0bfb696ebaa7000820812b24fafd00bca61832ba Mon Sep 17 00:00:00 2001 From: josemigallas Date: Wed, 28 Jun 2023 16:21:31 +0200 Subject: [PATCH 07/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20backend=20usages=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/stylesheets/provider/_tables.scss | 2 +- app/views/api/backend_usages/index.html.slim | 34 +++++++++++-------- .../api/backend_usages_controller_test.rb | 2 +- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/app/assets/stylesheets/provider/_tables.scss b/app/assets/stylesheets/provider/_tables.scss index 4d8328967b..f653a04099 100644 --- a/app/assets/stylesheets/provider/_tables.scss +++ b/app/assets/stylesheets/provider/_tables.scss @@ -273,7 +273,7 @@ table#contracts_table tr td.thhead { padding-top: 0; } -table#backend_api_configs,table#mapping_rules { +table#mapping_rules { tr th a, tr td.actions a { display: inline-block; } diff --git a/app/views/api/backend_usages/index.html.slim b/app/views/api/backend_usages/index.html.slim index 2fb9bda5c6..10cbed97a5 100644 --- a/app/views/api/backend_usages/index.html.slim +++ b/app/views/api/backend_usages/index.html.slim @@ -5,25 +5,29 @@ - content_for :page_header_button_label, 'Add backend' - content_for :page_header_button_href, new_admin_service_backend_usage_path(@service) -table#backend_api_configs.data +table class="pf-c-table pf-m-grid-lg" role="grid" aria-label="Backends table" thead - tr - th = sortable('backend_apis.name', 'Name') - th = sortable('backend_apis.private_endpoint', 'Private base URL') - th - = sortable('backend_api_configs.path', 'Public path') - th - tbody + tr role="row" + = th_sortable('backend_apis.name', 'Name') + = th_sortable('backend_apis.private_endpoint', 'Private base URL') + = th_sortable('backend_api_configs.path', 'Public path') + td + tbody role="rowgroup" - @backend_api_configs.each do |config| - tr - td + tr role="row" + td role="cell" data-label="Name" = link_to config.backend_api.name, provider_admin_backend_api_path(config.backend_api) - td.pattern + td role="cell" data-label="Private Base URL" class="pattern" = config.backend_api.private_endpoint - td.position + td role="cell" data-label="Public path" class="position" = config.path - td.actions - = link_to '', edit_admin_service_backend_usage_path(@service, config), class: 'action edit' - = link_to '', admin_service_backend_usage_path(@service, config), class: 'action delete', data: {confirm: 'Are you sure?'}, method: :delete + td role="cell" class="pf-c-table__action actions" + div class="pf-c-overflow-menu" + div class="pf-c-overflow-menu__content" + div class="pf-c-overflow-menu__group pf-m-button-group" + div class="pf-c-overflow-menu__item" + = link_to '', edit_admin_service_backend_usage_path(@service, config), class: 'action edit' + div class="pf-c-overflow-menu__item" + = link_to '', admin_service_backend_usage_path(@service, config), class: 'action delete', data: {confirm: 'Are you sure?'}, method: :delete = will_paginate(@backend_api_configs) diff --git a/test/integration/api/backend_usages_controller_test.rb b/test/integration/api/backend_usages_controller_test.rb index bde6617e6c..2a95af7afd 100644 --- a/test/integration/api/backend_usages_controller_test.rb +++ b/test/integration/api/backend_usages_controller_test.rb @@ -20,7 +20,7 @@ class Api::BackendUsagesControllerTest < ActionDispatch::IntegrationTest service.backend_api_configs.create!(backend_api: backend_api, path: 'whatever') get admin_service_backend_usages_path(service) assert_response :success - assert_select 'table#backend_api_configs tbody tr', count: service.backend_apis.count + assert_select 'table[aria-label="Backends table"] tbody tr', count: service.backend_apis.count end test '#new' do From 9b97bf62f9d6379ec037df3b5dc26d5c8ad93628 Mon Sep 17 00:00:00 2001 From: josemigallas Date: Wed, 28 Jun 2023 16:37:30 +0200 Subject: [PATCH 08/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20finance=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../finance/provider/dashboards/show.html.erb | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/app/views/finance/provider/dashboards/show.html.erb b/app/views/finance/provider/dashboards/show.html.erb index a5ab07e0a8..6c9be0044f 100644 --- a/app/views/finance/provider/dashboards/show.html.erb +++ b/app/views/finance/provider/dashboards/show.html.erb @@ -1,35 +1,33 @@ <% title 'Earnings by Month' %> <% content_for :page_header_title, 'Earnings by Month' %> - +
- - - - - - + + + + + + <% @months.each do |row| %> - - - + + - - - From ac5d8c782af1b9e838e860435cdfc7545692d8b6 Mon Sep 17 00:00:00 2001 From: josemigallas Date: Wed, 28 Jun 2023 17:04:03 +0200 Subject: [PATCH 09/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20invoices=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../finance/provider/invoices/index.html.erb | 62 +++++++++---------- features/old/finance/invoices/listing.feature | 2 +- .../finance/invoicing_steps.rb | 2 +- 3 files changed, 31 insertions(+), 35 deletions(-) diff --git a/app/views/finance/provider/invoices/index.html.erb b/app/views/finance/provider/invoices/index.html.erb index 6f76a3c762..d96e85a2cb 100644 --- a/app/views/finance/provider/invoices/index.html.erb +++ b/app/views/finance/provider/invoices/index.html.erb @@ -5,53 +5,49 @@ <%- end -%> <% end %> -
MonthTotal - In process - Overdue - Paid -
MonthTotalIn processOverduePaid
<%= row.link_to_invoices %> +
+ <%= row.link_to_invoices %> + <%= row.total_revenue %> + <%= row.in_process_revenue %> + <%= row.overdue_revenue %> + <%= row.paid_revenue %>
+
- - - - - - - + + <%= th_sortable('friendly_id', 'Number', :admin_finance_invoices_path) %> + <%= th_sortable('accounts.org_name', 'Account', :admin_finance_invoices_path) %> + <%= th_sortable('period', 'Month', :admin_finance_invoices_path) %> + + <%= th_sortable('state', 'State', :admin_finance_invoices_path) %> + + - + + <%= form_for @search, :as => :search, :url => '', :html => { :method => :get, :class => :search } do |s| -%> - - - + + - - + + + <%- end -%> - - - <% @invoices.each do |invoice| %> - <%= content_tag_for(:tr, invoice) do %> - - - - - - - <% end %> + + + + + + <% end %> <% end %> <%- if @invoices.empty? -%> - + diff --git a/features/old/finance/invoices/listing.feature b/features/old/finance/invoices/listing.feature index 22ab9b2595..ab57c3031b 100644 --- a/features/old/finance/invoices/listing.feature +++ b/features/old/finance/invoices/listing.feature @@ -51,7 +51,7 @@ Feature: Provider lists all invoices And I follow "Account" within "table" Then I should see 10 invoices Then I should see the first invoice belonging to "foobar" - And I follow "Account ▲" within "table" + And I follow "Account" within "table" Then I should see 10 invoices Then I should see the first invoice belonging to "mastermind" diff --git a/features/step_definitions/finance/invoicing_steps.rb b/features/step_definitions/finance/invoicing_steps.rb index 63c8d0fb83..779240a48f 100644 --- a/features/step_definitions/finance/invoicing_steps.rb +++ b/features/step_definitions/finance/invoicing_steps.rb @@ -69,7 +69,7 @@ end Then(/^I should see the first invoice belonging to "([^"]*)"$/) do |buyer| - assert find(:xpath, '//table/tbody/tr[1]').text.include?(buyer) + assert has_css?('table tbody tr.invoice td[data-label="Account"]', text: buyer) end Then(/^I should have (\d+) invoices?$/) do |count| From 87f74409091afb35864b29ba9e8a6d7ea90d1bf3 Mon Sep 17 00:00:00 2001 From: josemigallas Date: Thu, 29 Jun 2023 08:21:39 +0200 Subject: [PATCH 10/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20drafts=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../provider/admin/cms/changes/index.html.erb | 47 +++++++++++-------- .../admin/cms/changes/publish_all.js.erb | 2 +- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/app/views/provider/admin/cms/changes/index.html.erb b/app/views/provider/admin/cms/changes/index.html.erb index 4374507855..863ded8ead 100644 --- a/app/views/provider/admin/cms/changes/index.html.erb +++ b/app/views/provider/admin/cms/changes/index.html.erb @@ -1,12 +1,12 @@ <% content_for :page_header_title, 'Drafts' %> -
<%= sortable('friendly_id', 'Number', :admin_finance_invoices_path) %><%= sortable('accounts.org_name', 'Account', :admin_finance_invoices_path) %><%= sortable('period', 'Month', :admin_finance_invoices_path) %>Cost<%= sortable('state', 'State', :admin_finance_invoices_path) %>Download
CostDownload
<%= link_to invoice.friendly_id, - admin_finance_invoice_path(invoice), - :title => "Show #{invoice.friendly_id}" -%><%= link_to_buyer_or_deleted(invoice.buyer, :admin_buyers_account_invoices_path) %><%= h invoice.name %><%= price_tag(invoice.cost) %><%= h invoice.state %> - <%= invoice_pdf_link(invoice, label: 'PDF') %> + <% @invoices.each do |invoice| %> + <%= content_tag_for(:tr, invoice, role: "row") do %> + + <%= link_to invoice.friendly_id, admin_finance_invoice_path(invoice), + title: "Show #{invoice.friendly_id}" %> <%= link_to_buyer_or_deleted(invoice.buyer, :admin_buyers_account_invoices_path) %><%= h invoice.name %><%= price_tag(invoice.cost) %><%= h invoice.state %><%= invoice_pdf_link(invoice, label: 'PDF') %>
No Invoices.
+
- - - - - + + + + - + <% @changed.each do |changed_model| %> - - - - + + + - - - <% end %> diff --git a/app/views/provider/admin/cms/changes/publish_all.js.erb b/app/views/provider/admin/cms/changes/publish_all.js.erb index 6ea59971ec..31197478bd 100644 --- a/app/views/provider/admin/cms/changes/publish_all.js.erb +++ b/app/views/provider/admin/cms/changes/publish_all.js.erb @@ -1,2 +1,2 @@ $.flash('All pending changes published.'); -$('table.data tr').fadeOut().remove(); \ No newline at end of file +$('table#cms-changes tbody tr').fadeOut().remove(); From d0c73e5fbf425c048f9fb17f1894c7f2144cac70 Mon Sep 17 00:00:00 2001 From: josemigallas Date: Thu, 29 Jun 2023 08:31:13 +0200 Subject: [PATCH 11/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20redirects=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/cms/redirects/index.html.erb | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/app/views/provider/admin/cms/redirects/index.html.erb b/app/views/provider/admin/cms/redirects/index.html.erb index 5cc69b6b58..78ea61f470 100644 --- a/app/views/provider/admin/cms/redirects/index.html.erb +++ b/app/views/provider/admin/cms/redirects/index.html.erb @@ -1,25 +1,32 @@ <% content_for :page_header_title, 'Redirects' %> -
TypeNamePath +
TypeNamePath <% if @changed.size > 1 %> <%= link_to 'Publish All', publish_all_provider_admin_cms_changes_path, :class => 'action', :"data-method" => :put, @@ -19,25 +19,32 @@
<%= changed_model.class.model_name.human %><%= link_to changed_model.name, polymorphic_path([ :edit, :provider, :admin, changed_model ] ) %> +
<%= changed_model.class.model_name.human %><%= link_to changed_model.name, polymorphic_path([ :edit, :provider, :admin, changed_model ] ) %> <% if changed_model.is_a?(CMS::BasePage) %> - <%= link_to(changed_model.path || '(builtin path)', cms_draft_url(changed_model), :target => '_blank') %> + <%= link_to(changed_model.path || '(builtin path)', cms_draft_url(changed_model), :target => '_blank') %> <% end %> - <%= link_to 'Revert', revert_provider_admin_cms_change_path(changed_model), - :class => 'action', :"data-method" => :put, :"data-remote" => true %> + +
+
+
+
+ <%= link_to 'Revert', revert_provider_admin_cms_change_path(changed_model), + :class => 'action', :"data-method" => :put, :"data-remote" => true %> +
+
+ <%= link_to 'Publish', publish_provider_admin_cms_change_path(changed_model), + :class => 'action', :"data-method" => :put, :"data-remote" => true %> +
+
+
+
- <%= link_to 'Publish', publish_provider_admin_cms_change_path(changed_model), - :class => 'action', :"data-method" => :put, :"data-remote" => true %> -
+
- - - - + + + - + <% @redirects.each do |redirect| %> - - - - - + + <% end %> From 243421bf75093a26fee18238f2aaf95a3a6d77e2 Mon Sep 17 00:00:00 2001 From: josemigallas Date: Thu, 29 Jun 2023 12:43:57 +0200 Subject: [PATCH 12/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20dev=20portal=20groups=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../provider/admin/cms/groups/index.html.erb | 39 ++++++++++++------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/app/views/provider/admin/cms/groups/index.html.erb b/app/views/provider/admin/cms/groups/index.html.erb index 53b98ba432..5bce44ac06 100644 --- a/app/views/provider/admin/cms/groups/index.html.erb +++ b/app/views/provider/admin/cms/groups/index.html.erb @@ -1,22 +1,33 @@ <% content_for :page_header_title, 'Groups' %> -
FromTo - <%= link_to 'Create Redirect', new_provider_admin_cms_redirect_path, :class => 'add action' %> +
FromTo + <%= link_to 'Create Redirect', new_provider_admin_cms_redirect_path, class: 'add action' %>
<%= link_to h(redirect.source), edit_provider_admin_cms_redirect_path(redirect) %><%= redirect.target %> - <%= fancy_link_to 'Delete', provider_admin_cms_redirect_path(redirect), :confirm => 'Are you sure?', :method => :delete %> -
<%= link_to h(redirect.source), edit_provider_admin_cms_redirect_path(redirect) %> + <%= redirect.target %> + +
+
+
+
+ <%= fancy_link_to 'Delete', provider_admin_cms_redirect_path(redirect), confirm: 'Are you sure?', method: :delete %> +
+
+
+
+
+
- - - - + + + + - <% @groups.each do |group| %> - <%= content_tag_for :tr, group do %> - - - + + <% @groups.each do |group| %> + <%= content_tag_for :tr, group, role: 'row' do %> + + + + <% end %> <% end %> - <% end %> +
NameAllowed Sections<%= link_to 'Create Group', new_provider_admin_cms_group_path, :class => 'add action' %>
NameAllowed Sections + <%= link_to 'Create Group', new_provider_admin_cms_group_path, class: 'add action' %> +
<%= link_to h(group.name), edit_provider_admin_cms_group_path(group) %><%= group.sections.map(&:title).join(", ") %> - <%= fancy_link_to 'Delete', provider_admin_cms_group_path(group), data: {:confirm => 'Are you sure?' } , :method => :delete %> -
<%= link_to h(group.name), edit_provider_admin_cms_group_path(group) %><%= group.sections.map(&:title).join(", ") %> +
+
+
+
+ <%= fancy_link_to 'Delete', provider_admin_cms_group_path(group), data: { :confirm => 'Are you sure?' }, method: :delete %> +
+
+
+
+
-
From 56f7344560485e935f8fb43a0651596873a37a9f Mon Sep 17 00:00:00 2001 From: josemigallas Date: Thu, 29 Jun 2023 14:09:01 +0200 Subject: [PATCH 13/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20visibility=20switches=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../provider/admin/cms/_switches.scss | 16 +--- .../admin/cms/switches/index.html.erb | 86 ++++++++++++------- .../admin/cms/switches_controller_test.rb | 2 +- 3 files changed, 58 insertions(+), 46 deletions(-) diff --git a/app/assets/stylesheets/provider/admin/cms/_switches.scss b/app/assets/stylesheets/provider/admin/cms/_switches.scss index 05ce707148..93352e0f0c 100644 --- a/app/assets/stylesheets/provider/admin/cms/_switches.scss +++ b/app/assets/stylesheets/provider/admin/cms/_switches.scss @@ -1,15 +1,3 @@ -hr#allowed-switches-delimiter { - color: $border-color; -} - -table#switches { - p { - margin: 0; - } -} - -.Switch { - &--inactive { - color: $disabled-color; - } +tr.switch-inactive { + --pf-c-table--cell--Color: $disabled-color; } diff --git a/app/views/provider/admin/cms/switches/index.html.erb b/app/views/provider/admin/cms/switches/index.html.erb index 9f7592e98d..453ac1d5c0 100644 --- a/app/views/provider/admin/cms/switches/index.html.erb +++ b/app/views/provider/admin/cms/switches/index.html.erb @@ -8,29 +8,43 @@ feature is hidden. <% end %> - +
- - - - + + + + + -<% @allowed.each do |name, switch| %> - - - - - -<% end %> + + <% @allowed.each do |name, switch| %> + + + + + + + <% end %> +
FeatureDescriptionState
FeatureDescriptionState
<%= t("switches.#{name}.name") %> - <%= t("switches.#{name}.description_html") %> - <%= t("switches.#{name}.visibility_details_html", default: '') %> - - <%= render 'switch_state', switch: switch %> - - <%= render 'switch_toggle', switch: switch %> -
+ <%= t("switches.#{name}.name") %> + + <%= t("switches.#{name}.description_html") %> + <%= t("switches.#{name}.visibility_details_html", default: '') %> + + <%= render 'switch_state', switch: switch %> + +
+
+
+
+ <%= render 'switch_toggle', switch: switch %> +
+
+
+
+

@@ -42,17 +56,27 @@

Yes, there are features that are currently disabled for your account but you can enable them by upgrading.

- - <% @denied.each do |name, switch| %> - - - - - - <% end %> +
<%= t("switches.#{name}.name") %><%= t("switches.#{name}.description_html") %> - <% if new_plan = current_account.first_plan_with_switch(switch.name) %> - <%= render '/admin/upgrade_notices/provider_upgrade_button', plan: new_plan %> - <% end %> -
+ + <% @denied.each do |name, switch| %> + + + + + + <% end %> +
<%= t("switches.#{name}.name") %><%= t("switches.#{name}.description_html") %> +
+
+
+
+ <% if new_plan = current_account.first_plan_with_switch(switch.name) %> + <%= render '/admin/upgrade_notices/provider_upgrade_button', plan: new_plan %> + <% end %> +
+
+
+
+
<% end %> diff --git a/test/integration/admin/cms/switches_controller_test.rb b/test/integration/admin/cms/switches_controller_test.rb index 51f577e0f1..23018de0b9 100644 --- a/test/integration/admin/cms/switches_controller_test.rb +++ b/test/integration/admin/cms/switches_controller_test.rb @@ -22,7 +22,7 @@ def setup get provider_admin_cms_switches_path assert_response :success assert_select '#switch-finance-toggle', true - assert_select %(table#switches th), text: 'Finance', count: 1 + assert_select %(table#switches tbody td[data-label="Feature"]), text: 'Finance', count: 1 end test 'update shows the hidden switch' do From f03f710f074786b6203bfceb37568817e590062c Mon Sep 17 00:00:00 2001 From: josemigallas Date: Fri, 30 Jun 2023 09:05:51 +0200 Subject: [PATCH 14/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20dev=20portal=20SSO=20integrations=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_authentication_provider.html.slim | 19 ------------ .../authentication_providers/index.html.slim | 29 ++++++++++++++----- ...uthentication_providers_controller_test.rb | 4 +-- 3 files changed, 24 insertions(+), 28 deletions(-) delete mode 100644 app/views/provider/admin/authentication_providers/_authentication_provider.html.slim diff --git a/app/views/provider/admin/authentication_providers/_authentication_provider.html.slim b/app/views/provider/admin/authentication_providers/_authentication_provider.html.slim deleted file mode 100644 index aa232659f7..0000000000 --- a/app/views/provider/admin/authentication_providers/_authentication_provider.html.slim +++ /dev/null @@ -1,19 +0,0 @@ -tr - td.provider - - link = "#{icon(authentication_provider.kind, fixed_width: true)} #{authentication_provider.human_kind}".html_safe - - url = authentication_provider.persisted? ? \ - provider_admin_authentication_provider_path(authentication_provider) : \ - new_provider_admin_authentication_provider_path(kind: authentication_provider.kind) - - if authentication_provider.in_iam_tools_scope? - = switch_link link, url, - switch: authentication_provider.authorization_scope, upgrade_notice: true - - elsif authentication_provider.in_social_scope? - = link_to link, url - - - if branding_relevant? - td - = authentication_provider.in_social_scope? ? authentication_provider.human_state_name : '-' - td - = authentication_provider.published ? 'Published' : 'Hidden' - - diff --git a/app/views/provider/admin/authentication_providers/index.html.slim b/app/views/provider/admin/authentication_providers/index.html.slim index 302cd12b88..af599a3449 100644 --- a/app/views/provider/admin/authentication_providers/index.html.slim +++ b/app/views/provider/admin/authentication_providers/index.html.slim @@ -3,12 +3,27 @@ - content_for :page_header_title, "Single Sign-on Integrations" -table.data +table class="pf-c-table pf-m-grid-lg" role="grid" aria-label="Authentication providers table" thead - tr - th Integration + tr role="row" + th role="columnheader" scope="col" Integration - if branding_relevant? - th Branding - th State - tbody - = render partial: 'authentication_provider', collection: @authentication_providers + th role="columnheader" scope="col" Branding + th role="columnheader" scope="col" State + tbody role="rowgroup" + - for authentication_provider in @authentication_providers + tr role="row" + td role="cell" data-label="Integration" class="provider" + - link = "#{icon(authentication_provider.kind, fixed_width: true)} #{authentication_provider.human_kind}".html_safe + - url = authentication_provider.persisted? ? \ + provider_admin_authentication_provider_path(authentication_provider) : \ + new_provider_admin_authentication_provider_path(kind: authentication_provider.kind) + - if authentication_provider.in_iam_tools_scope? + = switch_link link, url, switch: authentication_provider.authorization_scope, upgrade_notice: true + - elsif authentication_provider.in_social_scope? + = link_to link, url + - if branding_relevant? + td role="cell" data-label="Branding" + = authentication_provider.in_social_scope? ? authentication_provider.human_state_name : '-' + td role="cell" data-label="State" + = authentication_provider.published ? 'Published' : 'Hidden' diff --git a/test/integration/provider/admin/authentication_providers_controller_test.rb b/test/integration/provider/admin/authentication_providers_controller_test.rb index fcede5681c..a712ad0416 100644 --- a/test/integration/provider/admin/authentication_providers_controller_test.rb +++ b/test/integration/provider/admin/authentication_providers_controller_test.rb @@ -14,10 +14,10 @@ class Provider::Admin::AuthenticationProvidersControllerTest < ActionDispatch::I test 'GET index' do get provider_admin_authentication_providers_path assert_response :success - provider_rows = css_select 'table.data tbody tr' + provider_rows = css_select 'table tbody tr' assert_equal AuthenticationProvider.available.count, provider_rows.size AuthenticationProvider.available.each do |auth_provider| - assert_select 'table.data td.provider', count: 1, text: auth_provider.human_kind + assert_select 'table td.provider', count: 1, text: auth_provider.human_kind end end From 0e6999f66a2dc2d200ec011e6d30a28d89cedbcf Mon Sep 17 00:00:00 2001 From: josemigallas Date: Fri, 30 Jun 2023 09:10:29 +0200 Subject: [PATCH 15/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20account=20SSO=20Integrations=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_authentication_provider.html.slim | 13 -------- .../authentication_providers/index.html.slim | 31 +++++++++++++------ 2 files changed, 22 insertions(+), 22 deletions(-) delete mode 100644 app/views/provider/admin/account/authentication_providers/_authentication_provider.html.slim diff --git a/app/views/provider/admin/account/authentication_providers/_authentication_provider.html.slim b/app/views/provider/admin/account/authentication_providers/_authentication_provider.html.slim deleted file mode 100644 index 5874cb7130..0000000000 --- a/app/views/provider/admin/account/authentication_providers/_authentication_provider.html.slim +++ /dev/null @@ -1,13 +0,0 @@ -tr - td.provider - = link_to "#{icon(authentication_provider.kind, fixed_width: true)} #{authentication_provider.human_kind}".html_safe, provider_admin_account_authentication_provider_path(authentication_provider) - td - = authentication_provider.created_at.to_date.to_s(:long) - td - = authentication_provider.sso_authorizations.count - td - => authentication_provider.published ? 'Visible' : 'Hidden' - | ( - = Provider::Admin::Account::AuthenticationProvidersShowPresenter.new(authentication_provider).test_text_short - |) - td diff --git a/app/views/provider/admin/account/authentication_providers/index.html.slim b/app/views/provider/admin/account/authentication_providers/index.html.slim index 0b1df3b8dc..80710e8895 100644 --- a/app/views/provider/admin/account/authentication_providers/index.html.slim +++ b/app/views/provider/admin/account/authentication_providers/index.html.slim @@ -14,16 +14,29 @@ p.Hint In order to edit active Single Sign-On integrations, first disable SSO enforcement. - else button.EnforceSSOButton.is-hidden.important-button.dangerous-button type="submit" yes, terminate current password-based sessions and disable password-based sign-ins for all users including myself -table.data + +table class="pf-c-table pf-m-grid-lg" role="grid" aria-label="Authentication providers table" thead - tr - th Integration - th Created on - th Number of users - th State - th class="actions" + tr role="row" + th role="columnheader" scope="col" Integration + th role="columnheader" scope="col" Created on + th role="columnheader" scope="col" Number of users + th role="columnheader" scope="col" State + th role="columnheader" scope="col" class="pf-c-table__action actions pf-m-fit-content" = link_to 'New SSO Integration', new_provider_admin_account_authentication_provider_path, title: 'Add a new Single sign-on provider', class: 'action add' - tbody - = render partial: 'authentication_provider', collection: @presenter.authentication_providers + tbody role="rowgroup" + - for authentication_provider in @presenter.authentication_providers + tr role="row" + td role="cell" data-label="Integration" class="provider" + = link_to "#{icon(authentication_provider.kind, fixed_width: true)} #{authentication_provider.human_kind}".html_safe, provider_admin_account_authentication_provider_path(authentication_provider) + td role="cell" data-label="Created on" + = authentication_provider.created_at.to_date.to_s(:long) + td role="cell" data-label="Number of users" + = authentication_provider.sso_authorizations.count + td role="cell" data-label="State" + - test = Provider::Admin::Account::AuthenticationProvidersShowPresenter.new(authentication_provider).test_text_short + = "#{authentication_provider.published ? 'Visible' : 'Hidden'} (#{test})" + td + From 5102d1a1aaafcbb7048bd0ef3d9420555a03e69c Mon Sep 17 00:00:00 2001 From: josemigallas Date: Fri, 30 Jun 2023 09:51:59 +0200 Subject: [PATCH 16/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20inbox=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/messages/inbox/index.html.slim | 41 +++++++++++-------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/app/views/provider/admin/messages/inbox/index.html.slim b/app/views/provider/admin/messages/inbox/index.html.slim index 17ba55e382..77522a484c 100644 --- a/app/views/provider/admin/messages/inbox/index.html.slim +++ b/app/views/provider/admin/messages/inbox/index.html.slim @@ -2,28 +2,37 @@ = render 'provider/admin/messages/bulk_operations', scope: :received_messages, messages: @messages -table#messages.data +table class="pf-c-table pf-m-grid-lg" role="grid" aria-label="Messages table" id="messages" thead - tr - th.select= bulk_select_all - th Subject - th From - th Date Sent - th.operations + tr role="row" + td role="columnheader" scope="col" class="select pf-c-table__check" + label + = bulk_select_all + th role="columnheader" scope="col" Subject + th role="columnheader" scope="col" From + th role="columnheader" scope="col" Date Sent + th role="columnheader" scope="col" class="pf-c-table__action pf-m-fit-content" = link_to 'Compose Message', new_provider_admin_messages_outbox_path, class: "action new" - tbody + tbody role="rowgroup" - if @messages.blank? - tr - td colspan="5" + tr role="row" + td role="cell" colspan="5" = t('provider.admin.messages.no_received_messages') - else - @messages.each do |message| - tr class=(message.state) id="message_#{message.id}" - td.select= bulk_select_one message - td = link_to message_subject(message), provider_admin_messages_inbox_path(message) - td = message_sender(message) - td = message.created_at.to_s(:long) - td.operations = delete_button_for provider_admin_messages_inbox_path(message), class: 'action' + tr role="row" class=message.state id="message_#{message.id}" + td class="pf-c-table__check select" role="cell" id=message.id + label + = bulk_select_one message + td role="cell" data-label="Subject" = link_to message_subject(message), provider_admin_messages_inbox_path(message) + td role="cell" data-label="From" = message_sender(message) + td role="cell" data-label="Date Sent" = message.created_at.to_s(:long) + td role="cell" class="pf-c-table__action" + div class="pf-c-overflow-menu" + div class="pf-c-overflow-menu__content" + div class="pf-c-overflow-menu__group pf-m-button-group" + div class="pf-c-overflow-menu__item" + = delete_button_for provider_admin_messages_inbox_path(message), class: 'action' = will_paginate(@messages) = link_to_export_widget_for('Messages') if can?(:export, :data) From 8013b4a2caeec6417fd21c6a801cda5559b0bec1 Mon Sep 17 00:00:00 2001 From: josemigallas Date: Fri, 30 Jun 2023 10:04:12 +0200 Subject: [PATCH 17/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20messages=20outbox=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/messages/outbox/index.html.slim | 46 ++++++++++++------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/app/views/provider/admin/messages/outbox/index.html.slim b/app/views/provider/admin/messages/outbox/index.html.slim index 5f67b45d90..753e4608fe 100644 --- a/app/views/provider/admin/messages/outbox/index.html.slim +++ b/app/views/provider/admin/messages/outbox/index.html.slim @@ -6,22 +6,34 @@ - else = render 'provider/admin/messages/bulk_operations', scope: :messages, messages: @messages - table.data#messages - thead - tr - th.select= bulk_select_all - th Subject - th To - th Date Sent - th.operations - = link_to 'Compose Message', new_provider_admin_messages_outbox_path, class: "action new" - tbody - - @messages.each do |message| - tr id="message_#{message.id}" - td.select= bulk_select_one message - td = link_to message_subject(message), provider_admin_messages_outbox_path(message) - td = message_receiver(message) - td = message.created_at.to_s(:long) - td.operations = delete_button_for provider_admin_messages_outbox_path(message), class: 'action' +table class="pf-c-table pf-m-grid-lg" role="grid" aria-label="Sent messages table" id="messages" + thead + tr role="row" + td role="columnheader" scope="col" class="select pf-c-table__check" + label + = bulk_select_all + th role="columnheader" scope="col" Subject + th role="columnheader" scope="col" From + th role="columnheader" scope="col" Date Sent + th role="columnheader" scope="col" class="pf-c-table__action pf-m-fit-content" + = link_to 'Compose Message', new_provider_admin_messages_outbox_path, class: "action new" + tbody role="rowgroup" + - @messages.each do |message| + tr role="row" id="message_#{message.id}" + td class="pf-c-table__check select" role="cell" id=message.id + label + = bulk_select_one message + td role="cell" data-label="Subject" + = link_to message_subject(message), provider_admin_messages_outbox_path(message) + td role="cell" data-label="From" + = message_receiver(message) + td role="cell" data-label="Data Sent" + = message.created_at.to_s(:long) + td role="cell" class="pf-c-table__action" + div class="pf-c-overflow-menu" + div class="pf-c-overflow-menu__content" + div class="pf-c-overflow-menu__group pf-m-button-group" + div class="pf-c-overflow-menu__item" + = delete_button_for provider_admin_messages_outbox_path(message), class: 'action' = will_paginate(@messages) From c4746e980ea292037ada82569b831b3db1812243 Mon Sep 17 00:00:00 2001 From: josemigallas Date: Fri, 30 Jun 2023 10:57:41 +0200 Subject: [PATCH 18/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20messages=20trash=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/messages/trash/index.html.slim | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/app/views/provider/admin/messages/trash/index.html.slim b/app/views/provider/admin/messages/trash/index.html.slim index 87bd619185..cd2a52f63c 100644 --- a/app/views/provider/admin/messages/trash/index.html.slim +++ b/app/views/provider/admin/messages/trash/index.html.slim @@ -8,20 +8,24 @@ // the whole explanation: https://github.com/3scale/system/issues/6275 //.operations // = fancy_button_to 'Empty the trash', empty_provider_admin_messages_trash_index_path, method: :delete, class: 'empty_trash' - table#messages.data + table class="pf-c-table pf-m-grid-lg" role="grid" id="messages" thead - tr - th Subject - th From - th Date sent + tr role="row" + th role="columnheader" scope="col" Subject + th role="columnheader" scope="col" From + th role="columnheader" scope="col" Date sent th - - tbody + tbody role="rowgroup" - @messages.each do |message| - tr class=cycle('odd', 'even', name: 'messages') - td = link_to message.subject, provider_admin_messages_trash_path(message) - td = link_to message_sender(message), provider_admin_messages_trash_path(message) - td = message.created_at.to_s(:long) - td.operations = fancy_button_to 'Restore', provider_admin_messages_trash_path(message), :method => :delete, :class => 'undelete action' + tr role="row" class=cycle('odd', 'even', name: 'messages') + td role="cell" data-label="Subject" = link_to message.subject, provider_admin_messages_trash_path(message) + td role="cell" data-label="From" = link_to message_sender(message), provider_admin_messages_trash_path(message) + td role="cell" data-label="Data sent" = message.created_at.to_s(:long) + td role="cell" class="pf-c-table__action" + div class="pf-c-overflow-menu" + div class="pf-c-overflow-menu__content" + div class="pf-c-overflow-menu__group pf-m-button-group" + div class="pf-c-overflow-menu__item" + = fancy_button_to 'Restore', provider_admin_messages_trash_path(message), method: :delete, class: 'undelete action' = will_paginate(@messages) From 91929bab8d868d21b19de2d4a56f91a928c8c86a Mon Sep 17 00:00:00 2001 From: josemigallas Date: Fri, 30 Jun 2023 11:28:28 +0200 Subject: [PATCH 19/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20email=20tempaltes=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/cms/email_templates/index.html.erb | 39 +++++++++++-------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/app/views/provider/admin/cms/email_templates/index.html.erb b/app/views/provider/admin/cms/email_templates/index.html.erb index 3a707fb3be..5c3e789b17 100644 --- a/app/views/provider/admin/cms/email_templates/index.html.erb +++ b/app/views/provider/admin/cms/email_templates/index.html.erb @@ -4,26 +4,33 @@ <% content_for :page_header_title, 'Email Templates' %> - +
- - - - - + + + + - + <% @defaults.each do |template| %> - - - - + + + <% end %> From c2bf5e322d97ccc6c5e2466e333dfed8e584c6f1 Mon Sep 17 00:00:00 2001 From: josemigallas Date: Fri, 30 Jun 2023 13:27:05 +0200 Subject: [PATCH 20/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20configuration=20history=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/api/proxy_configs/index.html.slim | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/views/api/proxy_configs/index.html.slim b/app/views/api/proxy_configs/index.html.slim index d94491694d..6f8928e6b3 100644 --- a/app/views/api/proxy_configs/index.html.slim +++ b/app/views/api/proxy_configs/index.html.slim @@ -1,19 +1,19 @@ - content_for :page_header_title, 'Configuration History' -table class="data" +table class="pf-c-table pf-m-grid-lg" role="grid" aria-label="Configuration history table" thead - tr - th Configuration file - th Version - th Date - th Configured by + tr role="row" + th role="columnheader" scope="col" Configuration file + th role="columnheader" scope="col" Version + th role="columnheader" scope="col" Date + th role="columnheader" scope="col" Configured by tbody - @proxy_configs.each do |proxy_config| - tr - td = link_to proxy_config.filename, admin_service_proxy_config_path(@service, proxy_config.id) - td = proxy_config.version - td = proxy_config.created_at - td = proxy_config.user_display_name + tr role="row" + td role="cell" data-label="Configuration file" = link_to proxy_config.filename, admin_service_proxy_config_path(@service, proxy_config.id) + td role="cell" data-label="Version" = proxy_config.version + td role="cell" data-label="Date" = proxy_config.created_at + td role="cell" data-label="Configured by" = proxy_config.user_display_name = will_paginate(@proxy_configs) From bc4da9aa7494ef7f1972aa85adafb22d47e94df5 Mon Sep 17 00:00:00 2001 From: josemigallas Date: Fri, 30 Jun 2023 15:58:06 +0200 Subject: [PATCH 21/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20account=20users=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/account/users/index.html.slim | 85 ++++++++++--------- 1 file changed, 44 insertions(+), 41 deletions(-) diff --git a/app/views/provider/admin/account/users/index.html.slim b/app/views/provider/admin/account/users/index.html.slim index f0069329e1..1e47e0d12d 100644 --- a/app/views/provider/admin/account/users/index.html.slim +++ b/app/views/provider/admin/account/users/index.html.slim @@ -1,63 +1,66 @@ - content_for :page_header_title, 'Users' -table class="data" id="users" +table class="pf-c-table pf-m-grid-lg" role="grid" aria-label="Users table" id="users" thead - tr - th Name - th = current_user.field_label("email") + tr role="row" + th role="columnheader" scope="col" Name + th role="columnheader" scope="col" + = current_user.field_label("email") - if show_provider_sso_status_for_user? - th - ' Authenticated through SSO - th Role + th role="columnheader" scope="col" Authenticated through SSO + th role="columnheader" scope="col" Role - if can?(:manage, :permissions) - th Permission Groups - th.operations colspan="2" + th role="columnheader" scope="col" Permission Groups + th role="columnheader" scope="col" class="pf-c-table__action pf-m-fit-content" - if can?(:create, Invitation) and can?(:see, :multiple_users) - = link_to_unless_current 'Invite a New User', - new_provider_admin_account_invitation_path, - class: 'action add' + = link_to_unless_current 'Invite a New User', new_provider_admin_account_invitation_path, + class: 'action add' - tbody + tbody role="rowgroup" - @users.each do |user| - tr id=(dom_id(user)) - td + tr role="row" id=(dom_id(user)) + td role="cell" data-label="Name" - if can? :manage, user - if current_user == user - = link_to user.display_name, - edit_provider_admin_user_personal_details_path(origin: 'users'), - title: 'Personal Details' + = link_to user.display_name, edit_provider_admin_user_personal_details_path(origin: 'users'), + title: 'Personal Details' - else - = link_to user.display_name, - edit_provider_admin_account_user_path(user), - title: 'Edit' + = link_to user.display_name, edit_provider_admin_account_user_path(user), + title: 'Edit' - else = user.username - td = user.email + td role="cell" data-label="Email" + = user.email - if show_provider_sso_status_for_user? - td + td role="cell" data-label="Authenticated through SSO" = user.sso_authorizations.exists? ? 'yes' : 'not yet' - td = user.role - + td role="cell" data-label="Role" + = user.role - if can?(:manage, :permissions) - td + td role="cell" data-label="Permission Groups" - if user.admin? | Unlimited Access - else = permission_groups_summary(user) - - td.operations - - if can? :destroy, user - = fancy_button_to 'Delete', provider_admin_account_user_path(user), - class: 'action delete', method: :delete, - data: { confirm: "Are you sure you want to delete this user?" } - td.operations - - if can? :manage, user - - if current_user == user - = link_to 'Personal Details', - edit_provider_admin_user_personal_details_path(origin: 'users'), - title: 'Personal Details', class: 'action edit' - - else - = link_to 'Edit', edit_provider_admin_account_user_path(user), - title: 'Edit', class: 'action edit' + td role="cell" class="pf-c-table__action" + div class="pf-c-overflow-menu" + div class="pf-c-overflow-menu__content" + div class="pf-c-overflow-menu__group pf-m-button-group" + - if can? :destroy, user + div class="pf-c-overflow-menu__item" + = fancy_button_to 'Delete', provider_admin_account_user_path(user), + class: 'action delete', + method: :delete, + data: { confirm: "Are you sure you want to delete this user?" } + - if can? :manage, user + div class="pf-c-overflow-menu__item" + - if current_user == user + = link_to 'Personal Details', edit_provider_admin_user_personal_details_path(origin: 'users'), + title: 'Personal Details', + class: 'action edit' + - else + = link_to 'Edit', edit_provider_admin_account_user_path(user), + title: 'Edit', + class: 'action edit' = will_paginate @users From 3e8212809d2a20500e129d601ffd8e36692f6b68 Mon Sep 17 00:00:00 2001 From: josemigallas Date: Fri, 30 Jun 2023 16:05:23 +0200 Subject: [PATCH 22/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20users=20invitations=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/account/invitations/index.html.erb | 55 +++++++++++-------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/app/views/provider/admin/account/invitations/index.html.erb b/app/views/provider/admin/account/invitations/index.html.erb index 96cfabc354..7696612e78 100644 --- a/app/views/provider/admin/account/invitations/index.html.erb +++ b/app/views/provider/admin/account/invitations/index.html.erb @@ -1,37 +1,44 @@ <% content_for :page_header_title, 'Invitations' %> -
NameDescription
NameDescription
<%= template.name %><%= template.description %> - <% if template.new_record? %> - <%= link_to 'Override', new_provider_admin_cms_email_template_path(system_name: template.system_name), title: template.name, class: 'less-important-button' %> - <% else %> - <%= link_to 'Edit', edit_provider_admin_cms_email_template_path(template), title: template.name, class: 'important-button'%> - <% end %> +
<%= template.name %><%= template.description %> +
+
+
+
+ <% if template.new_record? %> + <%= link_to 'Override', new_provider_admin_cms_email_template_path(system_name: template.system_name), title: template.name, class: 'pf-c-button pf-m-secondary' %> + <% else %> + <%= link_to 'Edit', edit_provider_admin_cms_email_template_path(template), title: template.name, class: 'pf-c-button pf-m-primary'%> + <% end %> +
+
+
+
+
- - - - - + + + + - + <% @invitations.each do |invitation| %> - - - - - - - + + + + <% end %> From ff580c58f37f737530d1bcddfb1df853aff8d28c Mon Sep 17 00:00:00 2001 From: josemigallas Date: Fri, 30 Jun 2023 16:13:48 +0200 Subject: [PATCH 23/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20account=20users=20invitations=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/buyers/invitations/index.html.erb | 51 ++++++++++++--------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/app/views/buyers/invitations/index.html.erb b/app/views/buyers/invitations/index.html.erb index 85cfdb88b3..a6721eb3da 100644 --- a/app/views/buyers/invitations/index.html.erb +++ b/app/views/buyers/invitations/index.html.erb @@ -4,13 +4,13 @@ <% content_for :page_header_title, "Sent invitations for #{@account.org_name}" %> -
RecipientSentAccepted? +
RecipientSentAccepted? <% if can?(:create, Invitation) and can?(:see, :multiple_users) %> <%= link_to_unless_current 'Invite a New Team Member', new_provider_admin_account_invitation_path, :class => 'action add' %> - <% end %> + <% end %>
<%= h invitation.email %><%= invitation_sent_date(invitation) %><%= invitation_status(invitation) %> - <% if can? :manage, invitation %> - <% unless invitation.accepted? -%> - <%= fancy_link_to("Resend", resend_provider_admin_account_invitation_path(invitation), {:method => :put, :class => 'refresh', "data-id" => invitation.id}) %> - <% end -%> - <% end -%> - - <% if can? :manage, invitation %> - <%= delete_link_for provider_admin_account_invitation_path(invitation), data: { confirm: 'Are you sure you want to delete this invitation?' } %> - <% end %> +
<%= h invitation.email %><%= invitation_sent_date(invitation) %><%= invitation_status(invitation) %> +
+
+
+ <% if can? :manage, invitation %> +
+ <% unless invitation.accepted? -%> + <%= fancy_link_to("Resend", resend_provider_admin_account_invitation_path(invitation), {:method => :put, :class => 'refresh', "data-id" => invitation.id}) %> + <% end -%> +
+ <% end -%> + <% if can? :manage, invitation %> +
+ <%= delete_link_for provider_admin_account_invitation_path(invitation), data: { confirm: 'Are you sure you want to delete this invitation?' } %> +
+ <% end %> +
+
+
+
- - - - - + + + + - + <% @invitations.each do |invitation| %> - - - - - + + + + <% end %> From 1c1c77ac9f5b79425360d8b62d1ce397c460b463 Mon Sep 17 00:00:00 2001 From: josemigallas Date: Mon, 3 Jul 2023 09:28:51 +0200 Subject: [PATCH 24/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20account=20invoices=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/buyers/invoices/index.html.erb | 28 ++++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/app/views/buyers/invoices/index.html.erb b/app/views/buyers/invoices/index.html.erb index e7c6d75d77..5b913ebec3 100644 --- a/app/views/buyers/invoices/index.html.erb +++ b/app/views/buyers/invoices/index.html.erb @@ -4,15 +4,15 @@ <% content_for :page_header_title, "Invoices for #{@account.org_name}" %> -
RecipientSentAccepted? +
RecipientSentAccepted? <% if can? :create, Invitation %> <%= link_to_unless_current 'Invite user', new_admin_buyers_account_invitation_path(@account), :class => 'action add' %> <% end %> @@ -18,22 +18,31 @@
<%= h invitation.email %><%= invitation_sent_date(invitation) %><%= invitation_status(invitation) %> - <% if can? :manage, invitation %> - <% unless invitation.accepted? -%> - <%= fancy_link_to('Resend', resend_admin_buyers_account_invitation_path(invitation.account,invitation), { :class => "refresh", :id => "resend-invitation-#{invitation.id}", :method => :put }) %> - <% end -%> - <% end %> - - <% if can? :manage, invitation %> - <%= delete_link_for admin_buyers_account_invitation_path(invitation.account, invitation), data: { disable_with: 'Deleting…', confirm: 'Are you sure you want to delete this invitation?' } %> - <% end %> +
<%= h invitation.email %><%= invitation_sent_date(invitation) %><%= invitation_status(invitation) %> +
+
+
+ <% if can? :manage, invitation %> + <% unless invitation.accepted? -%> +
+ <%= fancy_link_to('Resend', resend_admin_buyers_account_invitation_path(invitation.account,invitation), { :class => "refresh", :id => "resend-invitation-#{invitation.id}", :method => :put }) %> +
+ <% end -%> + <% end %> + <% if can? :manage, invitation %> +
+ <%= delete_link_for admin_buyers_account_invitation_path(invitation.account, invitation), data: { disable_with: 'Deleting…', confirm: 'Are you sure you want to delete this invitation?' } %> +
+ <% end %> +
+
+
+
- - - - - - - + + + + + + <% @invoices.each do |invoice| %> - <%= content_tag_for(:tr, invoice) do %> - - - - - + + + + <% end %> From de106b5cd0586c040ed2675b79d8b94b1168ca7b Mon Sep 17 00:00:00 2001 From: josemigallas Date: Tue, 4 Jul 2023 11:31:51 +0200 Subject: [PATCH 25/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20provider=20invoices=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/account/invoices/index.html.erb | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/app/views/provider/admin/account/invoices/index.html.erb b/app/views/provider/admin/account/invoices/index.html.erb index 09ad75d26d..a913eea2e1 100644 --- a/app/views/provider/admin/account/invoices/index.html.erb +++ b/app/views/provider/admin/account/invoices/index.html.erb @@ -3,33 +3,33 @@ <% if @invoices.blank?%> You have no invoices <% else %> -
IDMonthStateAmountDownload +
IDMonthStateAmountDownload <%= fancy_link_to('Create invoice', admin_buyers_account_invoices_path(@account), :method => :post, :class => 'new', :disabled => create_invoice_disabled(@account)) -%> @@ -21,12 +21,12 @@
<%= link_to invoice.friendly_id , admin_buyers_or_account_invoice_path(invoice) , :title => "Show #{invoice.friendly_id}" %><%= invoice.name %><%= h invoice.state %><%= price_tag(invoice.cost) %> + <%= content_tag_for(:tr, invoice, role: 'row') do %> + <%= link_to invoice.friendly_id , admin_buyers_or_account_invoice_path(invoice) , title: "Show #{invoice.friendly_id}" %><%= invoice.name %><%= h invoice.state %><%= price_tag(invoice.cost) %> <%= invoice_pdf_link(invoice, label: 'PDF') %>
+
- - - - - - + + + + + + - + <% @invoices.each do |invoice| %> - <%= content_tag_for(:tr, invoice) do %> - - - - - <% end %> From 087cb1edd47a672432a51d7ccc1ba20334a7f250 Mon Sep 17 00:00:00 2001 From: josemigallas Date: Mon, 3 Jul 2023 15:37:25 +0200 Subject: [PATCH 26/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20invoice=20show?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/stylesheets/provider/_finance.scss | 36 ----- .../stylesheets/provider/_invoices.scss | 12 -- app/helpers/finance/invoices_helper.rb | 17 --- app/javascript/packs/provider.scss | 2 + app/views/buyers/invoices/index.html.erb | 14 +- app/views/buyers/invoices/show.html.erb | 13 +- .../provider/invoices/_actions.html.erb | 16 +- .../finance/provider/invoices/show.html.erb | 12 +- .../provider/shared/_invoice_address.html.erb | 17 --- .../shared/_invoice_address_card.html.slim | 35 +++++ .../provider/shared/_invoice_header.html.erb | 78 +++++----- .../provider/shared/_invoice_item.slim | 9 ++ .../provider/shared/_line_item.html.erb | 33 +++-- .../provider/shared/_line_items.html.erb | 140 +++++++++--------- .../shared/_payment_transaction.html.erb | 12 +- .../shared/_payment_transactions.html.erb | 50 ++++--- .../admin/account/invoices/show.html.erb | 10 +- .../finance/invoicing_steps.rb | 8 +- .../buyers/invoices_controller_test.rb | 2 +- 19 files changed, 263 insertions(+), 253 deletions(-) delete mode 100644 app/views/finance/provider/shared/_invoice_address.html.erb create mode 100644 app/views/finance/provider/shared/_invoice_address_card.html.slim create mode 100644 app/views/finance/provider/shared/_invoice_item.slim diff --git a/app/assets/stylesheets/provider/_finance.scss b/app/assets/stylesheets/provider/_finance.scss index 3dd61b0869..ded91985fe 100644 --- a/app/assets/stylesheets/provider/_finance.scss +++ b/app/assets/stylesheets/provider/_finance.scss @@ -1,39 +1,3 @@ -table.invoice, -table.finance_data { - @include white-box-shadow; - border-collapse: collapse; - color: $font-color; - margin-bottom: line-height-times(1); - width: 100%; -} - -table.invoice thead, -table.finance_data thead { - border-top: $border-width solid $border-color; - background-color: $light-background-color; -} - -table.invoice tr td, -table.invoice tr th { - border-bottom: 1px solid $border-color; - padding: line-height-times(1); - word-break: normal; -} - -table.finance_data tbody tr td { - padding: line-height-times(1); -} - -table.invoice caption, -table.finance_data caption { - background-color: $light-background-color; - border-bottom: 0; - box-shadow: $whiteBoxShadow; - font-weight: $font-weight-bold; - padding: line-height-times(1); - text-align: left; -} - #actions form.button-to.remote { @include white-box-shadow; display: block; diff --git a/app/assets/stylesheets/provider/_invoices.scss b/app/assets/stylesheets/provider/_invoices.scss index 95495f578d..d7fee7efcf 100644 --- a/app/assets/stylesheets/provider/_invoices.scss +++ b/app/assets/stylesheets/provider/_invoices.scss @@ -1,15 +1,3 @@ -table.invoice tr th { - width: 50%; -} - -#buyer_details, #provider_details { - display: float; - width: 48%; -} - -#buyer_details { float: right; } -#provider_details { float: left; } - #actions { text-align: center; margin-bottom: line-height-times(1); diff --git a/app/helpers/finance/invoices_helper.rb b/app/helpers/finance/invoices_helper.rb index 388df60842..207e553014 100644 --- a/app/helpers/finance/invoices_helper.rb +++ b/app/helpers/finance/invoices_helper.rb @@ -22,23 +22,6 @@ def account_header_optional_field(name, account) end end - - def invoice_field(name, value, action = nil, options = {}) - title = case name - when Symbol - Invoice.human_attribute_name(name) - else - name - end - - content_tag :tr do - row = content_tag(:th, title) - row += content_tag(:td, value, :id => "field-#{name.to_s.downcase}") - row += content_tag(:td, action) - row - end - end - def current_invoice_link(buyer) link_to 'Current invoice', admin_finance_account_invoice_path(buyer, buyer.current_invoice.to_param), diff --git a/app/javascript/packs/provider.scss b/app/javascript/packs/provider.scss index 47ff5dad61..d2ccd8f29d 100644 --- a/app/javascript/packs/provider.scss +++ b/app/javascript/packs/provider.scss @@ -7,6 +7,7 @@ // Patternfly Layouts @import '~@patternfly/patternfly/layouts/Level/level.css'; @import '~@patternfly/patternfly/layouts/Flex/flex.css'; +@import '~@patternfly/patternfly/layouts/Grid/grid.css'; // Patternfly components - Add everything not covered by React. @import '~@patternfly/patternfly/components/Content/content.css'; @@ -14,3 +15,4 @@ @import '~@patternfly/patternfly/components/OverflowMenu/overflow-menu.css'; @import '~@patternfly/patternfly/components/EmptyState/empty-state.css'; @import '~@patternfly/patternfly/components/Card/card.css'; +@import '~@patternfly/patternfly/components/DataList/data-list.css'; diff --git a/app/views/buyers/invoices/index.html.erb b/app/views/buyers/invoices/index.html.erb index 5b913ebec3..0a2e3f7369 100644 --- a/app/views/buyers/invoices/index.html.erb +++ b/app/views/buyers/invoices/index.html.erb @@ -7,19 +7,19 @@
IDMonthStateAmountDownload
IDMonthStateAmountDownload
+ <%= content_tag_for(:tr, invoice, role: 'row') do %> + <%= link_to invoice.friendly_id, provider_admin_account_invoice_path(invoice) , :title => "Show #{invoice.friendly_id}" %> + <%= invoice.name %> <% if invoice.current? then %>(current)<% end %> + <%= h invoice.state %> + <%= price_tag(invoice.cost) %> + <%= link_to("PDF", invoice.pdf.expiring_url) if invoice.pdf.file? %>
- - - - - - + + + + + - + <% @invoices.each do |invoice| %> <%= content_tag_for(:tr, invoice, role: 'row') do %> diff --git a/app/views/buyers/invoices/show.html.erb b/app/views/buyers/invoices/show.html.erb index 3c66a757f4..48d5651a4a 100644 --- a/app/views/buyers/invoices/show.html.erb +++ b/app/views/buyers/invoices/show.html.erb @@ -1,8 +1,13 @@ +<%= render '/finance/provider/shared/invoice_title', invoice: @invoice %> + <% content_for :menu do %> <%= render 'buyers/accounts/menu' %> <% end %> -<%= render :partial => '/finance/provider/shared/invoice_header', :locals => { :editable => allow_edit?, :edit_link_scope => [:buyers, @account] } %> -<%= render :partial => '/finance/provider/shared/line_items', :locals => { :editable => allow_edit? } %> -<%= render :partial => '/finance/provider/shared/payment_transactions' %> -<%= render :partial => '/finance/provider/invoices/actions' %> +
+ <%= render :partial => '/finance/provider/shared/invoice_header', :locals => { :editable => allow_edit?, :edit_link_scope => [:buyers, @account] } %> + <%= render :partial => '/finance/provider/shared/line_items', :locals => { :editable => allow_edit? } %> + <%= render :partial => '/finance/provider/shared/payment_transactions' %> + <%= render :partial => '/finance/provider/invoices/actions' %> +
+ diff --git a/app/views/finance/provider/invoices/_actions.html.erb b/app/views/finance/provider/invoices/_actions.html.erb index f6b0927d50..f667fe8188 100644 --- a/app/views/finance/provider/invoices/_actions.html.erb +++ b/app/views/finance/provider/invoices/_actions.html.erb @@ -7,11 +7,13 @@ <%# TODO: move this to CanCan %> <% if @invoice.buyer %> -
    - <%= content_tag(:li, invoice_action_button(@invoice.pdf.file? ? 'Regenerate PDF' : 'Generate PDF', :generate_pdf, 'secondary')) %> - <%= content_tag(:li, invoice_action_button('Issue invoice', :issue, 'primary')) if @invoice.state_events.include?(:issue) %> - <%= content_tag(:li, invoice_action_button('Charge', :charge, 'primary')) if @invoice.state_events.include?(:pay) %> - <%= content_tag(:li, invoice_action_button('Mark as paid', :pay, 'primary')) if @invoice.state_events.include?(:pay) %> - <%= content_tag(:li, invoice_action_button('Cancel invoice', :cancel, 'danger')) if @invoice.state_events.include?(:cancel) %> -
+
+
    + <%= content_tag(:li, invoice_action_button(@invoice.pdf.file? ? 'Regenerate PDF' : 'Generate PDF', :generate_pdf, 'secondary')) %> + <%= content_tag(:li, invoice_action_button('Issue invoice', :issue, 'primary')) if @invoice.state_events.include?(:issue) %> + <%= content_tag(:li, invoice_action_button('Charge', :charge, 'primary')) if @invoice.state_events.include?(:pay) %> + <%= content_tag(:li, invoice_action_button('Mark as paid', :pay, 'primary')) if @invoice.state_events.include?(:pay) %> + <%= content_tag(:li, invoice_action_button('Cancel invoice', :cancel, 'danger')) if @invoice.state_events.include?(:cancel) %> +
+
<% end %> diff --git a/app/views/finance/provider/invoices/show.html.erb b/app/views/finance/provider/invoices/show.html.erb index 51e812197b..2d8622d050 100644 --- a/app/views/finance/provider/invoices/show.html.erb +++ b/app/views/finance/provider/invoices/show.html.erb @@ -1,4 +1,8 @@ -<%= render :partial => '/finance/provider/shared/invoice_header', :locals => { :editable => allow_edit?, edit_link_scope: [:finance] } %> -<%= render :partial => '/finance/provider/shared/line_items', :locals => { :editable => allow_edit? } %> -<%= render :partial => '/finance/provider/shared/payment_transactions' %> -<%= render :partial => '/finance/provider/invoices/actions' %> +<%= render '/finance/provider/shared/invoice_title', invoice: @invoice %> + +
+ <%= render :partial => '/finance/provider/shared/invoice_header', :locals => { :editable => allow_edit?, edit_link_scope: [:finance] } %> + <%= render :partial => '/finance/provider/shared/line_items', :locals => { :editable => allow_edit? } %> + <%= render :partial => '/finance/provider/shared/payment_transactions' %> + <%= render :partial => '/finance/provider/invoices/actions' %> +
diff --git a/app/views/finance/provider/shared/_invoice_address.html.erb b/app/views/finance/provider/shared/_invoice_address.html.erb deleted file mode 100644 index 51ee2631b7..0000000000 --- a/app/views/finance/provider/shared/_invoice_address.html.erb +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - -<%# account_header_optional_field(:vat_code, address) %> -<%# account_header_optional_field(:fiscal_code, address) %> diff --git a/app/views/finance/provider/shared/_invoice_address_card.html.slim b/app/views/finance/provider/shared/_invoice_address_card.html.slim new file mode 100644 index 0000000000..866c4acaa3 --- /dev/null +++ b/app/views/finance/provider/shared/_invoice_address_card.html.slim @@ -0,0 +1,35 @@ +div class="pf-c-card" + div class="pf-c-card__header" + div class="pf-c-card__title" + = title + + div class="pf-c-card__body" + dl class="pf-c-description-list pf-m-horizontal" + div class="pf-c-description-list__group" + dt class="pf-c-description-list__term" + span class="pf-c-description-list__text" + | Organization name + dd class="pf-c-description-list__description" + div class="pf-c-description-list__text" + = org_name + + div class="pf-c-description-list__group" + dt class="pf-c-description-list__term" + span class="pf-c-description-list__text" + | Address + dd class="pf-c-description-list__description" + div class="pf-c-description-list__text" + address + = [address.line1, address.line2].compact.join(' ') +
+ = [address.city, address.state].compact.join(', ') + ' + = address.zip + + - if address.country + div class="pf-c-description-list__group" + dt class="pf-c-description-list__term" + span class="pf-c-description-list__text" + dd class="pf-c-description-list__description" + div class="pf-c-description-list__text" + = address.country diff --git a/app/views/finance/provider/shared/_invoice_header.html.erb b/app/views/finance/provider/shared/_invoice_header.html.erb index e6677fea35..d019042858 100644 --- a/app/views/finance/provider/shared/_invoice_header.html.erb +++ b/app/views/finance/provider/shared/_invoice_header.html.erb @@ -1,41 +1,47 @@ -
- <%= render '/finance/provider/shared/invoice_title', invoice: @invoice %> + +
+
+
+
+
+ Details +
-
IDMonthStateAmountDownload + IDMonthStateAmountDownload <%= fancy_link_to('Create invoice', admin_buyers_account_invoices_path(@account), :method => :post, :class => 'new', :disabled => create_invoice_disabled(@account)) -%>
<%= link_to invoice.friendly_id , admin_buyers_or_account_invoice_path(invoice) , title: "Show #{invoice.friendly_id}" %>
Address -
- <%= [address.line1, address.line2].compact.join(' ') %> -
- <%= [ address.city, address.state ].compact.join(', ') %> <%= address.zip %> -
-
<%= address.country %>
- - <%= invoice_field(:friendly_id, "#{@invoice.friendly_id} #{' (This invoice id is already in use and should probably be changed)' if @invoice.friendly_id_already_used? && @invoice.editable? }") %> - <%= invoice_field(:state, @invoice.state.to_s.capitalize) %> - <%= invoice_field(:period, "#{invoice_date_format(@invoice.period.begin)} - #{invoice_date_format(@invoice.period.end)}") %> - <%= invoice_field(:finalized_on, invoice_date_format(@invoice.finalized_at)) %> - <%= invoice_field(:issued_on, invoice_date_format(@invoice.issued_on)) %> - <%= invoice_field(:due_on, invoice_date_format(@invoice.due_on)) %> - <%= invoice_field(:paid_on, invoice_date_format(@invoice.paid_at)) %> - <%= invoice_field('PDF', invoice_pdf_link(@invoice, class: 'pf-c-button pf-m-secondary')) %> +
+ <%= link_to 'Edit', polymorphic_path([:edit, :admin, *edit_link_scope, @invoice]), class: 'action edit next' if @invoice.editable? && can?(:update, @invoice) %> +
+ -
- Details - <%= link_to 'Edit', polymorphic_path([:edit, :admin, *edit_link_scope, @invoice]), :class => 'action edit next' if @invoice.editable? && can?(:update, @invoice) %> -
+
+
+ <%= render 'finance/provider/shared/invoice_item', name: :friendly_id, value: "#{@invoice.friendly_id} #{' (This invoice id is already in use and should probably be changed)' if @invoice.friendly_id_already_used? && @invoice.editable? }" %> + <%= render 'finance/provider/shared/invoice_item', name: :state, value: @invoice.state.to_s.capitalize %> + <%= render 'finance/provider/shared/invoice_item', name: :period, value: "#{invoice_date_format(@invoice.period.begin)} - #{invoice_date_format(@invoice.period.end)}" %> + <%= render 'finance/provider/shared/invoice_item', name: :finalized_on, value: invoice_date_format(@invoice.finalized_at) %> + <%= render 'finance/provider/shared/invoice_item', name: :issued_on, value: invoice_date_format(@invoice.issued_on) %> + <%= render 'finance/provider/shared/invoice_item', name: :due_on, value: invoice_date_format(@invoice.due_on) %> + <%= render 'finance/provider/shared/invoice_item', name: :paid_on, value: invoice_date_format(@invoice.paid_at) %> + <%= render 'finance/provider/shared/invoice_item', name: 'PDF', value: invoice_pdf_link(@invoice, class: 'pf-c-button pf-m-secondary') %> +
+
+
+ - - - - - - - <%= render :partial => '/finance/provider/shared/invoice_address', :locals => { :address => @invoice.from } %> -
- Issued by -
Organization name<%= @invoice.from.name %>
+
+ <%- address = @invoice.from %> + <%= render 'finance/provider/shared/invoice_address_card', title: 'Issued by', + org_name: address.name, + address: address %> +
- - - - - - - <%= render :partial => '/finance/provider/shared/invoice_address', :locals => { :address => @invoice.to } %> -
- Issued to -
Organization name<%= @invoice.buyer ? link_to(@invoice.to.name, admin_buyers_account_path(@invoice.buyer)) : @invoice.to.name %>
+
+ <%- address = @invoice.to %> + <%- org_name = @invoice.buyer ? link_to(address.name, admin_buyers_account_path(@invoice.buyer)) : address.name %> + <%= render 'finance/provider/shared/invoice_address_card', title: 'Issued to', + org_name: org_name, + address: address %> +
diff --git a/app/views/finance/provider/shared/_invoice_item.slim b/app/views/finance/provider/shared/_invoice_item.slim new file mode 100644 index 0000000000..51e2416839 --- /dev/null +++ b/app/views/finance/provider/shared/_invoice_item.slim @@ -0,0 +1,9 @@ +- id = "field-#{name.to_s.downcase}" + +div class="pf-c-description-list__group" id=id + dt class="pf-c-description-list__term" + span class="pf-c-description-list__text" + = name.is_a?(Symbol) ? Invoice.human_attribute_name(name) : name + dd class="pf-c-description-list__description" + div class="pf-c-description-list__text" + = value diff --git a/app/views/finance/provider/shared/_line_item.html.erb b/app/views/finance/provider/shared/_line_item.html.erb index fbda9c5823..6a6dda16c8 100644 --- a/app/views/finance/provider/shared/_line_item.html.erb +++ b/app/views/finance/provider/shared/_line_item.html.erb @@ -1,15 +1,24 @@ <%= content_tag_for :tr, line_item, :class => "line_item" do %> - <%= h line_item.name %> - <%= h line_item.description %> - <%= h line_item.quantity %> - <%= line_item_price_tag(line_item.cost) %> - - - <% if line_item.invoice.editable? && editable %> - <%= form_tag admin_finance_account_invoice_line_item_path(line_item.invoice.buyer_account, line_item.invoice, line_item), - :method => 'delete', :class => 'remote' do %> - - <% end %> - <% end %> + <%= h line_item.name %> + <%= h line_item.description %> + <%= h line_item.quantity %> + <%= line_item_price_tag(line_item.cost) %> + + +
+
+
+ <% if line_item.invoice.editable? && editable %> +
+ <%= form_tag admin_finance_account_invoice_line_item_path(line_item.invoice.buyer_account, line_item.invoice, line_item), + :method => 'delete', + :class => 'remote' do %> + + <% end %> +
+ <% end %> +
+
+
<% end %> diff --git a/app/views/finance/provider/shared/_line_items.html.erb b/app/views/finance/provider/shared/_line_items.html.erb index 15a65c4092..404dfe592e 100644 --- a/app/views/finance/provider/shared/_line_items.html.erb +++ b/app/views/finance/provider/shared/_line_items.html.erb @@ -1,70 +1,76 @@ - - - - - - - - - - - - +
+
+
+
+ Line Items +
+
-
- <%= render :partial => '/finance/provider/shared/line_item', :collection => @invoice.line_items, :locals => { :editable => editable } %> - +
- Line Items -
NameDescriptionQuantityPriceCharged - <% if @invoice.editable? && editable %> - <%= link_to 'Add', new_admin_finance_account_invoice_line_item_path(@invoice.buyer_account, @invoice), - :title => 'Add Custom Charge', - :class => 'action add fancybox', - :'data-autodimensions' => 'true' - %> - <% end %> -
+ + + + + + + + + + - - <% if @invoice.vat_rate.nil? %> - - - - - - - - - <% else %> - - - - - - - - - - - - - - - - - - - - - - - - <% end %> - -
NameDescriptionQuantityPriceCharged + <% if @invoice.editable? && editable %> + <%= link_to 'Add', new_admin_finance_account_invoice_line_item_path(@invoice.buyer_account, @invoice), + :title => 'Add Custom Charge', + :class => 'action add fancybox', + :'data-autodimensions' => 'true' + %> + <% end %> +
Total cost<%= line_item_price_tag(@invoice.exact_cost_without_vat) %><%= rounded_price_tag(@invoice.charge_cost)%>
Total cost (without <%= @invoice.buyer_field_label('vat_rate') %>)<%= line_item_price_tag(@invoice.exact_cost_without_vat) %><%= rounded_price_tag(@invoice.charge_cost_without_vat)%>
<%= @invoice.buyer_field_label('vat_rate') %> Amount<%= rounded_price_tag(@invoice.vat_amount) %>
Total cost (<%= @invoice.buyer_field_label('vat_rate') %> <%= @invoice.vat_rate %>% included)<%= rounded_price_tag(@invoice.charge_cost)%>
+ + <%= render :partial => '/finance/provider/shared/line_item', :collection => @invoice.line_items, :locals => { :editable => editable } %> + -<% if @invoice.vat_rate == 0 %> -

- <%= @invoice.provider_account.vat_zero_text %> -

-<% end %> + + <% if @invoice.vat_rate.nil? %> + + + Total cost + + <%= line_item_price_tag(@invoice.exact_cost_without_vat) %> + <%= rounded_price_tag(@invoice.charge_cost)%> + + + <% else %> + + + Total cost (without <%= @invoice.buyer_field_label('vat_rate') %>) + + <%= line_item_price_tag(@invoice.exact_cost_without_vat) %> + <%= rounded_price_tag(@invoice.charge_cost_without_vat)%> + + + + + <%= @invoice.buyer_field_label('vat_rate') %> Amount + + <%= rounded_price_tag(@invoice.vat_amount) %> + + + + + Total cost (<%= @invoice.buyer_field_label('vat_rate') %> <%= @invoice.vat_rate %>% included) + + <%= rounded_price_tag(@invoice.charge_cost)%> + + + <% end %> + + + + <% if @invoice.vat_rate == 0 %> +

+ <%= @invoice.provider_account.vat_zero_text %> +

+ <% end %> + + diff --git a/app/views/finance/provider/shared/_payment_transaction.html.erb b/app/views/finance/provider/shared/_payment_transaction.html.erb index 2dd1e32356..270bb649a9 100644 --- a/app/views/finance/provider/shared/_payment_transaction.html.erb +++ b/app/views/finance/provider/shared/_payment_transaction.html.erb @@ -1,14 +1,14 @@ <%= content_tag_for(:tr, payment_transaction) do %> - + <%= boolean_status_img(payment_transaction.success?) %> - + <%= payment_transaction.success? ? 'Success' : 'Failure' %> - <%= payment_transaction.created_at %> - <%= payment_transaction.reference %> - <%= payment_transaction.message %> - + <%= payment_transaction.created_at %> + <%= payment_transaction.reference %> + <%= payment_transaction.message %> + <%= payment_transaction.amount %> <%= payment_transaction.currency %> diff --git a/app/views/finance/provider/shared/_payment_transactions.html.erb b/app/views/finance/provider/shared/_payment_transactions.html.erb index c2ea964c28..782dd1e0af 100644 --- a/app/views/finance/provider/shared/_payment_transactions.html.erb +++ b/app/views/finance/provider/shared/_payment_transactions.html.erb @@ -1,21 +1,31 @@ - - - <% unless @invoice.payment_transactions.empty? %> - - - - - - - - - - - <%= render :partial => '/finance/provider/shared/payment_transaction', :collection => @invoice.payment_transactions %> - <% else %> - - - - <% end %> -
Transactions
StatusCreated AtReferenceMessageAmount
No transactions registered for this invoice.
+
+
+
+
+ Transactions +
+
+ + <% unless @invoice.payment_transactions.empty? %> + + + + + + + + + + + + <%= render :partial => '/finance/provider/shared/payment_transaction', :collection => @invoice.payment_transactions %> + + <% else %> + + + + <% end %> +
StatusCreated AtReferenceMessageAmount
No transactions registered for this invoice.
+
+
diff --git a/app/views/provider/admin/account/invoices/show.html.erb b/app/views/provider/admin/account/invoices/show.html.erb index 21fed66775..04316d029f 100644 --- a/app/views/provider/admin/account/invoices/show.html.erb +++ b/app/views/provider/admin/account/invoices/show.html.erb @@ -1,3 +1,7 @@ -<%= render :partial => '/finance/provider/shared/invoice_header', :locals => { :editable => false } %> -<%= render :partial => '/finance/provider/shared/line_items', :locals => { :editable => false } %> -<%= render :partial => '/finance/provider/shared/payment_transactions' %> +<%= render '/finance/provider/shared/invoice_title', invoice: @invoice %> + +
+ <%= render :partial => '/finance/provider/shared/invoice_header', :locals => { :editable => false } %> + <%= render :partial => '/finance/provider/shared/line_items', :locals => { :editable => false } %> + <%= render :partial => '/finance/provider/shared/payment_transactions' %> +
diff --git a/features/step_definitions/finance/invoicing_steps.rb b/features/step_definitions/finance/invoicing_steps.rb index 779240a48f..896a3c0da0 100644 --- a/features/step_definitions/finance/invoicing_steps.rb +++ b/features/step_definitions/finance/invoicing_steps.rb @@ -98,10 +98,10 @@ when /Total VAT Amount/ else prefix = "//table[@id='line_items']/tbody/tr[#{i + 1}]" - line_name = find(:xpath, "#{prefix}/th[1]").text.strip - description = find(:xpath, "#{prefix}/td[1]").text.strip - quantity = find(:xpath, "#{prefix}/td[2]").text.strip - real_cost = find(:xpath, "#{prefix}/td[3]").text.strip + line_name = find(:xpath, "#{prefix}/*[1]").text.strip + description = find(:xpath, "#{prefix}/*[2]").text.strip + quantity = find(:xpath, "#{prefix}/*[3]").text.strip + real_cost = find(:xpath, "#{prefix}/*[4]").text.strip # TODO: strip double whitespace as done in https://github.com/3scale/system/commit/ce72abe4d673b1592f96ed9532c62317306c7ea6 assert_equal line['name'], line_name unless line_name.blank? diff --git a/test/integration/buyers/invoices_controller_test.rb b/test/integration/buyers/invoices_controller_test.rb index 1f274341c3..17437cc728 100644 --- a/test/integration/buyers/invoices_controller_test.rb +++ b/test/integration/buyers/invoices_controller_test.rb @@ -78,7 +78,7 @@ def setup assert_template 'buyers/invoices/show' page = Nokogiri::HTML::Document.parse(response.body) - period_field = page.at("td[@id='field-period']") + period_field = page.at("div[@id='field-period']/dd") assert_equal '1 July, 2023 - 31 July, 2023', period_field.text.strip end From bce6ffa0b0a8738f02fd237c9c2c132d5c7e1ecd Mon Sep 17 00:00:00 2001 From: josemigallas Date: Tue, 4 Jul 2023 13:40:21 +0200 Subject: [PATCH 27/37] =?UTF-8?q?=F0=9F=A6=8B=20replaces=20table=20with=20?= =?UTF-8?q?PF4=20datalist=20in=20account=20settings=20overview?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../provider/admin/accounts/show.html.slim | 60 ++++++++++++------- features/step_definitions/account_steps.rb | 3 +- 2 files changed, 40 insertions(+), 23 deletions(-) diff --git a/app/views/provider/admin/accounts/show.html.slim b/app/views/provider/admin/accounts/show.html.slim index 8121f4120d..bf59063e85 100644 --- a/app/views/provider/admin/accounts/show.html.slim +++ b/app/views/provider/admin/accounts/show.html.slim @@ -29,15 +29,23 @@ div id="account-column-wrapper" span class="operations" = link_to 'Edit', edit_provider_admin_account_path, class: 'action edit' - table class="list" - tbody - - @presenter.visible_extra_fields.each do |field| - tr - th = @presenter.field_label(field.name) - td = @presenter.field_value(field.name) - tr - th Time Zone - td = @presenter.timezone + ul class="pf-c-data-list" role="list" aria-label="Account details list" + - @presenter.visible_extra_fields.each do |field| + - name = field.name + - id = "account-details-list-#{name}" + li class="pf-c-data-list__item" aria-labelledby=id + div class="pf-c-data-list__item-row" + div class="pf-c-data-list__item-content" + div class="pf-c-data-list__cell" + span id=id = @presenter.field_label(name) + div class="pf-c-data-list__cell" = @presenter.field_value(name) + + li class="pf-c-data-list__item" aria-labelledby="account-details-list-timezone" + div class="pf-c-data-list__item-row" + div class="pf-c-data-list__item-content" + div class="pf-c-data-list__cell" + span id="account-details-list-timezone" Time Zone + div class="pf-c-data-list__cell" = @presenter.timezone - if @presenter.redhat_customer_verification_enabled? div id="account-redhat-connect" @@ -74,16 +82,24 @@ div id="account-column-wrapper" = render 'change_plan' - table class="data" - tbody - - @presenter.plan_features.each do |feature| - tr - th = feature.name - td - i class="included fas fa-check-circle" - - - @presenter.absent_visible_features.each do |feature| - tr - th = feature.name - td - i class="excluded fas fa-times-circle" + ul class="pf-c-data-list" role="list" aria-label="Plan features list" + - @presenter.plan_features.each do |feature| + - name = feature.name + - id = "plan-features-list-#{name.parameterize}" + li class="pf-c-data-list__item" aria-labelledby=id + div class="pf-c-data-list__item-row" + div class="pf-c-data-list__item-content" + div class="pf-c-data-list__cell" + span id=id = name + div class="pf-c-data-list__cell pf-m-no-fill" + i class="included fas fa-check-circle" + - @presenter.absent_visible_features.each do |feature| + - name = feature.name + - id = "plan-features-list-#{name}" + li class="pf-c-data-list__item" aria-labelledby=id + div class="pf-c-data-list__item-row" + div class="pf-c-data-list__item-content" + div class="pf-c-data-list__cell" + span id=id = name + div class="pf-c-data-list__cell pf-m-no-fill" + i class="excluded fas fa-times-circle" diff --git a/features/step_definitions/account_steps.rb b/features/step_definitions/account_steps.rb index 30c49b88d2..406016edd1 100644 --- a/features/step_definitions/account_steps.rb +++ b/features/step_definitions/account_steps.rb @@ -24,7 +24,8 @@ end Then /^I should see the account details:$/ do |table| - table.diff! extract_table('#account-overview', 'tr', 'th,td') + assert_equal table.to_hash.flatten, + find_all('#account-overview .pf-c-data-list__cell').map(&:text) end Then "{provider} time zone should be {string}" do |provider, time_zone| From ae8e0f5e9177afbbc25cdc38d366743b7983b248 Mon Sep 17 00:00:00 2001 From: josemigallas Date: Mon, 3 Jul 2023 16:13:26 +0200 Subject: [PATCH 28/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20personal=20access=20tokens?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stylesheets/provider/_access_tokens.scss | 8 -- app/assets/stylesheets/provider/_commons.scss | 9 -- app/assets/stylesheets/provider/_section.scss | 1 - app/assets/stylesheets/provider/_theme.scss | 1 - app/javascript/packs/provider.scss | 1 + .../admin/user/access_tokens/index.html.slim | 122 +++++++++++------- 6 files changed, 73 insertions(+), 69 deletions(-) delete mode 100644 app/assets/stylesheets/provider/_access_tokens.scss diff --git a/app/assets/stylesheets/provider/_access_tokens.scss b/app/assets/stylesheets/provider/_access_tokens.scss deleted file mode 100644 index 224d63324e..0000000000 --- a/app/assets/stylesheets/provider/_access_tokens.scss +++ /dev/null @@ -1,8 +0,0 @@ -.AccessTokenBox { - background-color: $light-background-color; - - &-token { - color: $success-color; - font-weight: $font-weight-bold; - } -} diff --git a/app/assets/stylesheets/provider/_commons.scss b/app/assets/stylesheets/provider/_commons.scss index 1c7f242a88..845dd153a4 100644 --- a/app/assets/stylesheets/provider/_commons.scss +++ b/app/assets/stylesheets/provider/_commons.scss @@ -176,15 +176,6 @@ pre code { } } -.u-code { - white-space: nowrap; -} - -.u-unselectable { - -moz-user-select: none; /* Firefox all */ - -webkit-user-select: none; /* Chrome & Safari */ -} - .u-divider { height: line-height-times(1); margin: line-height-times(1/2) 0; diff --git a/app/assets/stylesheets/provider/_section.scss b/app/assets/stylesheets/provider/_section.scss index 689efec2fa..d8d68026b5 100644 --- a/app/assets/stylesheets/provider/_section.scss +++ b/app/assets/stylesheets/provider/_section.scss @@ -7,7 +7,6 @@ @include white-box-shadow; } - &#access-tokens p, &#service-tokens p { @include white-box-shadow; } diff --git a/app/assets/stylesheets/provider/_theme.scss b/app/assets/stylesheets/provider/_theme.scss index 59fc2acead..88e970450f 100644 --- a/app/assets/stylesheets/provider/_theme.scss +++ b/app/assets/stylesheets/provider/_theme.scss @@ -89,5 +89,4 @@ @import 'provider/colorbox'; @import 'provider/pagination'; -@import 'provider/access_tokens'; @import 'provider/print'; diff --git a/app/javascript/packs/provider.scss b/app/javascript/packs/provider.scss index d2ccd8f29d..81bd1e37e1 100644 --- a/app/javascript/packs/provider.scss +++ b/app/javascript/packs/provider.scss @@ -16,3 +16,4 @@ @import '~@patternfly/patternfly/components/EmptyState/empty-state.css'; @import '~@patternfly/patternfly/components/Card/card.css'; @import '~@patternfly/patternfly/components/DataList/data-list.css'; +@import '~@patternfly/patternfly/components/DescriptionList/description-list.css'; diff --git a/app/views/provider/admin/user/access_tokens/index.html.slim b/app/views/provider/admin/user/access_tokens/index.html.slim index e644f7034d..bfd0aaa7d3 100644 --- a/app/views/provider/admin/user/access_tokens/index.html.slim +++ b/app/views/provider/admin/user/access_tokens/index.html.slim @@ -1,61 +1,83 @@ - if flash[:token] - token = @access_tokens.last - content_for :page_header_title, 'Copy the new token and store it somewhere safe' - div.AccessTokenBox.InfoBox.InfoBox--notice - p Make sure to copy your new personal access token now. You won't be able to see it again as it isn't stored for security reasons. - dl.u-dl - dt.u-dl-term.u-unselectable - | Name - dd.u-dl-definition.u-unselectable - = token.name - dt.u-dl-term.u-unselectable - | Scopes - dd.u-dl-definition.u-unselectable - = token.human_scopes.to_sentence - dt.u-dl-term.u-unselectable - | Permission - dd.u-dl-definition.u-unselectable - = token.human_permission - dt.u-dl-term.u-unselectable - strong - | Token - dd.u-dl-definition - code.u-code.AccessTokenBox-token - = token.value + div class="pf-c-card" + div class="pf-c-card__body" + div class="pf-c-content" + p Make sure to copy your new personal access token now. You won't be able to see it again as it isn't stored for security reasons. + br + dl class="pf-c-description-list pf-m-horizontal" + div class="pf-c-description-list__group" + dt class="pf-c-description-list__term" + span class="pf-c-description-list__text" + | Name + dd class="pf-c-description-list__description" + div class="pf-c-description-list__text" + = token.name + div class="pf-c-description-list__group" + dt class="pf-c-description-list__term" + span class="pf-c-description-list__text" + | Scopes + dd class="pf-c-description-list__description" + div class="pf-c-description-list__text" + = token.human_scopes.to_sentence + div class="pf-c-description-list__group" + dt class="pf-c-description-list__term" + span class="pf-c-description-list__text" + | Permission + dd class="pf-c-description-list__description" + div class="pf-c-description-list__text" + = token.human_permission + div class="pf-c-description-list__group" + dt class="pf-c-description-list__term" + span class="pf-c-description-list__text" + | Token + dd class="pf-c-description-list__description" + div class="pf-c-description-list__text" + = token.value - = link_to 'I have copied the token' , provider_admin_user_access_tokens_path, class: 'important-button next' + div class="pf-c-page__main-section" + div class="pf-l-flex" + div class="pf-l-flex__item pf-m-align-right" + = link_to 'I have copied the token', provider_admin_user_access_tokens_path, class: 'pf-c-button pf-m-primary' - else - content_for :page_header_title, 'Tokens' - section#access-tokens.Section + section id="access-tokens" h2 Access Tokens p ' Access tokens are personal tokens that let you authenticate against the Account Management API, the Analytics API and the Billing API through HTTP Basic Auth. You can create multiple access tokens with custom scopes and permissions. We suggest you create tokens with the minimal scopes & permissions needed for the task at hand. Use Access Tokens from within the = link_to '3scale API docs', provider_admin_api_docs_path | . - table.data.access-tokens + table class="pf-c-table pf-m-grid-lg" role="grid" aria-label="Access tokens table" - allowed_scopes = current_user.allowed_access_token_scopes thead - tr - th Name - th Scopes - th Permission - th = fancy_link_to 'Add Access Token', new_provider_admin_user_access_token_path, class: 'new' if allowed_scopes.any? - tbody + tr role="row" + th role="columnheader" scope="col" Name + th role="columnheader" scope="col" Scopes + th role="columnheader" scope="col" Permission + th role="columnheader" scope="col" class="pf-c-table__action pf-m-fit-content" + = fancy_link_to 'Add Access Token', new_provider_admin_user_access_token_path, class: 'new' if allowed_scopes.any? + tbody role="rowgroup" - if @access_tokens.any? && allowed_scopes.any? - @access_tokens.each do |token| - tr - td = token.name - td = token.human_scopes.to_sentence - td = token.human_permission - td = link_to 'Edit', edit_provider_admin_user_access_token_path(token), class: 'action edit' + tr role="row" + td role="cell" data-label="Name" = token.name + td role="cell" data-label="Scopes" = token.human_scopes.to_sentence + td role="cell" data-label="Permission" = token.human_permission + td role="cell" class="pf-c-table__action" + div class="pf-c-overflow-menu" + div class="pf-c-overflow-menu__content" + div class="pf-c-overflow-menu__group pf-m-button-group" + div class="pf-c-overflow-menu__item" + = link_to 'Edit', edit_provider_admin_user_access_token_path(token), class: 'action edit' - else - tr - td colspan='4' + tr role="row" + td role="cell" colspan='4' - if allowed_scopes.any? | No access tokens yet… - else - | You can’t create access tokens because you don’t have access to the Account Management API, the Analytics API, and/or the Billing API. Please contact an administrator of this account. + | You can't create access tokens because you don't have access to the Account Management API, the Analytics API, and/or the Billing API. Please contact an administrator of this account. section#service-tokens.Section h2 Service Tokens @@ -64,23 +86,23 @@ = link_to '3scale API docs', provider_admin_api_docs_path | . - table.data.access-tokens + table class="pf-c-table pf-m-grid-lg" role="grid" aria-label="Service tokens table" thead - tr - th Service name - th Scope - th Permission - th Token + tr role="row" + th role="columnheader" scope="col" class="pf-m-fit-content" Service name + th role="columnheader" scope="col" Scope + th role="columnheader" scope="col" Permission + th role="columnheader" scope="col" Token tbody - accessible_service_tokens = current_user.accessible_service_tokens - if accessible_service_tokens.any? - accessible_service_tokens.each do |service_token| - tr - td = service_token.service.name - td Service management API - td Read & Write - td + tr role="row" + td role="cell" data-label="Service name" = service_token.service.name + td role="cell" data-label="Scope" Service management API + td role="cell" data-label="Permission" Read & Write + td role="cell" data-label="Token" code.u-code = service_token.value - else - tr + tr role="row" td colspan='4' You don't have access to any service. Contact an admin of this account to request access if needed. From ac0fad6e37f6508cf22a03cce12e745e42db1a76 Mon Sep 17 00:00:00 2001 From: josemigallas Date: Wed, 5 Jul 2023 08:46:07 +0200 Subject: [PATCH 29/37] =?UTF-8?q?=F0=9F=A6=8B=20replaces=20table=20with=20?= =?UTF-8?q?PF4=20description=20list=20in=20app=20overview?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/stylesheets/provider/_commons.scss | 4 + app/assets/stylesheets/provider/_tables.scss | 89 +------------------ .../stylesheets/provider/_utilization.scss | 43 ++++++--- .../admin/applications/_state.html.slim | 32 +++---- .../admin/applications/_trial.html.slim | 8 ++ .../admin/applications/_utilization.html.erb | 75 ++++++++-------- .../admin/applications/show.html.slim | 43 ++++++--- .../admin/applications/update_state.js.erb | 4 +- test/integration/utilization_test.rb | 17 +++- 9 files changed, 143 insertions(+), 172 deletions(-) create mode 100644 app/views/provider/admin/applications/_trial.html.slim diff --git a/app/assets/stylesheets/provider/_commons.scss b/app/assets/stylesheets/provider/_commons.scss index 845dd153a4..17bbf46198 100644 --- a/app/assets/stylesheets/provider/_commons.scss +++ b/app/assets/stylesheets/provider/_commons.scss @@ -215,3 +215,7 @@ hr, { padding: line-height-times(1); } } + +.pf-m-force-float-right { + float: right !important; /* scss-lint:disable ImportantRule */ +} diff --git a/app/assets/stylesheets/provider/_tables.scss b/app/assets/stylesheets/provider/_tables.scss index f653a04099..6f33834fda 100644 --- a/app/assets/stylesheets/provider/_tables.scss +++ b/app/assets/stylesheets/provider/_tables.scss @@ -2,16 +2,6 @@ $table-columns-width: line-height-times(11); $search-header-width: line-height-times(4); -// Utility styles -// TODO: Move to a separate file -.u-word-break-all { - word-break: break-all; -} - -.u-word-break-word { - word-break: break-word; -} - table:not(.pf-c-table) { background-color: $body-background; width: 100%; @@ -53,84 +43,7 @@ th.header { padding-top: line-height-times(2); } -table.data:not(.pf-c-table) { - @include white-box-shadow; - border: solid $body-background line-height-times(1); - border-collapse: collapse; - border-color: transparent; - margin-bottom: 0; - margin-top: 0; - width: 100%; - - a.is-inline { - display: inline; - padding: 0; - text-decoration: underline; - } - - a { - display: block; - margin: line-height-times(-1/4) 0; - padding: line-height-times(1/4, true) 0; - } - - thead { - vertical-align: middle; - - th { - border-bottom: $border-width solid $border-color; - font-weight: $font-weight-bold; - - &.actions, - &.right { - text-align: right; - } - - a.down { - background: url('../images/arrow_down.gif') no-repeat 100% 55%; - padding-right: line-height-times(1/2); - } - - a.up { - background: url('../images/arrow_up.gif') no-repeat 100% 55%; - padding-right: line-height-times(1/2); - } - - a { - &.up, - &.down { - background: none; - padding-right: 0; - } - } - - &:last-child { - padding-right: 0; - } - } - } - - tbody { - td.actions { - text-align: right; - } - } - - &.u-sixEqualColumns tr td { - word-break: break-word; - } - - td, - th { - border-bottom: $border-width solid $border-color; - font-weight: $font-weight-normal; - } - - &.notification-settings, - &.StatsMethodsTable { - box-shadow: none; - } -} +// TODO: seek and destroy .is-inline, .StatsMethodsTable, .notification-settings table:not(.pf-c-table) a.action, table:not(.pf-c-table) button.action { diff --git a/app/assets/stylesheets/provider/_utilization.scss b/app/assets/stylesheets/provider/_utilization.scss index bdb3c07008..2718f5355a 100644 --- a/app/assets/stylesheets/provider/_utilization.scss +++ b/app/assets/stylesheets/provider/_utilization.scss @@ -1,12 +1,33 @@ -.above-0, .above-50, .above-80, .above-90, .above-100, .above-120, .above-150, .above-200, .above-300, .infinity { - font-weight: $font-weight-bold; -} -.above-0, .above-50 { - color: green; -} -.above-80, .above-90 { - color: $warning-color; -} -.above-100, .above-120, .above-150, .above-200, .above-300, .infinity { - color: $error-color; +.utilization { + .above-0, + .above-50, + .above-80, + .above-90, + .above-100, + .above-120, + .above-150, + .above-200, + .above-300, + .infinity { + font-weight: $font-weight-bold; + } + + .above-0, + .above-50 { + color: green; + } + + .above-80, + .above-90 { + color: $warning-color; + } + + .above-100, + .above-120, + .above-150, + .above-200, + .above-300, + .infinity { + color: $error-color; + } } diff --git a/app/views/provider/admin/applications/_state.html.slim b/app/views/provider/admin/applications/_state.html.slim index 6339ea5324..0f14c7b21b 100644 --- a/app/views/provider/admin/applications/_state.html.slim +++ b/app/views/provider/admin/applications/_state.html.slim @@ -1,18 +1,14 @@ -dl#cinstance_state.u-dl.u-dl--skinny - dt.u-dl-term - | State - dd.u-dl-description - = h @cinstance.state.capitalize - - - if @cinstance.pending? - = render :partial => 'accept_reject' - - elsif @cinstance.live? - = fancy_link_to 'Suspend', suspend_provider_admin_application_path(@cinstance), method: :post, remote: true, data: {:confirm => suspend_application_confirmation(@cinstance)}, class: 'action suspend' - - elsif @cinstance.suspended? - = fancy_link_to 'Resume', resume_provider_admin_application_path(@cinstance), method: :post, remote: true, class: 'action resume' - - - if @cinstance.trial? - dt.u-dl-term - | Trial days left - dd.u-dl-description - = remaining_trial_days(@cinstance) if @cinstance.trial? +/ This is dinamically rendered by app/views/provider/admin/applications/update_state.js.erb +div class="pf-c-description-list__group" id="cinstance_state" + dt class="pf-c-description-list__term" + span class="pf-c-description-list__text" State + dd class="pf-c-description-list__description" + div class="pf-c-description-list__text" + = h @cinstance.state.capitalize + span class="pf-m-force-float-right" + - if @cinstance.pending? + = render :partial => 'accept_reject' + - elsif @cinstance.live? + = fancy_link_to 'Suspend', suspend_provider_admin_application_path(@cinstance), method: :post, remote: true, data: {:confirm => suspend_application_confirmation(@cinstance)}, class: 'action suspend' + - elsif @cinstance.suspended? + = fancy_link_to 'Resume', resume_provider_admin_application_path(@cinstance), method: :post, remote: true, class: 'action resume' diff --git a/app/views/provider/admin/applications/_trial.html.slim b/app/views/provider/admin/applications/_trial.html.slim new file mode 100644 index 0000000000..200d521a09 --- /dev/null +++ b/app/views/provider/admin/applications/_trial.html.slim @@ -0,0 +1,8 @@ +/ This is dinamically rendered by app/views/provider/admin/applications/update_state.js.erb +- if @cinstance.trial? + div class="pf-c-description-list__group" id="cinstance_trial" + dt class="pf-c-description-list__term" + span class="pf-c-description-list__text" Trial days left + dd class="pf-c-description-list__description" + div class="pf-c-description-list__text" + = remaining_trial_days(@cinstance) diff --git a/app/views/provider/admin/applications/_utilization.html.erb b/app/views/provider/admin/applications/_utilization.html.erb index 1cc0c3e67f..3f513b7efb 100644 --- a/app/views/provider/admin/applications/_utilization.html.erb +++ b/app/views/provider/admin/applications/_utilization.html.erb @@ -1,29 +1,31 @@
- -<% if utilization.error? %> -

There was a problem getting utilization data. Please try later.

-<% elsif utilization.nil? || utilization.size==0 %> -

This is an unmetered application, there are no limits defined -<% else %> - -

Overview of the current state of this application's limits - -

- - - - - - - - - - <% utilization.each do |item| %> - - - - <% - + <% if utilization.error? %> +

There was a problem getting utilization data. Please try later.

+ <% elsif utilization.nil? || utilization.size == 0 %> +

This is an unmetered application, there are no limits defined

+ <% else %> +

Overview of the current state of this application's limits

+ +
Metric NamePeriodValues%
<%=item.friendly_name %> (<%=item.system_name%>)per <%=item.period%>
+ + + + + + + + + + + <% utilization.each do |item| %> + + + + <% utilization = "#{item.current_value}/#{item.max_value}" if item.max_value.to_i > 0 || (item.max_value.to_i == 0 && item.current_value.to_i == 0) @@ -35,15 +37,16 @@ utilization_type = "infinity" percentage = "Inf" end - - %> - - - - <% end %> - -
Metric NamePeriodValues%
+ <%= item.friendly_name %> (<%= item.system_name %>) + + per <%=item.period%> + <%=utilization%><%=percentage%>
- -<%end%> - + %> + + <%= utilization %> + + + <%= percentage %> + + + <% end %> + + + <% end %>

diff --git a/app/views/provider/admin/applications/show.html.slim b/app/views/provider/admin/applications/show.html.slim index f5bf617aee..da5bb54886 100644 --- a/app/views/provider/admin/applications/show.html.slim +++ b/app/views/provider/admin/applications/show.html.slim @@ -12,21 +12,36 @@ div#twoCol.equal-width div.left div.wide_dashboard_card.round - table.list - tr - th Account - td - - account = @cinstance.buyer_account - = link_to account.name, admin_buyers_account_path(account) - - = fields_definitions_rows(@cinstance, %w{name}) - - service = @cinstance.service + dl class="pf-c-description-list pf-m-horizontal" aria-label="Application details list" + div class="pf-c-description-list__group" + dt class="pf-c-description-list__term" + span class="pf-c-description-list__text" Account + dd class="pf-c-description-list__description" + div class="pf-c-description-list__text" + - account = @cinstance.buyer_account + = link_to account.name, admin_buyers_account_path(account) + + - if @cinstance.defined_fields.present? + - for field in @cinstance.defined_fields.reject{ |f| %w{name}.include? f.name }.each + - method = field.name + - if @cinstance.field(field.name).present? && field.visible_for?(current_user) && @cinstance.field_value(method.to_s).present? + div class="pf-c-description-list__group" + dt class="pf-c-description-list__term" + span class="pf-c-description-list__text" = @cinstance.field_label(method.to_s) + dd class="pf-c-description-list__description" + div class="pf-c-description-list__text" + = h(@cinstance.field_value(method.to_s)) + - unless master_on_premises? - tr - th Service - td - = link_to service.name, admin_service_path(service) - = render 'state' + div class="pf-c-description-list__group" + dt class="pf-c-description-list__term" + span class="pf-c-description-list__text" Service + dd class="pf-c-description-list__description" + div class="pf-c-description-list__text" + - service = @cinstance.service + = link_to service.name, admin_service_path(service) + = render 'state' + = render 'trial' div.wide_dashboard_card.round#application_keys data-object="cinstance" data-url=(provider_admin_application_path(@cinstance, format: :json)) h3 API Credentials = render partial: 'provider/admin/keys/widget', diff --git a/app/views/provider/admin/applications/update_state.js.erb b/app/views/provider/admin/applications/update_state.js.erb index 475b85f8a3..c7d108a3bf 100644 --- a/app/views/provider/admin/applications/update_state.js.erb +++ b/app/views/provider/admin/applications/update_state.js.erb @@ -1,5 +1,5 @@ (function($) { <%= render :partial => '/shared/flash_message' %> - $("#cinstance_state").html(<%= render_to_js_string('state') %>); - // TODO: highlight effect + $("#cinstance_state").replaceWith(<%= render_to_js_string('state') %>); + $("#cinstance_trial").replaceWith(<%= render_to_js_string('trial') %>); })(jQuery); diff --git a/test/integration/utilization_test.rb b/test/integration/utilization_test.rb index 49568cd432..92a8efd6b9 100644 --- a/test/integration/utilization_test.rb +++ b/test/integration/utilization_test.rb @@ -21,6 +21,16 @@ class UtilizationTest < ActionDispatch::IntegrationTest @utilization = nil end + test 'utilization error' do + get provider_admin_application_path(@application) + assert_response :success + + assert_equal 1, utilization.size + assert_equal 0, utilization.search("table").size + assert_equal 'There was a problem getting utilization data. Please try later.', + utilization.search('p').text + end + test 'application is unmetered' do stub_backend_utilization([]) stub_backend_get_keys @@ -30,7 +40,8 @@ class UtilizationTest < ActionDispatch::IntegrationTest assert_equal 1, utilization.size assert_equal 0, utilization.search("table").size - assert_equal Nokogiri::XML::Text, utilization.children.first.class + assert_equal 'This is an unmetered application, there are no limits defined', + utilization.search('p').text end test 'application has metrics' do @@ -49,7 +60,7 @@ class UtilizationTest < ActionDispatch::IntegrationTest assert_equal 1, utilization.size - table = utilization.search("table[@class='data']") + table = utilization.search("table[@class*='utilization']") assert_equal 1, table.size assert_equal 1*2, table.search("td[@class='above-100']").size assert_equal 1*2, table.search("td[@class='above-80']").size @@ -72,7 +83,7 @@ class UtilizationTest < ActionDispatch::IntegrationTest assert_equal 1, utilization.size - table = utilization.search("table[@class='data']") + table = utilization.search("table[@class*='utilization']") assert_equal 1, table.size assert_equal 0*2, table.search("td[@class='above-100']").size assert_equal 1*2, table.search("td[@class='above-80']").size From bbb7d3b9d185fd8dbad57f6ca556f7097ce4f9f0 Mon Sep 17 00:00:00 2001 From: josemigallas Date: Thu, 6 Jul 2023 15:06:48 +0200 Subject: [PATCH 30/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20service=20applications=20usage=20rules?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/stylesheets/provider/_services.scss | 8 -------- app/assets/stylesheets/provider/_tables.scss | 6 +----- app/helpers/alerts_helper.rb | 14 +++++++------- .../api/services/forms/_usage_rules.html.slim | 12 ++++-------- features/support/selectors.rb | 4 +--- 5 files changed, 13 insertions(+), 31 deletions(-) diff --git a/app/assets/stylesheets/provider/_services.scss b/app/assets/stylesheets/provider/_services.scss index 219af05714..2440509f15 100644 --- a/app/assets/stylesheets/provider/_services.scss +++ b/app/assets/stylesheets/provider/_services.scss @@ -154,11 +154,3 @@ display: inline-block; } } - -table.data.notification-settings { - - .spacer { - padding-top: line-height-times(1); - visibility: hidden; - } -} diff --git a/app/assets/stylesheets/provider/_tables.scss b/app/assets/stylesheets/provider/_tables.scss index 6f33834fda..5e125bdf19 100644 --- a/app/assets/stylesheets/provider/_tables.scss +++ b/app/assets/stylesheets/provider/_tables.scss @@ -16,10 +16,6 @@ table:not(.pf-c-table) { height: line-height-times(2); padding: line-height-times(1/2, true) line-height-times(1/2) line-height-times(1/2) 0; vertical-align: top; - - &.u-underline { - border-bottom: $border-width solid $border-color; - } } @@ -43,7 +39,7 @@ th.header { padding-top: line-height-times(2); } -// TODO: seek and destroy .is-inline, .StatsMethodsTable, .notification-settings +// TODO: seek and destroy .is-inline, .StatsMethodsTable table:not(.pf-c-table) a.action, table:not(.pf-c-table) button.action { diff --git a/app/helpers/alerts_helper.rb b/app/helpers/alerts_helper.rb index 2bf918b78c..2e60602b66 100644 --- a/app/helpers/alerts_helper.rb +++ b/app/helpers/alerts_helper.rb @@ -1,4 +1,4 @@ -# encoding: UTF-8 +# frozen_string_literal: true module AlertsHelper def format_utilization value @@ -21,12 +21,12 @@ def row_for_alert_levels(label, key, hash = nil, levels = nil) hash ||= @service.notification_settings levels ||= alert_limits - content_tag :tr, id: key do - hidden_field_tag("service[notification_settings][#{key}][]", "") + - content_tag(:th, label, class: "u-underline") << levels.map do |level| - checked = hash.try!(:[], key.to_sym).try!(:include?, level) - content_tag(:td, check_box_tag("service[notification_settings][#{key}][]", level, checked, title: "#{label} at #{level}% usage")) - end.join.html_safe + content_tag :tr, id: key, role: 'row' do + (hidden_field_tag("service[notification_settings][#{key}][]", "") + + content_tag(:td, label, role: 'cell')) << levels.map do |level| + checked = hash.try!(:[], key.to_sym)&.include?(level) + content_tag(:td, check_box_tag("service[notification_settings][#{key}][]", level, checked, title: "#{label} at #{level}% usage"), role: 'cell') + end.join.html_safe # rubocop:disable Rails/OutputSafety end end diff --git a/app/views/api/services/forms/_usage_rules.html.slim b/app/views/api/services/forms/_usage_rules.html.slim index bc0843c1a7..05deeb3e33 100644 --- a/app/views/api/services/forms/_usage_rules.html.slim +++ b/app/views/api/services/forms/_usage_rules.html.slim @@ -16,7 +16,7 @@ = form.input :referrer_filters_required, as: :boolean = form.input :custom_keys_enabled - + = form.inputs "Application Plans" do = form.input :buyer_can_select_plan @@ -31,21 +31,17 @@ em In order for an application to trigger usage alerts, usage limit(s) need to be set up in the Application Plan to which the application is subscribed. li.full-width - table id="notification-settings-table" class="data notification-settings" + table id="notification-settings" class="pf-c-table pf-m-grid-lg" role="grid" thead - tr + tr role="row" th - alert_limits.each do |level| - th + th role="columnheader" scope="col" = level | % tbody = row_for_alert_levels 'Show Web Alerts to Admins of this Account', :web_provider = row_for_alert_levels 'Send Email Alerts to Admins of this Account', :email_provider - thead - tr - th.spacer colspan="9" - tbody = row_for_alert_levels 'Show Web Alerts to Admins of the Developer Account', :web_buyer = row_for_alert_levels 'Send Email Alerts to Admins of the Developer Account', :email_buyer diff --git a/features/support/selectors.rb b/features/support/selectors.rb index 14dfe08251..b4f1265d4b 100644 --- a/features/support/selectors.rb +++ b/features/support/selectors.rb @@ -24,8 +24,6 @@ def selector_for(scope) '#footer' when 'the account details box' '#account_details' - when 'notification settings' - 'table.notification-settings tbody' when 'service widget' '.service-widget' @@ -58,7 +56,7 @@ def selector_for(scope) 'tr.search' when 'the results' - 'table.data > tbody' + 'table.pf-c-table > tbody' when /the body/ "html > body" From 9ef4e166d6a5b4cebb3d1ed9e6f59705f2e44e34 Mon Sep 17 00:00:00 2001 From: josemigallas Date: Fri, 7 Jul 2023 09:37:39 +0200 Subject: [PATCH 31/37] =?UTF-8?q?=F0=9F=90=9B=F0=9F=A6=8B=20applies=20basi?= =?UTF-8?q?c=20PF4=20to=20finance=20logs=20table,=20also=20fixes=20nav=20i?= =?UTF-8?q?tem=20highlight=20and=20search=20bar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/stylesheets/provider/_colors.scss | 3 - .../stylesheets/provider/_log_entries.scss | 12 --- app/assets/stylesheets/provider/_theme.scss | 2 - app/helpers/vertical_nav_helper.rb | 6 +- .../provider/log_entries/index.html.erb | 80 +++++++++---------- 5 files changed, 40 insertions(+), 63 deletions(-) delete mode 100644 app/assets/stylesheets/provider/_log_entries.scss diff --git a/app/assets/stylesheets/provider/_colors.scss b/app/assets/stylesheets/provider/_colors.scss index 0f7ed1072c..174d28eb58 100644 --- a/app/assets/stylesheets/provider/_colors.scss +++ b/app/assets/stylesheets/provider/_colors.scss @@ -98,9 +98,6 @@ $submenu-border-color: $border-color; $chart-background-color: $white; -$log-entries-error-bg-color: $error-background-color; -$log-entries-warning-bg-color: rgba($warning-color, 0.1); - $sample-data-color: $white; $sample-data-bg-color: $lochMaraBlue; $sample-data-border-color: $lochMaraBlue; diff --git a/app/assets/stylesheets/provider/_log_entries.scss b/app/assets/stylesheets/provider/_log_entries.scss deleted file mode 100644 index 69504994b4..0000000000 --- a/app/assets/stylesheets/provider/_log_entries.scss +++ /dev/null @@ -1,12 +0,0 @@ -#log-entries { - tr.error { - background-color: $log-entries-error-bg-color; - td.description { font-weight: $font-weight-bold; } - } - - tr.warning { background-color: $log-entries-warning-bg-color; } - - td.created_at { width: 15em; } - td.level { width: 7em; } - td.description { width: auto; } -} diff --git a/app/assets/stylesheets/provider/_theme.scss b/app/assets/stylesheets/provider/_theme.scss index 88e970450f..09410e4da3 100644 --- a/app/assets/stylesheets/provider/_theme.scss +++ b/app/assets/stylesheets/provider/_theme.scss @@ -36,7 +36,6 @@ @import 'provider/sidetabs'; @import 'provider/services'; @import 'provider/plans'; -@import 'provider/search'; @import 'provider/bulk_operations'; @import 'provider/fields_definitions'; @@ -56,7 +55,6 @@ @import 'provider/groups'; @import 'provider/webhooks'; @import 'provider/metrics'; -@import 'provider/log_entries'; @import 'provider/authentication_providers'; @import 'provider/section'; diff --git a/app/helpers/vertical_nav_helper.rb b/app/helpers/vertical_nav_helper.rb index 12f188b1a8..4017d1d658 100644 --- a/app/helpers/vertical_nav_helper.rb +++ b/app/helpers/vertical_nav_helper.rb @@ -118,9 +118,9 @@ def audience_billing_items items = [] if can?(:manage, :finance) - items << {id: :earnings, title: 'Earnings by Month', path: admin_finance_root_path} - items << {id: :invoices, title: 'Invoices', path: admin_finance_invoices_path} - items << {id: :finance, title: 'Finance Log', path: admin_finance_log_entries_path} if current_user.impersonation_admin? + items << {id: :earnings, title: 'Earnings by Month', path: admin_finance_root_path} + items << {id: :invoices, title: 'Invoices', path: admin_finance_invoices_path} + items << {id: :log_entries, title: 'Finance Log', path: admin_finance_log_entries_path} if current_user.impersonation_admin? end if can?(:manage, :settings) diff --git a/app/views/finance/provider/log_entries/index.html.erb b/app/views/finance/provider/log_entries/index.html.erb index 2d029790f7..7242f1f117 100644 --- a/app/views/finance/provider/log_entries/index.html.erb +++ b/app/views/finance/provider/log_entries/index.html.erb @@ -1,56 +1,50 @@ -

Finance Log

+<%- content_for :page_header_title, 'Finance Log' %> - - +
- - - - - + + + + + - - <%- search_form do |s| -%> - - - - + + + <%= search_form do |s| -%> + + <% end %> - - <% @log_entries.each do |entry| %> - <%= content_tag_for(:tr, entry, :class => entry.level) do %> - - - - - - - + + <% @log_entries.each do |entry| %> + <%= content_tag_for(:tr, entry, class: entry.level, role: 'row') do %> + + + + <% end %> <% end %> - -
AccountLevelTime UTCDescription
AccountLevelTime UTCDescription
<%= entry.buyer.try(:name) || '--GLOBAL--' %> - <%= entry.level.to_s.upcase %> - - <%= entry.created_at.strftime("%Y-%m-%d %H:%M") %> - - - <%= - if entry.buyer - link_to entry.description, admin_buyers_account_invoices_path(entry.buyer) - else - entry.description - end - %> -
+ <%= entry.buyer.try(:name) || '--GLOBAL--' %> + + <%= entry.level.to_s.upcase %> + + <%= entry.created_at.strftime("%Y-%m-%d %H:%M") %> + + <%= + if entry.buyer + link_to entry.description, admin_buyers_account_invoices_path(entry.buyer) + else + entry.description + end + %> +
<%= will_paginate @log_entries %> From 2515ae0da24af69fb1aa6e9664b5884c8d1659f7 Mon Sep 17 00:00:00 2001 From: josemigallas Date: Fri, 7 Jul 2023 10:10:55 +0200 Subject: [PATCH 32/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20change=20plan=20modal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../master/providers/plans/edit.html.erb | 55 ++++++++++++------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/app/views/master/providers/plans/edit.html.erb b/app/views/master/providers/plans/edit.html.erb index 22a30751d2..9bef35da26 100644 --- a/app/views/master/providers/plans/edit.html.erb +++ b/app/views/master/providers/plans/edit.html.erb @@ -1,29 +1,44 @@ -

Upgrade '<%= @provider.name %>'

+
+

Upgrade '<%= @provider.name %>'

-

-You are changing the plan from <%= @current_plan.name %> to -<%= @new_plan.name %>. You can check what switches will be enabled -in the table below. You cannot downgrade reliably via this widget because -the plan will change but the switches will remain the same. -

+

+ You are changing the plan from <%= @current_plan.name %> to <%= @new_plan.name %>. + You can check what switches will be enabled in the table below. You cannot downgrade + reliably via this widget because the plan will change but the switches will remain the same. +

+
- - - - - - +
Current SettingsOn <%= @new_plan.name %>
+ <%- plan_col_name = "On #{@new_plan.name}" %> - <% @provider.available_plans.values.flatten.uniq.each do |switch_name| %> - <% next if switch_name == :branding %> - - - - + + + + - <% end %> + + + + <% @provider.available_plans.values.flatten.uniq.each do |switch_name| %> + <% next if switch_name == :branding %> + + + + + + <% end %> +
<%= t("switches.#{switch_name}.name") %><%= @provider.settings.send(switch_name).status.capitalize %><%= @new_switches.include?(switch_name) ? 'Allowed' : 'Denied' %>
+ Current Settings<%= plan_col_name %>
+ <%= t("switches.#{switch_name}.name") %> + + <%= @provider.settings.send(switch_name).status.capitalize %> + + <%= @new_switches.include?(switch_name) ? 'Allowed' : 'Denied' %> +
+
+ <%= form_tag master_provider_plan_path(@provider), :method => :put, :remote => true do %> <%= hidden_field_tag :plan_id, @new_plan.id %> <%= submit_tag "Yes, change the plan to #{@new_plan.name}", :class => 'important-button' %> From 839a89dd75d5e7b0ebf7659d472efee48f23c9b1 Mon Sep 17 00:00:00 2001 From: josemigallas Date: Mon, 10 Jul 2023 14:46:06 +0200 Subject: [PATCH 33/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20cms=20versions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/cms/versions/index.html.erb | 56 ++++++++++--------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/app/views/provider/admin/cms/versions/index.html.erb b/app/views/provider/admin/cms/versions/index.html.erb index a06dd5b1ef..8e1502b53e 100644 --- a/app/views/provider/admin/cms/versions/index.html.erb +++ b/app/views/provider/admin/cms/versions/index.html.erb @@ -4,40 +4,46 @@
<% unless @versions.blank? -%> <%= will_paginate @versions %> - +
- - - - - - + + + + + + + - + <%- @versions.each.with_index do |version, index| %> - - - - - - + + + + - - + <%- end %>
Created OnAuthorType of VersionChanges -
Created OnAuthorType of VersionChanges
<%= link_to l(version.created_at), - provider_admin_cms_template_version_path(@page, version), - :title => "Show #{version.created_at}" %><%= version.updated_by || '' %><%= version.state %> +
+ <%= link_to l(version.created_at), provider_admin_cms_template_version_path(@page, version), + title: "Show #{version.created_at}" %> + <%= version.updated_by || '' %><%= version.state %> <% if next_version = @versions[index + 1] %> <%= diff_widget(version.diff(next_version)) %> <% end %> - - <%= link_to 'Revert', - revert_provider_admin_cms_template_version_path(@page, version), - class: 'action revert', - :'data-method' => :post, - :'data-confirm' => "Do you really want to revert #{@page.name} to version from #{l version.created_at}?\nIt will remove current #{version.state} version." %> + +
+
+
+
+ <%= link_to 'Revert', revert_provider_admin_cms_template_version_path(@page, version), + class: 'action revert', + :'data-method' => :post, + :'data-confirm' => "Do you really want to revert #{@page.name} to version from #{l version.created_at}?\nIt will remove current #{version.state} version." %> +
+
+
+
From b12d618cb9d39f4880d5b2f8b21b317fd1e6f588 Mon Sep 17 00:00:00 2001 From: josemigallas Date: Mon, 10 Jul 2023 16:21:41 +0200 Subject: [PATCH 34/37] =?UTF-8?q?=F0=9F=A6=8B=20applies=20basic=20PF4=20to?= =?UTF-8?q?=20referrer=20filters=20widget?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/referrer_filters/_item.html.erb | 20 ++++++++++++++----- .../admin/referrer_filters/_widget.html.erb | 4 ++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/app/views/provider/admin/referrer_filters/_item.html.erb b/app/views/provider/admin/referrer_filters/_item.html.erb index cb90882857..e00b679298 100644 --- a/app/views/provider/admin/referrer_filters/_item.html.erb +++ b/app/views/provider/admin/referrer_filters/_item.html.erb @@ -1,7 +1,17 @@ - - <%= h referrer_filter.value %> - - <%= delete_button_for provider_admin_application_referrer_filter_path(cinstance, referrer_filter), :remote => true %> + + + <%= h referrer_filter.value %> + + +
+
+
+
+ <%= delete_button_for provider_admin_application_referrer_filter_path(cinstance, referrer_filter), :remote => true %> +
+
+
+
diff --git a/app/views/provider/admin/referrer_filters/_widget.html.erb b/app/views/provider/admin/referrer_filters/_widget.html.erb index 67b9a70643..178add6242 100644 --- a/app/views/provider/admin/referrer_filters/_widget.html.erb +++ b/app/views/provider/admin/referrer_filters/_widget.html.erb @@ -8,7 +8,7 @@ <%= context.enabled do %> <%= form_tag provider_admin_application_referrer_filters_path(cinstance), :class => 'remote' do %> <%= text_field_tag :referrer_filter %> - + <% end %> <% end %> @@ -18,7 +18,7 @@ <% end %> <% end %> - +
<% cinstance.referrer_filters.each do |filter| %> <%= render 'provider/admin/referrer_filters/item', :cinstance => cinstance, :referrer_filter => filter %> <% end %> From 9e5bc53e19ba6875c085d7c17b319384aa40a4bf Mon Sep 17 00:00:00 2001 From: josemigallas Date: Thu, 6 Jul 2023 13:19:54 +0200 Subject: [PATCH 35/37] =?UTF-8?q?=F0=9F=94=A5=20removes=20inconsistent=20"?= =?UTF-8?q?back"=20button=20and=20legacy=20table=20in=20Invoice=20Edit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/buyers/invoices/edit.html.slim | 5 ----- app/views/finance/provider/invoices/edit.html.slim | 5 ----- 2 files changed, 10 deletions(-) diff --git a/app/views/buyers/invoices/edit.html.slim b/app/views/buyers/invoices/edit.html.slim index 192c0fb2c7..845d17eca9 100644 --- a/app/views/buyers/invoices/edit.html.slim +++ b/app/views/buyers/invoices/edit.html.slim @@ -3,11 +3,6 @@ = render '/finance/provider/shared/invoice_title', invoice: @invoice -table class="invoice" - caption - ' Edit Details - = link_to 'cancel', :back, class: "next" - div class="wide" = semantic_form_for @invoice, url: admin_buyers_account_invoice_path(@account, @invoice.id) do |invoice| diff --git a/app/views/finance/provider/invoices/edit.html.slim b/app/views/finance/provider/invoices/edit.html.slim index 104ec9420e..64aa678e91 100644 --- a/app/views/finance/provider/invoices/edit.html.slim +++ b/app/views/finance/provider/invoices/edit.html.slim @@ -1,10 +1,5 @@ = render '/finance/provider/shared/invoice_title', invoice: @invoice -table class="invoice" - caption - ' Edit Details - = link_to 'cancel', :back, class: "next" - div class="wide" = semantic_form_for @invoice, url: admin_finance_invoice_path(@invoice.id) do |invoice| From 9969351f2d8f921dde31774f30edddaedcf7cda0 Mon Sep 17 00:00:00 2001 From: josemigallas Date: Tue, 11 Jul 2023 11:50:55 +0200 Subject: [PATCH 36/37] =?UTF-8?q?=F0=9F=A7=B9=20cleans=20up=20lefover=20.d?= =?UTF-8?q?ata=20table=20class?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/javascripts/bulk_operations.js | 8 ++++---- app/assets/stylesheets/provider/_buttons.scss | 6 +++--- app/assets/stylesheets/provider/_colorbox.scss | 4 ---- app/assets/stylesheets/provider/_liquid_docs.scss | 4 ---- app/assets/stylesheets/provider/_search.scss | 2 +- app/assets/stylesheets/provider/admin/_account.scss | 5 ----- app/assets/stylesheets/provider/admin/cms/_sections.scss | 2 -- app/views/admin/api_docs/base/index.html.slim | 2 +- app/views/buyers/accounts/_search_results.html.slim | 4 ++-- app/views/buyers/users/index.html.slim | 5 ++--- app/views/provider/admin/cms/portlets/pick.html.erb | 2 +- .../applications/bulk_operations_steps.rb | 2 +- features/step_definitions/table_steps.rb | 2 +- 13 files changed, 16 insertions(+), 32 deletions(-) diff --git a/app/assets/javascripts/bulk_operations.js b/app/assets/javascripts/bulk_operations.js index 02e91a52f4..8247d5c2cb 100644 --- a/app/assets/javascripts/bulk_operations.js +++ b/app/assets/javascripts/bulk_operations.js @@ -1,7 +1,7 @@ ;(function($) { var handle_checkboxes = function () { - var table = $('table.data'), + var table = $('table'), selectTotalEntries = $('#bulk-operations a.select-total-entries'); // select all checkbox @@ -61,7 +61,7 @@ $(this).wrapInner('
+
diff --git a/features/step_definitions/applications/bulk_operations_steps.rb b/features/step_definitions/applications/bulk_operations_steps.rb index 4f43278b44..151ede76b9 100644 --- a/features/step_definitions/applications/bulk_operations_steps.rb +++ b/features/step_definitions/applications/bulk_operations_steps.rb @@ -31,7 +31,7 @@ def check_or_uncheck_selected_row value, text = nil end When /^I (un)?check select in table header$/ do |un| - within 'table.data thead' do + within 'table.pf-c-table thead' do check_or_uncheck_selected_row un end end diff --git a/features/step_definitions/table_steps.rb b/features/step_definitions/table_steps.rb index 223799f54b..ce0d566d57 100644 --- a/features/step_definitions/table_steps.rb +++ b/features/step_definitions/table_steps.rb @@ -2,7 +2,7 @@ Then "I/they should see (the )following table:" do |expected| ThreeScale::Deprecation.warn "Detected old table. Move to PF4 and use step 'I should see the following table:'" - table = extract_table('table.data', 'tr:not(.search)', 'td:not(.select), th:not(.select)') + table = extract_table('table.pf-c-table', 'tr:not(.search)', 'td:not(.select), th:not(.select)') # strip html entities and non letter, space or number characters #table.first.map!{ |n| n.gsub(/(&#\d+;)|[^a-z\d\s]/i, '').strip } From ee6afab4bc84146c6327f16e09a88bf2eb906cab Mon Sep 17 00:00:00 2001 From: josemigallas Date: Mon, 17 Jul 2023 11:26:08 +0200 Subject: [PATCH 37/37] =?UTF-8?q?=F0=9F=92=84=20fixes=20utilization=20leve?= =?UTF-8?q?l=20font=20color?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/api/alerts/index.html.erb | 2 +- app/views/api/services/show.html.slim | 2 +- .../admin/applications/_utilization.html.erb | 10 +++++----- test/integration/utilization_test.rb | 20 +++++++++---------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app/views/api/alerts/index.html.erb b/app/views/api/alerts/index.html.erb index ce9a15ebbb..d91f3e2388 100644 --- a/app/views/api/alerts/index.html.erb +++ b/app/views/api/alerts/index.html.erb @@ -53,7 +53,7 @@ -
Portlet <%= h alert.message %> + <%= colorize_utilization(alert.level) %> diff --git a/app/views/api/services/show.html.slim b/app/views/api/services/show.html.slim index b90b582783..0f4017bd88 100644 --- a/app/views/api/services/show.html.slim +++ b/app/views/api/services/show.html.slim @@ -39,7 +39,7 @@ section class="service-widget" h2 = link_to 'Latest alerts', admin_service_alerts_path(service), :title => 'Show all limit alerts for this service' ol.latest-alerts = list_items_or_empty current_account.alerts.by_service(service).latest, 'There are no alerts.' do |alert| - li.item + li.item.utilization = link_to_cinstance_or_deleted(alert.cinstance) | at = l alert.timestamp diff --git a/app/views/provider/admin/applications/_utilization.html.erb b/app/views/provider/admin/applications/_utilization.html.erb index 3f513b7efb..6e373a446e 100644 --- a/app/views/provider/admin/applications/_utilization.html.erb +++ b/app/views/provider/admin/applications/_utilization.html.erb @@ -6,7 +6,7 @@ <% else %>

Overview of the current state of this application's limits

- +
@@ -38,11 +38,11 @@ percentage = "Inf" end %> - - <% end %> diff --git a/test/integration/utilization_test.rb b/test/integration/utilization_test.rb index 92a8efd6b9..aed31d0a5f 100644 --- a/test/integration/utilization_test.rb +++ b/test/integration/utilization_test.rb @@ -60,12 +60,12 @@ class UtilizationTest < ActionDispatch::IntegrationTest assert_equal 1, utilization.size - table = utilization.search("table[@class*='utilization']") + table = utilization.search('table') assert_equal 1, table.size - assert_equal 1*2, table.search("td[@class='above-100']").size - assert_equal 1*2, table.search("td[@class='above-80']").size - assert_equal 2*2, table.search("td[@class='above-0']").size - assert_equal 0*2, table.search("td[@class='infinity']").size + assert_equal 1*2, table.search("span[@class='above-100']").size + assert_equal 1*2, table.search("span[@class='above-80']").size + assert_equal 2*2, table.search("span[@class='above-0']").size + assert_equal 0*2, table.search("span[@class='infinity']").size end test 'application has metrics with one disabled over the limit' do @@ -83,12 +83,12 @@ class UtilizationTest < ActionDispatch::IntegrationTest assert_equal 1, utilization.size - table = utilization.search("table[@class*='utilization']") + table = utilization.search("table") assert_equal 1, table.size - assert_equal 0*2, table.search("td[@class='above-100']").size - assert_equal 1*2, table.search("td[@class='above-80']").size - assert_equal 2*2, table.search("td[@class='above-0']").size - assert_equal 1*2, table.search("td[@class='infinity']").size + assert_equal 0*2, table.search("span[@class='above-100']").size + assert_equal 1*2, table.search("span[@class='above-80']").size + assert_equal 2*2, table.search("span[@class='above-0']").size + assert_equal 1*2, table.search("span[@class='infinity']").size end private
Metric Name - <%= utilization %> + + <%= content_tag(:span, utilization, class: utilization_type) %> - <%= percentage %> + + <%= content_tag(:span, utilization, class: utilization_type) %>