1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-21 14:29:40 +02:00

feat(helm): helm actions [r8s-259] (#715)

Co-authored-by: James Player <james.player@portainer.io>
Co-authored-by: Cara Ryan <cara.ryan@portainer.io>
Co-authored-by: stevensbkang <skan070@gmail.com>
This commit is contained in:
Ali 2025-05-13 22:15:04 +12:00 committed by GitHub
parent dfa32b6755
commit 4ee349bd6b
117 changed files with 4161 additions and 696 deletions

View file

@ -58,7 +58,7 @@ export interface Props<D extends DefaultType> extends AutomationTestingProps {
getRowId?(row: D): string;
isRowSelectable?(row: Row<D>): boolean;
emptyContentLabel?: string;
title?: string;
title?: React.ReactNode;
titleIcon?: IconProps['icon'];
titleId?: string;
initialTableState?: Partial<TableState>;
@ -71,6 +71,8 @@ export interface Props<D extends DefaultType> extends AutomationTestingProps {
noWidget?: boolean;
extendTableOptions?: (options: TableOptions<D>) => TableOptions<D>;
includeSearch?: boolean;
ariaLabel?: string;
id?: string;
}
export function Datatable<D extends DefaultType>({
@ -100,6 +102,8 @@ export function Datatable<D extends DefaultType>({
isServerSidePagination = false,
extendTableOptions = (value) => value,
includeSearch,
ariaLabel,
id,
}: Props<D> & PaginationProps) {
const pageCount = useMemo(
() => Math.ceil(totalCount / settings.pageSize),
@ -181,9 +185,14 @@ export function Datatable<D extends DefaultType>({
() => _.difference(selectedItems, filteredItems),
[selectedItems, filteredItems]
);
const { titleAriaLabel, contentAriaLabel } = getAriaLabels(
ariaLabel,
title,
titleId
);
return (
<Table.Container noWidget={noWidget} aria-label={title}>
<Table.Container noWidget={noWidget} aria-label={titleAriaLabel} id={id}>
<DatatableHeader
onSearchChange={handleSearchBarChange}
searchValue={settings.search}
@ -204,7 +213,7 @@ export function Datatable<D extends DefaultType>({
isLoading={isLoading}
onSortChange={handleSortChange}
data-cy={dataCy}
aria-label={`${title} table`}
aria-label={contentAriaLabel}
/>
<DatatableFooter
@ -239,6 +248,23 @@ export function Datatable<D extends DefaultType>({
}
}
function getAriaLabels(
titleAriaLabel?: string,
title?: ReactNode,
titleId?: string
) {
if (titleAriaLabel) {
return { titleAriaLabel, contentAriaLabel: `${titleAriaLabel} table` };
}
if (typeof title === 'string') {
return { titleAriaLabel: title, contentAriaLabel: `${title} table` };
}
if (titleId) {
return { titleAriaLabel: titleId, contentAriaLabel: `${titleId} table` };
}
return { titleAriaLabel: 'table', contentAriaLabel: 'table' };
}
function defaultRenderRow<D extends DefaultType>(
row: Row<D>,
highlightedItemId?: string