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

View File

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

View File

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

View File

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

View File

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

View File

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