-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Import/export saved objects #3573
Conversation
Also, I should really write some tests for this code before we merge it. Just sayin'. |
Ermmm... and fix merge conflicts. :) |
I think this needs a conflict-resolution screen before it can be released. Maybe we can do it as a seperate pull, but I think it should block 4.1 if it's going to be separate. |
I'm also fine with this not having any dependency management. It's possible to add, and will help people make more useful exports, but I don't think it's necessary for the feature to be useful. |
Current functionality looks good! |
@@ -153,6 +140,23 @@ define(function (require) { | |||
}); | |||
}); | |||
|
|||
function parseSearchSource(searchSourceJson) { | |||
// if we have a searchSource, set its state based on the searchSourceJSON field | |||
if (self.searchSource) { |
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.
I realize this is just copy pasted, but can you put an early return here?
}; | ||
}; | ||
|
||
self.import = function (result) { |
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.
We talked about this in person, but the meaning of this method is a bit confusing. Might be better as a static method or a call to #saveSource
.
@spalger I made some changes for you to review again. Now I'm using mget/bulk APIs for import/export instead of single requests per doc. I'm also popping up a warning about all of the documents that will be overwritten if you continue to import the given set of documents. |
|
||
$scope.exportAll = function () { | ||
var objs = $scope.services.map(function (service) { | ||
return service.data.map(_.partialRight(_.extend, {type: service.type})); |
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.
Took me a minute to see what was going on here and on line 84. Maybe wrap this up like transformHitsToExportBody()
or something.
@lukasolson thanks for updating this to warn before doing anything. It works great! While walking through the code I noticed several style based things that would have made reviewing the code easier. I'll take care of them in another pull request unless you want to. Could you respond to #3573 (comment) though? |
sorry for poping in this thread . can i import the exported data using curl command (this use for automate installation / application upgrade .) ? |
@agonen This is not currently possible, but feel free to open a ticket asking for this enhancement. |
This adds importing and exporting of saved objects. All of the magic can be found on the Settings / Objects page, where you'll find a few new buttons/links.
First, you'll notice a couple of links up top: Export and Import. Export will export all of your objects: searches, visualizations, and dashboards. Import will prompt you to select an export file to import all of the objects from that file.
There is also a new export button in the table of objects below, next to delete. This allows you to select individual objects for export.
Currently, there is no dependency management in how objects are exported or imported. In other words, if you export a dashboard, right now it only exports data related to that specific dashboard, not all of the saved visualizations or searches associated with the dashboard. I'm open to discussion about how this can work, and implementing it if we figure out a good way to do it and people think it is necessary.
Closes #1552.