mirror of
https://github.com/portainer/portainer.git
synced 2025-07-20 05:49:40 +02:00
Some checks are pending
ci / build_images (map[arch:amd64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
ci / build_images (map[arch:arm platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:s390x platform:linux version:]) (push) Waiting to run
ci / build_manifests (push) Blocked by required conditions
/ triage (push) Waiting to run
Lint / Run linters (push) Waiting to run
Test / test-client (push) Waiting to run
Test / test-server (map[arch:amd64 platform:linux]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
Test / test-server (map[arch:arm64 platform:linux]) (push) Waiting to run
63 lines
1.3 KiB
TypeScript
63 lines
1.3 KiB
TypeScript
import { ReactNode } from 'react';
|
|
|
|
import { AutomationTestingProps } from '@/types';
|
|
|
|
import { IconProps } from '@@/Icon';
|
|
|
|
import { SearchBar } from './SearchBar';
|
|
import { Table } from './Table';
|
|
|
|
type Props = {
|
|
title?: string;
|
|
titleIcon?: IconProps['icon'];
|
|
searchValue: string;
|
|
onSearchChange(value: string): void;
|
|
renderTableSettings?(): ReactNode;
|
|
renderTableActions?(): ReactNode;
|
|
description?: ReactNode;
|
|
titleId?: string;
|
|
} & AutomationTestingProps;
|
|
|
|
export function DatatableHeader({
|
|
onSearchChange,
|
|
renderTableActions,
|
|
renderTableSettings,
|
|
searchValue,
|
|
title,
|
|
titleIcon,
|
|
description,
|
|
titleId,
|
|
'data-cy': dataCy,
|
|
}: Props) {
|
|
if (!title) {
|
|
return null;
|
|
}
|
|
|
|
const searchBar = (
|
|
<SearchBar
|
|
value={searchValue}
|
|
onChange={onSearchChange}
|
|
data-cy={`${dataCy}-search-input`}
|
|
/>
|
|
);
|
|
const tableActions = !!renderTableActions && (
|
|
<Table.Actions>{renderTableActions()}</Table.Actions>
|
|
);
|
|
const tableTitleSettings = !!renderTableSettings && (
|
|
<Table.TitleActions>{renderTableSettings()}</Table.TitleActions>
|
|
);
|
|
|
|
return (
|
|
<Table.Title
|
|
id={titleId}
|
|
label={title}
|
|
icon={titleIcon}
|
|
description={description}
|
|
data-cy={dataCy}
|
|
>
|
|
{searchBar}
|
|
{tableActions}
|
|
{tableTitleSettings}
|
|
</Table.Title>
|
|
);
|
|
}
|