mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
update patch types for current dependencies
This commit is contained in:
@@ -103,13 +103,13 @@ export class AppShowPage {
|
||||
depErrors,
|
||||
)
|
||||
|
||||
const depInfo = pkg.dependencyInfo[depId]
|
||||
const { title, icon, versionSpec } = pkg.currentDependencies[depId]
|
||||
|
||||
return {
|
||||
id: depId,
|
||||
version: pkg.currentDependencies[depId].versionRange, // @TODO do we want this version range?
|
||||
title: depInfo?.title || depId,
|
||||
icon: depInfo?.icon || '',
|
||||
version: versionSpec,
|
||||
title,
|
||||
icon,
|
||||
errorText: errorText
|
||||
? `${errorText}. ${manifest.title} will not work as expected.`
|
||||
: '',
|
||||
@@ -184,7 +184,7 @@ export class AppShowPage {
|
||||
const dependentInfo: DependentInfo = {
|
||||
id: pkgManifest.id,
|
||||
title: pkgManifest.title,
|
||||
version: pkg.currentDependencies[depId].versionRange,
|
||||
version: pkg.currentDependencies[depId].versionSpec,
|
||||
}
|
||||
const navigationExtras: NavigationExtras = {
|
||||
state: { dependentInfo },
|
||||
|
||||
@@ -55,15 +55,18 @@
|
||||
</p>
|
||||
</ion-label>
|
||||
<div slot="end" style="margin-left: 4px">
|
||||
<round-progress
|
||||
<ng-container
|
||||
*ngIf="local.stateInfo.state === 'updating' else notUpdating"
|
||||
[current]="(local.stateInfo.installingInfo.progress.overall | installingProgress) || 0"
|
||||
[max]="100"
|
||||
[radius]="13"
|
||||
[stroke]="3"
|
||||
[rounded]="true"
|
||||
color="var(--ion-color-primary)"
|
||||
></round-progress>
|
||||
>
|
||||
<round-progress
|
||||
[current]="(local.stateInfo.installingInfo.progress.overall | installingProgress) || 0"
|
||||
[max]="100"
|
||||
[radius]="13"
|
||||
[stroke]="3"
|
||||
[rounded]="true"
|
||||
color="var(--ion-color-primary)"
|
||||
></round-progress>
|
||||
</ng-container>
|
||||
<ng-template #notUpdating>
|
||||
<ion-spinner
|
||||
*ngIf="marketplaceService.updateQueue[pkg.manifest.id] else updateBtn"
|
||||
|
||||
@@ -44,8 +44,8 @@ export class UpdatesPage {
|
||||
marketplace: this.marketplaceService.getMarketplace$(),
|
||||
localPkgs: this.patch.watch$('packageData').pipe(
|
||||
map(pkgs =>
|
||||
Object.values(pkgs).reduce((acc, curr) => {
|
||||
if (isInstalled(curr) || isUpdating(curr)) return { ...acc, curr }
|
||||
Object.entries(pkgs).reduce((acc, [id, val]) => {
|
||||
if (isInstalled(val) || isUpdating(val)) return { ...acc, [id]: val }
|
||||
return acc
|
||||
}, {} as Record<string, PackageDataEntry<InstalledState | UpdatingState>>),
|
||||
),
|
||||
|
||||
@@ -24,9 +24,3 @@ export class InstallingProgressPipe implements PipeTransform {
|
||||
return Number((progress.done / progress.total).toFixed(2))
|
||||
}
|
||||
}
|
||||
|
||||
function getProgress(progress: Progress): number | null {
|
||||
if (progress === true) return 1
|
||||
if (progress === false || !progress.total) return null
|
||||
return Number((progress.done / progress.total).toFixed(2))
|
||||
}
|
||||
|
||||
@@ -1608,7 +1608,6 @@ export module Mock {
|
||||
},
|
||||
},
|
||||
currentDependencies: {},
|
||||
dependencyInfo: {},
|
||||
marketplaceUrl: 'https://registry.start9.com/',
|
||||
developerKey: 'developer-key',
|
||||
}
|
||||
@@ -1737,15 +1736,13 @@ export module Mock {
|
||||
},
|
||||
},
|
||||
currentDependencies: {
|
||||
bitcoind: {
|
||||
versionRange: '>=26.0.0',
|
||||
healthChecks: [],
|
||||
},
|
||||
},
|
||||
dependencyInfo: {
|
||||
bitcoind: {
|
||||
title: Mock.MockManifestBitcoind.title,
|
||||
icon: 'assets/img/service-icons/bitcoind.svg',
|
||||
kind: 'running',
|
||||
registryUrl: '',
|
||||
versionSpec: '>=26.0.0',
|
||||
healthChecks: [],
|
||||
},
|
||||
},
|
||||
marketplaceUrl: 'https://registry.start9.com/',
|
||||
@@ -1982,23 +1979,21 @@ export module Mock {
|
||||
},
|
||||
},
|
||||
currentDependencies: {
|
||||
bitcoind: {
|
||||
versionRange: '>=26.0.0',
|
||||
healthChecks: [],
|
||||
},
|
||||
'btc-rpc-proxy': {
|
||||
versionRange: '>2.0.0', // @TODO
|
||||
healthChecks: [],
|
||||
},
|
||||
},
|
||||
dependencyInfo: {
|
||||
bitcoind: {
|
||||
title: Mock.MockManifestBitcoind.title,
|
||||
icon: 'assets/img/service-icons/bitcoind.svg',
|
||||
kind: 'running',
|
||||
registryUrl: 'https://registry.start9.com',
|
||||
versionSpec: '>=26.0.0',
|
||||
healthChecks: [],
|
||||
},
|
||||
'btc-rpc-proxy': {
|
||||
title: Mock.MockManifestBitcoinProxy.title,
|
||||
icon: 'assets/img/service-icons/btc-rpc-proxy.png',
|
||||
kind: 'exists',
|
||||
registryUrl: 'https://community-registry.start9.com',
|
||||
versionSpec: '>2.0.0', // @TODO
|
||||
healthChecks: [],
|
||||
},
|
||||
},
|
||||
marketplaceUrl: 'https://registry.start9.com/',
|
||||
|
||||
@@ -679,8 +679,6 @@ export class MockApiService extends ApiService {
|
||||
this.updateProgress(params.id)
|
||||
}, 1000)
|
||||
|
||||
const manifest = Mock.LocalPkgs[params.id].stateInfo.manifest
|
||||
|
||||
const patch: Operation<
|
||||
PackageDataEntry<InstallingState | UpdatingState>
|
||||
>[] = [
|
||||
@@ -691,15 +689,15 @@ export class MockApiService extends ApiService {
|
||||
...Mock.LocalPkgs[params.id],
|
||||
stateInfo: {
|
||||
// if installing
|
||||
state: PackageState.Installing,
|
||||
// state: PackageState.Installing,
|
||||
|
||||
// if updating
|
||||
// state: PackageState.Updating,
|
||||
// manifest,
|
||||
state: PackageState.Updating,
|
||||
manifest: mockPatchData.packageData[params.id].stateInfo.manifest!,
|
||||
|
||||
// both
|
||||
installingInfo: {
|
||||
newManifest: manifest,
|
||||
newManifest: Mock.LocalPkgs[params.id].stateInfo.manifest,
|
||||
progress: PROGRESS,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -335,7 +335,6 @@ export const mockPatchData: DataModel = {
|
||||
},
|
||||
},
|
||||
currentDependencies: {},
|
||||
dependencyInfo: {},
|
||||
marketplaceUrl: 'https://registry.start9.com/',
|
||||
developerKey: 'developer-key',
|
||||
},
|
||||
@@ -570,23 +569,21 @@ export const mockPatchData: DataModel = {
|
||||
},
|
||||
},
|
||||
currentDependencies: {
|
||||
bitcoind: {
|
||||
versionRange: '>=26.0.0',
|
||||
healthChecks: [],
|
||||
},
|
||||
'btc-rpc-proxy': {
|
||||
versionRange: '>2.0.0',
|
||||
healthChecks: [],
|
||||
},
|
||||
},
|
||||
dependencyInfo: {
|
||||
bitcoind: {
|
||||
title: 'Bitcoin Core',
|
||||
icon: 'assets/img/service-icons/bitcoind.svg',
|
||||
kind: 'running',
|
||||
registryUrl: 'https://registry.start9.com',
|
||||
versionSpec: '>=26.0.0',
|
||||
healthChecks: [],
|
||||
},
|
||||
'btc-rpc-proxy': {
|
||||
title: 'Bitcoin Proxy',
|
||||
icon: 'assets/img/service-icons/btc-rpc-proxy.png',
|
||||
kind: 'running',
|
||||
registryUrl: 'https://community-registry.start9.com',
|
||||
versionSpec: '>2.0.0',
|
||||
healthChecks: [],
|
||||
},
|
||||
},
|
||||
marketplaceUrl: 'https://registry.start9.com/',
|
||||
|
||||
@@ -85,14 +85,14 @@ export class DepErrorService {
|
||||
}
|
||||
}
|
||||
|
||||
const versionRange = pkg.currentDependencies[depId].versionRange
|
||||
const versionSpec = pkg.currentDependencies[depId].versionSpec
|
||||
const depManifest = dep.stateInfo.manifest
|
||||
|
||||
// incorrect version
|
||||
if (!this.emver.satisfies(depManifest.version, versionRange)) {
|
||||
if (!this.emver.satisfies(depManifest.version, versionSpec)) {
|
||||
return {
|
||||
type: DependencyErrorType.IncorrectVersion,
|
||||
expected: versionRange,
|
||||
expected: versionSpec,
|
||||
received: depManifest.version,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,13 +100,7 @@ export type PackageDataEntry<T extends StateInfo = StateInfo> = {
|
||||
status: Status
|
||||
actions: Record<string, ActionMetadata>
|
||||
lastBackup: string | null
|
||||
currentDependencies: { [id: string]: CurrentDependencyInfo }
|
||||
dependencyInfo: {
|
||||
[id: string]: {
|
||||
title: string
|
||||
icon: Url
|
||||
}
|
||||
}
|
||||
currentDependencies: Record<string, CurrentDependencyInfo>
|
||||
serviceInterfaces: Record<string, ServiceInterfaceWithHostInfo>
|
||||
marketplaceUrl: string | null
|
||||
developerKey: string
|
||||
@@ -117,11 +111,13 @@ export type StateInfo = InstalledState | InstallingState | UpdatingState
|
||||
export type InstalledState = {
|
||||
state: PackageState.Installed | PackageState.Removing
|
||||
manifest: Manifest
|
||||
installingInfo?: undefined
|
||||
}
|
||||
|
||||
export type InstallingState = {
|
||||
state: PackageState.Installing | PackageState.Restoring
|
||||
installingInfo: InstallingInfo
|
||||
manifest?: undefined
|
||||
}
|
||||
|
||||
export type UpdatingState = {
|
||||
@@ -139,8 +135,10 @@ export enum PackageState {
|
||||
}
|
||||
|
||||
export interface CurrentDependencyInfo {
|
||||
title: string
|
||||
icon: string
|
||||
kind: 'exists' | 'running'
|
||||
url: string
|
||||
registryUrl: string
|
||||
versionSpec: string
|
||||
healthChecks: string[] // array of health check IDs
|
||||
}
|
||||
|
||||
@@ -12,8 +12,7 @@ export function dryUpdate(
|
||||
pkg =>
|
||||
Object.keys(pkg.currentDependencies || {}).some(
|
||||
pkgId => pkgId === id,
|
||||
) &&
|
||||
!emver.satisfies(version, pkg.currentDependencies[id].versionRange),
|
||||
) && !emver.satisfies(version, pkg.currentDependencies[id].versionSpec),
|
||||
)
|
||||
.map(pkg => getManifest(pkg).title)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user