Merge branch 'bugfix/close_mitt_signals_' into 'v3'
Bugfix/close mitt signals Closes #757 See merge request openflexure/openflexure-microscope-server!581
This commit is contained in:
commit
943ebb64b2
4 changed files with 35 additions and 18 deletions
|
|
@ -199,23 +199,36 @@ export default {
|
|||
mounted() {
|
||||
const store = useSettingsStore();
|
||||
// A global signal listener to switch tab
|
||||
eventBus.on("globalSwitchTab", (tabID) => {
|
||||
this.currentTab = tabID;
|
||||
});
|
||||
eventBus.on("globalSwitchTab", this.handleGlobalSwitchTab);
|
||||
// A global signal listener to increment tab
|
||||
eventBus.on("globalIncrementTab", () => {
|
||||
this.incrementTabBy(1);
|
||||
});
|
||||
eventBus.on("globalIncrementTab", this.handleGlobalIncrementTab);
|
||||
// A global signal listener to decrement tab
|
||||
eventBus.on("globalDecrementTab", () => {
|
||||
this.incrementTabBy(-1);
|
||||
});
|
||||
eventBus.on("globalDecrementTab", this.handleGlobalDecrementTab);
|
||||
if (store.ready) {
|
||||
this.startModals();
|
||||
}
|
||||
},
|
||||
|
||||
beforeUnmount() {
|
||||
// closing signals
|
||||
eventBus.off("globalSwitchTab", this.handleGlobalSwitchTab);
|
||||
eventBus.off("globalIncrementTab", this.handleGlobalIncrementTab);
|
||||
eventBus.off("globalDecrementTab", this.handleGlobalDecrementTab);
|
||||
},
|
||||
|
||||
methods: {
|
||||
// These methods are used for opening and closing signals.
|
||||
// They are used instead of anonymous arrow functions so we can
|
||||
// call close on the same function called with open.
|
||||
handleGlobalSwitchTab: function (tabID) {
|
||||
this.currentTab = tabID;
|
||||
},
|
||||
handleGlobalIncrementTab: function () {
|
||||
this.incrementTabBy(1);
|
||||
},
|
||||
handleGlobalDecrementTab: function () {
|
||||
this.incrementTabBy(-1);
|
||||
},
|
||||
setTab: function (event, tab) {
|
||||
if (!(this.currentTab == tab)) {
|
||||
this.currentTab = tab;
|
||||
|
|
|
|||
|
|
@ -219,22 +219,22 @@ export default {
|
|||
}
|
||||
// A global signal listener to perform the action
|
||||
if (this.submitOnEvent) {
|
||||
eventBus.on(this.submitOnEvent, () => {
|
||||
if (this.isDisabled) return;
|
||||
// Bootstrap task if button is not disabled.
|
||||
this.bootstrapTask();
|
||||
});
|
||||
eventBus.on(this.submitOnEvent, this.handleShortcutTrigger);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
beforeUnmount() {
|
||||
if (this.submitOnEvent) {
|
||||
eventBus.off(this.submitOnEvent);
|
||||
eventBus.off(this.submitOnEvent, this.handleShortcutTrigger);
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
handleShortcutTrigger() {
|
||||
if (this.isDisabled) return;
|
||||
this.bootstrapTask();
|
||||
},
|
||||
handleClick() {
|
||||
if (this.taskStarted) {
|
||||
this.terminateTask();
|
||||
|
|
|
|||
|
|
@ -109,6 +109,8 @@ export default {
|
|||
this.sizeObserver.disconnect();
|
||||
// Remove from the array of active streams
|
||||
this.store.removeStream(this.$.uid);
|
||||
// close signal
|
||||
eventBus.off("globalFlashStream", this.onFlashStream);
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue