-
Notifications
You must be signed in to change notification settings - Fork 8.1k
/
index.js
69 lines (65 loc) · 2.26 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { connect } from 'react-redux';
import { MapsAppView } from './maps_app_view';
import { getFlyoutDisplay, getIsFullScreen } from '../../../selectors/ui_selectors';
import {
getFilters,
getQueryableUniqueIndexPatternIds,
getRefreshConfig,
getLayerListConfigOnly,
} from '../../../selectors/map_selectors';
import {
replaceLayerList,
setGotoWithCenter,
setIsLayerTOCOpen,
setMapSettings,
setOpenTOCDetails,
setQuery,
setReadOnly,
setRefreshConfig,
setSelectedLayer,
updateFlyout,
} from '../../../actions';
import { FLYOUT_STATE } from '../../../reducers/ui';
import { getMapsCapabilities } from '../../../kibana_services';
function mapStateToProps(state = {}) {
return {
isFullScreen: getIsFullScreen(state),
nextIndexPatternIds: getQueryableUniqueIndexPatternIds(state),
flyoutDisplay: getFlyoutDisplay(state),
refreshConfig: getRefreshConfig(state),
filters: getFilters(state),
layerListConfigOnly: getLayerListConfigOnly(state),
};
}
function mapDispatchToProps(dispatch) {
return {
dispatchSetQuery: (refresh, filters, query, time) => {
dispatch(
setQuery({
filters,
query,
timeFilters: time,
refresh,
})
);
},
setRefreshConfig: (refreshConfig) => dispatch(setRefreshConfig(refreshConfig)),
replaceLayerList: (layerList) => dispatch(replaceLayerList(layerList)),
setGotoWithCenter: (latLonZoom) => dispatch(setGotoWithCenter(latLonZoom)),
setMapSettings: (mapSettings) => dispatch(setMapSettings(mapSettings)),
setIsLayerTOCOpen: (isLayerTOCOpen) => dispatch(setIsLayerTOCOpen(isLayerTOCOpen)),
setOpenTOCDetails: (openTOCDetails) => dispatch(setOpenTOCDetails(openTOCDetails)),
clearUi: () => {
dispatch(setSelectedLayer(null));
dispatch(updateFlyout(FLYOUT_STATE.NONE));
dispatch(setReadOnly(!getMapsCapabilities().save));
},
};
}
const connectedMapsAppView = connect(mapStateToProps, mapDispatchToProps)(MapsAppView);
export { connectedMapsAppView as MapsAppView };