Skip to content
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

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

Merged
merged 3 commits into from
Jul 29, 2015

Conversation

lukasolson
Copy link
Member

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.

.then(refreshData, notify.error);
}
});
return Promise.all(docs.map(function (doc) {
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
Member 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
Member 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