mirror of
https://github.com/hashicorp/vault.git
synced 2025-09-20 13:21:14 +02:00
* build filter toolbar component * delete unused controllers * rename enum and move to client count utils * wire up filters to route query params * update test coverage * add support for appliedFilters from parent * update type of ns param * move lists to client-list page component
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import ActivityComponent from '../activity';
|
|
import { action } from '@ember/object';
|
|
import { cached } from '@glimmer/tracking';
|
|
|
|
import type { ClientFilterTypes, MountClients } from 'core/utils/client-count-utils';
|
|
|
|
export default class ClientsClientListPageComponent extends ActivityComponent {
|
|
@cached
|
|
get namespaceLabels() {
|
|
// TODO namespace list will be updated to come from the export data, not by_namespace from sys/internal/counters/activity
|
|
return this.args.activity.byNamespace.map((n) => n.label);
|
|
}
|
|
|
|
@cached
|
|
get mounts() {
|
|
// TODO same comment here
|
|
return this.args.activity.byNamespace.map((n) => n.mounts).flat();
|
|
}
|
|
|
|
@cached
|
|
get mountPaths() {
|
|
return [...new Set(this.mounts.map((m: MountClients) => m.label))];
|
|
}
|
|
|
|
@cached
|
|
get mountTypes() {
|
|
return [...new Set(this.mounts.map((m: MountClients) => m.mount_type))];
|
|
}
|
|
|
|
@action
|
|
handleFilter(filters: Record<ClientFilterTypes, string>) {
|
|
const { nsLabel, mountPath, mountType } = filters;
|
|
this.args.onFilterChange({ nsLabel, mountPath, mountType });
|
|
}
|
|
}
|