Skip to content

Change importer to use saved object class, fix broken select all#4509

Merged
jbudz merged 3 commits intoelastic:masterfrom
lukasolson:import-saved-objects
Jul 29, 2015
Merged

Change importer to use saved object class, fix broken select all#4509
jbudz merged 3 commits intoelastic:masterfrom
lukasolson:import-saved-objects

Conversation

@lukasolson
Copy link
Contributor

Closes #3912, #4311, and #4508,

Prior to this, the import functionality would work by reading in the uploaded file then creating a simple bulk request to the .kibana index.

While this seems good and all, it caused issues, such as this: #3882.

What happens behind the scenes, is that when importing, if we don't use the saved object classes, then certain values (such as hits and version) can get mapped to an incorrect type (long instead of int, etc.).

This PR addresses this by utilizing the saved object classes when importing. Basically, how I accomplished this was by taking the applyESResp function out and separating it, so that it could be used from outside the loading of an object. When an import happens, we use that function to load the objects as if we were loading them directly from an ES fetch, so all of the magic that usually gets applied can get applied in this step.

Also part of this PR is fixing the select all functionality, which was broken because $scope.currentTab wasn't being set initially if it was explicit in the URL.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use Promise.map, which uses Promise.all internally

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delicious.

@w33ble
Copy link
Contributor

w33ble commented Jul 28, 2015

There's an issue with the importing, which may not be related to this PR.

  • Do an import and it would overwrite an existing object
  • Select cancel at the prompt
  • Try importing again, and this time nothing happens

@w33ble
Copy link
Contributor

w33ble commented Jul 28, 2015

This looks good to me, passing on for last looks. @lukasolson do chime in on that import cancel issue though.

@w33ble w33ble assigned jbudz and unassigned w33ble Jul 28, 2015
@lukasolson
Copy link
Contributor Author

This was due to the fact that we use an onchange handler, and if you upload the same file twice, it doesn't fire the onchange handler (since it didn't change). Resetting the value on click seems to solve this though. I've added a fix for it.

jbudz added a commit that referenced this pull request Jul 29, 2015
Change importer to use saved object class, fix broken select all
@jbudz jbudz merged commit 05ca74b into elastic:master Jul 29, 2015
@lukasolson lukasolson deleted the import-saved-objects branch February 11, 2016 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Object importing doesn't utilize the Saved Object classes

3 participants