new return type for dry configure dependency

This commit is contained in:
Matt Hill
2021-10-20 14:51:52 -06:00
committed by Aiden McClelland
parent fdfb0ecbb9
commit ded4c6a597
3 changed files with 43 additions and 26 deletions

View File

@@ -49,14 +49,23 @@ export class AppConfigPage {
if (!this.hasConfig) return
try {
this.loadingText = 'Loading Config'
const { spec, config } = await this.embassyApi.getPackageConfig({ id: this.pkgId })
let depConfig: object
let oldConfig: object
let newConfig: object
let spec: ConfigSpec
if (this.rec) {
this.loadingText = `Setting properties to accommodate ${this.rec.dependentTitle}`
depConfig = await this.embassyApi.dryConfigureDependency({ 'dependency-id': this.pkgId, 'dependent-id': this.rec.dependentId })
const { 'old-config': oc, 'new-config': nc, spec: s } = await this.embassyApi.dryConfigureDependency({ 'dependency-id': this.pkgId, 'dependent-id': this.rec.dependentId })
oldConfig = oc
newConfig = nc
spec = s
} else {
this.loadingText = 'Loading Config'
const { config: oc, spec: s } = await this.embassyApi.getPackageConfig({ id: this.pkgId })
oldConfig = oc
spec = s
}
this.setConfig(spec, config, depConfig)
this.setConfig(spec, oldConfig, newConfig)
} catch (e) {
this.loadingError = getErrorMessage(e)
} finally {

View File

@@ -182,7 +182,11 @@ export module RR {
export type DeleteRecoveredPackageRes = WithRevision<null>
export type DryConfigureDependencyReq = { 'dependency-id': string, 'dependent-id': string } // package.dependency.configure.dry
export type DryConfigureDependencyRes = object
export type DryConfigureDependencyRes = {
'old-config': object
'new-config': object
spec: ConfigSpec
}
// marketplace

View File

@@ -542,28 +542,32 @@ export class MockApiService extends ApiService {
async dryConfigureDependency (params: RR.DryConfigureDependencyReq): Promise<RR.DryConfigureDependencyRes> {
await pauseFor(2000)
return {
testnet: true,
// objectList: [],
// unionList: [],
randomEnum: 'option2',
favoriteNumber: 9,
secondaryNumbers: [2, 3, 5, 6],
rpcsettings: {
laws: {
law1: 'The 1st law',
law2: 'The 2nd law',
'old-config': Mock.PackageConfig.config,
spec: Mock.PackageConfig.spec,
'new-config': {
testnet: true,
// objectList: [],
// unionList: [],
randomEnum: 'option2',
favoriteNumber: 9,
secondaryNumbers: [2, 3, 5, 6],
rpcsettings: {
laws: {
law1: 'The 1st law',
law2: 'The 2nd law',
},
rpcpass: null,
rpcuser: '123',
rulemakers: [],
},
rpcpass: null,
rpcuser: '123',
rulemakers: [],
advanced: {
notifications: ['call', 'text'],
},
// bitcoinNode: undefined,
port: 22,
// rpcallowip: undefined,
// rpcauth: ['matt: 8273gr8qwoidm1uid91jeh8y23gdio1kskmwejkdnm'],
},
advanced: {
notifications: ['call', 'text'],
},
// bitcoinNode: undefined,
port: 22,
// rpcallowip: undefined,
// rpcauth: ['matt: 8273gr8qwoidm1uid91jeh8y23gdio1kskmwejkdnm'],
}
}