-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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(#7394): Incorporate Status Indicators into the main Vue app #7395
Conversation
- Adds a new property to Indicators, `component`, which is a synchronous or asynchronous Vue component. - Adds `wrapHtmlElement` utility function to create anonymous Vue components out of `HTMLElement`s (for backwards compatibility) - Refactors StatusIndicators.vue to use dynamic components, allowing us to dynamically render indicators (and keep it all within Vue's ecosystem).
- Refactors some indicators to use Vue components directly as async components
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #7395 +/- ##
==========================================
+ Coverage 55.88% 55.98% +0.09%
==========================================
Files 659 660 +1
Lines 26277 26282 +5
Branches 2549 2550 +1
==========================================
+ Hits 14686 14715 +29
+ Misses 10885 10857 -28
- Partials 706 710 +4
*This pull request uses carry forward flags. Click here to find out more.
... and 5 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
@@ -53,6 +53,9 @@ test.describe('LAD Table Sets', () => { | |||
|
|||
await page.goto(ladTableSet.url); | |||
|
|||
// Wait for the initial value to show after mount | |||
await expect(page.getByLabel('lad value').first()).not.toContainText('---'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will need to factor out the use of first at some point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's ok if we're accessing a value in a table?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, seems rational here
Changes look good to me, thanks. Just needs some testing instructions. I tested this by verifying:
The Performance Indicator can be installed like so: openmct.install(openmct.plugins.PerformanceIndicator()); |
*/ | ||
add(indicator) { | ||
if (!indicator.priority) { | ||
indicator.priority = this.openmct.priority.DEFAULT; | ||
} | ||
if (!indicator.vueComponent) { | ||
indicator.vueComponent = vueWrapHtmlElement(indicator.element); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the element
property for indicator objects still exist after removing the mount
utility? See here: https://github.com/nasa/openmct/blob/vue-indicators/src/plugins/clearData/plugin.js#L34
Perhaps you need to create the indicator.element
node here as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shefalijoshi Not for most of our default indicators. The idea is that if the vueComponent
is provided to the indicator API, it will mount the component directly. Otherwise, it will look for the element
property and wrap it in an anonymous Vue component, and then mount that. So one or the other is required here. If both vueComponent and element are missing, then we fail fast.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Add some documentation around this in the API change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are the existing docs ok? this just explains how to use the API, the implementation details shouldn't be important to the average user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @ozyx - and much simpler! I had one question about the of
-> on
change that needs checking, but otherwise looks good.
Here are the new indicators in action:
Screen.Recording.2024-01-23.at.10.05.12.AM.mov
@@ -53,6 +53,9 @@ test.describe('LAD Table Sets', () => { | |||
|
|||
await page.goto(ladTableSet.url); | |||
|
|||
// Wait for the initial value to show after mount | |||
await expect(page.getByLabel('lad value').first()).not.toContainText('---'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, seems rational here
src/plugins/notificationIndicator/components/NotificationIndicator.vue
Outdated
Show resolved
Hide resolved
Added testing instructions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Closes #7394
Describe your changes:
This is a bit of a refactor in order to support incorporating our Status Indicators into the main Vue app (AppLayout). This includes non-breaking changes to the IndicatorAPI which allow it to support directly rendering Vue components provided to the API either as
Component
objects themselves, or asHTMLElement
s (the original behavior, to be framework-agnostic). It introduces a new utility functionvueWrapHtmlElement()
that takes anHTMLElement
and uses a render function to create an Anonymous Vue component to be dynamically rendered in the StatusIndicator bar.This means:
This is an enhancement to support the VIPER S.A. work.
All Submissions:
Author Checklist
type:
label? Note: this is not necessarily the same as the original issue.Reviewer Checklist