Seed patchdb UI data (#1835)

* adjust types
for patchdb ui data and create seed file

* feat: For init and the migration use defaults

* fix update path

* update build for ui seed file

* fix accidential revert

* chore: Convert to do during the init

* chore: Update the commit message

Co-authored-by: BluJ <mogulslayer@gmail.com>
This commit is contained in:
Lucy C
2022-09-26 17:36:37 -06:00
committed by GitHub
parent 31c5aebe90
commit 1702c07481
13 changed files with 113 additions and 67 deletions

View File

@@ -49,7 +49,7 @@ export class DeveloperListPage {
}
async openCreateProjectModal() {
const projNumber = Object.keys(this.devData || {}).length + 1
const projNumber = Object.keys(this.devData).length + 1
const options: GenericInputOptions = {
title: 'Add new project',
message: 'Create a new dev project.',
@@ -130,7 +130,7 @@ export class DeveloperListPage {
async createProject(name: string) {
// fail silently if duplicate project name
if (
Object.values(this.devData || {})
Object.values(this.devData)
.map(v => v.name)
.includes(name)
)
@@ -148,11 +148,7 @@ export class DeveloperListPage {
.replace(/warning:/g, '# Optional\n warning:')
const def = { name, config, instructions: SAMPLE_INSTUCTIONS }
if (this.devData) {
await this.api.setDbValue({ pointer: `/dev/${id}`, value: def })
} else {
await this.api.setDbValue({ pointer: `/dev`, value: { [id]: def } })
}
await this.api.setDbValue({ pointer: `/dev/${id}`, value: def })
} catch (e: any) {
this.errToast.present(e)
} finally {

View File

@@ -66,7 +66,7 @@ export class MarketplacesPage {
this.patch
.watch$('ui', 'marketplace')
.pipe(distinctUntilChanged(), takeUntil(this.destroy$))
.subscribe((mp: UIMarketplaceData | undefined) => {
.subscribe((mp: UIMarketplaceData) => {
let marketplaces: Marketplaces = [
{
id: null,
@@ -74,17 +74,15 @@ export class MarketplacesPage {
url: this.config.marketplace.url,
},
]
if (mp) {
this.selectedId = mp['selected-id']
const alts = Object.entries(mp['known-hosts']).map(([k, v]) => {
return {
id: k,
name: v.name,
url: v.url,
}
})
marketplaces = marketplaces.concat(alts)
}
this.selectedId = mp['selected-id']
const alts = Object.entries(mp['known-hosts']).map(([k, v]) => {
return {
id: k,
name: v.name,
url: v.url,
}
})
marketplaces = marketplaces.concat(alts)
this.marketplaces = marketplaces
})
}