fe fixes after merge

This commit is contained in:
Matt Hill
2023-09-28 14:10:04 -06:00
parent d43767b945
commit d9dfacaaf4
10 changed files with 42 additions and 33 deletions

View File

@@ -82,10 +82,11 @@ export class MarketplaceShowControlsComponent {
if (!proceed) return if (!proceed) return
} }
const { id, version } = this.pkg.manifest const currentDeps = hasCurrentDeps(this.localPkg)
if (
const currentDeps = await hasCurrentDeps(this.patch, id) currentDeps &&
if (currentDeps && this.emver.compare(this.localVersion, version) !== 0) { this.emver.compare(this.localVersion, this.pkg.manifest.version) !== 0
) {
this.dryInstall(url) this.dryInstall(url)
} else { } else {
this.install(url) this.install(url)

View File

@@ -106,7 +106,7 @@ export class AppActionsPage {
alerts.uninstall || alerts.uninstall ||
`Uninstalling ${title} will permanently delete its data` `Uninstalling ${title} will permanently delete its data`
if (await hasCurrentDeps(this.patch, id)) { if (hasCurrentDeps(pkg)) {
message = `${message}. Services that depend on ${title} will no longer work properly and may crash` message = `${message}. Services that depend on ${title} will no longer work properly and may crash`
} }

View File

@@ -118,10 +118,10 @@ export class AppShowStatusComponent {
} }
async tryStop(): Promise<void> { async tryStop(): Promise<void> {
const { title, alerts, id } = this.pkg.manifest const { title, alerts } = this.pkg.manifest
let message = alerts.stop || '' let message = alerts.stop || ''
if (await hasCurrentDeps(this.patch, id)) { if (hasCurrentDeps(this.pkg)) {
const depMessage = `Services that depend on ${title} will no longer work properly and may crash` const depMessage = `Services that depend on ${title} will no longer work properly and may crash`
message = message ? `${message}.\n\n${depMessage}` : depMessage message = message ? `${message}.\n\n${depMessage}` : depMessage
} }
@@ -153,12 +153,10 @@ export class AppShowStatusComponent {
} }
async tryRestart(): Promise<void> { async tryRestart(): Promise<void> {
const { id, title } = this.pkg.manifest if (hasCurrentDeps(this.pkg)) {
if (await hasCurrentDeps(this.patch, id)) {
const alert = await this.alertCtrl.create({ const alert = await this.alertCtrl.create({
header: 'Warning', header: 'Warning',
message: `Services that depend on ${title} may temporarily experiences issues`, message: `Services that depend on ${this.pkg.manifest.title} may temporarily experiences issues`,
buttons: [ buttons: [
{ {
text: 'Cancel', text: 'Cancel',

View File

@@ -113,7 +113,7 @@ export class AppConfigPage {
try { try {
await this.uploadFiles(config, loader) await this.uploadFiles(config, loader)
if (await hasCurrentDeps(this.patchDb, this.pkgId)) { if (hasCurrentDeps(this.pkg!)) {
await this.configureDeps(config, loader) await this.configureDeps(config, loader)
} else { } else {
await this.configure(config, loader) await this.configure(config, loader)

View File

@@ -1,5 +1,4 @@
import { import {
DependencyErrorType,
HealthResult, HealthResult,
PackageDataEntry, PackageDataEntry,
PackageMainStatus, PackageMainStatus,
@@ -845,7 +844,7 @@ export module Mock {
integer: false, integer: false,
}), }),
}), }),
displayAs: "I'm {{last-name}}, {{first-name}} {{last-name}}", displayAs: 'I\'m {{last-name}}, {{first-name}} {{last-name}}',
uniqueBy: 'last-name', uniqueBy: 'last-name',
}, },
), ),

View File

@@ -1,10 +1,7 @@
import { DOCUMENT } from '@angular/common' import { DOCUMENT } from '@angular/common'
import { Inject, Injectable } from '@angular/core' import { Inject, Injectable } from '@angular/core'
import { WorkspaceConfig } from '@start9labs/shared' import { WorkspaceConfig } from '@start9labs/shared'
import { import { InstalledPackageInfo } from 'src/app/services/patch-db/data-model'
InstalledPackageInfo,
PackageMainStatus,
} from 'src/app/services/patch-db/data-model'
const { const {
packageArch, packageArch,
@@ -70,6 +67,10 @@ export class ConfigService {
return window.isSecureContext || this.isTor() return window.isSecureContext || this.isTor()
} }
getHost(): string {
return this.host
}
private isHttps(): boolean { private isHttps(): boolean {
return useMocks ? mocks.maskAsHttps : this.protocol === 'https:' return useMocks ? mocks.maskAsHttps : this.protocol === 'https:'
} }

View File

@@ -6,7 +6,7 @@ import {
DataModel, DataModel,
HealthCheckResult, HealthCheckResult,
HealthResult, HealthResult,
InstalledPackageDataEntry, PackageDataEntry,
PackageMainStatus, PackageMainStatus,
} from './patch-db/data-model' } from './patch-db/data-model'
@@ -46,14 +46,14 @@ export class DepErrorService {
pkgId: string, pkgId: string,
outerErrors: PackageDependencyErrors, outerErrors: PackageDependencyErrors,
): DependencyErrors { ): DependencyErrors {
const pkgInstalled = pkgs[pkgId].installed const pkg = pkgs[pkgId]
if (!pkgInstalled) return {} if (!pkg.installed) return {}
return currentDeps(pkgs, pkgId).reduce( return currentDeps(pkgs, pkgId).reduce(
(innerErrors, depId): DependencyErrors => ({ (innerErrors, depId): DependencyErrors => ({
...innerErrors, ...innerErrors,
[depId]: this.getDepError(pkgs, pkgInstalled, depId, outerErrors), [depId]: this.getDepError(pkgs, pkg, depId, outerErrors),
}), }),
{} as DependencyErrors, {} as DependencyErrors,
) )
@@ -61,11 +61,17 @@ export class DepErrorService {
private getDepError( private getDepError(
pkgs: DataModel['package-data'], pkgs: DataModel['package-data'],
pkgInstalled: InstalledPackageDataEntry, pkg: PackageDataEntry,
depId: string, depId: string,
outerErrors: PackageDependencyErrors, outerErrors: PackageDependencyErrors,
): DependencyError | null { ): DependencyError | null {
const depInstalled = pkgs[depId]?.installed console.warn(depId)
console.warn(pkgs)
const dep = pkgs[depId]
const pkgInstalled = pkg.installed!
const depInstalled = dep?.installed
// not installed // not installed
if (!depInstalled) { if (!depInstalled) {
@@ -74,8 +80,17 @@ export class DepErrorService {
} }
} }
const pkgManifest = pkgInstalled.manifest const depStatus = depInstalled.status.main.status
const depManifest = depInstalled.manifest
// backing up
if (depStatus === PackageMainStatus.BackingUp) {
return {
type: DependencyErrorType.NotRunning,
}
}
const pkgManifest = pkg.manifest
const depManifest = dep.manifest
// incorrect version // incorrect version
if ( if (
@@ -102,16 +117,10 @@ export class DepErrorService {
} }
} }
const depStatus = depInstalled.status.main.status
// not running // not running
if ( if (
depStatus !== PackageMainStatus.Running && depStatus !== PackageMainStatus.Running &&
depStatus !== PackageMainStatus.Starting && depStatus !== PackageMainStatus.Starting
!(
depStatus === PackageMainStatus.BackingUp &&
depInstalled.status.main.started
)
) { ) {
return { return {
type: DependencyErrorType.NotRunning, type: DependencyErrorType.NotRunning,
@@ -176,6 +185,7 @@ export type DependencyError =
export enum DependencyErrorType { export enum DependencyErrorType {
NotInstalled = 'notInstalled', NotInstalled = 'notInstalled',
BackingUp = 'backingUp',
NotRunning = 'notRunning', NotRunning = 'notRunning',
IncorrectVersion = 'incorrectVersion', IncorrectVersion = 'incorrectVersion',
ConfigUnsatisfied = 'configUnsatisfied', ConfigUnsatisfied = 'configUnsatisfied',