Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Mission Status for Situational Awareness #7418

Merged
merged 34 commits into from
Feb 2, 2024

Conversation

ozyx
Copy link
Member

@ozyx ozyx commented Jan 26, 2024

Closes VIPEROMCT-461
Closes #7420

Describe your changes:

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Is this change backwards compatible? For example, developers won't need to change how they are calling the API or how they've extended core plugins such as Tables or Plots.

Author Checklist

  • Changes address original issue?
  • Tests included and/or updated with changes?
  • Has this been smoke tested?
  • Have you associated this PR with a type: label? Note: this is not necessarily the same as the original issue.
  • Have you associated a milestone with this PR? Note: leave blank if unsure.
  • Is this a breaking change to be called out in the release notes?
  • Testing instructions included in associated issue OR is this a dependency/testcase change?

Reviewer Checklist

  • Changes appear to address issue?
  • Reviewer has tested changes by following the provided instructions?
  • Changes appear not to be breaking changes?
  • Appropriate automated tests included?
  • Code style and in-line documentation are appropriate?

@ozyx ozyx added the type:feature Feature. Required intentional design label Jan 26, 2024
@ozyx ozyx added this to the Target:4.0.0 milestone Jan 26, 2024
* at runtime from the About dialog for additional information.
*****************************************************************************/
/* eslint-disable func-style */
import { onBeforeUnmount, reactive } from 'vue';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Composables for ResizeObservers and window resizes

* @param {string} event - The name of the event to listen for.
* @param {Function} callback - The callback function to execute when the event is triggered.
*/
export function useEventListener(target, event, handler) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generic composables for EventListeners and EventEmitters-- these can be used to construct more complex composables (such as the window resize composable)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and we don't have to track on and off anymore! good stuff

