Only show alpha and beta in updates with dev tools enabled (#2132)

only show alpha and beta in updates with dev tools
This commit is contained in:
Matt Hill
2023-01-24 11:17:13 -07:00
committed by Aiden McClelland
parent 46222e9352
commit cf70933e21
5 changed files with 25 additions and 6 deletions

View File

@@ -10,7 +10,8 @@
"marketplace": { "marketplace": {
"start9": "https://registry.start9.com/", "start9": "https://registry.start9.com/",
"community": "https://community-registry.start9.com/", "community": "https://community-registry.start9.com/",
"beta": "https://beta-registry.start9.com/" "beta": "https://beta-registry.start9.com/",
"alpha": "https://alpha-registry-x.start9.com/"
}, },
"mocks": { "mocks": {
"maskAs": "tor", "maskAs": "tor",

View File

@@ -13,6 +13,7 @@ export type WorkspaceConfig = {
start9: 'https://registry.start9.com/' start9: 'https://registry.start9.com/'
community: 'https://community-registry.start9.com/' community: 'https://community-registry.start9.com/'
beta: 'https://beta-registry.start9.com/' beta: 'https://beta-registry.start9.com/'
alpha: 'https://alpha-registry-x.start9.com/'
} }
mocks: { mocks: {
maskAs: 'tor' | 'lan' maskAs: 'tor' | 'lan'

View File

@@ -39,9 +39,9 @@ export class MarketplaceSettingsPage {
selected: sameUrl(s.url, selected.url), selected: sameUrl(s.url, selected.url),
})) }))
// 0 and 1 are prod and community // 0 and 1 are prod and community
const standard = toSlice.slice(0, 1) const standard = toSlice.slice(0, 2)
// 2 and beyond are alts // 2 and beyond are alts
const alt = toSlice.slice(1) const alt = toSlice.slice(2)
return { standard, alt } return { standard, alt }
}), }),

View File

@@ -16,7 +16,7 @@ import {
} from '@start9labs/marketplace' } from '@start9labs/marketplace'
import { Emver, isEmptyObject, sameUrl } from '@start9labs/shared' import { Emver, isEmptyObject, sameUrl } from '@start9labs/shared'
import { Pipe, PipeTransform } from '@angular/core' import { Pipe, PipeTransform } from '@angular/core'
import { combineLatest, Observable } from 'rxjs' import { combineLatest, map, Observable } from 'rxjs'
import { import {
AlertController, AlertController,
LoadingController, LoadingController,
@@ -25,6 +25,8 @@ import {
import { hasCurrentDeps } from 'src/app/util/has-deps' import { hasCurrentDeps } from 'src/app/util/has-deps'
import { getAllPackages } from 'src/app/util/get-package-data' import { getAllPackages } from 'src/app/util/get-package-data'
import { Breakages } from 'src/app/services/api/api.types' import { Breakages } from 'src/app/services/api/api.types'
import { ClientStorageService } from 'src/app/services/client-storage.service'
import { ConfigService } from 'src/app/services/config.service'
interface UpdatesData { interface UpdatesData {
hosts: StoreIdentity[] hosts: StoreIdentity[]
@@ -39,8 +41,21 @@ interface UpdatesData {
styleUrls: ['updates.page.scss'], styleUrls: ['updates.page.scss'],
}) })
export class UpdatesPage { export class UpdatesPage {
readonly hosts$ = combineLatest([
this.clientStorageService.showDevTools$,
this.marketplaceService.getKnownHosts$(),
]).pipe(
map(([devMode, knownHosts]) => {
if (devMode) return knownHosts
return knownHosts.filter(h => {
const { alpha, beta } = this.config.marketplace
return ![alpha, beta].includes(h.url as any)
})
}),
)
readonly data$: Observable<UpdatesData> = combineLatest({ readonly data$: Observable<UpdatesData> = combineLatest({
hosts: this.marketplaceService.getKnownHosts$(), hosts: this.hosts$,
marketplace: this.marketplaceService.getMarketplace$(), marketplace: this.marketplaceService.getMarketplace$(),
localPkgs: this.patch.watch$('package-data'), localPkgs: this.patch.watch$('package-data'),
errors: this.marketplaceService.getRequestErrors$(), errors: this.marketplaceService.getRequestErrors$(),
@@ -56,6 +71,8 @@ export class UpdatesPage {
private readonly navCtrl: NavController, private readonly navCtrl: NavController,
private readonly loadingCtrl: LoadingController, private readonly loadingCtrl: LoadingController,
private readonly alertCtrl: AlertController, private readonly alertCtrl: AlertController,
private readonly clientStorageService: ClientStorageService,
private readonly config: ConfigService,
) {} ) {}
viewInMarketplace(pkg: PackageDataEntry) { viewInMarketplace(pkg: PackageDataEntry) {

View File

@@ -44,7 +44,7 @@ export class MarketplaceService implements AbstractMarketplaceService {
const { start9, community } = this.config.marketplace const { start9, community } = this.config.marketplace
let arr = [ let arr = [
toStoreIdentity(start9, hosts[start9]), toStoreIdentity(start9, hosts[start9]),
// toStoreIdentity(community, hosts[community]), toStoreIdentity(community, hosts[community]),
] ]
return arr.concat( return arr.concat(