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