mirror of
https://github.com/nasa/openmct.git
synced 2024-12-20 13:43:09 +00:00
refactor: more method renaming
This commit is contained in:
parent
1c4b611fbb
commit
eece4d03d4
@ -114,23 +114,23 @@ export default class StatusAPI extends EventEmitter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setMissionStatusForRole(role, status) {
|
setStatusForMissionRole(role, status) {
|
||||||
const provider = this.#userAPI.getProvider();
|
const provider = this.#userAPI.getProvider();
|
||||||
|
|
||||||
if (provider.setMissionStatusForRole) {
|
if (provider.setStatusForMissionRole) {
|
||||||
return provider.setMissionStatusForRole(role, status);
|
return provider.setStatusForMissionRole(role, status);
|
||||||
} else {
|
} else {
|
||||||
this.#userAPI.error('User provider does not support setting mission status');
|
this.#userAPI.error('User provider does not support setting mission role status');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getMissionStatusForRole(role) {
|
getStatusForMissionRole(role) {
|
||||||
const provider = this.#userAPI.getProvider();
|
const provider = this.#userAPI.getProvider();
|
||||||
|
|
||||||
if (provider.getMissionStatusForRole) {
|
if (provider.getStatusForMissionRole) {
|
||||||
return provider.getMissionStatusForRole(role);
|
return provider.getStatusForMissionRole(role);
|
||||||
} else {
|
} else {
|
||||||
this.#userAPI.error('User provider does not support getting mission status');
|
this.#userAPI.error('User provider does not support getting mission role status');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,11 +138,11 @@ export default class StatusAPI extends EventEmitter {
|
|||||||
* Fetch the list of possible mission status options
|
* Fetch the list of possible mission status options
|
||||||
* @returns {Promise<MissionStatusOption[]>} the current mission status
|
* @returns {Promise<MissionStatusOption[]>} the current mission status
|
||||||
*/
|
*/
|
||||||
async getPossibleMissionStatusOptions() {
|
async getPossibleMissionRoleStatuses() {
|
||||||
const provider = this.#userAPI.getProvider();
|
const provider = this.#userAPI.getProvider();
|
||||||
|
|
||||||
if (provider.getPossibleMissionStatusOptions) {
|
if (provider.getPossibleMissionRoleStatuses) {
|
||||||
const possibleOptions = await provider.getPossibleMissionStatusOptions();
|
const possibleOptions = await provider.getPossibleMissionRoleStatuses();
|
||||||
|
|
||||||
return possibleOptions;
|
return possibleOptions;
|
||||||
} else {
|
} else {
|
||||||
|
@ -48,17 +48,17 @@ export default {
|
|||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
try {
|
try {
|
||||||
// Fetch missionStatuses and missionStatusOptions simultaneously
|
// Fetch missionStatuses and missionRoleStatuses simultaneously
|
||||||
const [missionRoles, missionRoleStatusOptions] = await Promise.all([
|
const [missionRoles, missionRoleStatusOptions] = await Promise.all([
|
||||||
this.openmct.user.status.getPossibleMissionRoles(),
|
this.openmct.user.status.getPossibleMissionRoles(),
|
||||||
this.openmct.user.status.getPossibleMissionStatusOptions()
|
this.openmct.user.status.getPossibleMissionRoleStatuses()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
this.missionRoles = missionRoles;
|
this.missionRoles = missionRoles;
|
||||||
this.missionRoleStatusOptions = missionRoleStatusOptions;
|
this.missionRoleStatusOptions = missionRoleStatusOptions;
|
||||||
|
|
||||||
const statusPromises = missionRoles.map((status) =>
|
const statusPromises = missionRoles.map((role) =>
|
||||||
this.openmct.user.status.getMissionStatusForRole(status)
|
this.openmct.user.status.getStatusForMissionRole(role)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Fetch all mission role statuses simultaneously
|
// Fetch all mission role statuses simultaneously
|
||||||
@ -89,7 +89,7 @@ export default {
|
|||||||
if (this.missionRoleStatusMap !== undefined) {
|
if (this.missionRoleStatusMap !== undefined) {
|
||||||
const statusObject = this.findOptionByKey(this.missionRoleStatusMap[status]);
|
const statusObject = this.findOptionByKey(this.missionRoleStatusMap[status]);
|
||||||
|
|
||||||
const result = await this.openmct.user.status.setMissionStatusForRole(status, statusObject);
|
const result = await this.openmct.user.status.setStatusForMissionRole(status, statusObject);
|
||||||
if (result === true) {
|
if (result === true) {
|
||||||
this.openmct.notifications.info('Successfully set mission status');
|
this.openmct.notifications.info('Successfully set mission status');
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user