1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-19 13:29:41 +02:00
portainer/app/react/edge/edge-stacks/ItemView/ItemView.tsx
Chaim Lev-Ari cd5f342da0
Some checks are pending
ci / build_images (map[arch:amd64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
ci / build_images (map[arch:arm platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:s390x platform:linux version:]) (push) Waiting to run
ci / build_manifests (push) Blocked by required conditions
/ triage (push) Waiting to run
Lint / Run linters (push) Waiting to run
Test / test-client (push) Waiting to run
Test / test-server (map[arch:amd64 platform:linux]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
Test / test-server (map[arch:arm64 platform:linux]) (push) Waiting to run
refactor(edge/stacks): migrate edit view to react [EE-2222] (#11648)
2024-05-09 18:02:20 +03:00

74 lines
2 KiB
TypeScript

import { HardDriveIcon, LayersIcon } from 'lucide-react';
import { EditEdgeStackForm } from '@/react/edge/edge-stacks/ItemView/EditEdgeStackForm/EditEdgeStackForm';
import { useParamState } from '@/react/hooks/useParamState';
import { useIdParam } from '@/react/hooks/useIdParam';
import { NavTabs } from '@@/NavTabs';
import { PageHeader } from '@@/PageHeader';
import { Widget } from '@@/Widget';
import { useEdgeStack } from '../queries/useEdgeStack';
import { EnvironmentsDatatable } from './EnvironmentsDatatable';
export function ItemView() {
const idParam = useIdParam('stackId');
const edgeStackQuery = useEdgeStack(idParam);
const [tab = 'stack', setTab] = useParamState<'stack' | 'environments'>(
'tab'
);
if (!edgeStackQuery.data) {
return null;
}
const stack = edgeStackQuery.data;
return (
<>
<PageHeader
title="Edit Edge stack"
breadcrumbs={[
{ label: 'Edge Stacks', link: 'edge.stacks' },
stack.Name,
]}
reload
/>
<div className="row">
<div className="col-sm-12">
<Widget>
<Widget.Body className="!p-0">
<NavTabs<'stack' | 'environments'>
justified
type="pills"
options={[
{
id: 'stack',
label: 'Stack',
icon: LayersIcon,
children: (
<div className="p-5 pb-10">
<EditEdgeStackForm edgeStack={stack} />
</div>
),
},
{
id: 'environments',
icon: HardDriveIcon,
label: 'Environments',
children: <EnvironmentsDatatable />,
},
]}
selectedId={tab}
onSelect={setTab}
/>
</Widget.Body>
</Widget>
</div>
</div>
</>
);
}