mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-04 14:29:45 +00:00
ui: finalize toast
This commit is contained in:
committed by
Aiden McClelland
parent
d6dfdda061
commit
4aaddb233a
@@ -1,37 +1,29 @@
|
|||||||
<ion-header>
|
|
||||||
<ion-toolbar>
|
|
||||||
<ion-title>
|
|
||||||
Confirm Backup
|
|
||||||
</ion-title>
|
|
||||||
<ion-buttons slot="start">
|
|
||||||
<ion-button slot="start" (click)="cancel()">
|
|
||||||
<ion-icon name="close-outline"></ion-icon>
|
|
||||||
</ion-button>
|
|
||||||
</ion-buttons>
|
|
||||||
</ion-toolbar>
|
|
||||||
</ion-header>
|
|
||||||
|
|
||||||
<ion-content>
|
<ion-content>
|
||||||
<!-- <ion-label class="ion-text-wrap" style="margin: 20px">{{message}}</ion-label> -->
|
<div style="height: 85%; margin: 20px; display: flex; flex-direction: column; justify-content: space-between;">
|
||||||
<form (submit)="submit()">
|
<div>
|
||||||
<ion-item-group>
|
<h4><ion-text color="dark">Ready to Backup</ion-text></h4>
|
||||||
<ion-item>
|
<p><ion-text color="medium">Enter your master password to create an encrypted backup.</ion-text></p>
|
||||||
<ion-input [type]="unmasked ? 'text' : 'password'" name="password" placeholder="password" [(ngModel)]="password" (ionChange)="$error$.next('')"></ion-input>
|
</div>
|
||||||
<!-- <ion-button fill="clear" [color]="unmasked ? 'danger' : 'primary'" (click)="toggleMask()">
|
<div>
|
||||||
<ion-icon slot="icon-only" [name]="unmasked ? 'eye-off-outline' : 'eye-outline'" size="small"></ion-icon>
|
<ion-item lines="none" style="--background: var(--ion-background-color); --border-color: var(--ion-color-medium);">
|
||||||
</ion-button> -->
|
<ion-label style="font-size: small" position="floating">Master Password</ion-label>
|
||||||
|
<ion-input style="border-style: solid; border-width: 0px 0px 1px 0px; border-color: var(--ion-color-dark);" [(ngModel)]="password" type="password" (ionChange)="$error$.next('')"></ion-input>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-item *ngIf="$error$ | async as e" lines="none">
|
<ion-item *ngIf="$error$ | async as e" lines="none" style="--background: var(--ion-background-color);">
|
||||||
<ion-label class="ion-text-wrap" color="danger">{{ e }}</ion-label>
|
<ion-label style="font-size: small" color="danger" class="ion-text-wrap">{{e}}</ion-label>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-item-divider></ion-item-divider>
|
<ion-item lines="none" style="--background: var(--ion-background-color)">
|
||||||
<ion-item>
|
<ion-label class="ion-text-wrap" color="medium" style="font-size: small">Eject drive when backup complete?</ion-label>
|
||||||
<ion-label>Eject drive when backup complete?</ion-label>
|
|
||||||
<ion-checkbox color="primary" checked slot="end" [(ngModel)]="eject"></ion-checkbox>
|
<ion-checkbox color="primary" checked slot="end" [(ngModel)]="eject"></ion-checkbox>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
</ion-item-group>
|
</div>
|
||||||
<ion-button type="submit" [disabled]="!password" style="margin-top: 30px" expand="block" fill="outline">
|
<div style="display: flex; justify-content: flex-end; align-items: center;">
|
||||||
Backup
|
<ion-button fill="clear" color="medium" (click)="cancel()">
|
||||||
</ion-button>
|
Cancel
|
||||||
</form>
|
</ion-button>
|
||||||
|
<ion-button fill="clear" color="primary" (click)="submit()">
|
||||||
|
Create Backup
|
||||||
|
</ion-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { AppBackupConfirmationComponent } from './app-backup-confirmation.compon
|
|||||||
import { IonicModule } from '@ionic/angular'
|
import { IonicModule } from '@ionic/angular'
|
||||||
import { RouterModule } from '@angular/router'
|
import { RouterModule } from '@angular/router'
|
||||||
import { SharingModule } from 'src/app/modules/sharing.module'
|
import { SharingModule } from 'src/app/modules/sharing.module'
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
@@ -14,6 +15,7 @@ import { SharingModule } from 'src/app/modules/sharing.module'
|
|||||||
IonicModule,
|
IonicModule,
|
||||||
RouterModule.forChild([]),
|
RouterModule.forChild([]),
|
||||||
SharingModule,
|
SharingModule,
|
||||||
|
FormsModule,
|
||||||
],
|
],
|
||||||
exports: [AppBackupConfirmationComponent],
|
exports: [AppBackupConfirmationComponent],
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
.toast-close-button {
|
||||||
|
color: var(--ion-color-primary) !important;
|
||||||
|
}
|
||||||
|
|||||||
@@ -90,7 +90,9 @@ export class AppBackupPage {
|
|||||||
app: this.app,
|
app: this.app,
|
||||||
partition,
|
partition,
|
||||||
},
|
},
|
||||||
|
cssClass: 'alertlike-modal',
|
||||||
component: AppBackupConfirmationComponent,
|
component: AppBackupConfirmationComponent,
|
||||||
|
backdropDismiss: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
m.onWillDismiss().then(res => {
|
m.onWillDismiss().then(res => {
|
||||||
@@ -100,43 +102,6 @@ export class AppBackupPage {
|
|||||||
})
|
})
|
||||||
|
|
||||||
return await m.present()
|
return await m.present()
|
||||||
// const alert = await this.alertCtrl.create({
|
|
||||||
// backdropDismiss: false,
|
|
||||||
// header: `Ready to Backup`,
|
|
||||||
// message: `Enter your master password to create an encrypted backup of ${this.app.title} to "${partition.label || partition.logicalname}".`,
|
|
||||||
// inputs: [
|
|
||||||
// {
|
|
||||||
// name: 'password',
|
|
||||||
// label: 'Password',
|
|
||||||
// type: 'password',
|
|
||||||
// placeholder: 'Master Password',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: 'eject',
|
|
||||||
// label: 'Eject drive when finished',
|
|
||||||
// placeholder: 'Eject drive when',
|
|
||||||
// type: 'checkbox',
|
|
||||||
// },
|
|
||||||
// ],
|
|
||||||
// buttons: [
|
|
||||||
// {
|
|
||||||
// text: 'Cancel',
|
|
||||||
// role: 'cancel',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// text: 'Create Backup',
|
|
||||||
// handler: async (data) => {
|
|
||||||
// if (!data.password || data.password.length < 12) {
|
|
||||||
// alert.message = new IonicSafeString(alert.message + '<br /><br /><ion-text color="danger">Password must be at least 12 characters in length.</ion-text>')
|
|
||||||
// return false
|
|
||||||
// } else {
|
|
||||||
// return this.create(disk, partition, data.password, data.eject)
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// ],
|
|
||||||
// })
|
|
||||||
// await alert.present()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async presentAlertWarn (partition: DiskPartition): Promise<void> {
|
private async presentAlertWarn (partition: DiskPartition): Promise<void> {
|
||||||
@@ -223,8 +188,8 @@ export class AppBackupPage {
|
|||||||
this.appModel.watchForBackup(this.app.id).pipe(concatMap(
|
this.appModel.watchForBackup(this.app.id).pipe(concatMap(
|
||||||
() => this.apiService.ejectExternalDisk(disk.logicalname),
|
() => this.apiService.ejectExternalDisk(disk.logicalname),
|
||||||
)).subscribe({
|
)).subscribe({
|
||||||
next: () => this.toastEjection(true),
|
next: () => this.toastEjection(disk, true),
|
||||||
error: () => this.toastEjection(false),
|
error: () => this.toastEjection(disk, false),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
await this.dismiss()
|
await this.dismiss()
|
||||||
@@ -236,24 +201,21 @@ export class AppBackupPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async toastEjection (success: boolean) {
|
private async toastEjection (disk: DiskInfo, success: boolean) {
|
||||||
const { header, message, cssClass } = success ? {
|
const { header, message, cssClass } = success ? {
|
||||||
header: 'Success',
|
header: 'Success',
|
||||||
message: 'Drive ejected successfully',
|
message: `Drive ${disk.logicalname} ejected successfully`,
|
||||||
cssClass: '',
|
cssClass: 'notification-toast',
|
||||||
} : {
|
} : {
|
||||||
header: 'Error',
|
header: 'Error',
|
||||||
message: 'Drive did not eject successfully',
|
message: `Drive ${disk.logicalname} did not eject successfully`,
|
||||||
cssClass: 'alert-error-message',
|
cssClass: 'alert-error-message',
|
||||||
}
|
}
|
||||||
const t = await this.toastCtrl.create({
|
const t = await this.toastCtrl.create({
|
||||||
header,
|
header,
|
||||||
message,
|
message,
|
||||||
cssClass,
|
cssClass,
|
||||||
buttons: [{
|
duration: 2000,
|
||||||
icon: 'close-outline',
|
|
||||||
role: 'cancel',
|
|
||||||
}]
|
|
||||||
})
|
})
|
||||||
await t.present()
|
await t.present()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,3 +40,4 @@ const routes: Routes = [
|
|||||||
declarations: [AppInstalledShowPage],
|
declarations: [AppInstalledShowPage],
|
||||||
})
|
})
|
||||||
export class AppInstalledShowPageModule { }
|
export class AppInstalledShowPageModule { }
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@
|
|||||||
--button-color: var(--ion-color-primary);
|
--button-color: var(--ion-color-primary);
|
||||||
--border-color: var(--ion-color-warning);
|
--border-color: var(--ion-color-warning);
|
||||||
--border-style: solid;
|
--border-style: solid;
|
||||||
--border-width: 2px;
|
--border-width: 1px;
|
||||||
--color: white;
|
--color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,6 +194,32 @@ ion-popover {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@media (min-width:1000px) {
|
||||||
|
.alertlike-modal {
|
||||||
|
--backdrop-opacity: 0.7 !important;
|
||||||
|
.modal-wrapper {
|
||||||
|
height: 46% !important;
|
||||||
|
width: 46% !important;
|
||||||
|
left: 26% !important;
|
||||||
|
top: 26% !important;
|
||||||
|
--box-shadow: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.alertlike-modal {
|
||||||
|
--backdrop-opacity: 0.7 !important;
|
||||||
|
.modal-wrapper {
|
||||||
|
height: 60% !important;
|
||||||
|
width: 80% !important;
|
||||||
|
left: 10% !important;
|
||||||
|
top: 20% !important;
|
||||||
|
--box-shadow: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.alert-error-message {
|
.alert-error-message {
|
||||||
.alert-message {
|
.alert-message {
|
||||||
color: var(--ion-color-danger);
|
color: var(--ion-color-danger);
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"useMocks": true
|
"useMocks": false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user