diff --git a/landing-zone-configurator/app/apps/web/src/components/Applications.tsx b/landing-zone-configurator/app/apps/web/src/components/Applications.tsx index f39a76c..b749a8a 100644 --- a/landing-zone-configurator/app/apps/web/src/components/Applications.tsx +++ b/landing-zone-configurator/app/apps/web/src/components/Applications.tsx @@ -2097,6 +2097,7 @@ export function Applications({ configurationDirty = false, configurationSaved = false, onEditTemplates, + onTemplateEditingChange, }: { session: Session | null; draft: CommonConfiguration | null; @@ -2105,6 +2106,7 @@ export function Applications({ configurationDirty?: boolean; configurationSaved?: boolean; onEditTemplates?: () => void; + onTemplateEditingChange?: (editing: boolean) => void; }) { const [versions, setVersions] = useState([]); const [instances, setInstances] = useState([]); @@ -2163,6 +2165,9 @@ export function Applications({ >([]); const [platformRevision, setPlatformRevision] = useState(""); const [activeTab, setActiveTab] = useState(null); + useEffect(() => { + onTemplateEditingChange?.(activeTab === null || activeTab === "drafts"); + }, [activeTab, onTemplateEditingChange]); const [appliedPlatformsEnabled, setAppliedPlatformsEnabled] = useState(false); const [appliedPlatforms, setAppliedPlatforms] = useState< z.infer["platforms"] @@ -2397,8 +2402,11 @@ export function Applications({ if (!session) return (
-

{t("Anmeldung erforderlich")}

+

+ {t(templateEditor ? "Template-Entwürfe" : "Anmeldung erforderlich")} +

{t("Bitte melde dich für Application Landing Zones an.")}

+ {templateEditor}
); diff --git a/landing-zone-configurator/app/apps/web/src/components/CommonEditor.tsx b/landing-zone-configurator/app/apps/web/src/components/CommonEditor.tsx index 33463bb..dab4735 100644 --- a/landing-zone-configurator/app/apps/web/src/components/CommonEditor.tsx +++ b/landing-zone-configurator/app/apps/web/src/components/CommonEditor.tsx @@ -22,13 +22,11 @@ import { import { useState } from "react"; import { t } from "../i18n"; import type { EditorStep } from "../navigation"; -import type { Session } from "./Account"; import { useObservabilityCatalogue } from "./CloudCatalogues"; import { ComponentPicker } from "./ComponentPicker"; import { FederatedIdentityEditor } from "./FederatedIdentityEditor"; import { labelFor } from "./feature-labels"; import { NetworkEditor } from "./NetworkEditor"; -import { ProjectTemplates } from "./ProjectTemplates"; import { projectTemplateSummary } from "./project-template-summary"; import { StructuredField } from "./StructuredField"; import { Topology } from "./Topology"; @@ -87,22 +85,20 @@ const steps: { id: EditorStep; title: string; inputs: string[] }[] = [ export function CommonEditor({ draft, - session = null, - savedConfigurationId = null, onChange, step, onStepChange, onOpenStorage, onCreatePlatformCopy, + onOpenTemplates, }: { draft: CommonConfiguration; - session?: Session | null; - savedConfigurationId?: string | null; onChange: (draft: CommonConfiguration) => void; step: EditorStep; onStepChange: (step: EditorStep) => void; onOpenStorage: () => void; onCreatePlatformCopy?: () => void; + onOpenTemplates: () => void; }) { const [error, setError] = useState(""); const [notice, setNotice] = useState(""); @@ -110,24 +106,12 @@ export function CommonEditor({ "public", ); const [newKey, setNewKey] = useState(""); - const [selectedTemplateId, setSelectedTemplateId] = useState( - null, - ); const platformDraft = draft.projectTemplates !== undefined; - const selectedTemplate = - draft.projectTemplates?.find( - (template) => template.id === selectedTemplateId, - ) ?? draft.projectTemplates?.[0]; - const selectTemplate = (id: string) => { - setSelectedTemplateId(id); - onStepChange("projects"); - }; + const visibleSteps = steps.filter( + (item) => !platformDraft || item.id !== "projects", + ); const stepTitle = (id: EditorStep, title: string) => - id === "projects" - ? platformDraft - ? "Template-Entwürfe" - : "Projekte (Bestand)" - : title; + id === "projects" ? "Projekte (Bestand)" : title; const values = compileCommonConfiguration(draft); const projects = commonProjects(draft); const areas = commonNetworkAreas(draft); @@ -158,7 +142,8 @@ export function CommonEditor({ ) .map((finding) => ({ field: finding.path, message: finding.message })), ]; - const active = steps.find((item) => item.id === step) ?? steps[0]; + const active = + visibleSteps.find((item) => item.id === step) ?? visibleSteps[0]; const perform = (action: () => CommonConfiguration) => { try { onChange(action()); @@ -257,11 +242,25 @@ export function CommonEditor({ {t("Konfigurationen →")} + {platformDraft && ( +

+ {t( + "Template-Entwürfe bearbeitest du unter Application Landing Zones. Sie werden weiterhin mit dieser Konfiguration gespeichert.", + )}{" "} + +

+ )}