From 341c76750c95d47b650a4a419a716913c77aef09 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Wed, 29 Sep 2021 16:23:14 -0600 Subject: [PATCH] fix bug with launching config modal from dependency auto config --- ui/src/app/modals/app-config/app-config.page.ts | 8 +++----- .../pages/apps-routes/app-show/app-show.page.ts | 15 +++++++-------- ui/src/app/services/api/api.types.ts | 1 - 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/ui/src/app/modals/app-config/app-config.page.ts b/ui/src/app/modals/app-config/app-config.page.ts index a0e7f45ff..9718b6877 100644 --- a/ui/src/app/modals/app-config/app-config.page.ts +++ b/ui/src/app/modals/app-config/app-config.page.ts @@ -4,11 +4,11 @@ import { ApiService } from 'src/app/services/api/embassy-api.service' import { isEmptyObject, isObject, Recommendation } from 'src/app/util/misc.util' import { wizardModal } from 'src/app/components/install-wizard/install-wizard.component' import { WizardBaker } from 'src/app/components/install-wizard/prebaked-wizards' -import { ConfigSpec, ListValueSpecObject, ListValueSpecUnion } from 'src/app/pkg-config/config-types' +import { ConfigSpec } from 'src/app/pkg-config/config-types' import { PackageDataEntry } from 'src/app/services/patch-db/data-model' import { PatchDbService } from 'src/app/services/patch-db/patch-db.service' import { ErrorToastService } from 'src/app/services/error-toast.service' -import { FormArray, FormGroup } from '@angular/forms' +import { FormGroup } from '@angular/forms' import { convertToNumberRecursive, FormService } from 'src/app/services/form.service' @Component({ @@ -18,6 +18,7 @@ import { convertToNumberRecursive, FormService } from 'src/app/services/form.ser }) export class AppConfigPage { @Input() pkgId: string + @Input() rec: Recommendation | null = null pkg: PackageDataEntry loadingText: string | undefined configSpec: ConfigSpec @@ -26,7 +27,6 @@ export class AppConfigPage { hasConfig = false saving = false - rec: Recommendation | null = null showRec = true openRec = false @@ -49,8 +49,6 @@ export class AppConfigPage { if (!this.hasConfig) return - this.rec = history.state?.configRecommendation as Recommendation - try { this.loadingText = 'Loading Config' const { spec, config } = await this.embassyApi.getPackageConfig({ id: this.pkgId }) diff --git a/ui/src/app/pages/apps-routes/app-show/app-show.page.ts b/ui/src/app/pages/apps-routes/app-show/app-show.page.ts index c74fe2ed5..07b1fdc58 100644 --- a/ui/src/app/pages/apps-routes/app-show/app-show.page.ts +++ b/ui/src/app/pages/apps-routes/app-show/app-show.page.ts @@ -193,12 +193,10 @@ export class AppShowPage { } } - async presentModalConfig (): Promise { + async presentModalConfig (props: { pkgId: string, rec?: Recommendation }): Promise { const modal = await this.modalCtrl.create({ component: AppConfigPage, - componentProps: { - pkgId: this.pkgId, - }, + componentProps: props, }) await modal.present() } @@ -293,11 +291,12 @@ export class AppShowPage { dependentIcon: this.pkg['static-files'].icon, description, } - const navigationExtras: NavigationExtras = { - state: { configRecommendation }, + const params = { + pkgId: depId, + rec: configRecommendation, } - await this.navCtrl.navigateForward(`/services/${depId}/config`, navigationExtras) + await this.presentModalConfig(params) } private async presentAlertStart (message: string): Promise { @@ -349,7 +348,7 @@ export class AppShowPage { }, // config { - action: async () => this.presentModalConfig(), + action: async () => this.presentModalConfig({ pkgId: this.pkgId }), title: 'Config', icon: 'construct-outline', color: 'danger', diff --git a/ui/src/app/services/api/api.types.ts b/ui/src/app/services/api/api.types.ts index 7e8e04d81..3aaaaa28f 100644 --- a/ui/src/app/services/api/api.types.ts +++ b/ui/src/app/services/api/api.types.ts @@ -184,7 +184,6 @@ export module RR { export type DryConfigureDependencyReq = { 'dependency-id': string, 'dependent-id': string } // package.dependency.configure.dry export type DryConfigureDependencyRes = object - // marketplace export type GetMarketplaceDataReq = { }