diff --git a/app/docker/components/datatables/container-processes-datatable/containerProcessesDatatable.html b/app/docker/components/datatables/container-processes-datatable/containerProcessesDatatable.html deleted file mode 100644 index d90ecaf0f..000000000 --- a/app/docker/components/datatables/container-processes-datatable/containerProcessesDatatable.html +++ /dev/null @@ -1,66 +0,0 @@ -
- - -
-
-
- -
- {{ $ctrl.titleText }} -
- -
-
- - - - - - - - - - - - - - - - - -
- {{ header }} -
{{ info }}
Loading...
No process available.
-
- -
-
-
diff --git a/app/docker/components/datatables/container-processes-datatable/containerProcessesDatatable.js b/app/docker/components/datatables/container-processes-datatable/containerProcessesDatatable.js deleted file mode 100644 index b89a4d63b..000000000 --- a/app/docker/components/datatables/container-processes-datatable/containerProcessesDatatable.js +++ /dev/null @@ -1,13 +0,0 @@ -angular.module('portainer.docker').component('containerProcessesDatatable', { - templateUrl: './containerProcessesDatatable.html', - controller: 'GenericDatatableController', - bindings: { - titleText: '@', - titleIcon: '@', - dataset: '=', - headerset: '<', - tableKey: '@', - orderBy: '@', - reverseOrder: '<', - }, -}); diff --git a/app/docker/react/components/index.ts b/app/docker/react/components/index.ts index df5338c60..4ad27f5bb 100644 --- a/app/docker/react/components/index.ts +++ b/app/docker/react/components/index.ts @@ -20,6 +20,7 @@ import { EventsDatatable } from '@/react/docker/events/EventsDatatables'; import { ConfigsDatatable } from '@/react/docker/configs/ListView/ConfigsDatatable'; import { AgentHostBrowser } from '@/react/docker/host/BrowseView/AgentHostBrowser'; import { AgentVolumeBrowser } from '@/react/docker/volumes/BrowseView/AgentVolumeBrowser'; +import { ProcessesDatatable } from '@/react/docker/containers/StatsView/ProcessesDatatable'; const ngModule = angular .module('portainer.docker.react.components', []) @@ -120,6 +121,10 @@ const ngModule = angular 'relativePath', ]) ) - .component('dockerEventsDatatable', r2a(EventsDatatable, ['dataset'])); + .component('dockerEventsDatatable', r2a(EventsDatatable, ['dataset'])) + .component( + 'dockerContainerProcessesDatatable', + r2a(ProcessesDatatable, ['dataset', 'headers']) + ); export const componentsModule = ngModule.name; diff --git a/app/docker/views/containers/stats/containerstats.html b/app/docker/views/containers/stats/containerstats.html index f676aed73..5ce40dd46 100644 --- a/app/docker/views/containers/stats/containerstats.html +++ b/app/docker/views/containers/stats/containerstats.html @@ -108,14 +108,4 @@ -
-
- -
-
+ diff --git a/app/react/docker/containers/StatsView/.keep b/app/react/docker/containers/StatsView/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/app/react/docker/containers/StatsView/ProcessesDatatable.tsx b/app/react/docker/containers/StatsView/ProcessesDatatable.tsx new file mode 100644 index 000000000..8f30f246e --- /dev/null +++ b/app/react/docker/containers/StatsView/ProcessesDatatable.tsx @@ -0,0 +1,58 @@ +import { ColumnDef } from '@tanstack/react-table'; +import { List } from 'lucide-react'; +import { useMemo } from 'react'; + +import { Datatable } from '@@/datatables'; +import { createPersistedStore } from '@@/datatables/types'; +import { useTableState } from '@@/datatables/useTableState'; + +const tableKey = 'container-processes'; +const store = createPersistedStore(tableKey); + +export function ProcessesDatatable({ + dataset, + headers, +}: { + dataset?: Array>; + headers?: Array; +}) { + const tableState = useTableState(store, tableKey); + const rows = useMemo(() => { + if (!dataset || !headers) { + return []; + } + + return dataset.map((row, index) => ({ + id: index, + ...Object.fromEntries( + headers.map((header, index) => [header, row[index]]) + ), + })); + }, [dataset, headers]); + + const columns = useMemo( + () => + headers + ? headers.map( + (header) => + ({ header, accessorKey: header } satisfies ColumnDef<{ + [k: string]: string; + }>) + ) + : [], + [headers] + ); + + return ( + + ); +}