skip prompt if no dep issues

This commit is contained in:
Matt Hill
2021-12-06 12:36:55 -07:00
committed by Aiden McClelland
parent b4ffcb7ab5
commit 7723b704ec
3 changed files with 69 additions and 28 deletions

View File

@@ -3,26 +3,24 @@
<ion-label class="long-message">Checking for installed services which depend on {{ params.title }}...</ion-label> <ion-label class="long-message">Checking for installed services which depend on {{ params.title }}...</ion-label>
</div> </div>
<div *ngIf="!(loading$ | async)" class="slide-content"> <div *ngIf="!(loading$ | async) && !!dependentViolation" class="slide-content">
<div style="margin-top: 25px;"> <div style="margin-top: 25px;">
<div style="margin: 15px; display: flex; justify-content: center; align-items: center;"> <div style="margin: 15px; display: flex; justify-content: center; align-items: center;">
<ion-label color="warning" style="font-size: xx-large; font-weight: bold;" <ion-label color="warning" style="font-size: xx-large; font-weight: bold;">
*ngIf="hasDependentViolation">
WARNING WARNING
</ion-label> </ion-label>
<ion-label color="success" style="font-size: x-large; font-weight: bold; text-transform: capitalize;"
*ngIf="!hasDependentViolation">
READY
</ion-label>
</div> </div>
<div *ngIf="message" class="long-message"> <div class="long-message">
{{ message }} {{ dependentViolation }}
</div> </div>
<div *ngIf="hasDependentViolation" style="margin: 25px 0px;">
<div style="margin: 25px 0px;">
<div style="border-width: 0px 0px 1px 0px; font-size: unset; text-align: left; font-weight: bold; margin-left: 13px; border-style: solid; border-color: var(--ion-color-light-tint);"> <div style="border-width: 0px 0px 1px 0px; font-size: unset; text-align: left; font-weight: bold; margin-left: 13px; border-style: solid; border-color: var(--ion-color-light-tint);">
<ion-text color="warning">Affected Services</ion-text> <ion-text color="warning">Affected Services</ion-text>
</div> </div>
<ion-item <ion-item
style="--ion-item-background: margin-top: 5px" style="--ion-item-background: margin-top: 5px"
*ngFor="let dep of dependentBreakages | keyvalue" *ngFor="let dep of dependentBreakages | keyvalue"

View File

