mirror of
https://github.com/nasa/openmct.git
synced 2024-12-28 08:58:52 +00:00
Removed extractRoleFromEvent from ActiveRoleSynchronizer
This commit is contained in:
parent
81c33efc6e
commit
9050b7a2da
@ -16,13 +16,14 @@ class ActiveRoleSynchronizer {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
subscribeToRoleChanges(callback) {
|
subscribeToRoleChanges(callback) {
|
||||||
this.#roleChannel.addEventListener('message', this.extractRoleFromEvent(callback));
|
this.#roleChannel.addEventListener('message', callback);
|
||||||
}
|
}
|
||||||
unsubscribeFromRoleChanges(callback) {
|
unsubscribeFromRoleChanges(callback) {
|
||||||
this.#roleChannel.removeEventListener('message', this.extractRoleFromEvent(callback));
|
this.#roleChannel.removeEventListener('message', callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
setActiveRoleFromChannelMessage(role) {
|
setActiveRoleFromChannelMessage(event) {
|
||||||
|
const role = event.data;
|
||||||
this.openmct.user.setActiveRole(role);
|
this.openmct.user.setActiveRole(role);
|
||||||
}
|
}
|
||||||
broadcastNewRole(role) {
|
broadcastNewRole(role) {
|
||||||
|
@ -46,11 +46,11 @@ export default {
|
|||||||
async mounted() {
|
async mounted() {
|
||||||
this.getUserInfo();
|
this.getUserInfo();
|
||||||
this.roleChannel = new ActiveRoleSynchronizer(this.openmct);
|
this.roleChannel = new ActiveRoleSynchronizer(this.openmct);
|
||||||
this.roleChannel.subscribeToRoleChanges(this.setRoleSelection);
|
this.roleChannel.subscribeToRoleChanges(this.onRoleChange);
|
||||||
await this.fetchOrPromptForRole();
|
await this.fetchOrPromptForRole();
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
this.roleChannel.unsubscribeFromRoleChanges(this.setRoleSelection);
|
this.roleChannel.unsubscribeFromRoleChanges(this.onRoleChange);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async getUserInfo() {
|
async getUserInfo() {
|
||||||
@ -97,6 +97,10 @@ export default {
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
onRoleChange(event) {
|
||||||
|
const role = event.data;
|
||||||
|
this.setRoleSelection(role);
|
||||||
|
},
|
||||||
setRoleSelection(role) {
|
setRoleSelection(role) {
|
||||||
this.role = role;
|
this.role = role;
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user