mirror of
https://github.com/portainer/portainer.git
synced 2025-08-04 21:35:23 +02:00
feat(edge/templates): introduce edge app templates [EE-6209] (#10480)
This commit is contained in:
parent
95d96e1164
commit
e1e90c9c1d
58 changed files with 1142 additions and 365 deletions
|
@ -0,0 +1,41 @@
|
|||
import { useParamState } from '@/react/hooks/useParamState';
|
||||
import { AppTemplatesList } from '@/react/portainer/templates/app-templates/AppTemplatesList';
|
||||
import { useAppTemplates } from '@/react/portainer/templates/app-templates/queries/useAppTemplates';
|
||||
import { TemplateType } from '@/react/portainer/templates/app-templates/types';
|
||||
|
||||
import { PageHeader } from '@@/PageHeader';
|
||||
|
||||
import { DeployFormWidget } from './DeployForm';
|
||||
|
||||
export function AppTemplatesView() {
|
||||
const [selectedTemplateId, setSelectedTemplateId] = useParamState<number>(
|
||||
'template',
|
||||
(param) => (param ? parseInt(param, 10) : 0)
|
||||
);
|
||||
const templatesQuery = useAppTemplates();
|
||||
const selectedTemplate = selectedTemplateId
|
||||
? templatesQuery.data?.find(
|
||||
(template) => template.Id === selectedTemplateId
|
||||
)
|
||||
: undefined;
|
||||
return (
|
||||
<>
|
||||
<PageHeader title="Application templates list" breadcrumbs="Templates" />
|
||||
{selectedTemplate && (
|
||||
<DeployFormWidget
|
||||
template={selectedTemplate}
|
||||
unselect={() => setSelectedTemplateId()}
|
||||
/>
|
||||
)}
|
||||
|
||||
<AppTemplatesList
|
||||
templates={templatesQuery.data}
|
||||
selectedId={selectedTemplateId}
|
||||
onSelect={(template) => setSelectedTemplateId(template.Id)}
|
||||
disabledTypes={[TemplateType.Container]}
|
||||
fixedCategories={['edge']}
|
||||
hideDuplicate
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue