feat(WIP): can display mission statuses now

This commit is contained in:
Mazzella, Jesse D. (ARC-TI)[KBR Wyle Services, LLC] 2024-01-25 14:09:58 -08:00
parent ebc67ebbc9
commit f11e4aa7a1
4 changed files with 33 additions and 25 deletions

View File

@ -131,18 +131,18 @@ export default class StatusAPI extends EventEmitter {
} }
/** /**
* Fetch the list of possible mission status roles * Fetch the list of possible mission status options
* @returns {Promise<MissionStatusRole[]>} * @returns {Promise<MissionStatusOption[]>} the current mission status
*/ */
async getPossibleMissionStatusRoles() { async getPossibleMissionStatuses() {
const provider = this.#userAPI.getProvider(); const provider = this.#userAPI.getProvider();
if (provider.getPossibleMissionStatusRoles) { if (provider.getPossibleMissionStatuses) {
const possibleRoles = await provider.getPossibleMissionStatusRoles(); const possibleStatuses = await provider.getPossibleMissionStatuses();
return possibleRoles; return possibleStatuses;
} else { } else {
this.#userAPI.error('User provider does not support mission status roles'); this.#userAPI.error('User provider does not support mission statuses');
} }
} }

View File

@ -20,11 +20,7 @@
at runtime from the About dialog for additional information. at runtime from the About dialog for additional information.
--> -->
<template> <template>
<div <div :style="position" class="c-status-poll-panel c-status-poll-panel--operator" @click.stop>
:style="position"
class="c-status-poll-panel c-status-poll-panel--operator"
@click.stop="noop"
>
<div class="c-status-poll-panel__section c-status-poll-panel__top"> <div class="c-status-poll-panel__section c-status-poll-panel__top">
<div class="c-status-poll-panel__title">Status Poll</div> <div class="c-status-poll-panel__title">Status Poll</div>
<div class="c-status-poll-panel__user-role icon-person">{{ role }}</div> <div class="c-status-poll-panel__user-role icon-person">{{ role }}</div>
@ -191,8 +187,7 @@ export default {
} else { } else {
return status; return status;
} }
}, }
noop() {}
} }
}; };
</script> </script>

View File

@ -4,14 +4,21 @@
<span>CONTROL PANEL</span> <span>CONTROL PANEL</span>
<button class="close-btn">X</button> <button class="close-btn">X</button>
</div> </div>
<div class="status-item"> <div v-for="status in missionStatuses" :key="status" class="status-item">
<label :for="status">{{ status }}</label>
<button class="status-btn go">GO</button>
<select :id="status.label">
<option v-for="option in missionStatusOptions" :key="option.key">
{{ option.label }}
</option>
</select>
<!-- <div class="status-item">
<label for="commandingStatus">Commanding Status</label> <label for="commandingStatus">Commanding Status</label>
<button class="status-btn go">GO</button> <button class="status-btn go">GO</button>
<select id="commandingStatus"> <select id="commandingStatus">
<option>- Set Status -</option> <option>- Set Status -</option>
<option value="status1">Status 1</option> <option value="status1">Status 1</option>
<option value="status2">Status 2</option> <option value="status2">Status 2</option>
<!-- Add more status options here -->
</select> </select>
</div> </div>
<div class="status-item"> <div class="status-item">
@ -21,22 +28,25 @@
<option>- Set Status -</option> <option>- Set Status -</option>
<option value="status1">Status 1</option> <option value="status1">Status 1</option>
<option value="status2">Status 2</option> <option value="status2">Status 2</option>
<!-- Add more status options here -->
</select> </select>
</div> -->
</div> </div>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: 'ControlPanel', inject: ['openmct'],
data() { data() {
return { return {
// Define your data properties here missionStatuses: [],
missionStatusOptions: []
}; };
}, },
methods: { async created() {
// Define your component methods here this.missionStatuses = await this.openmct.user.status.getPossibleMissionStatuses();
} this.missionStatusOptions = await this.openmct.user.status.getPossibleMissionStatusOptions();
},
methods: {}
}; };
</script> </script>

View File

@ -23,7 +23,8 @@
<template> <template>
<div <div
ref="userIndicator" ref="userIndicator"
class="c-indicator c-indicator--user icon-person c-indicator--clickable" class="c-indicator c-indicator--user icon-person"
:class="canSetMissionStatus ? 'c-indicator--clickable' : ''"
v-bind="$attrs" v-bind="$attrs"
@click.stop="togglePopup" @click.stop="togglePopup"
> >
@ -36,7 +37,7 @@
</div> </div>
<Teleport to="body"> <Teleport to="body">
<div v-if="isPopupVisible" class="c-user-control-panel"> <div v-if="isPopupVisible" class="c-user-control-panel">
<MissionStatusPopup /> <MissionStatusPopup v-if="canSetMissionStatus" />
</div> </div>
</Teleport> </Teleport>
</template> </template>
@ -60,7 +61,8 @@ export default {
loggedIn: false, loggedIn: false,
inputRoleSelection: undefined, inputRoleSelection: undefined,
roleSelectionDialog: undefined, roleSelectionDialog: undefined,
isPopupVisible: false isPopupVisible: false,
canSetMissionStatus: false
}; };
}, },
computed: { computed: {
@ -107,6 +109,7 @@ export default {
methods: { methods: {
async getUserInfo() { async getUserInfo() {
const user = await this.openmct.user.getCurrentUser(); const user = await this.openmct.user.getCurrentUser();
this.canSetMissionStatus = await this.openmct.user.status.canSetMissionStatus();
this.userName = user.getName(); this.userName = user.getName();
this.role = this.openmct.user.getActiveRole(); this.role = this.openmct.user.getActiveRole();
this.loggedIn = this.openmct.user.isLoggedIn(); this.loggedIn = this.openmct.user.isLoggedIn();