diff --git a/frontend/projects/ui/src/app/pages/login/ca-wizard/ca-wizard.component.html b/frontend/projects/ui/src/app/apps/login/ca-wizard/ca-wizard.component.html similarity index 100% rename from frontend/projects/ui/src/app/pages/login/ca-wizard/ca-wizard.component.html rename to frontend/projects/ui/src/app/apps/login/ca-wizard/ca-wizard.component.html diff --git a/frontend/projects/ui/src/app/pages/login/ca-wizard/ca-wizard.component.scss b/frontend/projects/ui/src/app/apps/login/ca-wizard/ca-wizard.component.scss similarity index 100% rename from frontend/projects/ui/src/app/pages/login/ca-wizard/ca-wizard.component.scss rename to frontend/projects/ui/src/app/apps/login/ca-wizard/ca-wizard.component.scss diff --git a/frontend/projects/ui/src/app/pages/login/ca-wizard/ca-wizard.component.ts b/frontend/projects/ui/src/app/apps/login/ca-wizard/ca-wizard.component.ts similarity index 100% rename from frontend/projects/ui/src/app/pages/login/ca-wizard/ca-wizard.component.ts rename to frontend/projects/ui/src/app/apps/login/ca-wizard/ca-wizard.component.ts diff --git a/frontend/projects/ui/src/app/apps/ui/pages/marketplace/marketplace-show/components/marketplace-show-controls/marketplace-show-controls.component.ts b/frontend/projects/ui/src/app/apps/ui/pages/marketplace/marketplace-show/components/marketplace-show-controls/marketplace-show-controls.component.ts index 33772dd86..cbffe01b8 100644 --- a/frontend/projects/ui/src/app/apps/ui/pages/marketplace/marketplace-show/components/marketplace-show-controls/marketplace-show-controls.component.ts +++ b/frontend/projects/ui/src/app/apps/ui/pages/marketplace/marketplace-show/components/marketplace-show-controls/marketplace-show-controls.component.ts @@ -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) diff --git a/frontend/projects/ui/src/app/apps/ui/pages/services/app-actions/app-actions.page.ts b/frontend/projects/ui/src/app/apps/ui/pages/services/app-actions/app-actions.page.ts index e8eaa1010..654748db9 100644 --- a/frontend/projects/ui/src/app/apps/ui/pages/services/app-actions/app-actions.page.ts +++ b/frontend/projects/ui/src/app/apps/ui/pages/services/app-actions/app-actions.page.ts @@ -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` } diff --git a/frontend/projects/ui/src/app/apps/ui/pages/services/app-show/components/app-show-status/app-show-status.component.ts b/frontend/projects/ui/src/app/apps/ui/pages/services/app-show/components/app-show-status/app-show-status.component.ts index 178199ef8..e9b4c4143 100644 --- a/frontend/projects/ui/src/app/apps/ui/pages/services/app-show/components/app-show-status/app-show-status.component.ts +++ b/frontend/projects/ui/src/app/apps/ui/pages/services/app-show/components/app-show-status/app-show-status.component.ts @@ -118,10 +118,10 @@ export class AppShowStatusComponent { } async tryStop(): Promise { - 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 { - 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', diff --git a/frontend/projects/ui/src/app/apps/ui/pages/services/app-show/modals/app-config/app-config.page.ts b/frontend/projects/ui/src/app/apps/ui/pages/services/app-show/modals/app-config/app-config.page.ts index f606d067e..dbbd1384e 100644 --- a/frontend/projects/ui/src/app/apps/ui/pages/services/app-show/modals/app-config/app-config.page.ts +++ b/frontend/projects/ui/src/app/apps/ui/pages/services/app-show/modals/app-config/app-config.page.ts @@ -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) diff --git a/frontend/projects/ui/src/app/services/api/api.fixures.ts b/frontend/projects/ui/src/app/services/api/api.fixures.ts index 36bc9f0e0..1fac619dc 100644 --- a/frontend/projects/ui/src/app/services/api/api.fixures.ts +++ b/frontend/projects/ui/src/app/services/api/api.fixures.ts @@ -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', }, ), diff --git a/frontend/projects/ui/src/app/services/config.service.ts b/frontend/projects/ui/src/app/services/config.service.ts index 36dc102fc..b36e54aa0 100644 --- a/frontend/projects/ui/src/app/services/config.service.ts +++ b/frontend/projects/ui/src/app/services/config.service.ts @@ -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:' } diff --git a/frontend/projects/ui/src/app/services/dep-error.service.ts b/frontend/projects/ui/src/app/services/dep-error.service.ts index 733b0a377..320d47d65 100644 --- a/frontend/projects/ui/src/app/services/dep-error.service.ts +++ b/frontend/projects/ui/src/app/services/dep-error.service.ts @@ -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',