Skip to content

Commit

Permalink
Add Api tokens counters to support api token index page
Browse files Browse the repository at this point in the history
  • Loading branch information
CatalinVoineag committed Jan 22, 2025
1 parent 5e1dfca commit 288a443
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
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
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

0 comments on commit 288a443

Please sign in to comment.