/** * 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; } export default class ClientsActivityComponent extends Component { @action handleFilter(filters: Record) { 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: '' }); } }