fix bug with launching config modal from dependency auto config

This commit is contained in:
Matt Hill
2021-09-29 16:23:14 -06:00
committed by Aiden McClelland
parent 2dc0f97d90
commit 9edda3a313
3 changed files with 10 additions and 14 deletions

View File

@@ -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 { isEmptyObject, isObject, Recommendation } from 'src/app/util/misc.util'
import { wizardModal } from 'src/app/components/install-wizard/install-wizard.component' import { wizardModal } from 'src/app/components/install-wizard/install-wizard.component'
import { WizardBaker } from 'src/app/components/install-wizard/prebaked-wizards' 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 { PackageDataEntry } from 'src/app/services/patch-db/data-model'
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service' import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
import { ErrorToastService } from 'src/app/services/error-toast.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' import { convertToNumberRecursive, FormService } from 'src/app/services/form.service'
@Component({ @Component({
@@ -18,6 +18,7 @@ import { convertToNumberRecursive, FormService } from 'src/app/services/form.ser
}) })
export class AppConfigPage { export class AppConfigPage {
@Input() pkgId: string @Input() pkgId: string
@Input() rec: Recommendation | null = null
pkg: PackageDataEntry pkg: PackageDataEntry
loadingText: string | undefined loadingText: string | undefined
configSpec: ConfigSpec configSpec: ConfigSpec
@@ -26,7 +27,6 @@ export class AppConfigPage {
hasConfig = false hasConfig = false
saving = false saving = false
rec: Recommendation | null = null
showRec = true showRec = true
openRec = false openRec = false
@@ -49,8 +49,6 @@ export class AppConfigPage {
if (!this.hasConfig) return if (!this.hasConfig) return
this.rec = history.state?.configRecommendation as Recommendation
try { try {
this.loadingText = 'Loading Config' this.loadingText = 'Loading Config'
const { spec, config } = await this.embassyApi.getPackageConfig({ id: this.pkgId }) const { spec, config } = await this.embassyApi.getPackageConfig({ id: this.pkgId })

View File

@@ -193,12 +193,10 @@ export class AppShowPage {
} }
} }
async presentModalConfig (): Promise<void> { async presentModalConfig (props: { pkgId: string, rec?: Recommendation }): Promise<void> {
const modal = await this.modalCtrl.create({ const modal = await this.modalCtrl.create({
component: AppConfigPage, component: AppConfigPage,
componentProps: { componentProps: props,
pkgId: this.pkgId,
},
}) })
await modal.present() await modal.present()
} }
@@ -293,11 +291,12 @@ export class AppShowPage {
dependentIcon: this.pkg['static-files'].icon, dependentIcon: this.pkg['static-files'].icon,
description, description,
} }
const navigationExtras: NavigationExtras = { const params = {
state: { configRecommendation }, pkgId: depId,
rec: configRecommendation,
} }
await this.navCtrl.navigateForward(`/services/${depId}/config`, navigationExtras) await this.presentModalConfig(params)
} }
private async presentAlertStart (message: string): Promise<void> { private async presentAlertStart (message: string): Promise<void> {
@@ -349,7 +348,7 @@ export class AppShowPage {
}, },
// config // config
{ {
action: async () => this.presentModalConfig(), action: async () => this.presentModalConfig({ pkgId: this.pkgId }),
title: 'Config', title: 'Config',
icon: 'construct-outline', icon: 'construct-outline',
color: 'danger', color: 'danger',

View File

@@ -184,7 +184,6 @@ export module RR {
export type DryConfigureDependencyReq = { 'dependency-id': string, 'dependent-id': string } // package.dependency.configure.dry export type DryConfigureDependencyReq = { 'dependency-id': string, 'dependent-id': string } // package.dependency.configure.dry
export type DryConfigureDependencyRes = object export type DryConfigureDependencyRes = object
// marketplace // marketplace
export type GetMarketplaceDataReq = { } export type GetMarketplaceDataReq = { }