From 6d805ae941bae324bf4373319906b8a0bf2914ea Mon Sep 17 00:00:00 2001
From: Lucy C <12953208+elvece@users.noreply.github.com>
Date: Fri, 1 Jul 2022 18:25:45 -0600
Subject: [PATCH] Fix/UI misc (#1606)
* stop expansion when description icon clicked
* add test for ensuring string sanitization
* rename log out to terminate in sessions component and remove sanitization bypass as unneeded
* remove unecessary instances of safe string
---
.../src/app/pages/home/home.page.ts | 6 +-----
.../src/app/pages/recover/recover.page.ts | 10 +++++++---
.../app/app/global/services/offline.service.ts | 4 ++--
.../form-object/form-label.component.html | 2 +-
.../form-object/form-object.component.html | 3 ++-
.../form-object/form-object.component.ts | 13 ++++++++++---
.../app/modals/app-config/app-config.page.ts | 4 ++--
.../modals/backup-select/backup-select.page.ts | 3 +--
.../app-actions/app-actions.page.ts | 1 -
.../marketplace-show-controls.component.ts | 10 +++-------
.../server-show/server-show.page.ts | 9 ++-------
.../server-routes/sessions/sessions.page.html | 2 +-
.../server-routes/sessions/sessions.page.ts | 18 ++++++------------
.../ui/src/app/services/api/api.fixures.ts | 4 ++--
.../ui/src/app/services/api/mock-patch.ts | 2 +-
15 files changed, 41 insertions(+), 50 deletions(-)
diff --git a/frontend/projects/diagnostic-ui/src/app/pages/home/home.page.ts b/frontend/projects/diagnostic-ui/src/app/pages/home/home.page.ts
index 1537acfd0..6009c4a32 100644
--- a/frontend/projects/diagnostic-ui/src/app/pages/home/home.page.ts
+++ b/frontend/projects/diagnostic-ui/src/app/pages/home/home.page.ts
@@ -1,9 +1,5 @@
import { Component } from '@angular/core'
-import {
- AlertController,
- IonicSafeString,
- LoadingController,
-} from '@ionic/angular'
+import { AlertController, LoadingController } from '@ionic/angular'
import { ApiService } from 'src/app/services/api/api.service'
@Component({
diff --git a/frontend/projects/setup-wizard/src/app/pages/recover/recover.page.ts b/frontend/projects/setup-wizard/src/app/pages/recover/recover.page.ts
index 75dd411c3..23dccbd04 100644
--- a/frontend/projects/setup-wizard/src/app/pages/recover/recover.page.ts
+++ b/frontend/projects/setup-wizard/src/app/pages/recover/recover.page.ts
@@ -32,7 +32,7 @@ export class RecoverPage {
private readonly loadingCtrl: LoadingController,
private readonly errorToastService: ErrorToastService,
public readonly stateService: StateService,
- ) { }
+ ) {}
async ngOnInit() {
await this.getDrives()
@@ -99,8 +99,12 @@ export class RecoverPage {
const alert = await this.alertCtrl.create({
header: 'Embassy Data Drive Detected',
message: new IonicSafeString(
- `${importableDrive.vendor || 'Unknown Vendor'} - ${importableDrive.model || 'Unknown Model'
- } contains Embassy data. To use this drive and its data as-is, click "Use Drive". This will complete the setup process.
Important. If you are trying to restore from backup or update from 0.2.x, DO NOT click "Use Drive". Instead, click "Cancel" and follow instructions.`,
+ `${importableDrive.vendor || 'Unknown Vendor'} - ${
+ importableDrive.model || 'Unknown Model'
+ } contains Embassy data.
+
To use this drive and its data, select "USE DRIVE". This will complete the setup process. +
Important! 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. 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. 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. 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.
+ If you are trying to restore from a backup or update from 0.2.x, DO NOT select "USE DRIVE". Instead, select "CANCEL" and follow instructions.`,
),
buttons: [
{
diff --git a/frontend/projects/ui/src/app/app/global/services/offline.service.ts b/frontend/projects/ui/src/app/app/global/services/offline.service.ts
index 60eded578..a26e1cac6 100644
--- a/frontend/projects/ui/src/app/app/global/services/offline.service.ts
+++ b/frontend/projects/ui/src/app/app/global/services/offline.service.ts
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core'
-import { IonicSafeString, ToastController, ToastOptions } from '@ionic/angular'
+import { ToastController, ToastOptions } from '@ionic/angular'
import { ToastButton } from '@ionic/core'
import { EMPTY, from, Observable } from 'rxjs'
import {
@@ -112,6 +112,6 @@ function getButtons(link?: string): ToastButton[] {
}
interface OfflineMessage {
- readonly message: string | IonicSafeString
+ readonly message: string
readonly link?: string
}
diff --git a/frontend/projects/ui/src/app/components/form-object/form-label.component.html b/frontend/projects/ui/src/app/components/form-object/form-label.component.html
index 1e70f50e2..ea2fbae4f 100644
--- a/frontend/projects/ui/src/app/components/form-object/form-label.component.html
+++ b/frontend/projects/ui/src/app/components/form-object/form-label.component.html
@@ -2,7 +2,7 @@
*ngIf="data.spec.description"
class="slot-start"
fill="clear"
- (click)="presentAlertDescription()"
+ (click)="presentAlertDescription($event)"
>
'
const localPkgs = this.patch.getData()['package-data']
const bullets = Object.keys(breakages).map(id => {
const title = localPkgs[id].manifest.title
return `
`)
+ message = `${message}${bullets}`
return new Promise(async resolve => {
const alert = await this.alertCtrl.create({
diff --git a/frontend/projects/ui/src/app/modals/backup-select/backup-select.page.ts b/frontend/projects/ui/src/app/modals/backup-select/backup-select.page.ts
index 7c817a4f9..f8b2250fe 100644
--- a/frontend/projects/ui/src/app/modals/backup-select/backup-select.page.ts
+++ b/frontend/projects/ui/src/app/modals/backup-select/backup-select.page.ts
@@ -1,5 +1,5 @@
import { Component } from '@angular/core'
-import { ModalController, IonicSafeString } from '@ionic/angular'
+import { ModalController } from '@ionic/angular'
import { map, take } from 'rxjs/operators'
import { PackageState } from 'src/app/services/patch-db/data-model'
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
@@ -11,7 +11,6 @@ import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
})
export class BackupSelectPage {
hasSelection = false
- error: string | IonicSafeString = ''
selectAll = true
pkgs: {
id: string
diff --git a/frontend/projects/ui/src/app/pages/apps-routes/app-actions/app-actions.page.ts b/frontend/projects/ui/src/app/pages/apps-routes/app-actions/app-actions.page.ts
index ee8da6856..e4564f135 100644
--- a/frontend/projects/ui/src/app/pages/apps-routes/app-actions/app-actions.page.ts
+++ b/frontend/projects/ui/src/app/pages/apps-routes/app-actions/app-actions.page.ts
@@ -4,7 +4,6 @@ import { ApiService } from 'src/app/services/api/embassy-api.service'
import {
AlertController,
IonContent,
- IonicSafeString,
LoadingController,
ModalController,
NavController,
diff --git a/frontend/projects/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show-controls/marketplace-show-controls.component.ts b/frontend/projects/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show-controls/marketplace-show-controls.component.ts
index 7ee5745f7..581e41af3 100644
--- a/frontend/projects/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show-controls/marketplace-show-controls.component.ts
+++ b/frontend/projects/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show-controls/marketplace-show-controls.component.ts
@@ -4,11 +4,7 @@ import {
Inject,
Input,
} from '@angular/core'
-import {
- AlertController,
- IonicSafeString,
- LoadingController,
-} from '@ionic/angular'
+import { AlertController, LoadingController } from '@ionic/angular'
import {
AbstractMarketplaceService,
MarketplacePkg,
@@ -153,14 +149,14 @@ export class MarketplaceShowControlsComponent {
}
private async presentAlertBreakages(breakages: Breakages): Promise'
const localPkgs = this.patch.getData()['package-data']
const bullets = Object.keys(breakages).map(id => {
const title = localPkgs[id].manifest.title
return `
`)
+ message = `${message}${bullets}`
return new Promise(async resolve => {
const alert = await this.alertCtrl.create({
diff --git a/frontend/projects/ui/src/app/pages/server-routes/server-show/server-show.page.ts b/frontend/projects/ui/src/app/pages/server-routes/server-show/server-show.page.ts
index e76e0eb1e..a89ee89cf 100644
--- a/frontend/projects/ui/src/app/pages/server-routes/server-show/server-show.page.ts
+++ b/frontend/projects/ui/src/app/pages/server-routes/server-show/server-show.page.ts
@@ -3,7 +3,6 @@ import {
AlertController,
LoadingController,
NavController,
- IonicSafeString,
ModalController,
} from '@ionic/angular'
import { ApiService } from 'src/app/services/api/embassy-api.service'
@@ -121,9 +120,7 @@ export class ServerShowPage {
const minutes = Object.keys(this.patch.getData()['package-data']).length * 2
const alert = await this.alertCtrl.create({
header: 'Warning',
- message: new IonicSafeString(
- `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.`,
- ),
+ message: `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: [
{
text: 'Cancel',
@@ -145,9 +142,7 @@ export class ServerShowPage {
async presentAlertRepairDisk() {
const alert = await this.alertCtrl.create({
header: 'Warning',
- message: new IonicSafeString(
- `