Remove app wiz and dry calls (#1541)

* no more app wiz or dry calls

* change spinner type

* better display for update available

* reintroduce dep breakages for update/downgrade and style alerts everywhere

* only show install alert on first install

Co-authored-by: Matt Hill <matthill@Matt-M1.local>
Co-authored-by: Matt Hill <matthill@Matt-M1.start9.dev>
This commit is contained in:
Matt Hill
2022-06-16 13:30:23 -06:00
committed by Lucy C
parent 37304a9d92
commit 0ac5b34f2d
57 changed files with 669 additions and 521 deletions

View File

@@ -145,7 +145,6 @@ export class MarketplacesPage {
: this.config.marketplace.url
const loader = await this.loadingCtrl.create({
spinner: 'lines',
message: 'Validating Marketplace...',
})
await loader.present()
@@ -189,7 +188,6 @@ export class MarketplacesPage {
)
const loader = await this.loadingCtrl.create({
spinner: 'lines',
message: 'Deleting...',
})
await loader.present()
@@ -219,7 +217,6 @@ export class MarketplacesPage {
if (currentUrls.includes(new URL(url).hostname)) return
const loader = await this.loadingCtrl.create({
spinner: 'lines',
message: 'Validating Marketplace...',
})
@@ -264,7 +261,6 @@ export class MarketplacesPage {
if (currentUrls.includes(new URL(url).hostname)) return
const loader = await this.loadingCtrl.create({
spinner: 'lines',
message: 'Validating Marketplace...',
})
await loader.present()

View File

@@ -66,7 +66,6 @@ export class PreferencesPage {
private async setDbValue(key: string, value: string): Promise<void> {
const loader = await this.loadingCtrl.create({
spinner: 'lines',
message: 'Saving...',
})
await loader.present()

View File

@@ -65,7 +65,6 @@ export class RestorePage {
oldPassword?: string,
): Promise<void> {
const loader = await this.loadingCtrl.create({
spinner: 'lines',
message: 'Decrypting drive...',
})
await loader.present()

View File

@@ -158,7 +158,6 @@ export class ServerBackupPage {
oldPassword?: string,
): Promise<void> {
const loader = await this.loadingCtrl.create({
spinner: 'lines',
message: 'Beginning backup...',
})
await loader.present()

View File

@@ -6,6 +6,7 @@ import { ServerShowPage } from './server-show.page'
import { FormsModule } from '@angular/forms'
import { TextSpinnerComponentModule } from '@start9labs/shared'
import { BadgeMenuComponentModule } from 'src/app/components/badge-menu-button/badge-menu.component.module'
import { OSUpdatePageModule } from 'src/app/modals/os-update/os-update.page.module'
const routes: Routes = [
{
@@ -22,6 +23,7 @@ const routes: Routes = [
RouterModule.forChild(routes),
TextSpinnerComponentModule,
BadgeMenuComponentModule,
OSUpdatePageModule,
],
declarations: [ServerShowPage],
})

View File

@@ -69,18 +69,16 @@
</p>
<!-- "Software Update" button only -->
<p *ngIf="button.title === 'Software Update'">
<ng-container *ngIf="button.disabled | async; else enabled">
<ion-text
*ngIf="server['status-info'].updated"
class="inline"
color="warning"
>
Update Complete, Restart to apply changes
</ion-text>
</ng-container>
<ng-template #enabled>
<ion-text
*ngIf="server['status-info'].updated; else notUpdated"
class="inline"
color="warning"
>
Update Complete. Restart to apply changes
</ion-text>
<ng-template #notUpdated>
<ng-container
*ngIf="eosService.updateAvailable$ | async; else check"
*ngIf="eosService.showUpdate$ | async; else check"
>
<ion-text class="inline" color="success">
<ion-icon name="rocket-outline"></ion-icon>

View File

@@ -11,12 +11,11 @@ import { ActivatedRoute } from '@angular/router'
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
import { Observable, of } from 'rxjs'
import { filter, map, take } from 'rxjs/operators'
import { wizardModal } from 'src/app/components/app-wizard/app-wizard.component'
import { WizardDefs } from 'src/app/components/app-wizard/wizard-defs'
import { exists, isEmptyObject, ErrorToastService } from '@start9labs/shared'
import { EOSService } from 'src/app/services/eos.service'
import { LocalStorageService } from 'src/app/services/local-storage.service'
import { RecoveredPackageDataEntry } from 'src/app/services/patch-db/data-model'
import { OSUpdatePage } from 'src/app/modals/os-update/os-update.page'
@Component({
selector: 'server-show',
@@ -33,7 +32,6 @@ export class ServerShowPage {
constructor(
private readonly alertCtrl: AlertController,
private readonly modalCtrl: ModalController,
private readonly wizards: WizardDefs,
private readonly loadingCtrl: LoadingController,
private readonly errToast: ErrorToastService,
private readonly embassyApi: ApiService,
@@ -63,26 +61,19 @@ export class ServerShowPage {
})
await alert.present()
} else {
const {
version,
headline,
'release-notes': releaseNotes,
} = this.eosService.eos
await wizardModal(
this.modalCtrl,
this.wizards.updateOS({
version,
headline,
releaseNotes,
}),
)
const modal = await this.modalCtrl.create({
componentProps: {
releaseNotes: this.eosService.eos['release-notes'],
},
component: OSUpdatePage,
})
modal.present()
}
}
async presentAlertRestart() {
const alert = await this.alertCtrl.create({
header: 'Confirm',
header: 'Restart',
message:
'Are you sure you want to restart your Embassy? It can take several minutes to come back online.',
buttons: [
@@ -106,7 +97,7 @@ export class ServerShowPage {
const alert = await this.alertCtrl.create({
header: 'Warning',
message:
'Are you sure you want to power down your Embassy? This can take several minutes, and your Embassy will not come back online automatically. To power on again, You will need to physically unplug your Embassy and plug it back in.',
'Are you sure you want to power down your Embassy? This can take several minutes, and your Embassy will not come back online automatically. To power on again, You will need to physically unplug your Embassy and plug it back in',
buttons: [
{
text: 'Cancel',
@@ -120,6 +111,7 @@ export class ServerShowPage {
cssClass: 'enter-click',
},
],
cssClass: 'alert-warning-message',
})
await alert.present()
}
@@ -127,9 +119,9 @@ export class ServerShowPage {
async presentAlertSystemRebuild() {
const minutes = Object.keys(this.patch.getData()['package-data']).length * 2
const alert = await this.alertCtrl.create({
header: 'System Rebuild',
header: 'Warning',
message: new IonicSafeString(
`<ion-text color="warning">Warning:</ion-text> This action will tear down all service containers and rebuild them from scratch. No data will be deleted. This action is useful if your system gets into a bad state, and it should only be performed if you are experiencing general performance or reliability issues. It may take up to ${minutes} minutes to complete. During this time, you will lose all connectivity to your Embassy.`,
`This action will tear down all service containers and rebuild them from scratch. No data will be deleted. This action is useful if your system gets into a bad state, and it should only be performed if you are experiencing general performance or reliability issues. It may take up to ${minutes} minutes to complete. During this time, you will lose all connectivity to your Embassy.`,
),
buttons: [
{
@@ -144,15 +136,16 @@ export class ServerShowPage {
cssClass: 'enter-click',
},
],
cssClass: 'alert-warning-message',
})
await alert.present()
}
async presentAlertRepairDisk() {
const alert = await this.alertCtrl.create({
header: 'Repair Disk',
header: 'Warning',
message: new IonicSafeString(
`<ion-text color="warning">Warning:</ion-text> <p>This action will attempt to preform a disk repair operation and system reboot. No data will be deleted. This action should only be executed if directed by a Start9 support specialist. We recommend backing up your device before preforming this action.</p><p>If anything happens to the device during the reboot (between the bep and chime), such as loosing power, a power surge, unplugging the drive, or unplugging the Embassy, the filesystem *will* be in an unrecoverable state. Please proceed with caution.</p>`,
`<p>This action will attempt to preform a disk repair operation and system reboot. No data will be deleted. This action should only be executed if directed by a Start9 support specialist. We recommend backing up your device before preforming this action.</p><p>If anything happens to the device during the reboot (between the bep and chime), such as loosing power, a power surge, unplugging the drive, or unplugging the Embassy, the filesystem <i>will</i> be in an unrecoverable state. Please proceed with caution.</p>`,
),
buttons: [
{
@@ -173,13 +166,13 @@ export class ServerShowPage {
cssClass: 'enter-click',
},
],
cssClass: 'alert-warning-message',
})
await alert.present()
}
private async restart() {
const loader = await this.loadingCtrl.create({
spinner: 'lines',
message: 'Restarting...',
})
await loader.present()
@@ -195,7 +188,6 @@ export class ServerShowPage {
private async shutdown() {
const loader = await this.loadingCtrl.create({
spinner: 'lines',
message: 'Shutting down...',
})
await loader.present()
@@ -211,7 +203,6 @@ export class ServerShowPage {
private async systemRebuild() {
const loader = await this.loadingCtrl.create({
spinner: 'lines',
message: 'Hard Restarting...',
})
await loader.present()
@@ -227,7 +218,6 @@ export class ServerShowPage {
private async checkForEosUpdate(): Promise<void> {
const loader = await this.loadingCtrl.create({
spinner: 'lines',
message: 'Checking for updates',
})
await loader.present()
@@ -282,14 +272,7 @@ export class ServerShowPage {
action: () =>
this.navCtrl.navigateForward(['restore'], { relativeTo: this.route }),
detail: true,
disabled: this.patch
.watch$('server-info', 'status-info')
.pipe(
map(
status =>
status && (status['backing-up'] || !!status['update-progress']),
),
),
disabled: this.eosService.updatingOrBackingUp$,
},
],
Settings: [
@@ -302,17 +285,7 @@ export class ServerShowPage {
? this.updateEos()
: this.checkForEosUpdate(),
detail: false,
disabled: this.patch
.watch$('server-info', 'status-info')
.pipe(
map(
status =>
status &&
(status['backing-up'] ||
!!status['update-progress'] ||
status.updated),
),
),
disabled: this.eosService.updatingOrBackingUp$,
},
{
title: 'Preferences',

View File

@@ -53,7 +53,6 @@ export class SessionsPage {
async kill(id: string): Promise<void> {
const loader = await this.loadingCtrl.create({
spinner: 'lines',
message: 'Killing session...',
})
await loader.present()

View File

@@ -50,8 +50,7 @@ export class SideloadPage {
}
async setFile(files?: File[]) {
const loader = await this.loadingCtrl.create({
spinner: 'lines',
message: 'Verifying Package',
message: 'Verifying package',
cssClass: 'loader',
})
await loader.present()
@@ -84,8 +83,7 @@ export class SideloadPage {
async handleUpload() {
const loader = await this.loadingCtrl.create({
spinner: 'lines',
message: 'Uploading Package',
message: 'Uploading package',
cssClass: 'loader',
})
await loader.present()

View File

@@ -64,7 +64,6 @@ export class SSHKeysPage {
async add(pubkey: string): Promise<void> {
const loader = await this.loadingCtrl.create({
spinner: 'lines',
message: 'Saving...',
})
await loader.present()
@@ -100,7 +99,6 @@ export class SSHKeysPage {
async delete(i: number): Promise<void> {
const loader = await this.loadingCtrl.create({
spinner: 'lines',
message: 'Deleting...',
})
await loader.present()

View File

@@ -170,7 +170,7 @@ export class WifiPage {
private async setCountry(country: string): Promise<void> {
const loader = await this.loadingCtrl.create({
spinner: 'lines',
message: 'Setting country...',
})
await loader.present()
@@ -261,7 +261,6 @@ export class WifiPage {
private async connect(ssid: string): Promise<void> {
const loader = await this.loadingCtrl.create({
spinner: 'lines',
message: 'Connecting. This could take a while...',
})
await loader.present()
@@ -278,7 +277,6 @@ export class WifiPage {
private async delete(ssid: string): Promise<void> {
const loader = await this.loadingCtrl.create({
spinner: 'lines',
message: 'Deleting...',
})
await loader.present()
@@ -296,7 +294,6 @@ export class WifiPage {
private async save(ssid: string, password: string): Promise<void> {
const loader = await this.loadingCtrl.create({
spinner: 'lines',
message: 'Saving...',
})
await loader.present()
@@ -318,7 +315,6 @@ export class WifiPage {
private async saveAndConnect(ssid: string, password: string): Promise<void> {
const loader = await this.loadingCtrl.create({
spinner: 'lines',
message: 'Connecting. This could take a while...',
})
await loader.present()