openmct/src/api/overlays/ProgressDialog.js

44 lines
1.1 KiB
JavaScript
Raw Normal View History

2018-12-13 17:45:50 +00:00
import ProgressComponent from '../../ui/components/ProgressBar.vue';
import Overlay from './Overlay';
import Vue from 'vue';
var component;
class ProgressDialog extends Overlay {
constructor({progressPerc, progressText, ...options}) {
component = new Vue({
components: {
ProgressComponent: ProgressComponent
},
data() {
return {
model: {
progressPerc: progressPerc || 0,
progressText: progressText
}
}
},
template: '<progress-component :model="model"></progress-component>'
}).$mount();
super({
element: component.$el,
size: 'fit',
dismissable: false,
...options
});
this.once('destroy', () => {
component.$destroy();
});
}
updateProgress(progressPerc, progressText) {
component.model.progressPerc = progressPerc;
component.model.progressText = progressText;
}
}
export default ProgressDialog;