Skip to content

Commit

Permalink
Revert "[Maps] clean-up unsaved state check (elastic#61535)"
Browse files Browse the repository at this point in the history
This reverts commit 30bdfed.
  • Loading branch information
spalger committed Mar 27, 2020
1 parent 4e7c681 commit 4c18199
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
7 changes: 1 addition & 6 deletions x-pack/legacy/plugins/maps/public/angular/map_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4c18199

Please sign in to comment.