vault/ui/app/components/clients/activity.ts
Vault Automation c2823e96eb
UI: Render client export table in "Client list" tab (#8880) (#9071)
* render export activity in table by client type

* refactor filter toolbar to apply filters when selected

* finish filter toolbar refactor

* finish building client-list page

* remaing test updates from the filter-toolbar refactor

* WIP tests

* finish tests for export tab!

* add test for bar chart colors

* reveal client list tab

* add changelog

* filter root namespace on empty string or "root"

Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>
2025-09-03 00:24:00 +00:00

36 lines
1.2 KiB
TypeScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
// base component for counts child routes that can be extended as needed
// contains getters that filter and extract data from activity model for use in charts
import Component from '@glimmer/component';
import { action } from '@ember/object';
import type ClientsActivityModel from 'vault/models/clients/activity';
import type { ActivityExportData, ClientFilterTypes } from 'core/utils/client-count-utils';
/* This component does not actually render and is the base class to house
shared computations between the Clients::Page::Overview and Clients::Page::List components */
export interface Args {
activity: ClientsActivityModel;
exportData: ActivityExportData[];
onFilterChange: CallableFunction;
filterQueryParams: Record<ClientFilterTypes, string>;
}
export default class ClientsActivityComponent extends Component<Args> {
@action
handleFilter(filters: Record<ClientFilterTypes, string>) {
const { namespace_path, mount_path, mount_type } = filters;
this.args.onFilterChange({ namespace_path, mount_path, mount_type });
}
@action
resetFilters() {
this.handleFilter({ namespace_path: '', mount_path: '', mount_type: '' });
}
}