Skip to content

Commit

Permalink
temp patch for marketplace rendering bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Hill authored and elvece committed Jun 16, 2022
1 parent d061121 commit 9d4de69
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { v4 } from 'uuid'
import { UIMarketplaceData } from '../../../services/patch-db/data-model'
import { ConfigService } from '../../../services/config.service'
import { MarketplaceService } from 'src/app/services/marketplace.service'
import { finalize, first } from 'rxjs/operators'
import { finalize, first, startWith } from 'rxjs/operators'

type Marketplaces = {
id: string | undefined
Expand Down Expand Up @@ -45,27 +45,35 @@ export class MarketplacesPage {
) {}

ngOnInit() {
this.patch.watch$('ui', 'marketplace').subscribe(mp => {
let marketplaces: Marketplaces = [
{
id: undefined,
name: this.config.marketplace.name,
url: this.config.marketplace.url,
},
]
if (mp) {
this.selectedId = mp['selected-id'] || undefined
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
})
this.patch
.watch$('ui', 'marketplace')
.pipe(
startWith({
'selected-id': null,
'known-hosts': {},
}),
)
.subscribe(mp => {
let marketplaces: Marketplaces = [
{
id: undefined,
name: this.config.marketplace.name,
url: this.config.marketplace.url,
},
]
if (mp) {
this.selectedId = mp['selected-id'] || undefined
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
})
}

async presentModalAdd() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class ServerLogsPage {
async copy(): Promise<void> {
const logs = document
.getElementById('template')
.cloneNode(true) as HTMLElement
?.cloneNode(true) as HTMLElement
const formatted = '```' + logs.innerHTML + '```'
const success = await copyToClipboard(formatted)
const message = success
Expand Down
2 changes: 1 addition & 1 deletion frontend/projects/ui/src/app/services/api/mock-patch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ export const mockPatchData: DataModel = {
'donation-url': null,
alerts: {
install: null,
uninstall: undefined,
uninstall: null,
restore:
'If this is a duplicate instance of the same LND node, you may loose your funds.',
start: 'Starting LND is good for your health.',
Expand Down
8 changes: 7 additions & 1 deletion frontend/projects/ui/src/app/services/marketplace.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ export class MarketplaceService extends AbstractMarketplaceService {

private readonly data$: Observable<UIMarketplaceData> = this.patch
.watch$('ui', 'marketplace')
.pipe(take(1), shareReplay({ bufferSize: 1, refCount: true }))
.pipe(
startWith({
'selected-id': null,
'known-hosts': {},
}),
shareReplay({ bufferSize: 1, refCount: true }),
)

private readonly marketplace$: Observable<Marketplace> = this.data$.pipe(
map(data => this.toMarketplace(data)),
Expand Down

0 comments on commit 9d4de69

Please sign in to comment.