Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Api tokens counters to support api token index page #10294

Merged
merged 3 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/controllers/support_interface/api_tokens_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ def index
VendorAPIToken.arel_table[:last_used_at].desc.nulls_last,
created_at: :desc,
)
@api_tokens_last_3_months_count = @api_tokens.where('last_used_at >= ?', 3.months.ago).count
CatalinVoineag marked this conversation as resolved.
Show resolved Hide resolved
end

def new
Expand Down
19 changes: 19 additions & 0 deletions app/views/support_interface/api_tokens/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@

<%= govuk_button_link_to 'Add a token', new_support_interface_api_token_path %>

<div class="govuk-grid-row">
<div class="govuk-grid-column-one-quarter">
<%= render SupportInterface::TileComponent.new(
count: @api_tokens.count,
label: 'API tokens issued',
colour: :blue,
href: '#not-connected',
) %>
</div>
<div class="govuk-grid-column-one-quarter">
<%= render SupportInterface::TileComponent.new(
count: @api_tokens_last_3_months_count,
label: 'API tokens used in the last 3 months',
colour: :blue,
href: '#not-synced',
) %>
</div>
</div>

<table class='govuk-table'>
<thead class='govuk-table__head'>
<tr class='govuk-table__row'>
Expand Down
Loading