diff --git a/pkg/store/kotsstore/version_store.go b/pkg/store/kotsstore/version_store.go index b6baea220f..9a56c24930 100644 --- a/pkg/store/kotsstore/version_store.go +++ b/pkg/store/kotsstore/version_store.go @@ -547,9 +547,21 @@ func (s *KOTSStore) upsertAppVersionStatements(appID string, sequence int64, bas appIcon := kotsKinds.KotsApplication.Spec.Icon - renderedPreflight, err := s.renderPreflightSpec(appID, a.Slug, sequence, a.IsAirgap, kotsKinds, renderer) + tsKinds, err := kotsutil.LoadTSKindsFromPath(filepath.Join(filesInDir, "rendered")) if err != nil { - return nil, errors.Wrap(err, "failed to render app preflight spec") + return nil, errors.Wrap(err, "failed to load troubleshoot kinds from path") + } + + var renderedPreflight *troubleshootv1beta2.Preflight + if tsKinds.PreflightsV1Beta2 != nil { + for _, v := range tsKinds.PreflightsV1Beta2 { + renderedPreflight = troubleshootpreflight.ConcatPreflightSpec(renderedPreflight, &v) + } + } else { + renderedPreflight, err = s.renderPreflightSpec(appID, a.Slug, sequence, a.IsAirgap, kotsKinds, renderer) + if err != nil { + return nil, errors.Wrap(err, "failed to render app preflight spec") + } } kotsKinds.Preflight = renderedPreflight diff --git a/web/src/features/AppConfig/components/AppConfig.tsx b/web/src/features/AppConfig/components/AppConfig.tsx index e9214d58f2..ff9057648d 100644 --- a/web/src/features/AppConfig/components/AppConfig.tsx +++ b/web/src/features/AppConfig/components/AppConfig.tsx @@ -141,8 +141,10 @@ class AppConfig extends Component { } window.addEventListener("resize", this.determineSidebarHeight); - if (!this.props.app) { - this.getApp(); + if (!app) { + this.fetchApp(); + } else { + this.setState({ app }); } this.getConfig(); } @@ -204,11 +206,7 @@ class AppConfig extends Component { } }; - getApp = async () => { - if (this.props.app) { - return; - } - + fetchApp = async (): Promise => { try { const { slug } = this.props.params; const res = await fetch(`${process.env.API_ENDPOINT}/app/${slug}`, { @@ -221,6 +219,7 @@ class AppConfig extends Component { if (res.ok && res.status == 200) { const app = await res.json(); this.setState({ app }); + return app; } } catch (err) { console.log(err); @@ -416,7 +415,8 @@ class AppConfig extends Component { } if (fromLicenseFlow) { - const hasPreflight = this.props.app.hasPreflight; + const app = await this.fetchApp(); + const hasPreflight = app?.hasPreflight; if (hasPreflight) { navigate(`/${slug}/preflight`, { replace: true }); @@ -661,6 +661,7 @@ class AppConfig extends Component { render() { const { + app, changed, showConfigError, configErrorMessage, @@ -675,7 +676,6 @@ class AppConfig extends Component { showValidationError, } = this.state; const { fromLicenseFlow, params, isHelmManaged } = this.props; - const app = this.props.app; if (configLoading || !app) { return (