From 359339d9405b853674acd2af595b7e0a5ea99966 Mon Sep 17 00:00:00 2001 From: Lukas Olson Date: Tue, 15 Sep 2015 21:30:32 -0700 Subject: [PATCH] Fix export all so that it exports everything instead of just what's in view --- .../public/dashboard/services/saved_dashboards.js | 4 ++-- .../public/discover/saved_searches/saved_searches.js | 4 ++-- .../public/settings/sections/objects/_objects.html | 2 +- .../public/settings/sections/objects/_objects.js | 12 +++++++----- .../saved_visualizations/saved_visualizations.js | 4 ++-- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/plugins/kibana/public/dashboard/services/saved_dashboards.js b/src/plugins/kibana/public/dashboard/services/saved_dashboards.js index 5d9024000bea3..8510254fd6dd3 100644 --- a/src/plugins/kibana/public/dashboard/services/saved_dashboards.js +++ b/src/plugins/kibana/public/dashboard/services/saved_dashboards.js @@ -43,7 +43,7 @@ define(function (require) { }; - this.find = function (searchString) { + this.find = function (searchString, size = 100) { var self = this; var body; if (searchString) { @@ -64,7 +64,7 @@ define(function (require) { index: kbnIndex, type: 'dashboard', body: body, - size: 100 + size: size }) .then(function (resp) { return { diff --git a/src/plugins/kibana/public/discover/saved_searches/saved_searches.js b/src/plugins/kibana/public/discover/saved_searches/saved_searches.js index b6c9c6373bccb..cf3c1895eb1e8 100644 --- a/src/plugins/kibana/public/discover/saved_searches/saved_searches.js +++ b/src/plugins/kibana/public/discover/saved_searches/saved_searches.js @@ -46,7 +46,7 @@ define(function (require) { }); }; - this.find = function (searchString) { + this.find = function (searchString, size = 100) { var self = this; var body; if (searchString) { @@ -67,7 +67,7 @@ define(function (require) { index: kbnIndex, type: 'search', body: body, - size: 100 + size: size }) .then(function (resp) { return { diff --git a/src/plugins/kibana/public/settings/sections/objects/_objects.html b/src/plugins/kibana/public/settings/sections/objects/_objects.html index 241520acb65f7..3c1da5cd909ad 100644 --- a/src/plugins/kibana/public/settings/sections/objects/_objects.html +++ b/src/plugins/kibana/public/settings/sections/objects/_objects.html @@ -2,7 +2,7 @@

Edit Saved Objects

- +

diff --git a/src/plugins/kibana/public/settings/sections/objects/_objects.js b/src/plugins/kibana/public/settings/sections/objects/_objects.js index d5ed679a67dda..bc31a3d2182db 100644 --- a/src/plugins/kibana/public/settings/sections/objects/_objects.js +++ b/src/plugins/kibana/public/settings/sections/objects/_objects.js @@ -4,6 +4,7 @@ define(function (require) { var saveAs = require('@spalger/filesaver').saveAs; var registry = require('plugins/kibana/settings/saved_object_registry'); var objectIndexHTML = require('plugins/kibana/settings/sections/objects/_objects.html'); + const MAX_SIZE = Math.pow(2, 31) - 1; require('ui/directives/file_upload'); @@ -91,11 +92,12 @@ define(function (require) { retrieveAndExportDocs(objs); }; - $scope.exportAll = function () { - var objs = $scope.services.map(function (service) { - return service.data.map(_.partialRight(_.extend, {type: service.type})); - }); - retrieveAndExportDocs(_.flattenDeep(objs)); + $scope.exportAll = () => { + Promise.map($scope.services, (service) => + service.service.find('', MAX_SIZE).then((results) => + results.hits.map((hit) => _.extend(hit, {type: service.type})) + ) + ).then((results) => retrieveAndExportDocs(_.flattenDeep(results))); }; function retrieveAndExportDocs(objs) { diff --git a/src/plugins/kibana/public/visualize/saved_visualizations/saved_visualizations.js b/src/plugins/kibana/public/visualize/saved_visualizations/saved_visualizations.js index aa49e31513894..8019ff9c540a7 100644 --- a/src/plugins/kibana/public/visualize/saved_visualizations/saved_visualizations.js +++ b/src/plugins/kibana/public/visualize/saved_visualizations/saved_visualizations.js @@ -41,7 +41,7 @@ define(function (require) { }); }; - this.find = function (searchString) { + this.find = function (searchString, size = 100) { var self = this; var body; if (searchString) { @@ -62,7 +62,7 @@ define(function (require) { index: kbnIndex, type: 'visualization', body: body, - size: 100, + size: size }) .then(function (resp) { return {