mirror of https://github.com/portainer/portainer
fix(edge/stack): edge stack env table pagination and action [EE-6836] (#11836)
parent
f5d896bce1
commit
61ef133bb8
|
@ -19,12 +19,12 @@ export function EnvironmentActions({ environment }: Props) {
|
||||||
} = useCurrentStateAndParams();
|
} = useCurrentStateAndParams();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-x-2">
|
<div>
|
||||||
{environment.Snapshots.length > 0 && (
|
{environment.Snapshots.length > 0 && environment.Edge.AsyncMode && (
|
||||||
<Link
|
<Link
|
||||||
to="edge.browse.containers"
|
to="edge.browse.containers"
|
||||||
params={{ environmentId: environment.Id, edgeStackId }}
|
params={{ environmentId: environment.Id, edgeStackId }}
|
||||||
className="!text-inherit hover:!no-underline"
|
className="hover:!no-underline"
|
||||||
>
|
>
|
||||||
<Button color="none" title="Browse Snapshot">
|
<Button color="none" title="Browse Snapshot">
|
||||||
<Icon icon={Search} className="searchIcon" />
|
<Icon icon={Search} className="searchIcon" />
|
||||||
|
|
|
@ -9,14 +9,19 @@ import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||||
import { isBE } from '@/react/portainer/feature-flags/feature-flags.service';
|
import { isBE } from '@/react/portainer/feature-flags/feature-flags.service';
|
||||||
|
|
||||||
import { Datatable } from '@@/datatables';
|
import { Datatable } from '@@/datatables';
|
||||||
import { useTableStateWithoutStorage } from '@@/datatables/useTableState';
|
|
||||||
import { PortainerSelect } from '@@/form-components/PortainerSelect';
|
import { PortainerSelect } from '@@/form-components/PortainerSelect';
|
||||||
|
import { createPersistedStore } from '@@/datatables/types';
|
||||||
|
import { useTableState } from '@@/datatables/useTableState';
|
||||||
|
|
||||||
import { useEdgeStack } from '../../queries/useEdgeStack';
|
import { useEdgeStack } from '../../queries/useEdgeStack';
|
||||||
|
|
||||||
import { EdgeStackEnvironment } from './types';
|
import { EdgeStackEnvironment } from './types';
|
||||||
import { columns } from './columns';
|
import { columns } from './columns';
|
||||||
|
|
||||||
|
const tableKey = 'edge-stacks-environment';
|
||||||
|
|
||||||
|
const settingsStore = createPersistedStore(tableKey);
|
||||||
|
|
||||||
export function EnvironmentsDatatable() {
|
export function EnvironmentsDatatable() {
|
||||||
const {
|
const {
|
||||||
params: { stackId },
|
params: { stackId },
|
||||||
|
@ -40,7 +45,7 @@ export function EnvironmentsDatatable() {
|
||||||
'status',
|
'status',
|
||||||
(value) => (value ? parseInt(value, 10) : undefined)
|
(value) => (value ? parseInt(value, 10) : undefined)
|
||||||
);
|
);
|
||||||
const tableState = useTableStateWithoutStorage('name');
|
const tableState = useTableState(settingsStore, tableKey);
|
||||||
const environmentsQuery = useEnvironmentList({
|
const environmentsQuery = useEnvironmentList({
|
||||||
pageLimit: tableState.pageSize,
|
pageLimit: tableState.pageSize,
|
||||||
page: page + 1,
|
page: page + 1,
|
||||||
|
|
|
@ -34,7 +34,12 @@ export function LogsActions({ environmentId, edgeStackId }: Props) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Button color="none" title="Retrieve logs" onClick={handleCollectLogs}>
|
<Button
|
||||||
|
className="p-0"
|
||||||
|
color="link"
|
||||||
|
title="Retrieve logs"
|
||||||
|
onClick={handleCollectLogs}
|
||||||
|
>
|
||||||
<Icon
|
<Icon
|
||||||
icon={clsx({
|
icon={clsx({
|
||||||
'file-text': !collecting,
|
'file-text': !collecting,
|
||||||
|
@ -43,7 +48,8 @@ export function LogsActions({ environmentId, edgeStackId }: Props) {
|
||||||
/>
|
/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
color="none"
|
className="p-0"
|
||||||
|
color="link"
|
||||||
title="Download logs"
|
title="Download logs"
|
||||||
disabled={status !== 'collected'}
|
disabled={status !== 'collected'}
|
||||||
onClick={handleDownloadLogs}
|
onClick={handleDownloadLogs}
|
||||||
|
@ -56,7 +62,8 @@ export function LogsActions({ environmentId, edgeStackId }: Props) {
|
||||||
/>
|
/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
color="none"
|
className="p-0"
|
||||||
|
color="link"
|
||||||
title="Delete logs"
|
title="Delete logs"
|
||||||
disabled={status !== 'collected'}
|
disabled={status !== 'collected'}
|
||||||
onClick={handleDeleteLogs}
|
onClick={handleDeleteLogs}
|
||||||
|
|
Loading…
Reference in New Issue