mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-22 23:21:08 +02:00
* replace attribution charts with a table by month * update tests to include mount_type * fix another portion of tests that were missing secret sync stat and testing for old attribution charts * add tests for attribution table * add changelog and tidy * remove remaining todos * tidy * reset month query param in ce * fix tests missing month param * add margin to pagination in accordance to helios rec * remove query param, update change log, move table into own comp * remove commented code * remove month query params * tidy * update test mount paths * remove unused client attribution component * update tests
45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import ActivityComponent from '../activity';
|
|
import { service } from '@ember/service';
|
|
import { tracked } from '@glimmer/tracking';
|
|
import { action } from '@ember/object';
|
|
import { HTMLElementEvent } from 'vault/forms';
|
|
import { parseAPITimestamp } from 'core/utils/date-formatters';
|
|
import { formatTableData, TableData } from 'core/utils/client-count-utils';
|
|
import type FlagsService from 'vault/services/flags';
|
|
import type RouterService from '@ember/routing/router-service';
|
|
|
|
export default class ClientsOverviewPageComponent extends ActivityComponent {
|
|
@service declare readonly flags: FlagsService;
|
|
@service('app-router') declare readonly router: RouterService;
|
|
|
|
@tracked selectedMonth = '';
|
|
|
|
get hasAttributionData() {
|
|
// we hide attribution table when mountPath filter present
|
|
// or if there's no data
|
|
return !this.args.mountPath && this.totalUsageCounts.clients;
|
|
}
|
|
|
|
get months() {
|
|
return this.byMonthNewClients.map((m) => ({
|
|
display: parseAPITimestamp(m.timestamp, 'MMMM yyyy'),
|
|
value: m.month,
|
|
}));
|
|
}
|
|
|
|
get tableData(): TableData[] | undefined {
|
|
if (!this.selectedMonth) return undefined;
|
|
return formatTableData(this.byMonthNewClients, this.selectedMonth);
|
|
}
|
|
|
|
@action
|
|
selectMonth(e: HTMLElementEvent<HTMLInputElement>) {
|
|
this.selectedMonth = e.target.value;
|
|
}
|
|
}
|