Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

Commit

Permalink
[Maps] expand/collapse Layer TOC (elastic#34506) (elastic#34873)
Browse files Browse the repository at this point in the history
* [Maps] expand/collapse Layer TOC

* Design edits (#30)

* fix jest test snapshots

* make default isLayerTOCOpen a constant

* use newly release EUI menuLeft and menuRight icons instead of arrow icon
  • Loading branch information
nreese authored Apr 10, 2019
1 parent 13e6a4a commit f416619
Show file tree
Hide file tree
Showing 11 changed files with 334 additions and 127 deletions.
10 changes: 9 additions & 1 deletion x-pack/plugins/maps/public/angular/map_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import _ from 'lodash';
import chrome from 'ui/chrome';
import 'ui/listen';
import React from 'react';
Expand All @@ -25,10 +26,12 @@ import {
clearTransientLayerStateAndCloseFlyout,
} from '../actions/store_actions';
import {
DEFAULT_IS_LAYER_TOC_OPEN,
enableFullScreen,
getIsFullScreen,
updateFlyout,
FLYOUT_STATE
FLYOUT_STATE,
setIsLayerTOCOpen
} from '../store/ui';
import { getUniqueIndexPatternIds } from '../selectors/map_selectors';
import { getInspectorAdapters } from '../store/non_serializable_instances';
Expand Down Expand Up @@ -138,6 +141,11 @@ app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage
}));
}

if (savedMap.uiStateJSON) {
const uiState = JSON.parse(savedMap.uiStateJSON);
store.dispatch(setIsLayerTOCOpen(_.get(uiState, 'isLayerTOCOpen', DEFAULT_IS_LAYER_TOC_OPEN)));
}

const layerList = getInitialLayers(savedMap.layerListJSON);
store.dispatch(replaceLayerList(layerList));

Expand Down
5 changes: 4 additions & 1 deletion x-pack/plugins/maps/public/angular/services/saved_gis_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
getRefreshConfig,
getQuery,
} from '../../selectors/map_selectors';
import { getIsLayerTOCOpen } from '../../store/ui';
import { convertMapExtentToPolygon } from '../../elasticsearch_geo_utils';
import { copyPersistentState } from '../../store/util';
import { extractReferences, injectReferences } from '../../../common/migrations/references';
Expand Down Expand Up @@ -99,7 +100,9 @@ module.factory('SavedGisMap', function (Private) {
query: _.omit(getQuery(state), 'queryLastTriggeredAt'),
});

this.uiStateJSON = JSON.stringify({});
this.uiStateJSON = JSON.stringify({
isLayerTOCOpen: getIsLayerTOCOpen(state)
});

this.bounds = convertMapExtentToPolygon(getMapExtent(state));
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@
max-width: 24rem;
}

.mapWidgetOverlay__layerWrapper {
align-items: flex-end;
}

.mapWidgetControl {
max-height: 100%;
width: 100%;
overflow: hidden;
padding-bottom: $euiSizeS; // ensures the scrollbar doesn't appear unnecessarily because of flex group negative margins
border-color: transparent !important;
Expand All @@ -30,11 +35,12 @@
&.mapWidgetControl-hasShadow {
@include euiBottomShadowLarge;
}
}

.mapWidgetControl__header {
padding: $euiSizeS $euiSize;
flex-shrink: 0;
}
.mapWidgetControl__header {
padding: 0 $euiSize;
flex-shrink: 0;
text-transform: uppercase;
}


Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,20 @@
overflow-y: auto;
flex-basis: auto !important; // Fixes IE and ensures the layer items are visible
}

.mapLayerControl__addLayerButton,
.mapLayerControl__openLayerTOCButton {
pointer-events: all;

&:enabled,
&:enabled:hover,
&:enabled:focus {
@include euiBottomShadowLarge;
}
}

.mapLayerControl__openLayerTOCButton,
.mapLayerControl__closeLayerTOCButton {
@include size($euiSizeXL);
background-color: $euiColorEmptyShade;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ import { connect } from 'react-redux';
import { LayerControl } from './view';
import {
getIsReadOnly,
getIsLayerTOCOpen,
updateFlyout,
FLYOUT_STATE,
setIsLayerTOCOpen,
} from '../../../store/ui';

function mapStateToProps(state = {}) {
return {
isReadOnly: getIsReadOnly(state),
isLayerTOCOpen: getIsLayerTOCOpen(state),
};
}

Expand All @@ -23,6 +26,12 @@ function mapDispatchToProps(dispatch) {
showAddLayerWizard: () => {
dispatch(updateFlyout(FLYOUT_STATE.ADD_LAYER_WIZARD));
},
closeLayerTOC: () => {
dispatch(setIsLayerTOCOpen(false));
},
openLayerTOC: () => {
dispatch(setIsLayerTOCOpen(true));
},
};
}

Expand Down
Loading

0 comments on commit f416619

Please sign in to comment.