mirror of
https://github.com/nasa/openmct.git
synced 2025-01-18 10:46:42 +00:00
* Save and Finish blocking modal dialog Refactor and Styles #2500 * created new template for ProgressDialogComponent * Tweaks for #2501 - Normalized dialog icon size; - Enhanced text formatting in dialog; - Changed "Saving..." to remove ellipsis;
This commit is contained in:
parent
6e2497461a
commit
c6f83dea8d
@ -6,7 +6,7 @@ define([], function () {
|
||||
|
||||
SaveInProgressDialog.prototype.show = function () {
|
||||
this.dialog = this.dialogService.showBlockingMessage({
|
||||
title: "Saving...",
|
||||
title: "Saving",
|
||||
hint: "Do not navigate away from this page or close this browser tab while this message is displayed.",
|
||||
unknownProgress: true,
|
||||
severity: "info",
|
||||
|
@ -1,25 +1,31 @@
|
||||
import ProgressComponent from '../../ui/components/ProgressBar.vue';
|
||||
import ProgressDialogComponent from './components/ProgressDialogComponent.vue';
|
||||
import Overlay from './Overlay';
|
||||
import Vue from 'vue';
|
||||
|
||||
var component;
|
||||
|
||||
class ProgressDialog extends Overlay {
|
||||
constructor({progressPerc, progressText, ...options}) {
|
||||
|
||||
constructor({progressPerc, progressText, iconClass, message, title, hint, timestamp, ...options}) {
|
||||
component = new Vue({
|
||||
provide: {
|
||||
iconClass,
|
||||
message,
|
||||
title,
|
||||
hint,
|
||||
timestamp
|
||||
},
|
||||
components: {
|
||||
ProgressComponent: ProgressComponent
|
||||
ProgressDialogComponent: ProgressDialogComponent
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
model: {
|
||||
progressPerc: progressPerc || 0,
|
||||
progressText: progressText
|
||||
progressText
|
||||
}
|
||||
}
|
||||
},
|
||||
template: '<progress-component :model="model"></progress-component>'
|
||||
template: '<progress-dialog-component :model="model"></progress-dialog-component>'
|
||||
}).$mount();
|
||||
|
||||
super({
|
||||
|
@ -20,6 +20,7 @@
|
||||
v-if="message">
|
||||
{{message}}
|
||||
</div>
|
||||
<slot></slot>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -44,7 +45,7 @@
|
||||
|
||||
&__icon {
|
||||
// Holds a background SVG graphic
|
||||
$s: 50px;
|
||||
$s: 80px;
|
||||
flex: 0 0 auto;
|
||||
min-width: $s;
|
||||
min-height: $s;
|
||||
@ -61,9 +62,13 @@
|
||||
}
|
||||
|
||||
// __text elements
|
||||
&__title,
|
||||
&__action-text {
|
||||
font-size: 1.2em; // TEMP
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
&__title {
|
||||
font-size: 1.5em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
&--simple {
|
||||
|
22
src/api/overlays/components/ProgressDialogComponent.vue
Normal file
22
src/api/overlays/components/ProgressDialogComponent.vue
Normal file
@ -0,0 +1,22 @@
|
||||
<template>
|
||||
<dialog-component>
|
||||
<progress-component :model="model"></progress-component>
|
||||
</dialog-component>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
</style>
|
||||
|
||||
<script>
|
||||
import ProgressComponent from '../../../ui/components/ProgressBar.vue';
|
||||
import DialogComponent from './DialogComponent.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
DialogComponent: DialogComponent,
|
||||
ProgressComponent: ProgressComponent,
|
||||
},
|
||||
inject:['iconClass', 'title', 'hint', 'timestamp', 'message'],
|
||||
props:['model']
|
||||
}
|
||||
</script>
|
@ -2,13 +2,13 @@
|
||||
<div class="c-progress-bar">
|
||||
<div class="c-progress-bar__holder">
|
||||
<div class="c-progress-bar__bar"
|
||||
:class="{'--indeterminate': model.progressPerc === 'unknown' }"
|
||||
:class="{'--indeterminate': model.progressPerc === 'unknown'}"
|
||||
:style="`width: ${model.progressPerc}%;`">
|
||||
</div>
|
||||
</div>
|
||||
<div class="c-progress-bar__text"
|
||||
v-if="model.progressText !== undefined">
|
||||
<span v-if="model.progressPerc > 0">{{model.progressPerc}}% complete. </span>
|
||||
<span v-if="model.progressPerc > 0">{{model.progressPerc}}% complete.</span>
|
||||
{{model.progressText}}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -129,17 +129,20 @@ const PLACEHOLDER_OBJECT = {};
|
||||
saveAndFinishEditing() {
|
||||
let dialog = this.openmct.overlays.progressDialog({
|
||||
progressPerc: 'unknown',
|
||||
progressText: 'Saving...',
|
||||
message: 'Do not navigate away from this page or close this browser tab while this message is displayed.',
|
||||
iconClass: 'info',
|
||||
title: 'Saving',
|
||||
});
|
||||
|
||||
return this.openmct.editor.save().then(()=> {
|
||||
dialog.dismiss();
|
||||
this.openmct.notifications.info('Save successful');
|
||||
}).catch((error) => {
|
||||
dialog.dismiss();
|
||||
this.openmct.notifications.error('Error saving objects');
|
||||
console.error(error);
|
||||
});
|
||||
return this.openmct.editor.save()
|
||||
.then(()=> {
|
||||
dialog.dismiss();
|
||||
this.openmct.notifications.info('Save successful');
|
||||
}).catch((error) => {
|
||||
dialog.dismiss();
|
||||
this.openmct.notifications.error('Error saving objects');
|
||||
console.error(error);
|
||||
});
|
||||
},
|
||||
saveAndContinueEditing() {
|
||||
this.saveAndFinishEditing().then(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user