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 { 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 })

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({
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<void> {
@@ -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',

View File

@@ -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 = { }