From 4c1819920807fe6787c2cd30697fee8f30c79272 Mon Sep 17 00:00:00 2001 From: spalger Date: Fri, 27 Mar 2020 13:54:45 -0700 Subject: [PATCH] Revert "[Maps] clean-up unsaved state check (#61535)" This reverts commit 30bdfeda6cbfd4c1fa26e2d49817d8de051cb0f8. --- .../maps/public/angular/map_controller.js | 7 +------ .../components/color/dynamic_color_form.js | 16 ++++------------ 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/x-pack/legacy/plugins/maps/public/angular/map_controller.js b/x-pack/legacy/plugins/maps/public/angular/map_controller.js index a19f8cdf5f7fc..519ba0b1e3d96 100644 --- a/x-pack/legacy/plugins/maps/public/angular/map_controller.js +++ b/x-pack/legacy/plugins/maps/public/angular/map_controller.js @@ -312,12 +312,7 @@ app.controller( const savedLayerList = savedMap.getLayerList(); const oldConfig = savedLayerList ? savedLayerList : initialLayerListConfig; - // savedMap stores layerList as a JSON string using JSON.stringify. - // JSON.stringify removes undefined properties from objects. - // savedMap.getLayerList converts the JSON string back into Javascript array of objects. - // Need to perform the same process for layerListConfigOnly to compare apples to apples - // and avoid undefined properties in layerListConfigOnly triggering unsaved changes. - return !_.isEqual(JSON.parse(JSON.stringify(layerListConfigOnly)), oldConfig); + return !_.isEqual(layerListConfigOnly, oldConfig); } function isOnMapNow() { diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/color/dynamic_color_form.js b/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/color/dynamic_color_form.js index 5e8f720fcc5e3..a1c15e27c9eb3 100644 --- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/color/dynamic_color_form.js +++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/color/dynamic_color_form.js @@ -28,20 +28,12 @@ export function DynamicColorForm({ }; if (type === COLOR_MAP_TYPE.ORDINAL) { newColorOptions.useCustomColorRamp = useCustomColorMap; - if (customColorMap) { - newColorOptions.customColorRamp = customColorMap; - } - if (color) { - newColorOptions.color = color; - } + newColorOptions.customColorRamp = customColorMap; + newColorOptions.color = color; } else { newColorOptions.useCustomColorPalette = useCustomColorMap; - if (customColorMap) { - newColorOptions.customColorPalette = customColorMap; - } - if (color) { - newColorOptions.colorCategory = color; - } + newColorOptions.customColorPalette = customColorMap; + newColorOptions.colorCategory = color; } onDynamicStyleChange(styleProperty.getStyleName(), newColorOptions);