-
Notifications
You must be signed in to change notification settings - Fork 8.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
[Metrics UI] Created new HTTP endpoints for Saved Views functionality #152617
Closed
6 tasks done
Tracked by
#152274
Labels
Feature:Metrics UI
Metrics UI feature
Team:Infra Monitoring UI - DEPRECATED
DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services
Comments
neptunian
added
Feature:Metrics UI
Metrics UI feature
Team:Infra Monitoring UI - DEPRECATED
DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services
labels
Mar 2, 2023
Pinging @elastic/infra-monitoring-ui (Team:Infra Monitoring UI) |
2 tasks
neptunian
changed the title
[Metrics UI] Created a new HTTP endpoint for Saved Views functionality
[Metrics UI] Created new HTTP endpoints for Saved Views functionality
Mar 6, 2023
This was referenced Apr 12, 2023
tonyghiani
added a commit
that referenced
this issue
Apr 24, 2023
## 📓 Summary Part of #152617 Closes #155158 This PR implements the CRUD endpoints for the inventory views. Following the approach used for the LogViews service, it exposes a client that abstracts all the logic concerned to the `inventory-view` saved objects. It also follows the guideline provided for [Versioning interfaces](https://docs.elastic.dev/kibana-dev-docs/versioning-interfaces) and [Versioning HTTP APIs](https://docs.elastic.dev/kibana-dev-docs/versioning-http-apis), preparing for the serverless. ## 🤓 Tips for the reviewer You can open the Kibana dev tools and play with the following snippet to test the create APIs, or you can perform the same requests with your preferred client: ``` // Get all GET kbn:/api/infra/inventory_views // Create one POST kbn:/api/infra/inventory_views { "attributes": { "name": "My inventory view" } } // Get one GET kbn:/api/infra/inventory_views/<switch-with-id> // Update one PUT kbn:/api/infra/inventory_views/<switch-with-id> { "attributes": { "name": "My inventory view 2" } } // Delete one DELETE kbn:/api/infra/inventory_views/<switch-with-id> ``` ## 👣 Next steps - Replicate the same logic for the metrics explorer saved object - Create a client-side abstraction to consume the service - Update the existing react custom hooks to consume the endpoint --------- Co-authored-by: Marco Antonio Ghiani <[email protected]> Co-authored-by: kibanamachine <[email protected]>
tonyghiani
added a commit
that referenced
this issue
Apr 25, 2023
… hooks (#155174) ## 📓 Summary Part of #152617 This PR does some refactoring on the presentational components used to render the saved views on both Infra Inventory and Metrics Explorer, preparing for the additional work required once [[Infrastructure UI] Saved object hooks that use the SO client are removed in favour of the new endpoints#154725](#154725) will be implemented. ## 🐞 Bug fixes While working on this code, some pre-existing issues have been discovered and fixed: - "Make default" star icon was not aligned correctly when rendered alone: <img width="751" alt="Screenshot 2023-04-19 at 15 22 24" src="https://user-images.githubusercontent.com/34506779/233088425-34992395-4d18-46bc-9124-5d99101406ce.png"> - Delete view confirm prompt not closed after removing a view: https://user-images.githubusercontent.com/34506779/233088780-9b1bfe57-170c-4e66-9303-f41448eb8447.mov --------- Co-authored-by: Marco Antonio Ghiani <[email protected]> Co-authored-by: kibanamachine <[email protected]>
tonyghiani
added a commit
that referenced
this issue
Apr 26, 2023
…155621) ## 📓 Summary Part of #152617 Closes #155111 This PR implements the CRUD endpoints for the metrics explorer views. Following the approach used for the InventoryView service, it exposes a client that abstracts all the logic concerned to the `metrics-explorer-view` saved objects. It also follows the guideline provided for [Versioning interfaces](https://docs.elastic.dev/kibana-dev-docs/versioning-interfaces) and [Versioning HTTP APIs](https://docs.elastic.dev/kibana-dev-docs/versioning-http-apis), preparing for the serverless. ## 🤓 Tips for the reviewer You can open the Kibana dev tools and play with the following snippet to test the create APIs, or you can perform the same requests with your preferred client: ``` // Get all GET kbn:/api/infra/metrics_explorer_views // Create one POST kbn:/api/infra/metrics_explorer_views { "attributes": { "name": "My view" } } // Get one GET kbn:/api/infra/metrics_explorer_views/<switch-with-id> // Update one PUT kbn:/api/infra/metrics_explorer_views/<switch-with-id> { "attributes": { "name": "My view 2" } } // Delete one DELETE kbn:/api/infra/metrics_explorer_views/<switch-with-id> ``` --------- Co-authored-by: Marco Antonio Ghiani <[email protected]> Co-authored-by: kibanamachine <[email protected]>
1 task
tonyghiani
added a commit
that referenced
this issue
May 2, 2023
## 📓 Summary Part of #152617 Closes #106650 Closes #154725 This PR replace the existing client React logic for handling saved views on the `infra` plugin with a new state management implementation that interacts with the newly created API. It brings the following changes: - Implement `useInventoryViews` and `useMetricsExplorerViews` custom hooks. - Adopt `@tanstack/react-query` for the above hooks implementation as it was already used across the plugin and simplifies the server state management. Extract the provider for the react query cache. - Update server services to fix an issue while updating views, which was preventing the unset of properties from the view. - Update Saved Views components to integrate the new hooks. - The `Load views` option has been removed accordingly to the decision made with the UX team, since it wasn't adding any value that wasn't already present in the `Manage views` option. Even if we are duplicating similar logic to handle the Inventory and Metrics Explorer views, we decided to keep them separated to easily control their behaviour and avoid coupled logic that can be painful to split in future. ## 🐞 Bug fixes This implementation also fixed some existing bugs in production: - As reported in [this comment](#155174 (review)), when the current view is deleted, the selector doesn't fallback on another view and keeps showing the same view title. It has been fixed and the selected view fallbacks to the default view. - When refreshing the page after a view was selected, the view was not correctly recovered and shown. The implemented changes fix this behaviour. - The "include time" option for creating/updating a saved view was not working and never removed the time property if disabled. - Minor visual adjustments such as action button type and alignment. ## 👨💻 Review hints The best way to verify all the interactions and loadings work correctly as a user expects, running the branch locally with an oblt cluster is recommended. In both the inventory and metrics explorer pages, the user should be able to: - Access and manage the saved views, select and load a view, delete a view, and set a view as default. - Save a new view. - Update the currently used view, except for the static **Default view**. - Show an error when trying to create/update a view with a name already held by another view. - Restore the view with the following priority order - Use from the URL the stored view id to restore the view - Use the default view id stored in the source configuration as a user preference - Use the static **Default view** ## 👣 Following steps - [ ] #155117 --------- Co-authored-by: Marco Antonio Ghiani <[email protected]> Co-authored-by: kibanamachine <[email protected]> Co-authored-by: jennypavlova <[email protected]>
tonyghiani
added a commit
that referenced
this issue
May 4, 2023
…56158) ## 📓 Summary Closes #155117 Closes #152617 This PR removes all the legacy code unused for handling the saved views client logic. --------- Co-authored-by: Marco Antonio Ghiani <[email protected]> Co-authored-by: kibanamachine <[email protected]> Co-authored-by: jennypavlova <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Feature:Metrics UI
Metrics UI feature
Team:Infra Monitoring UI - DEPRECATED
DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services
📓 Summary
To migrate away from using the browser-side SO client, the Metrics UI must stop using the SO client to perform CRUD operations for Saved Views functionality and move this logic behind a domain-specific endpoint. Behind the concept of Saved Views exist two separate saved object types:
inventory-view
andmetrics-explorer-view
.🔗 part of #152274
🔗 part of #149098
✔️ Acceptance criteria
inventory-view
andmetrics-explorer-view
that supports the current Saved Views CRUD operations which the respective UI views will useFollow-up tasks
The text was updated successfully, but these errors were encountered: