default to all category and fix rounding for progress (#2682)

* default to all category and fix rounding for progress

* Update install-progress.pipe.ts
This commit is contained in:
Matt Hill
2024-07-24 22:40:13 -06:00
committed by GitHub
parent c6f19db1ec
commit ab465a755e
6 changed files with 19 additions and 23 deletions

View File

@@ -2,7 +2,7 @@
<p> <p>
{{ phase.name }} {{ phase.name }}
<span *ngIf="phase.progress | installingProgress as progress"> <span *ngIf="phase.progress | installingProgress as progress">
: {{ progress * 100 }}% : {{ progress }}%
</span> </span>
</p> </p>
<ion-progress-bar <ion-progress-bar
@@ -15,6 +15,6 @@
: 'determinate' : 'determinate'
" "
[color]="phase.progress === true ? 'success' : 'secondary'" [color]="phase.progress === true ? 'success' : 'secondary'"
[value]="phase.progress | installingProgress" [value]="(phase.progress | installingProgress) / 100"
></ion-progress-bar> ></ion-progress-bar>
</ng-container> </ng-container>

View File

@@ -22,11 +22,7 @@ export class MarketplaceListPage {
readonly store$ = this.marketplaceService.getSelectedStore$().pipe( readonly store$ = this.marketplaceService.getSelectedStore$().pipe(
map(({ info, packages }) => { map(({ info, packages }) => {
const categories = new Map<string, T.Category>() const categories = new Map<string, T.Category>()
if (info.categories['featured'])
categories.set('featured', info.categories['featured'])
Object.keys(info.categories).forEach(c =>
categories.set(c, info.categories[c]),
)
categories.set('all', { categories.set('all', {
name: 'All', name: 'All',
description: { description: {
@@ -35,6 +31,10 @@ export class MarketplaceListPage {
}, },
}) })
Object.keys(info.categories).forEach(c =>
categories.set(c, info.categories[c]),
)
return { categories, packages } return { categories, packages }
}), }),
) )
@@ -88,7 +88,7 @@ export class MarketplaceListPage {
private readonly route: ActivatedRoute, private readonly route: ActivatedRoute,
) {} ) {}
category = 'featured' category = 'all'
query = '' query = ''
async presentModalMarketplaceSettings() { async presentModalMarketplaceSettings() {

View File

@@ -53,7 +53,7 @@
*ngIf="local.stateInfo.state === 'updating' else notUpdating" *ngIf="local.stateInfo.state === 'updating' else notUpdating"
> >
<round-progress <round-progress
[current]="(local.stateInfo.installingInfo.progress.overall | installingProgress) || 0" [current]="(local.stateInfo.installingInfo.progress.overall | installingProgress) / 100"
[max]="1" [max]="1"
[radius]="13" [radius]="13"
[stroke]="3" [stroke]="3"

View File

@@ -19,9 +19,9 @@ export class InstallingProgressDisplayPipe implements PipeTransform {
name: 'installingProgress', name: 'installingProgress',
}) })
export class InstallingProgressPipe implements PipeTransform { export class InstallingProgressPipe implements PipeTransform {
transform(progress: T.Progress): number | null { transform(progress: T.Progress): number {
if (progress === true) return 1 if (progress === true) return 100
if (progress === false || progress === null || !progress.total) return null if (progress === false || progress === null || !progress.total) return 0
return Number((progress.done / progress.total).toFixed(2)) return Math.floor((100 * progress.done) / progress.total)
} }
} }

View File

@@ -450,7 +450,7 @@ export module Mock {
}, },
}, },
}, },
categories: ['lightning', 'featured'], categories: ['lightning'],
otherVersions: { otherVersions: {
'0.18.0:0.0.1': { '0.18.0:0.0.1': {
releaseNotes: 'Upstream release and minor fixes.', releaseNotes: 'Upstream release and minor fixes.',
@@ -506,7 +506,7 @@ export module Mock {
}, },
}, },
}, },
categories: ['lightning', 'featured'], categories: ['lightning'],
otherVersions: { otherVersions: {
'0.18.0:0.0.1': { '0.18.0:0.0.1': {
releaseNotes: 'Upstream release and minor fixes.', releaseNotes: 'Upstream release and minor fixes.',
@@ -684,7 +684,7 @@ export module Mock {
}, },
}, },
}, },
categories: ['lightning', 'featured'], categories: ['lightning'],
otherVersions: { otherVersions: {
'0.17.5:0': { '0.17.5:0': {
releaseNotes: 'Upstream release to 0.17.5', releaseNotes: 'Upstream release to 0.17.5',

View File

@@ -19,11 +19,7 @@ import {
} from 'rxjs' } from 'rxjs'
import { RR } from 'src/app/services/api/api.types' import { RR } from 'src/app/services/api/api.types'
import { ApiService } from 'src/app/services/api/embassy-api.service' import { ApiService } from 'src/app/services/api/embassy-api.service'
import { import { DataModel, UIStore } from 'src/app/services/patch-db/data-model'
DataModel,
UIMarketplaceData,
UIStore,
} from 'src/app/services/patch-db/data-model'
import { PatchDB } from 'patch-db-client' import { PatchDB } from 'patch-db-client'
import { import {
catchError, catchError,
@@ -39,14 +35,14 @@ import {
import { ConfigService } from './config.service' import { ConfigService } from './config.service'
import { Exver, sameUrl } from '@start9labs/shared' import { Exver, sameUrl } from '@start9labs/shared'
import { ClientStorageService } from './client-storage.service' import { ClientStorageService } from './client-storage.service'
import { ExtendedVersion, T } from '@start9labs/start-sdk' import { T } from '@start9labs/start-sdk'
@Injectable() @Injectable()
export class MarketplaceService implements AbstractMarketplaceService { export class MarketplaceService implements AbstractMarketplaceService {
private readonly knownHosts$: Observable<StoreIdentity[]> = this.patch private readonly knownHosts$: Observable<StoreIdentity[]> = this.patch
.watch$('ui', 'marketplace', 'knownHosts') .watch$('ui', 'marketplace', 'knownHosts')
.pipe( .pipe(
map((hosts: UIMarketplaceData['knownHosts']) => { map(hosts => {
const { start9, community } = this.config.marketplace const { start9, community } = this.config.marketplace
let arr = [ let arr = [
toStoreIdentity(start9, hosts[start9]), toStoreIdentity(start9, hosts[start9]),