-
Notifications
You must be signed in to change notification settings - Fork 918
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
Update import api to have data source id to allow import saved objects from uploading files to have data source #5777
Update import api to have data source id to allow import saved objects from uploading files to have data source #5777
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #5777 +/- ##
==========================================
- Coverage 66.97% 66.78% -0.19%
==========================================
Files 3301 2591 -710
Lines 63437 48749 -14688
Branches 10107 8765 -1342
==========================================
- Hits 42485 32559 -9926
+ Misses 18499 14053 -4446
+ Partials 2453 2137 -316
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View 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.
Left some comments and please let me know if any question
src/core/server/saved_objects/import/check_conflict_for_data_source.ts
Outdated
Show resolved
Hide resolved
src/core/server/saved_objects/import/check_conflict_for_data_source.ts
Outdated
Show resolved
Hide resolved
src/core/server/saved_objects/import/check_conflict_for_data_source.ts
Outdated
Show resolved
Hide resolved
src/core/server/saved_objects/import/check_conflict_for_data_source.ts
Outdated
Show resolved
Hide resolved
Can you please take a look at failed checks and try to resolve them? Also it looks like commit are signed. |
src/core/server/saved_objects/import/check_conflict_for_data_source.test.ts
Outdated
Show resolved
Hide resolved
src/core/server/saved_objects/import/check_conflict_for_data_source.test.ts
Show resolved
Hide resolved
src/core/server/saved_objects/import/check_conflict_for_data_source.ts
Outdated
Show resolved
Hide resolved
src/core/server/saved_objects/import/check_conflict_for_data_source.ts
Outdated
Show resolved
Hide resolved
src/core/server/saved_objects/import/import_saved_objects.test.ts
Outdated
Show resolved
Hide resolved
src/core/server/saved_objects/import/import_saved_objects.test.ts
Outdated
Show resolved
Hide resolved
Couple of suggestions:
|
src/core/server/saved_objects/import/check_conflict_for_data_source.test.ts
Show resolved
Hide resolved
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 comments
Signed-off-by: yujin-emma <yujin.emma.work@gmail.com>
Signed-off-by: yujin-emma <yujin.emma.work@gmail.com>
Signed-off-by: yujin-emma <yujin.emma.work@gmail.com>
Signed-off-by: yujin-emma <yujin.emma.work@gmail.com>
…ed new but display they are overriden Signed-off-by: yujin-emma <yujin.emma.work@gmail.com>
Signed-off-by: yujin-emma <yujin.emma.work@gmail.com>
Signed-off-by: yujin-emma <yujin.emma.work@gmail.com>
…hboards into dev-import-api
Signed-off-by: yujin-emma <yujin.emma.work@gmail.com>
Signed-off-by: yujin-emma <yujin.emma.work@gmail.com>
Signed-off-by: yujin-emma <yujin.emma.work@gmail.com>
Signed-off-by: yujin-emma <yujin.emma.work@gmail.com>
Signed-off-by: yujin-emma <yujin.emma.work@gmail.com>
@@ -274,4 +274,4 @@ | |||
# opensearchDashboards.survey.url: "https://survey.opensearch.org" | |||
|
|||
# Set the value of this setting to true to enable plugin augmentation on Dashboard | |||
# vis_augmenter.pluginAugmentationEnabled: true | |||
# vis_augmenter.pluginAugmentationEnabled: true |
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.
nit: let's revert this file. It is not related to our change.
src/core/server/saved_objects/import/check_conflict_for_data_source.test.ts
Show resolved
Hide resolved
if (object.type === 'visualization' || object.type === 'search') { | ||
// @ts-expect-error | ||
const searchSourceString = object.attributes?.kibanaSavedObjectMeta?.searchSourceJSON; | ||
// @ts-expect-error |
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.
what error we are getting here?
test('with createNewCopies disabled', async () => { | ||
const options = setupOptions(); | ||
const options = setupOptions(false, undefined); |
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.
why we are changing this? Default values are false and undefined?
@@ -410,7 +475,7 @@ describe('#importSavedObjectsFromStream', () => { | |||
|
|||
test('with createNewCopies enabled', async () => { | |||
// however, we include it here for posterity | |||
const options = setupOptions(true); | |||
const options = setupOptions(true, undefined); |
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.
same as above
}); | ||
|
||
test('accumulates multiple errors', async () => { | ||
const options = setupOptions(); | ||
const options = setupOptions(false, undefined); |
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.
don't need to change. They have setupOptions has default value.
Although this PR has scope for improvement, functionality wise it is good to go. Let's please make sure to address all the comments and improve quality of this PR in followup PRs. |
The backport to
To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch-Dashboards/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch-Dashboards/backport-2.x
# Create a new branch
git switch --create backport/backport-5777-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 510c7597e4efad952af8de902d1734e2ee726a9d
# Push it to GitHub
git push --set-upstream origin backport/backport-5777-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch-Dashboards/backport-2.x Then, create a pull request where the |
Description
Open Search launched Multiple Data Source at 2.4, this feature enables Dashboards to query data from multiple compatible OpenSearch endpoints. When this feature enabled, users can connect data source when adding sample data, querying data via dev tool. However, there is a limitation when user try to import saved objects by uploading a local file. First, we need to know, when multiple data source feature enabled, if you export objects, the data source information will be attached to each object, when using dashboard to visualize the object, each object already contains the data source info, therefore, the visualization tool knows where the object comes from; However, if user tried to import saved objects when they haven’t enabled multiple data source, or from another dashboards where not have the data source info, then the imported saved objects does not include data source, which can be a problem to be visualized correctly in the dashboards when enabled multiple data source.
When multiple data source feature is enabled, user can add sample data and use the dev tool with one connected data source. Import saved objects accepts uploaded files, but the API does not know the data source. These objects cannot display correctly since the it does not know where to fetch the data.
We want to provide user the ability to specify a data source when importing saved objects. When user import saved object without any data source information, the imported saved objects will attach the specified dataSourceId with the objectId; while user import saved objects different data source information ( e.g. user can connect with dataSource1 and some exported saved objects from dataSource2 ), then the objectId would already contains data source info ( dataSource2 ), for this case, we will replace the dataSourceId. The id schema are exactly same as when user add sample data and dev tools with multiple data source enabled. The behavior will keep consistent for users.
Issues Resolved
#5712
previous behavior
test1_createNewCopy.mov
resolveDataSourceConflict.mov
Screenshot
Testing the changes
Check List
yarn test:jest
yarn test:jest_integration
test1_createNewCopy.mov
resolveDataSourceConflict.mov
checkConflictNoDataSourceConflict.mov
checkConflictAndAskForOverride.mov
checkConflictAndAskForOverrideWithDataSourceConflict.mov