-
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
[NP] Graph: get rid of saved objects class wrapper #59917
[NP] Graph: get rid of saved objects class wrapper #59917
Conversation
Pinging @elastic/kibana-app (Team:KibanaApp) |
@elasticmachine merge upstream |
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.
Added a bunch of general hints because I noticed too late it's probably still too early to review at this level. Most of it is probably planned like this anyway.
src/plugins/saved_objects/public/saved_object/helpers/apply_es_resp.ts
Outdated
Show resolved
Hide resolved
@@ -80,3 +80,44 @@ export async function createSource( | |||
return await Promise.reject(err); | |||
} | |||
} | |||
|
|||
export async function createSourceUtil( |
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.
This helper makes a lot of sense to me, but the name is a little confusing to me - isn't this just saveWithConfirmation
(or something like that)?
Also we shouldn't make this helper dependent on the legacy type SavedObject
- just pass in the stuff you need directly.
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.
Of course, it was just a draft function name.
Updated.
x-pack/legacy/plugins/graph/public/helpers/saved_workspace_utils.ts
Outdated
Show resolved
Hide resolved
x-pack/legacy/plugins/graph/public/helpers/saved_workspace_utils.ts
Outdated
Show resolved
Hide resolved
# Conflicts: # x-pack/legacy/plugins/graph/public/app.js # x-pack/legacy/plugins/graph/public/application.ts # x-pack/legacy/plugins/graph/public/state_management/mocks.ts # x-pack/legacy/plugins/graph/public/state_management/store.ts # x-pack/legacy/plugins/graph/public/types/persistence.ts
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.
src/plugins/saved_objects/public/saved_object/helpers/create_source.ts
Outdated
Show resolved
Hide resolved
@elasticmachine merge upstream |
@elasticmachine merge upstream |
The issue, when saved object is not overwritten, is reproduced in master. Here is the issue #60735. |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
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.
Code LGTM! nice cleanup! Tested locally in chrome. works
* Implement find saved workspace * Implement get saved workspace * Create helper function as applyESResp * Fix eslint * Implement savedWorkspaceLoader.get() * Implement deleteWS * Implement saveWS * Remove applyESRespUtil * Refactoring * Refactoring * Remove savedWorkspaceLoader * Update unit test * Fix merge conflicts * Add unit tests for saveWithConfirmation * Fix TS * Move saveWithConfirmation to a separate file Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
* master: Updating our direct usage of https-proxy-agent to 5.0.0 (elastic#58296) allow users to unset the throttle of an alert (elastic#60964) [Lens] Fix bug in metric config panel (elastic#60982) [SearchProfiler] Minor fixes (elastic#60919) [ML] Renaming ML setup and start contracts (elastic#60980) introduce StartServicesAccessor type for `CoreSetup.getStartServices` (elastic#60748) [SIEM][Detection Engine] Add rule's notification alert type (elastic#60832) [APM] Re-revert "Collect telemetry about data/API performance" (elastic#61030) [NP] Graph: get rid of saved objects class wrapper (elastic#59917) [EPM] merge duplicate fields when creating index patterns (elastic#60957) [Uptime] Ml detection of duration anomalies (elastic#59785) [Alerting] removes unimplemented buttons from Alert Details page (elastic#60934) [skip-ci] Fix CODEOWNERS paths for the Pulse team (elastic#60944) [APM] Threshold alerts (elastic#59566) [ML] Add support for percentiles aggregation to Transform wizard (elastic#60763) Cahgen save object duplicate message (elastic#60901)
Part of #46435 and #58243.
The main purpose is to decouple Graph from a saved object loader and a class wrapping the core saved object client in favor of using core saved object client directly.
So
createSavedWorkspacesLoader
andcreateSavedWorkspaceClass
were replaced by helper functions in newsaved_workspace_utils.ts
which usesavedObjectsClient
directly.It turned out that much functionality of
SavedObjectClass
isn't needed for Graph. And now Graph is responsible for saving saved object including check for duplicate title. And for this casesaveWithConfirmation
function was created (it's decoupled from core SavedObject).Checklist
Delete any items that are not applicable to this PR.
[ ] This was checked for keyboard-only and screenreader accessibility[ ] This was checked for cross-browser compatibility, including a check against IE11