@@ -27,8 +27,8 @@ export class DependentsComponent {
} }
dependentBreakages: Breakages dependentBreakages: Breakages
hasDependentViolation: boolean dependentViolation: string | undefined
message: string | null = null
loading$ = new BehaviorSubject(false) loading$ = new BehaviorSubject(false)
cancel$ = new Subject<void>() cancel$ = new Subject<void>()
@@ -45,11 +45,10 @@ export class DependentsComponent {
.subscribe( .subscribe(
{ {
complete: () => { complete: () => {
this.hasDependentViolation = this.dependentBreakages && !isEmptyObject(this.dependentBreakages) if (this.dependentBreakages && !isEmptyObject(this.dependentBreakages)) {
if (this.hasDependentViolation) { this.dependentViolation = `${capitalizeFirstLetter(this.params.verb)} ${this.params.title} will prohibit the following services from functioning properly and may cause them to stop if they are currently running.`
this.message = `${capitalizeFirstLetter(this.params.verb)} ${this.params.title} will prohibit the following services from functioning properly and may cause them to stop if they are currently running.`
} else { } else {
this.message = `No other services installed on your Embassy will be affected by this action.` this.transitions.next()
} }
}, },
error: (e: Error) => this.transitions.error(new Error(`Fetching dependent service information failed: ${e.message || e}`)), error: (e: Error) => this.transitions.error(new Error(`Fetching dependent service information failed: ${e.message || e}`)),

View File

@@ -33,7 +33,9 @@ export class WizardBaker {
}, },
}, },
bottomBar: { bottomBar: {
cancel: { afterLoading: { text: 'Cancel' } }, cancel: {
afterLoading: { text: 'Cancel' },
},
next: 'Next', next: 'Next',
}, },
} : undefined, } : undefined,
@@ -48,8 +50,10 @@ export class WizardBaker {
}, },
}, },
bottomBar: { bottomBar: {
cancel: { afterLoading: { text: 'Cancel' } }, cancel: {
next: 'Update Anyways', afterLoading: { text: 'Cancel' },
},
next: 'Update Anyway',
}, },
}, },
{ {
@@ -94,7 +98,10 @@ export class WizardBaker {
}, },
}, },
bottomBar: { bottomBar: {
cancel: { afterLoading: { text: 'Cancel' } }, next: 'Begin Update', cancel: {
afterLoading: { text: 'Cancel' },
},
next: 'Begin Update',
}, },
}, },
{ {
@@ -137,7 +144,12 @@ export class WizardBaker {
titleColor: 'warning', titleColor: 'warning',
}, },
}, },
bottomBar: { cancel: { afterLoading: { text: 'Cancel' } }, next: 'Next' }, bottomBar: {
cancel: {
afterLoading: { text: 'Cancel' },
},
next: 'Next',
},
} : undefined, } : undefined,
{ slide: { { slide: {
selector: 'dependents', selector: 'dependents',
@@ -149,7 +161,11 @@ export class WizardBaker {
}, },
}, },
bottomBar: { bottomBar: {
cancel: { whileLoading: { }, afterLoading: { text: 'Cancel' } }, next: 'Downgrade Anyways', cancel: {
whileLoading: { },
afterLoading: { text: 'Cancel' },
},
next: 'Downgrade Anyway',
}, },
}, },
{ slide: { { slide: {
@@ -191,7 +207,11 @@ export class WizardBaker {
titleColor: 'warning', titleColor: 'warning',
}, },
}, },
bottomBar: { cancel: { afterLoading: { text: 'Cancel' } }, next: 'Continue' }, bottomBar: {
cancel: {
afterLoading: { text: 'Cancel' },
},
next: 'Continue' },
}, },
{ {
slide: { slide: {
@@ -203,7 +223,12 @@ export class WizardBaker {
fetchBreakages: () => this.embassyApi.dryUninstallPackage({ id }).then(breakages => breakages), fetchBreakages: () => this.embassyApi.dryUninstallPackage({ id }).then(breakages => breakages),
}, },
}, },
bottomBar: { cancel: { whileLoading: { }, afterLoading: { text: 'Cancel' } }, next: 'Uninstall' }, bottomBar: {
cancel: {
whileLoading: { },
afterLoading: { text: 'Cancel' },
},
next: 'Uninstall' },
}, },
{ {
slide: { slide: {
@@ -215,7 +240,12 @@ export class WizardBaker {
executeAction: () => this.embassyApi.uninstallPackage({ id }), executeAction: () => this.embassyApi.uninstallPackage({ id }),
}, },
}, },
bottomBar: { finish: 'Dismiss', cancel: { whileLoading: { } } }, bottomBar: {
finish: 'Dismiss',
cancel: {
whileLoading: { },
},
},
}, },
] ]
return { toolbar, slideDefinitions: slideDefinitions.filter(exists) } return { toolbar, slideDefinitions: slideDefinitions.filter(exists) }
@@ -242,7 +272,12 @@ export class WizardBaker {
fetchBreakages: () => this.embassyApi.dryStopPackage({ id }).then(breakages => breakages), fetchBreakages: () => this.embassyApi.dryStopPackage({ id }).then(breakages => breakages),
}, },
}, },
bottomBar: { cancel: { whileLoading: { }, afterLoading: { text: 'Cancel' } }, next: 'Stop Service' }, bottomBar: {
cancel: {
whileLoading: { },
afterLoading: { text: 'Cancel' },
},
next: 'Stop Service' },
}, },
{ {
slide: { slide: {
@@ -254,7 +289,12 @@ export class WizardBaker {
executeAction: () => this.embassyApi.stopPackage({ id }), executeAction: () => this.embassyApi.stopPackage({ id }),
}, },
}, },
bottomBar: { finish: 'Dismiss', cancel: { whileLoading: { } } }, bottomBar: {
finish: 'Dismiss',
cancel: {
whileLoading: { },
},
},
}, },
] ]
return { toolbar, slideDefinitions } return { toolbar, slideDefinitions }
@@ -279,7 +319,11 @@ export class WizardBaker {
title, fetchBreakages: () => Promise.resolve(breakages), title, fetchBreakages: () => Promise.resolve(breakages),
}, },
}, },
bottomBar: { cancel: { afterLoading: { text: 'Cancel' } }, next: 'Save Config Anyways' }, bottomBar: {
cancel: {
afterLoading: { text: 'Cancel' },
},
next: 'Save Config Anyway' },
}, },
] ]
return { toolbar, slideDefinitions } return { toolbar, slideDefinitions }