mirror of
https://github.com/nasa/openmct.git
synced 2024-12-26 08:11:05 +00:00
Removed status.getStatusRoleForCurrentUser
This commit is contained in:
parent
c52ee6c40d
commit
56827ad17b
@ -140,9 +140,9 @@ export default class StatusAPI extends EventEmitter {
|
||||
const provider = this.#userAPI.getProvider();
|
||||
|
||||
if (provider.canProvideStatusForRole) {
|
||||
return provider.canProvideStatusForRole(role);
|
||||
return Promise.resolve(provider.canProvideStatusForRole(role));
|
||||
} else {
|
||||
return false;
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -221,23 +221,6 @@ export default class StatusAPI extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The status role of the current user. A user may have multiple roles, but will only have one role
|
||||
* that provides status at any time.
|
||||
* @returns {Promise<import("./UserAPI").Role>} the role for which the current user can provide status.
|
||||
*/
|
||||
getStatusRoleForCurrentUser() {
|
||||
const provider = this.#userAPI.getProvider();
|
||||
|
||||
if (provider.getStatusRoleForCurrentUser) {
|
||||
const activeRole = this.#userAPI.getActiveRole();
|
||||
|
||||
return provider.getStatusRoleForCurrentUser(activeRole);
|
||||
} else {
|
||||
this.#userAPI.error("User provider cannot provide role status for this user");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<Boolean>} true if the configured UserProvider can provide status for the currently logged in user, false otherwise.
|
||||
* @see StatusUserProvider
|
||||
|
@ -77,5 +77,4 @@ export default class StatusUserProvider extends UserProvider {
|
||||
/**
|
||||
* @returns {Promise<import("./UserAPI").Role>} the active status role for the currently logged in user
|
||||
*/
|
||||
async getStatusRoleForCurrentUser() {}
|
||||
}
|
||||
|
@ -94,11 +94,12 @@ export default {
|
||||
this.openmct.user.status.off('pollQuestionChange', this.setPollQuestion);
|
||||
},
|
||||
async mounted() {
|
||||
console.log('mounted')
|
||||
this.unsubscribe = [];
|
||||
await this.fetchUser();
|
||||
this.fetchPossibleStatusesForUser();
|
||||
this.fetchCurrentPoll();
|
||||
this.fetchMyStatus();
|
||||
await this.fetchMyStatus();
|
||||
this.subscribeToMyStatus();
|
||||
this.subscribeToPollQuestion();
|
||||
},
|
||||
@ -123,8 +124,8 @@ export default {
|
||||
this.indicator.text(pollQuestion?.question || '');
|
||||
},
|
||||
async fetchMyStatus() {
|
||||
const activeStatusRole = await this.openmct.user.status.getStatusRoleForCurrentUser();
|
||||
const status = await this.openmct.user.status.getStatusForRole(activeStatusRole);
|
||||
const activeRole = await this.openmct.user.getActiveRole();
|
||||
const status = await this.openmct.user.status.getStatusForRole(activeRole);
|
||||
|
||||
if (status !== undefined) {
|
||||
this.setStatus({status});
|
||||
|
@ -30,7 +30,8 @@ export default function operatorStatusPlugin(configuration) {
|
||||
return function install(openmct) {
|
||||
|
||||
if (openmct.user.hasProvider()) {
|
||||
openmct.user.status.canProvideStatusForCurrentUser().then(canProvideStatus => {
|
||||
const activeRole = openmct.user.getActiveRole();
|
||||
openmct.user.status.canProvideStatusForRole(activeRole).then(canProvideStatus => {
|
||||
if (canProvideStatus) {
|
||||
const operatorStatusIndicator = new OperatorStatusIndicator(openmct, configuration);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user