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(); } = 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" />

View File

@ -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,

View File

@ -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}