diff --git a/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/databases/_components/DatabasesTableColumns.component.tsx b/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/databases/_components/DatabasesTableColumns.component.tsx
index ce6a01dc0230..61eb461809c6 100644
--- a/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/databases/_components/DatabasesTableColumns.component.tsx
+++ b/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/databases/_components/DatabasesTableColumns.component.tsx
@@ -2,7 +2,6 @@ import { ColumnDef } from '@tanstack/react-table';
import { MoreHorizontal } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { Button } from '@/components/ui/button';
-import { SortableHeader } from '@/components/ui/data-table';
import {
DropdownMenu,
DropdownMenuContent,
@@ -17,6 +16,8 @@ import {
} from '@/components/ui/tooltip';
import * as database from '@/types/cloud/project/database';
import { useServiceData } from '../../Service.context';
+import { MENU_COLUMN_ID } from '@/components/data-table/DataTable';
+import DataTable from '@/components/data-table';
interface DatabasesTableColumnsProps {
onDeleteClick: (db: database.service.Database) => void;
@@ -30,12 +31,14 @@ export const getColumns = ({ onDeleteClick }: DatabasesTableColumnsProps) => {
{
id: 'name',
header: ({ column }) => (
-
),
accessorFn: (row) => row.name,
},
{
- id: 'actions',
+ id: MENU_COLUMN_ID,
cell: ({ row }) => {
return (
diff --git a/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/integrations/Integrations.page.tsx b/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/integrations/Integrations.page.tsx
index 1634a494b6df..b25ef7502703 100644
--- a/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/integrations/Integrations.page.tsx
+++ b/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/integrations/Integrations.page.tsx
@@ -5,7 +5,7 @@ import { Outlet, useNavigate } from 'react-router-dom';
import BreadcrumbItem from '@/components/breadcrumb/BreadcrumbItem.component';
import * as database from '@/types/cloud/project/database';
import { useServiceData } from '../Service.context';
-import { DataTable } from '@/components/ui/data-table';
+import DataTable from '@/components/data-table';
import { Button } from '@/components/ui/button';
import { POLLING } from '@/configuration/polling.constants';
import { getColumns } from './_components/IntegrationListColumns.component';
@@ -87,7 +87,11 @@ const Integrations = () => {
)}
{!isLoading ? (
-
+
) : (
diff --git a/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/integrations/_components/IntegrationListColumns.component.tsx b/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/integrations/_components/IntegrationListColumns.component.tsx
index 46a93f440525..abb3ddd1966d 100644
--- a/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/integrations/_components/IntegrationListColumns.component.tsx
+++ b/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/integrations/_components/IntegrationListColumns.component.tsx
@@ -2,7 +2,6 @@ import { ColumnDef } from '@tanstack/react-table';
import { MoreHorizontal } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { Button } from '@/components/ui/button';
-import { SortableHeader } from '@/components/ui/data-table';
import {
DropdownMenu,
DropdownMenuContent,
@@ -14,6 +13,7 @@ import { useServiceData } from '../../Service.context';
import UserStatusBadge from '../../users/_components/UserStatusBadge.component';
import { IntegrationWithServices } from '../Integrations.page';
import IntegrationServiceLink from './IntegrationServiceLink.component';
+import DataTable from '@/components/data-table';
interface IntegrationsTableColumnsProps {
onDeleteClick: (db: database.service.Integration) => void;
@@ -29,7 +29,9 @@ export const getColumns = ({
{
id: 'source',
header: ({ column }) => (
-
{t('tableHeadSource')}
+
+ {t('tableHeadSource')}
+
),
accessorFn: (row) => row.source.description,
cell: ({ row }) => (
@@ -39,9 +41,9 @@ export const getColumns = ({
{
id: 'destination',
header: ({ column }) => (
-
+
{t('tableHeadDestination')}
-
+
),
accessorFn: (row) => row.destination.description,
cell: ({ row }) => (
@@ -51,14 +53,18 @@ export const getColumns = ({
{
id: 'type',
header: ({ column }) => (
-
{t('tableHeadType')}
+
+ {t('tableHeadType')}
+
),
accessorFn: (row) => row.type,
},
{
id: 'status',
header: ({ column }) => (
-
{t('tableHeadStatus')}
+
+ {t('tableHeadStatus')}
+
),
accessorFn: (row) => row.status,
cell: ({ row }) =>
,
diff --git a/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/namespaces/Namespace.page.tsx b/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/namespaces/Namespace.page.tsx
index 670484429f2e..f487364912c7 100644
--- a/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/namespaces/Namespace.page.tsx
+++ b/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/namespaces/Namespace.page.tsx
@@ -5,7 +5,6 @@ import { Plus } from 'lucide-react';
import { Outlet, useNavigate } from 'react-router-dom';
import * as database from '@/types/cloud/project/database';
import { Button } from '@/components/ui/button';
-import { DataTable } from '@/components/ui/data-table';
import { useUserActivityContext } from '@/contexts/UserActivityContext';
import { useServiceData } from '../Service.context';
@@ -14,6 +13,7 @@ import { getColumns } from './_components/NamespacesTableColumns.component';
import { NAMESPACES_CONFIG } from './_components/formNamespace/namespace.constants';
import BreadcrumbItem from '@/components/breadcrumb/BreadcrumbItem.component';
import { useGetNamespaces } from '@/hooks/api/database/namespace/useGetNamespaces.hook';
+import DataTable from '@/components/data-table';
export function breadcrumb() {
return (
@@ -75,7 +75,7 @@ const Namespaces = () => {
)}
{namespacesQuery.isSuccess ? (
-
void;
@@ -40,23 +40,27 @@ export const getColumns = ({
{
id: 'name',
header: ({ column }) => (
- {t('tableHeadName')}
+
+ {t('tableHeadName')}
+
),
accessorFn: (row) => row.name,
},
{
id: 'type',
header: ({ column }) => (
- {t('tableHeadType')}
+
+ {t('tableHeadType')}
+
),
accessorFn: (row) => row.type,
},
{
id: 'retention',
header: ({ column }) => (
-
+
{t('tableHeadRetentionTime')}
-
+
),
accessorFn: (row) =>
durationStringToHuman(row.retention.periodDuration, dateLocale),
@@ -64,9 +68,9 @@ export const getColumns = ({
{
id: 'resolution',
header: ({ column }) => (
-
+
{t('tableHeadResolution')}
-
+
),
accessorFn: (row) => durationStringToHuman(row.resolution, dateLocale),
},
diff --git a/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/pools/Pools.page.tsx b/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/pools/Pools.page.tsx
index 99f27cbacedf..d399e351b521 100644
--- a/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/pools/Pools.page.tsx
+++ b/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/pools/Pools.page.tsx
@@ -1,10 +1,10 @@
import { useTranslation } from 'react-i18next';
import { ColumnDef } from '@tanstack/react-table';
-import { useEffect, useState } from 'react';
+import { useEffect, useMemo, useState } from 'react';
import { Outlet, useNavigate } from 'react-router-dom';
import { Plus } from 'lucide-react';
import { Button } from '@/components/ui/button';
-import { DataTable } from '@/components/ui/data-table';
+import DataTable from '@/components/data-table';
import BreadcrumbItem from '@/components/breadcrumb/BreadcrumbItem.component';
import { useServiceData } from '../Service.context';
import { POLLING } from '@/configuration/polling.constants';
@@ -39,9 +39,6 @@ const Pools = () => {
'pci-databases-analytics/services/service/pools',
);
const { projectId, service } = useServiceData();
- const [connectionPoolListWithData, setConnectionPoolListWithData] = useState<
- ConnectionPoolWithData[]
- >([]);
const { isUserActive } = useUserActivityContext();
const connectionPoolsQuery = useGetConnectionPools(
projectId,
@@ -63,7 +60,7 @@ const Pools = () => {
refetchInterval: isUserActive && POLLING.USERS,
});
- useEffect(() => {
+ const connectionPoolListWithData = useMemo(() => {
if (
!(
connectionPoolsQuery.isSuccess &&
@@ -71,18 +68,23 @@ const Pools = () => {
databasesQuery.isSuccess
)
)
- return;
- const cpListWithData: ConnectionPoolWithData[] = connectionPoolsQuery.data.map(
- (cp) => ({
- ...cp,
- user: cp.userId
- ? usersQuery.data.find((user) => user.id === cp.userId)
- : null,
- database: databasesQuery.data.find((db) => db.id === cp.databaseId),
- }),
- );
- setConnectionPoolListWithData(cpListWithData);
- }, [connectionPoolsQuery.data, usersQuery.data, databasesQuery.data]);
+ return [];
+
+ return connectionPoolsQuery.data.map((cp) => ({
+ ...cp,
+ user: cp.userId
+ ? usersQuery.data.find((user) => user.id === cp.userId)
+ : null,
+ database: databasesQuery.data.find((db) => db.id === cp.databaseId),
+ }));
+ }, [
+ connectionPoolsQuery.isSuccess,
+ connectionPoolsQuery.data,
+ usersQuery.isSuccess,
+ usersQuery.data,
+ databasesQuery.isSuccess,
+ databasesQuery.data,
+ ]);
const columns: ColumnDef[] = getColumns({
onGetInformationClick: (pool: ConnectionPoolWithData) =>
@@ -117,7 +119,7 @@ const Pools = () => {
)}
{connectionPoolsQuery.isSuccess && connectionPoolListWithData ? (
- {
}));
vi.mock('@/data/api/database/user.api', () => ({
- getUsers: vi.fn(() => [mockedUser]),
+ getUsers: vi.fn(() => [mockedDatabaseUser]),
}));
vi.mock('@/data/api/database/certificate.api', () => ({
@@ -107,6 +109,9 @@ describe('Connection pool page', () => {
});
it('renders and shows skeletons while loading', async () => {
+ vi.mocked(poolsApi.getConnectionPools).mockImplementationOnce(() => {
+ throw apiErrorMock;
+ });
render(, { wrapper: RouterWithQueryClientWrapper });
await waitFor(() => {
expect(
diff --git a/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/pools/_components/PoolsTableColumns.component.tsx b/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/pools/_components/PoolsTableColumns.component.tsx
index 132d6487ea16..5f48740fe49e 100644
--- a/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/pools/_components/PoolsTableColumns.component.tsx
+++ b/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/pools/_components/PoolsTableColumns.component.tsx
@@ -2,7 +2,7 @@ import { useTranslation } from 'react-i18next';
import { ColumnDef } from '@tanstack/react-table';
import { MoreHorizontal } from 'lucide-react';
-import { SortableHeader } from '@/components/ui/data-table';
+import DataTable from '@/components/data-table';
import {
Tooltip,
TooltipProvider,
@@ -38,39 +38,45 @@ export const getColumns = ({
{
id: 'name',
header: ({ column }) => (
- {t('tableHeadName')}
+
+ {t('tableHeadName')}
+
),
accessorFn: (row) => row.name,
},
{
id: 'database',
header: ({ column }) => (
-
+
{t('tableHeadDatabase')}
-
+
),
accessorFn: (row) => row.database.name,
},
{
id: 'mode',
header: ({ column }) => (
- {t('tableHeadMode')}
+
+ {t('tableHeadMode')}
+
),
accessorFn: (row) => row.mode,
},
{
id: 'size',
header: ({ column }) => (
- {t('tableHeadSize')}
+
+ {t('tableHeadSize')}
+
),
accessorFn: (row) => row.size,
},
{
id: 'username',
header: ({ column }) => (
-
+
{t('tableHeadUsername')}
-
+
),
accessorFn: (row) => (row.user ? row.user.username : ''),
},
diff --git a/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/queries/_components/CurrentQueries.component.tsx b/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/queries/_components/CurrentQueries.component.tsx
index 63e809ee65a8..3d627b4b4179 100644
--- a/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/queries/_components/CurrentQueries.component.tsx
+++ b/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/queries/_components/CurrentQueries.component.tsx
@@ -2,7 +2,7 @@ import { ColumnDef } from '@tanstack/react-table';
import { useTranslation } from 'react-i18next';
import { useState } from 'react';
import { useServiceData } from '../../Service.context';
-import { DataTable } from '@/components/ui/data-table';
+import DataTable from '@/components/data-table';
import * as database from '@/types/cloud/project/database';
import { getColumns } from './CurrentQueriesTableColumns.component';
import { useToast } from '@/components/ui/use-toast';
@@ -128,7 +128,11 @@ const CurrentQueries = () => {
diff --git a/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/queries/_components/CurrentQueriesTableColumns.component.tsx b/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/queries/_components/CurrentQueriesTableColumns.component.tsx
index 34eb6af2e968..5b8b1c7952d8 100644
--- a/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/queries/_components/CurrentQueriesTableColumns.component.tsx
+++ b/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/queries/_components/CurrentQueriesTableColumns.component.tsx
@@ -1,7 +1,7 @@
import { useTranslation } from 'react-i18next';
import { MoreHorizontal } from 'lucide-react';
import { ColumnDef } from '@tanstack/react-table';
-import { SortableHeader } from '@/components/ui/data-table';
+import DataTable from '@/components/data-table';
import { ExpandableSqlQuery } from './ExpandableSqlQuery.component';
import {
DropdownMenu,
@@ -27,9 +27,9 @@ export const getColumns = ({
{
id: 'query',
header: ({ column }) => (
-
+
{t('tableCurrentQueriesHeadName')}
-
+
),
accessorFn: (row) => row.query,
cell: ({ row }) =>
,
@@ -37,45 +37,45 @@ export const getColumns = ({
{
id: 'pid',
header: ({ column }) => (
-
+
{t('tableCurrentQueriesHeadPid')}
-
+
),
accessorFn: (row) => row.pid,
},
{
id: 'queryDuration',
header: ({ column }) => (
-
+
{t('tableCurrentQueriesHeadQueryDuration')}
-
+
),
accessorFn: (row) => row.queryDuration,
},
{
id: 'databaseName',
header: ({ column }) => (
-
+
{t('tableCurrentQueriesHeadDatabaseName')}
-
+
),
accessorFn: (row) => row.databaseName,
},
{
id: 'clientIp',
header: ({ column }) => (
-
+
{t('tableCurrentQueriesHeadClientIp')}
-
+
),
accessorFn: (row) => row.clientIp,
},
{
id: 'applicationName',
header: ({ column }) => (
-
+
{t('tableCurrentQueriesHeadApplicationName')}
-
+
),
accessorFn: (row) => row.applicationName,
},
diff --git a/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/queries/_components/QueryStatistics.component.tsx b/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/queries/_components/QueryStatistics.component.tsx
index c1bd4fa9ff34..fd49663f01ad 100644
--- a/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/queries/_components/QueryStatistics.component.tsx
+++ b/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/queries/_components/QueryStatistics.component.tsx
@@ -2,7 +2,7 @@ import { ColumnDef } from '@tanstack/react-table';
import { useTranslation } from 'react-i18next';
import { RotateCcw } from 'lucide-react';
import { useServiceData } from '../../Service.context';
-import { DataTable } from '@/components/ui/data-table';
+import DataTable from '@/components/data-table';
import * as database from '@/types/cloud/project/database';
import { Button } from '@/components/ui/button';
import { useToast } from '@/components/ui/use-toast';
@@ -72,7 +72,7 @@ const QueryStatistics = () => {
)}
{queryStatisticsQuery.isSuccess ? (
-
{
{
id: 'query',
header: ({ column }) => (
-
+
{t('tableQueryStatisticsHeadName')}
-
+
),
accessorFn: (row) => row.query,
cell: ({ row }) => ,
@@ -22,36 +22,36 @@ export const getColumns = () => {
{
id: 'rows',
header: ({ column }) => (
-
+
{t('tableQueryStatisticsHeadRows')}
-
+
),
accessorFn: (row) => row.rows,
},
{
id: 'calls',
header: ({ column }) => (
-
+
{t('tableQueryStatisticsHeadCalls')}
-
+
),
accessorFn: (row) => row.calls,
},
{
id: 'minTime',
header: ({ column }) => (
-
+
{t('tableQueryStatisticsHeadMinTime')}
-
+
),
accessorFn: (row) => row.minTime.toFixed(2),
},
{
id: 'maxTime',
header: ({ column }) => (
-
+
{t('tableQueryStatisticsHeadMaxTime')}
-
+
),
accessorFn: (row) => row.maxTime.toFixed(2),
},
@@ -59,9 +59,9 @@ export const getColumns = () => {
{
id: 'meamTime',
header: ({ column }) => (
-
+
{t('tableQueryStatisticsHeadMeanTime')}
-
+
),
accessorFn: (row) => row.meanTime.toFixed(2),
},
@@ -69,18 +69,18 @@ export const getColumns = () => {
{
id: 'stdDevTime',
header: ({ column }) => (
-
+
{t('tableQueryStatisticsHeadStdDevTime')}
-
+
),
accessorFn: (row) => row.stddevTime.toFixed(2),
},
{
id: 'totalTime',
header: ({ column }) => (
-
+
{t('tableQueryStatisticsHeadTotalTime')}
-
+
),
accessorFn: (row) => row.totalTime.toFixed(2),
},
diff --git a/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/users/Users.page.tsx b/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/users/Users.page.tsx
index 49ac4efa778a..3c9ad186d6f8 100644
--- a/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/users/Users.page.tsx
+++ b/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/users/Users.page.tsx
@@ -9,9 +9,11 @@ import { GenericUser } from '@/data/api/database/user.api';
import * as database from '@/types/cloud/project/database';
import { getColumns } from './_components/UsersTableColumns.component';
import { Button } from '@/components/ui/button';
-import { DataTable } from '@/components/ui/data-table';
+import DataTable from '@/components/data-table';
import { useUserActivityContext } from '@/contexts/UserActivityContext';
import { POLLING } from '@/configuration/polling.constants';
+import { FilterCategories } from '@/lib/filters';
+import UserStatusBadge from './_components/UserStatusBadge.component';
export function breadcrumb() {
return (
@@ -53,32 +55,64 @@ const Users = () => {
},
});
+ const filters = [
+ {
+ id: 'username',
+ label: "Nom d'utilisateur",
+ comparators: FilterCategories.String,
+ },
+ {
+ id: 'createdAt',
+ label: 'Date de création',
+ comparators: FilterCategories.Date,
+ },
+ {
+ id: 'status',
+ label: 'Statut',
+ comparators: FilterCategories.Options,
+ options: Object.values(database.StatusEnum).map((value) => ({
+ label: ,
+ value,
+ })),
+ },
+ ];
+
return (
<>
{t('title')}
- {service.capabilities.users?.create && (
-
- )}
-
{usersQuery.isSuccess ? (
-
+
+
+ {service.capabilities.users?.create && (
+
+
+
+ )}
+
+
+
+
+
+
+
) : (
-
-
-
+
)}
diff --git a/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/users/Users.spec.tsx b/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/users/Users.spec.tsx
index d781e57f513e..ad5d3e38a240 100644
--- a/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/users/Users.spec.tsx
+++ b/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/users/Users.spec.tsx
@@ -98,7 +98,7 @@ describe('Users page', () => {
throw apiErrorMock;
});
render(, { wrapper: RouterWithQueryClientWrapper });
- expect(screen.getByTestId('users-table-skeleton')).toBeInTheDocument();
+ expect(screen.getByTestId('datatable.skeleton')).toBeInTheDocument();
});
it('renders and shows users table', async () => {
render(, { wrapper: RouterWithQueryClientWrapper });
@@ -115,7 +115,7 @@ describe('Users page', () => {
]);
render(, { wrapper: RouterWithQueryClientWrapper });
await waitFor(() => {
- expect(screen.getByText('mongoRole')).toBeInTheDocument();
+ expect(screen.getByText('tableHeadRoles')).toBeInTheDocument();
});
});
it('renders redis columns', async () => {
diff --git a/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/users/_components/UsersTableColumns.component.tsx b/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/users/_components/UsersTableColumns.component.tsx
index 45da0a54d588..5e7d3dc71c22 100644
--- a/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/users/_components/UsersTableColumns.component.tsx
+++ b/packages/manager/apps/pci-databases-analytics/src/pages/services/[serviceId]/users/_components/UsersTableColumns.component.tsx
@@ -3,9 +3,10 @@ import { useTranslation } from 'react-i18next';
import { Badge } from '@/components/ui/badge';
import FormattedDate from '@/components/formatted-date/FormattedDate.component';
import { GenericUser } from '@/data/api/database/user.api';
-import { SortableHeader } from '@/components/ui/data-table';
+import DataTable from '@/components/data-table';
import UserStatusBadge from './UserStatusBadge.component';
import UserActions from './UsersTableActions.component';
+import { MENU_COLUMN_ID } from '@/components/data-table/DataTable';
interface UserListColumnsProps {
displayGroupCol: boolean;
@@ -36,14 +37,18 @@ export const getColumns = ({
const userNameColumn: ColumnDef = {
id: 'username',
header: ({ column }) => (
- {t('tableHeadName')}
+
+ {t('tableHeadName')}
+
),
accessorFn: (row) => row.username,
};
const groupColumn: ColumnDef = {
id: 'group',
header: ({ column }) => (
- {t('tableHeadGroup')}
+
+ {t('tableHeadGroup')}
+
),
accessorFn: (row) => ('group' in row ? row.group : ''),
};
@@ -68,7 +73,9 @@ export const getColumns = ({
const keysColumn: ColumnDef = {
id: 'keys',
header: ({ column }) => (
- {t('tableHeadKeys')}
+
+ {t('tableHeadKeys')}
+
),
accessorFn: (row) => ('keys' in row ? row.keys.length : ''),
cell: ({ row }) => (
@@ -88,9 +95,9 @@ export const getColumns = ({
const categoriesColumn: ColumnDef = {
id: 'categories',
header: ({ column }) => (
-
+
{t('tableHeadCategories')}
-
+
),
accessorFn: (row) => ('categories' in row ? row.categories.length : ''),
cell: ({ row }) => (
@@ -110,7 +117,9 @@ export const getColumns = ({
const commandsColumn: ColumnDef = {
id: 'commands',
header: ({ column }) => (
- {t('tableHeadCommands')}
+
+ {t('tableHeadCommands')}
+
),
accessorFn: (row) => ('commands' in row ? row.commands.length : ''),
cell: ({ row }) => (
@@ -130,7 +139,9 @@ export const getColumns = ({
const channelsColumn: ColumnDef = {
id: 'channels',
header: ({ column }) => (
- {t('tableHeadChannels')}
+
+ {t('tableHeadChannels')}
+
),
accessorFn: (row) => ('channels' in row ? row.channels.length : ''),
cell: ({ row }) => (
@@ -151,9 +162,9 @@ export const getColumns = ({
id: 'Creation date',
accessorFn: (row) => row.createdAt,
header: ({ column }) => (
-
+
{t('tableHeadCreationDate')}
-
+
),
cell: ({ row }) => (
@@ -163,14 +174,16 @@ export const getColumns = ({
id: 'Status',
accessorFn: (row) => row.status,
header: ({ column }) => (
- {t('tableHeadStatus')}
+
+ {t('tableHeadStatus')}
+
),
cell: ({ row }) => {
return ;
},
};
const actionsColumn: ColumnDef = {
- id: 'actions',
+ id: MENU_COLUMN_ID,
cell: ({ row }) => (
void;
@@ -37,9 +38,11 @@ export const getColumns = ({
{
id: 'description/id',
header: ({ column }) => (
- {t('tableHeaderName')}
+
+ {t('tableHeaderName')}
+
),
- accessorFn: (row) => row.description,
+ accessorFn: (row) => `${row.description}-${row.id}`,
cell: ({ row }) => {
const { id, description, status, engine, nodes } = row.original;
return (
@@ -78,9 +81,9 @@ export const getColumns = ({
id: 'Engine',
accessorFn: (row) => row.engine,
header: ({ column }) => (
-
+
{t('tableHeaderEngine')}
-
+
),
cell: ({ row }) => {
const { engine, version } = row.original;
@@ -99,7 +102,9 @@ export const getColumns = ({
id: 'Plan',
accessorFn: (row) => row.plan,
header: ({ column }) => (
- {t('tableHeaderPlan')}
+
+ {t('tableHeaderPlan')}
+
),
cell: ({ row }) => {
const { plan } = row.original;
@@ -110,9 +115,9 @@ export const getColumns = ({
id: 'Flavor',
accessorFn: (row) => row.flavor,
header: ({ column }) => (
-
+
{t('tableHeaderFlavor')}
-
+
),
cell: ({ row }) => {
const { flavor } = row.original;
@@ -123,16 +128,16 @@ export const getColumns = ({
id: 'Storage',
accessorFn: (row) => row.storage?.size.value ?? 0,
header: ({ column }) => (
-
+
{t('tableHeaderStorage')}
-
+
),
cell: ({ row }) => {
const service = row.original;
return (
{service.storage && service.storage.size.value > 0
- ? `${service.storage.size.value} ${service.storage.size.unit}`
+ ? `${formatStorage(service.storage.size)}`
: '-'}
);
@@ -142,9 +147,9 @@ export const getColumns = ({
id: 'Region',
accessorFn: (row) => row.nodes[0].region,
header: ({ column }) => (
-
+
{t('tableHeaderLocation')}
-
+
),
cell: ({ row }) => (
{tRegions(`region_${row.original.nodes[0].region}`)}
@@ -154,7 +159,9 @@ export const getColumns = ({
id: 'Nodes',
accessorFn: (row) => row.nodes.length,
header: ({ column }) => (
- {t('tableHeaderNodes')}
+
+ {t('tableHeaderNodes')}
+
),
cell: ({ row }) => {
const service = row.original;
@@ -200,9 +207,9 @@ export const getColumns = ({
id: 'Creation date',
accessorFn: (row) => row.createdAt,
header: ({ column }) => (
-
+
{t('tableHeaderCreationDate')}
-
+
),
cell: ({ row }) => (
@@ -214,9 +221,9 @@ export const getColumns = ({
id: 'Status',
accessorFn: (row) => row.status,
header: ({ column }) => (
-
+
{t('tableHeaderStatus')}
-
+
),
cell: ({ row }) => {
return ;
@@ -224,6 +231,7 @@ export const getColumns = ({
},
{
id: 'actions',
+ enableGlobalFilter: false,
cell: ({ row }) => {
const service = row.original;
diff --git a/packages/manager/apps/pci-databases-analytics/src/pages/services/_components/ServiceListFilters.component.tsx b/packages/manager/apps/pci-databases-analytics/src/pages/services/_components/ServiceListFilters.component.tsx
new file mode 100644
index 000000000000..5754b137dd55
--- /dev/null
+++ b/packages/manager/apps/pci-databases-analytics/src/pages/services/_components/ServiceListFilters.component.tsx
@@ -0,0 +1,90 @@
+import { useTranslation } from 'react-i18next';
+import * as database from '@/types/cloud/project/database';
+import { humanizeEngine } from '@/lib/engineNameHelper';
+import { FilterCategories } from '@/lib/filters';
+import ServiceStatusBadge from './ServiceStatusBadge.component';
+
+export const getFilters = () => {
+ const { t: tRegions } = useTranslation('regions');
+ return [
+ {
+ id: 'description',
+ label: 'Nom',
+ comparators: FilterCategories.String,
+ },
+ {
+ id: 'id',
+ label: 'ID',
+ comparators: FilterCategories.String,
+ },
+ {
+ id: 'engine',
+ label: 'Engine',
+ comparators: FilterCategories.Options,
+ options: Object.values(database.EngineEnum).map((value) => ({
+ label: humanizeEngine(value),
+ value,
+ })),
+ },
+ {
+ id: 'plan',
+ label: 'Plan',
+ comparators: FilterCategories.Options,
+ options: [
+ 'Discovery',
+ 'Production',
+ 'Advanced',
+ 'Essential',
+ 'Business',
+ 'Enterprise',
+ ].map((plan) => ({ label: plan, value: plan })),
+ },
+ {
+ id: 'nodes[0].region',
+ label: 'Region',
+ comparators: FilterCategories.Options,
+ options: ['BHS', 'DE', 'GRA', 'SBG', 'UK', 'WAW'].map((region) => ({
+ label: tRegions(`region_${region}`),
+ value: region,
+ })),
+ },
+ {
+ id: 'flavor',
+ label: 'Flavor',
+ comparators: FilterCategories.Options,
+ options: [
+ 'db2-free',
+ 'db2-2',
+ 'db2-4',
+ 'db2-7',
+ 'db2-15',
+ 'db2-30',
+ 'db2-60',
+ 'db2-120',
+ 'db1-4',
+ 'db1-7',
+ 'db1-15',
+ 'db1-30',
+ 'db1-60',
+ 'db1-120',
+ ].map((flavor) => ({
+ label: {flavor},
+ value: flavor,
+ })),
+ },
+ {
+ id: 'createdAt',
+ label: 'Date de création',
+ comparators: FilterCategories.Date,
+ },
+ {
+ id: 'status',
+ label: 'Statut',
+ comparators: FilterCategories.Options,
+ options: Object.values(database.StatusEnum).map((value) => ({
+ label: ,
+ value,
+ })),
+ },
+ ];
+};
diff --git a/packages/manager/apps/pci-databases-analytics/src/pages/services/_components/ServiceListTable.component.tsx b/packages/manager/apps/pci-databases-analytics/src/pages/services/_components/ServiceListTable.component.tsx
index 0840de2ea2e4..6e8fef8d220b 100644
--- a/packages/manager/apps/pci-databases-analytics/src/pages/services/_components/ServiceListTable.component.tsx
+++ b/packages/manager/apps/pci-databases-analytics/src/pages/services/_components/ServiceListTable.component.tsx
@@ -1,18 +1,24 @@
import { useNavigate } from 'react-router-dom';
import { ColumnDef } from '@tanstack/react-table';
-import { DataTable } from '@/components/ui/data-table';
+import { Plus } from 'lucide-react';
+import { useTranslation } from 'react-i18next';
import * as database from '@/types/cloud/project/database';
import { Skeleton } from '@/components/ui/skeleton';
import { getColumns } from './ServiceListColumns.component';
import { useTrackAction } from '@/hooks/useTracking';
import { TRACKING } from '@/configuration/tracking.constants';
+import { Button } from '@/components/ui/button';
+import { getFilters } from './ServiceListFilters.component';
+import DataTable from '@/components/data-table';
interface ServicesListProps {
services: database.Service[];
}
export default function ServicesList({ services }: ServicesListProps) {
+ const { t } = useTranslation('pci-databases-analytics/services');
const track = useTrackAction();
+
const navigate = useNavigate();
const columns: ColumnDef[] = getColumns({
@@ -30,16 +36,35 @@ export default function ServicesList({ services }: ServicesListProps) {
navigate(`./delete/${service.id}`);
},
});
+ const servicesFilters = getFilters();
return (
- <>
-
- >
+
+
+
+
+
+
+
+
+
+
+
+
);
}