fix(edge/stack): edge stack env table pagination and action [EE-6836] (#11836)

pull/11856/head
Oscar Zhou 2024-05-21 09:40:03 +12:00 committed by GitHub
parent f5d896bce1
commit 61ef133bb8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 8 deletions

View File

@ -19,12 +19,12 @@ export function EnvironmentActions({ environment }: Props) {
} = useCurrentStateAndParams();
return (
<div className="space-x-2">
{environment.Snapshots.length > 0 && (
<div>
{environment.Snapshots.length > 0 && environment.Edge.AsyncMode && (
<Link
to="edge.browse.containers"
params={{ environmentId: environment.Id, edgeStackId }}
className="!text-inherit hover:!no-underline"
className="hover:!no-underline"
>
<Button color="none" title="Browse Snapshot">
<Icon icon={Search} className="searchIcon" />

View File

@ -9,14 +9,19 @@ import { EnvironmentId } from '@/react/portainer/environments/types';
import { isBE } from '@/react/portainer/feature-flags/feature-flags.service';
import { Datatable } from '@@/datatables';
import { useTableStateWithoutStorage } from '@@/datatables/useTableState';
import { PortainerSelect } from '@@/form-components/PortainerSelect';
import { createPersistedStore } from '@@/datatables/types';
import { useTableState } from '@@/datatables/useTableState';
import { useEdgeStack } from '../../queries/useEdgeStack';
import { EdgeStackEnvironment } from './types';
import { columns } from './columns';
const tableKey = 'edge-stacks-environment';
const settingsStore = createPersistedStore(tableKey);
export function EnvironmentsDatatable() {
const {
params: { stackId },
@ -40,7 +45,7 @@ export function EnvironmentsDatatable() {
'status',
(value) => (value ? parseInt(value, 10) : undefined)
);
const tableState = useTableStateWithoutStorage('name');
const tableState = useTableState(settingsStore, tableKey);
const environmentsQuery = useEnvironmentList({
pageLimit: tableState.pageSize,
page: page + 1,

View File

@ -34,7 +34,12 @@ export function LogsActions({ environmentId, edgeStackId }: Props) {
return (
<>
<Button color="none" title="Retrieve logs" onClick={handleCollectLogs}>
<Button
className="p-0"
color="link"
title="Retrieve logs"
onClick={handleCollectLogs}
>
<Icon
icon={clsx({
'file-text': !collecting,
@ -43,7 +48,8 @@ export function LogsActions({ environmentId, edgeStackId }: Props) {
/>
</Button>
<Button
color="none"
className="p-0"
color="link"
title="Download logs"
disabled={status !== 'collected'}
onClick={handleDownloadLogs}
@ -56,7 +62,8 @@ export function LogsActions({ environmentId, edgeStackId }: Props) {
/>
</Button>
<Button
color="none"
className="p-0"
color="link"
title="Delete logs"
disabled={status !== 'collected'}
onClick={handleDeleteLogs}