Comment on lines +60 to +76
setup() {
const { windowSize } = useWindowResize();
const isPopupVisible = ref(false);
const userIndicatorRef = ref(null);
const popupRef = ref(null);

// eslint-disable-next-line func-style
const handleOutsideClick = (event) => {
if (isPopupVisible.value && popupRef.value && !popupRef.value.contains(event.target)) {
isPopupVisible.value = false;
}
};

useEventListener(document, 'click', handleOutsideClick);

return { windowSize, isPopupVisible, popupRef, userIndicatorRef };
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CompositionAPI syntax here so we can use reactive refs and composables

Copy link

codecov bot commented Jan 26, 2024

Codecov Report

Attention: 104 lines in your changes are missing coverage. Please review.

Comparison is base (ee5081f) 54.66% compared to head (8e7d01d) 55.36%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7418      +/-   ##
==========================================
+ Coverage   54.66%   55.36%   +0.69%     
==========================================
  Files         668      671       +3     
  Lines       26800    26919     +119     
  Branches     2606     2614       +8     
==========================================
+ Hits        14651    14903     +252     
+ Misses      11433    11300     -133     
  Partials      716      716              
Flag Coverage Δ
e2e-full 49.01% <ø> (-0.01%) ⬇️
e2e-stable 58.90% <27.41%> (+2.71%) ⬆️
unit 48.37% <20.61%> (-0.23%) ⬇️
Files Coverage Δ
example/exampleUser/ExampleUserProvider.js 81.13% <100.00%> (-7.33%) ⬇️
...s/operatorStatus/operatorStatus/OperatorStatus.vue 1.66% <ø> (ø)
src/plugins/userIndicator/plugin.js 83.33% <ø> (-2.39%) ⬇️
src/ui/composables/event.js 46.66% <46.66%> (ø)
src/ui/composables/resize.js 20.00% <20.00%> (ø)
src/api/user/StatusAPI.js 60.78% <23.07%> (-12.90%) ⬇️
...plugins/userIndicator/components/UserIndicator.vue 27.94% <24.32%> (-14.92%) ⬇️
...ns/userIndicator/components/MissionStatusPopup.vue 0.00% <0.00%> (ø)

... and 41 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ee5081f...8e7d01d. Read the comment docs.

Comment on lines 38 to 42
<Teleport to="body">
<div v-show="isPopupVisible" ref="popupRef" class="c-user-control-panel" :style="popupStyle">
<MissionStatusPopup v-show="canSetMissionStatus" @dismiss="togglePopup" />
</div>
</Teleport>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually this logic can be made more generic and move into some kind of higher-order function that can apply auto-positioning popups to whatever component we pass in

@charlesh88
Copy link
Contributor

charlesh88 commented Jan 26, 2024

Todo

  • Add a "Control Panel" button to the user indicator in the same way that it's included in other indicators. Clicking the button should then display the control panel, rather than clicking the indicator itself.

Screenshot 2024-01-26 at 1 14 35 PM

Screenshot 2024-01-26 at 1 14 11 PM

charlesh88 and others added 2 commits January 26, 2024 14:18
- Styling and markup for mission status control panel.
- Tweaks and additions to some common style elements.
Copy link
Contributor

@scottbell scottbell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good @ozyx

inject: ['openmct'],
inheritAttrs: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

neat

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fragments!!

* @param {string} event - The name of the event to listen for.
* @param {Function} callback - The callback function to execute when the event is triggered.
*/
export function useEventListener(target, event, handler) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and we don't have to track on and off anymore! good stuff

Copy link
Contributor

@shefalijoshi shefalijoshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still working through the .vue popup changes. Will get back to this soon.

src/api/user/StatusAPI.js Outdated Show resolved Hide resolved
src/api/user/StatusAPI.js Outdated Show resolved Hide resolved
src/plugins/userIndicator/plugin.js Show resolved Hide resolved
Copy link
Contributor

@shefalijoshi shefalijoshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears that the vue changes are more of a stub than actual changes. Will come back to this when it's out of draft.

- These tests are going to be wonky since they depend on the View. Any unit tests depending on Vue / the View will become increasingly volatile over time as we migrate more of the app into the main Vue app. Since these LOC are already covered by e2e, I'm going to remove them. We will need to move towards a more component / Vue-friendly testing framework to stabilize all of this.
Copy link
Contributor

@shefalijoshi shefalijoshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small changes, but looks good overall

src/api/user/UserAPISpec.js Show resolved Hide resolved
src/ui/composables/event.js Outdated Show resolved Hide resolved
@shefalijoshi
Copy link
Contributor

Noticed a popup positioning issue while testing:
On loading Open MCT, there were no notifications (could also get to this state by clearing all notifications) and the popup appears like this.
image

Now change the status for any mission action.
You should now have the Notification Indicator showing and the User Indicator bumped to the left like this:

image

The popup no longer stays aligned with the User Indicator.

Copy link
Contributor

@shefalijoshi shefalijoshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some notes from testing plus a couple other finds.

src/api/user/StatusAPI.js Outdated Show resolved Hide resolved

try {
// Listen for missionActionStatusChange events
useEventEmitter(openmct.user.status, 'missionActionStatusChange', ({ action, status }) => {
Copy link
Contributor

@shefalijoshi shefalijoshi Jan 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The handler parameter signature does not match the what is emitted by the StatusAPI here:
https://github.com/nasa/openmct/pull/7418/files#diff-de4973d1b097ba7bca4bd6b61530a0edee5925fd20eb9fb537a1bd133d474119R348

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, it works

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it doesn't. There's a console error thrown and if you change the mission status in one browser window I don't see it reflected in a different window.
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still seeing this issue testing locally. Will check on the banner deployment and resolve if it's OK

@ozyx
Copy link
Member Author

ozyx commented Jan 31, 2024

Noticed a popup positioning issue while testing: On loading Open MCT, there were no notifications (could also get to this state by clearing all notifications) and the popup appears like this. image

Now change the status for any mission action. You should now have the Notification Indicator showing and the User Indicator bumped to the left like this:

image The popup no longer stays aligned with the User Indicator.

Extracted and created issue #7444

@ozyx ozyx added the pr:e2e:couchdb npm run test:e2e:couchdb label Jan 31, 2024
@github-actions github-actions bot removed the pr:e2e:couchdb npm run test:e2e:couchdb label Jan 31, 2024

try {
// Listen for missionActionStatusChange events
useEventEmitter(openmct.user.status, 'missionActionStatusChange', ({ action, status }) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it doesn't. There's a console error thrown and if you change the mission status in one browser window I don't see it reflected in a different window.
image

@shefalijoshi
Copy link
Contributor

Just one bug remains that could be a user/local testing issue.
#7418 (comment)

The rest looks good!

Copy link
Contributor

@shefalijoshi shefalijoshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs tests (probably create an issue for this). Approving with caveats.

@ozyx ozyx added the pr:e2e:flakefinder Runs the tests 10 times label Feb 1, 2024
@github-actions github-actions bot removed the pr:e2e:flakefinder Runs the tests 10 times label Feb 1, 2024
@unlikelyzero unlikelyzero added the pr:e2e:couchdb npm run test:e2e:couchdb label Feb 2, 2024
@github-actions github-actions bot removed the pr:e2e:couchdb npm run test:e2e:couchdb label Feb 2, 2024
@unlikelyzero unlikelyzero enabled auto-merge (squash) February 2, 2024 22:49
@unlikelyzero unlikelyzero merged commit 82fa4c1 into master Feb 2, 2024
19 of 21 checks passed
@unlikelyzero unlikelyzero deleted the mission-status-situational-awareness branch February 2, 2024 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature Feature. Required intentional design
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Mission Status user indicator control panel
6 participants