From ee751b644489a1bc10999842a219afe0cb410fb8 Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Fri, 11 Apr 2014 12:42:16 -0700 Subject: [PATCH] closes #51, and a bug in the mapping format used by the SavedObject class --- src/kibana/apps/dashboard/index.js | 3 ++- .../dashboard/partials/load_dashboard.html | 7 +++--- .../apps/discover/controllers/discover.js | 2 +- .../components/saved_object/saved_object.js | 25 +++++++++---------- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/kibana/apps/dashboard/index.js b/src/kibana/apps/dashboard/index.js index 76fb9aaf376d77..27036ecc5a8376 100644 --- a/src/kibana/apps/dashboard/index.js +++ b/src/kibana/apps/dashboard/index.js @@ -114,12 +114,13 @@ define(function (require) { $scope.openLoad = function () { var open = toggleConfigTemplate('load'); if (open) { - dashboardSearch($scope.configurable.input.search); + dashboardSearch($scope.input.search || ''); $scope.configSubmit = null; } }; $scope.save = function () { + dash.id = dash.title; dash.panelsJSON = JSON.stringify($scope.gridControl.serializeGrid() || []); return dash.save() diff --git a/src/kibana/apps/dashboard/partials/load_dashboard.html b/src/kibana/apps/dashboard/partials/load_dashboard.html index be37c7e6fa3a92..e91bee2d919a59 100644 --- a/src/kibana/apps/dashboard/partials/load_dashboard.html +++ b/src/kibana/apps/dashboard/partials/load_dashboard.html @@ -4,9 +4,8 @@ \ No newline at end of file diff --git a/src/kibana/apps/discover/controllers/discover.js b/src/kibana/apps/discover/controllers/discover.js index b88a5cc9bd90d1..05a9b2812eab07 100644 --- a/src/kibana/apps/discover/controllers/discover.js +++ b/src/kibana/apps/discover/controllers/discover.js @@ -117,7 +117,7 @@ define(function (require) { } ] }]}]}; - return search.onResults(onResults); + return search.onResults().then(onResults); }).catch(function (err) { console.log('An error'); }); diff --git a/src/kibana/components/saved_object/saved_object.js b/src/kibana/components/saved_object/saved_object.js index 1890c04d4080c6..65c7a3269b8912 100644 --- a/src/kibana/components/saved_object/saved_object.js +++ b/src/kibana/components/saved_object/saved_object.js @@ -55,7 +55,6 @@ define(function (require) { .type(type) .id(obj.id); - // check that the mapping for this type is defined return mappingSetup.isDefined(type) .then(function (defined) { @@ -63,21 +62,21 @@ define(function (require) { if (defined) return true; // we need to setup the mapping, flesh it out first - var mapping = { + var mapping = _.mapValues(mapping, function (val, prop) { // allow shortcuts for the field types, by just setting the value // to the type name - properties: _.mapValues(mapping, function (val, prop) { - if (typeof val !== 'string') return val; - return { - type: val - }; - }) - }; + if (typeof val !== 'string') return val; + return { + type: val + }; + }); - mapping.properties.kibanaSavedObjectMeta = { - // setup the searchSource mapping, even if it is not used but this type yet - searchSourceJSON: { - type: 'string' + mapping.kibanaSavedObjectMeta = { + properties: { + // setup the searchSource mapping, even if it is not used but this type yet + searchSourceJSON: { + type: 'string' + } } };