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
}
const { id, version } = this.pkg.manifest
const currentDeps = await hasCurrentDeps(this.patch, id)
if (currentDeps && this.emver.compare(this.localVersion, version) !== 0) {
const currentDeps = hasCurrentDeps(this.localPkg)
if (
currentDeps &&
this.emver.compare(this.localVersion, this.pkg.manifest.version) !== 0
) {
this.dryInstall(url)
} else {
this.install(url)

View File

@@ -106,7 +106,7 @@ export class AppActionsPage {
alerts.uninstall ||
`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`
}

View File

@@ -118,10 +118,10 @@ export class AppShowStatusComponent {
}
async tryStop(): Promise<void> {
const { title, alerts, id } = this.pkg.manifest
const { title, alerts } = this.pkg.manifest
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`
message = message ? `${message}.\n\n${depMessage}` : depMessage
}
@@ -153,12 +153,10 @@ export class AppShowStatusComponent {
}
async tryRestart(): Promise<void> {
const { id, title } = this.pkg.manifest
if (await hasCurrentDeps(this.patch, id)) {
if (hasCurrentDeps(this.pkg)) {
const alert = await this.alertCtrl.create({
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: [
{
text: 'Cancel',

View File

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

View File

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

View File

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

View File

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