Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] [Maps] expand/collapse Layer TOC (#34506) #34873

Merged
merged 1 commit into from
Apr 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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