vault/ui/tests/helpers/clients/client-count-selectors.ts
lane-wetmore 9c8d8e8013
UI: Update Enterprise Client Count Datepicker (#30349)
* date picker changes (mostly) for ent client counts

* Move edit modal button + padding

* only show start time in dropdown and add changelog

* remove unused variable and update toggle width

* remove unnecessary period end dates

* tidy

* update tests

* Update changelog/30349.txt

Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>

* improve date logic

* add export button back in, re-arrange header, update dropdown

* update when date is shown

* add default for retention months

* update tests and remove unnecessary tests

* account for retention months that are not whole periods

* update logic to show end date on export modal

* update exported file name

---------

Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>
2025-05-01 11:42:58 -05:00

58 lines
2.4 KiB
TypeScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
// TODO: separate nested into distinct exported consts
export const CLIENT_COUNT = {
counts: {
description: '[data-test-counts-description]',
configDisabled: '[data-test-counts-disabled]',
namespaces: '[data-test-counts-namespaces]',
mountPaths: '[data-test-counts-auth-mounts]',
startDiscrepancy: '[data-test-counts-start-discrepancy]',
},
dateRange: {
dropdownOption: (idx = 0) => `[data-test-date-range-billing-start="${idx}"]`,
dateDisplay: (name: string) => (name ? `[data-test-date-range="${name}"]` : '[data-test-date-range]'),
edit: '[data-test-date-range-edit]',
editModal: '[data-test-date-range-edit-modal]',
editDate: (name: string) => `[data-test-date-edit="${name}"]`,
reset: '[data-test-date-edit="reset"]',
defaultRangeAlert: '[data-test-range-default-alert]',
validation: '[data-test-date-range-validation]',
},
statText: (label: string) => `[data-test-stat-text="${label}"]`,
statTextValue: (label: string) =>
label ? `[data-test-stat-text="${label}"] .stat-value` : '[data-test-stat-text]',
usageStats: (title: string) => `[data-test-usage-stats="${title}"]`,
attributionBlock: (type: string) =>
type ? `[data-test-clients-attribution="${type}"]` : '[data-test-clients-attribution]',
filterBar: '[data-test-clients-filter-bar]',
nsFilter: '#namespace-search-select',
mountFilter: '#mounts-search-select',
selectedAuthMount: 'div#mounts-search-select [data-test-selected-option] div',
selectedNs: 'div#namespace-search-select [data-test-selected-option] div',
upgradeWarning: '[data-test-clients-upgrade-warning]',
exportButton: '[data-test-export-button]',
};
export const CHARTS = {
// container
container: (title: string) => `[data-test-chart-container="${title}"]`,
timestamp: '[data-test-chart-container-timestamp]',
legend: '[data-test-chart-container-legend]',
legendLabel: (nth: number) => `.legend-label:nth-child(${nth * 2})`, // nth * 2 accounts for dots in legend
// chart elements
chart: (title: string) => `[data-test-chart="${title}"]`,
hover: (area: string) => `[data-test-interactive-area="${area}"]`,
table: '[data-test-underlying-data]',
tooltip: '[data-test-tooltip]',
verticalBar: '[data-test-vertical-bar]',
xAxis: '[data-test-x-axis]',
yAxis: '[data-test-y-axis]',
xAxisLabel: '[data-test-x-axis] text',
plotPoint: '[data-test-plot-point]',
};