mirror of
https://github.com/portainer/portainer.git
synced 2025-08-10 00:05:24 +02:00
fix(app/edge-jobs): edge job results page crash at scale (#954)
This commit is contained in:
parent
d306d7a983
commit
a472de1919
27 changed files with 2595 additions and 107 deletions
|
@ -1,18 +1,20 @@
|
|||
import { CellContext, createColumnHelper } from '@tanstack/react-table';
|
||||
|
||||
import { sortOptionsFromColumns } from '@/react/common/api/sort.types';
|
||||
|
||||
import { Button } from '@@/buttons';
|
||||
|
||||
import { LogsStatus } from '../../types';
|
||||
import { JobResult, LogsStatus } from '../../types';
|
||||
import { useDownloadLogsMutation } from '../../queries/jobResults/useDownloadLogsMutation';
|
||||
import { useClearLogsMutation } from '../../queries/jobResults/useClearLogsMutation';
|
||||
import { useCollectLogsMutation } from '../../queries/jobResults/useCollectLogsMutation';
|
||||
|
||||
import { DecoratedJobResult, getTableMeta } from './types';
|
||||
import { getTableMeta } from './types';
|
||||
|
||||
const columnHelper = createColumnHelper<DecoratedJobResult>();
|
||||
const columnHelper = createColumnHelper<JobResult>();
|
||||
|
||||
export const columns = [
|
||||
columnHelper.accessor('Endpoint.Name', {
|
||||
columnHelper.accessor('EndpointName', {
|
||||
header: 'Environment',
|
||||
meta: {
|
||||
className: 'w-1/2',
|
||||
|
@ -30,7 +32,7 @@ export const columns = [
|
|||
function ActionsCell({
|
||||
row: { original: item },
|
||||
table,
|
||||
}: CellContext<DecoratedJobResult, unknown>) {
|
||||
}: CellContext<JobResult, unknown>) {
|
||||
const tableMeta = getTableMeta(table.options.meta);
|
||||
const id = tableMeta.jobId;
|
||||
|
||||
|
@ -51,13 +53,13 @@ function ActionsCell({
|
|||
<>
|
||||
<Button
|
||||
onClick={() => downloadLogsMutation.mutate(item.EndpointId)}
|
||||
data-cy={`edge-job-download-logs-${item.Endpoint?.Name}`}
|
||||
data-cy={`edge-job-download-logs-${item.EndpointName}`}
|
||||
>
|
||||
Download logs
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => clearLogsMutations.mutate(item.EndpointId)}
|
||||
data-cy={`edge-job-clear-logs-${item.Endpoint?.Name}`}
|
||||
data-cy={`edge-job-clear-logs-${item.EndpointName}`}
|
||||
>
|
||||
Clear logs
|
||||
</Button>
|
||||
|
@ -68,10 +70,12 @@ function ActionsCell({
|
|||
return (
|
||||
<Button
|
||||
onClick={() => collectLogsMutation.mutate(item.EndpointId)}
|
||||
data-cy={`edge-job-retrieve-logs-${item.Endpoint?.Name}`}
|
||||
data-cy={`edge-job-retrieve-logs-${item.EndpointName}`}
|
||||
>
|
||||
Retrieve logs
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export const sortOptions = sortOptionsFromColumns(columns);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue