-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3835 from 3scale/THREESCALE-9807_analytics_errors…
…_toolbar 🦋 Update Product Integration Errors
- Loading branch information
Showing
11 changed files
with
106 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# frozen_string_literal: true | ||
|
||
class Api::ErrorsIndexPresenter | ||
include ::Draper::ViewHelpers | ||
|
||
def initialize(errors:, service:) | ||
@errors = errors | ||
@service = service | ||
end | ||
|
||
attr_reader :errors, :service | ||
|
||
def empty_state? | ||
errors.empty? | ||
end | ||
|
||
def toolbar_props | ||
{ | ||
totalEntries: errors.total_entries, | ||
pageEntries: errors.length, | ||
actions: [{ | ||
variant: :danger, | ||
label: I18n.t('api.errors.index.toolbar.purge.title'), | ||
href: h.admin_service_errors_path(service), | ||
'data-confirm': I18n.t('api.errors.index.toolbar.purge.confirm'), | ||
'data-method': :delete, | ||
}], | ||
} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
- content_for :page_header_title, t('.title', service: @service.name) | ||
- content_for :page_header_body, t('.body_html', href: provider_admin_api_docs_path(anchor: '/service_management_api')) | ||
|
||
- if presenter.empty_state? | ||
= render partial: 'shared/empty_state', locals: { icon: 'check-circle', | ||
title: t('.empty_state.title'), | ||
body: t('.empty_state.body') } | ||
- else | ||
- content_for :javascripts do | ||
= javascript_packs_with_chunks_tag 'table_toolbar' | ||
|
||
table class="pf-c-table pf-m-grid-lg" role="grid" aria-label="Integration errors table" data-toolbar-props=presenter.toolbar_props.to_json | ||
thead | ||
tr role="row" | ||
th role="columnheader" scope="col" Time (UTC) | ||
th role="columnheader" scope="col" Error | ||
td | ||
|
||
tbody role="rowgroup" | ||
- presenter.errors.each do |error| | ||
tr role="row" | ||
td role="cell" data-label="Time (UTC)" = error.timestamp | ||
td role="cell" data-label="Error" = h error.message | ||
td |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# frozen_string_literal: true | ||
|
||
Given "{product} has the following integration errors:" do |product, table| | ||
transform_integration_errors_table(table) | ||
errors = table.hashes.map { |error| ThreeScale::Core::ServiceError.new(error) } | ||
@purge = states('purge').starts_as('pending') | ||
|
||
ThreeScale::Core::ServiceError.stubs(:load_all) | ||
.with(product.id, any_parameters) | ||
.when(@purge.is('pending')) | ||
.returns(ThreeScale::Core::APIClient::Collection.new(errors)) | ||
end | ||
|
||
Given "they want to empty the integration errors table" do | ||
product_id = @product.id | ||
|
||
ThreeScale::Core::ServiceError.stubs(:delete_all) | ||
.with(product_id) | ||
.then(@purge.is('done')) | ||
.returns(true) | ||
.once | ||
|
||
ThreeScale::Core::ServiceError.stubs(:load_all) | ||
.with(product_id, any_parameters) | ||
.when(@purge.is('done')) | ||
.returns(ThreeScale::Core::APIClient::Collection.new([])) | ||
.once | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters