ui: refactor advisories enabled usage and more#12676
ui: refactor advisories enabled usage and more#12676shwstppr wants to merge 5 commits intoapache:mainfrom
Conversation
Considers advisoriesDisabled as false if no value is found in the config or if set to false. Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12676 +/- ##
==========================================
Coverage 18.00% 18.01%
- Complexity 16466 16473 +7
==========================================
Files 5977 5978 +1
Lines 537777 537889 +112
Branches 66037 66047 +10
==========================================
+ Hits 96844 96887 +43
- Misses 430011 430079 +68
- Partials 10922 10923 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
|
@shwstppr a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress. |
There was a problem hiding this comment.
Pull request overview
This PR refactors advisory system usage in the UI by introducing a centralized hasNoItems utility function and adding new advisories for VNF appliances and instances. The PR aims to improve code maintainability by reducing duplication and providing a consistent approach to checking resource availability for advisory conditions.
Changes:
- Added
hasNoItemsutility function to centralize API-based advisory condition checking - Refactored existing Kubernetes cluster advisories to use the new utility function
- Added new advisories for instance and VNF appliance deployment prerequisites (templates, ISOs, compute offerings, networks)
- Updated router configuration to handle
advisoriesDisabledconfig with proper null/undefined handling - Added new localization messages for the new advisories
- Added
advisoriesDisabledconfig option toconfig.json
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| ui/src/utils/advisory/index.js | New utility file with hasNoItems helper function for checking API resource availability |
| ui/src/config/section/network.js | Added advisories for VNF appliance deployment (template and compute offering checks) |
| ui/src/config/section/compute.js | Added advisories for instance deployment (image, compute offering, network checks) and refactored CKS advisories |
| ui/src/config/router.js | Improved handling of advisoriesDisabled config with nullish coalescing operator |
| ui/public/locales/en.json | Added localization messages for new advisory warnings |
| ui/public/config.json | Added advisoriesDisabled: false configuration option |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return a | ||
| } | ||
| return items.length === 0 | ||
| } catch (error) { |
There was a problem hiding this comment.
The error handling silently returns false when an API call fails, which could hide legitimate errors and cause advisories not to appear when they should. Consider logging the error or providing more specific error handling, especially since API failures could indicate permission issues or connectivity problems that users should be aware of.
| } catch (error) { | |
| } catch (error) { | |
| console.error(`Failed to fetch items for advisory check via API ${apiName}`, error) |
|
UI build: ✔️ |
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
|
@shwstppr a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress. |
|
UI build: ✔️ |
Description
Considers advisoriesDisabled as false if no value is found in the config or if set to false.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?