mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
* [Maps] show maps webgl error in generated reports * add data-shared-item prop
This commit is contained in:
parent
07a880bffd
commit
ee14952e83
7 changed files with 61 additions and 15 deletions
|
@ -59,6 +59,7 @@ export const DRAW_TYPE = {
|
||||||
POLYGON: 'POLYGON'
|
POLYGON: 'POLYGON'
|
||||||
};
|
};
|
||||||
export const SET_SCROLL_ZOOM = 'SET_SCROLL_ZOOM';
|
export const SET_SCROLL_ZOOM = 'SET_SCROLL_ZOOM';
|
||||||
|
export const SET_MAP_INIT_ERROR = 'SET_MAP_INIT_ERROR';
|
||||||
|
|
||||||
function getLayerLoadingCallbacks(dispatch, layerId) {
|
function getLayerLoadingCallbacks(dispatch, layerId) {
|
||||||
return {
|
return {
|
||||||
|
@ -87,6 +88,13 @@ async function syncDataForAllLayers(getState, dispatch, dataFilters) {
|
||||||
await Promise.all(syncs);
|
await Promise.all(syncs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function setMapInitError(errorMessage) {
|
||||||
|
return {
|
||||||
|
type: SET_MAP_INIT_ERROR,
|
||||||
|
errorMessage
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export function trackCurrentLayerState(layerId) {
|
export function trackCurrentLayerState(layerId) {
|
||||||
return {
|
return {
|
||||||
type: TRACK_CURRENT_LAYER_STATE,
|
type: TRACK_CURRENT_LAYER_STATE,
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { connect } from 'react-redux';
|
||||||
import { GisMap } from './view';
|
import { GisMap } from './view';
|
||||||
import { getFlyoutDisplay, getIsFullScreen, exitFullScreen, FLYOUT_STATE } from '../../store/ui';
|
import { getFlyoutDisplay, getIsFullScreen, exitFullScreen, FLYOUT_STATE } from '../../store/ui';
|
||||||
import { triggerRefreshTimer } from '../../actions/store_actions';
|
import { triggerRefreshTimer } from '../../actions/store_actions';
|
||||||
import { getRefreshConfig } from '../../selectors/map_selectors';
|
import { getRefreshConfig, getMapInitError } from '../../selectors/map_selectors';
|
||||||
|
|
||||||
function mapStateToProps(state = {}) {
|
function mapStateToProps(state = {}) {
|
||||||
const flyoutDisplay = getFlyoutDisplay(state);
|
const flyoutDisplay = getFlyoutDisplay(state);
|
||||||
|
@ -18,6 +18,7 @@ function mapStateToProps(state = {}) {
|
||||||
noFlyoutVisible: flyoutDisplay === FLYOUT_STATE.NONE,
|
noFlyoutVisible: flyoutDisplay === FLYOUT_STATE.NONE,
|
||||||
isFullScreen: getIsFullScreen(state),
|
isFullScreen: getIsFullScreen(state),
|
||||||
refreshConfig: getRefreshConfig(state),
|
refreshConfig: getRefreshConfig(state),
|
||||||
|
mapInitError: getMapInitError(state),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,9 @@ import { WidgetOverlay } from '../widget_overlay/index';
|
||||||
import { ToolbarOverlay } from '../toolbar_overlay/index';
|
import { ToolbarOverlay } from '../toolbar_overlay/index';
|
||||||
import { LayerPanel } from '../layer_panel/index';
|
import { LayerPanel } from '../layer_panel/index';
|
||||||
import { AddLayerPanel } from '../layer_addpanel/index';
|
import { AddLayerPanel } from '../layer_addpanel/index';
|
||||||
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
|
import { EuiFlexGroup, EuiFlexItem, EuiCallOut } from '@elastic/eui';
|
||||||
import { ExitFullScreenButton } from 'ui/exit_full_screen';
|
import { ExitFullScreenButton } from 'ui/exit_full_screen';
|
||||||
|
import { i18n } from '@kbn/i18n';
|
||||||
|
|
||||||
export class GisMap extends Component {
|
export class GisMap extends Component {
|
||||||
|
|
||||||
|
@ -63,11 +64,29 @@ export class GisMap extends Component {
|
||||||
noFlyoutVisible,
|
noFlyoutVisible,
|
||||||
isFullScreen,
|
isFullScreen,
|
||||||
exitFullScreen,
|
exitFullScreen,
|
||||||
|
mapInitError,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
if (mapInitError) {
|
||||||
|
return (
|
||||||
|
<div data-render-complete data-shared-item>
|
||||||
|
<EuiCallOut
|
||||||
|
title={i18n.translate('xpack.maps.map.initializeErrorTitle', {
|
||||||
|
defaultMessage: 'Unable to initialize map'
|
||||||
|
})}
|
||||||
|
color="danger"
|
||||||
|
iconType="cross"
|
||||||
|
>
|
||||||
|
<p>
|
||||||
|
{mapInitError}
|
||||||
|
</p>
|
||||||
|
</EuiCallOut>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
let currentPanel;
|
let currentPanel;
|
||||||
let currentPanelClassName;
|
let currentPanelClassName;
|
||||||
|
|
||||||
if (noFlyoutVisible) {
|
if (noFlyoutVisible) {
|
||||||
currentPanel = null;
|
currentPanel = null;
|
||||||
} else if (addLayerVisible) {
|
} else if (addLayerVisible) {
|
||||||
|
|
|
@ -14,6 +14,7 @@ import {
|
||||||
clearMouseCoordinates,
|
clearMouseCoordinates,
|
||||||
clearGoto,
|
clearGoto,
|
||||||
setTooltipState,
|
setTooltipState,
|
||||||
|
setMapInitError,
|
||||||
updateDrawState
|
updateDrawState
|
||||||
} from '../../../actions/store_actions';
|
} from '../../../actions/store_actions';
|
||||||
import {
|
import {
|
||||||
|
@ -65,6 +66,9 @@ function mapDispatchToProps(dispatch) {
|
||||||
setTooltipState(tooltipState) {
|
setTooltipState(tooltipState) {
|
||||||
dispatch(setTooltipState(tooltipState));
|
dispatch(setTooltipState(tooltipState));
|
||||||
},
|
},
|
||||||
|
setMapInitError(errorMessage) {
|
||||||
|
dispatch(setMapInitError(errorMessage));
|
||||||
|
},
|
||||||
disableDrawState() {
|
disableDrawState() {
|
||||||
dispatch(updateDrawState(null));
|
dispatch(updateDrawState(null));
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,11 +250,13 @@ export class MBMapContainer extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
|
if (this._mbMap) {
|
||||||
// do not debounce syncing of map-state and tooltip
|
// do not debounce syncing of map-state and tooltip
|
||||||
this._syncMbMapWithMapState();
|
this._syncMbMapWithMapState();
|
||||||
this._syncTooltipState();
|
this._syncTooltipState();
|
||||||
this._debouncedSync();
|
this._debouncedSync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this._initializeMap();
|
this._initializeMap();
|
||||||
|
@ -299,12 +301,16 @@ export class MBMapContainer extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
async _initializeMap() {
|
async _initializeMap() {
|
||||||
|
try {
|
||||||
this._mbMap = await createMbMapInstance({
|
this._mbMap = await createMbMapInstance({
|
||||||
node: this.refs.mapContainer,
|
node: this.refs.mapContainer,
|
||||||
initialView: this.props.goto ? this.props.goto.center : null,
|
initialView: this.props.goto ? this.props.goto.center : null,
|
||||||
scrollZoom: this.props.scrollZoom
|
scrollZoom: this.props.scrollZoom
|
||||||
});
|
});
|
||||||
|
} catch(error) {
|
||||||
|
this.props.setMapInitError(error.message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!this._isMounted) {
|
if (!this._isMounted) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -67,6 +67,8 @@ export const getTooltipState = ({ map }) => {
|
||||||
|
|
||||||
export const getMapReady = ({ map }) => map && map.ready;
|
export const getMapReady = ({ map }) => map && map.ready;
|
||||||
|
|
||||||
|
export const getMapInitError = ({ map }) => map.mapInitError;
|
||||||
|
|
||||||
export const getGoto = ({ map }) => map && map.goto;
|
export const getGoto = ({ map }) => map && map.goto;
|
||||||
|
|
||||||
export const getSelectedLayerId = ({ map }) => {
|
export const getSelectedLayerId = ({ map }) => {
|
||||||
|
@ -150,7 +152,6 @@ export const getDataFilters = createSelector(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
export const getLayerList = createSelector(
|
export const getLayerList = createSelector(
|
||||||
getLayerListRaw,
|
getLayerListRaw,
|
||||||
getInspectorAdapters,
|
getInspectorAdapters,
|
||||||
|
|
|
@ -38,8 +38,9 @@ import {
|
||||||
REMOVE_TRACKED_LAYER_STATE,
|
REMOVE_TRACKED_LAYER_STATE,
|
||||||
UPDATE_SOURCE_DATA_REQUEST,
|
UPDATE_SOURCE_DATA_REQUEST,
|
||||||
SET_TOOLTIP_STATE,
|
SET_TOOLTIP_STATE,
|
||||||
|
SET_SCROLL_ZOOM,
|
||||||
|
SET_MAP_INIT_ERROR,
|
||||||
UPDATE_DRAW_STATE,
|
UPDATE_DRAW_STATE,
|
||||||
SET_SCROLL_ZOOM
|
|
||||||
} from '../actions/store_actions';
|
} from '../actions/store_actions';
|
||||||
|
|
||||||
import { copyPersistentState, TRACKED_LAYER_DESCRIPTOR } from './util';
|
import { copyPersistentState, TRACKED_LAYER_DESCRIPTOR } from './util';
|
||||||
|
@ -87,6 +88,7 @@ const updateLayerSourceDescriptorProp = (state, layerId, propName, value) => {
|
||||||
|
|
||||||
const INITIAL_STATE = {
|
const INITIAL_STATE = {
|
||||||
ready: false,
|
ready: false,
|
||||||
|
mapInitError: null,
|
||||||
goto: null,
|
goto: null,
|
||||||
tooltipState: null,
|
tooltipState: null,
|
||||||
mapState: {
|
mapState: {
|
||||||
|
@ -317,6 +319,11 @@ export function map(state = INITIAL_STATE, action) {
|
||||||
scrollZoom: action.scrollZoom,
|
scrollZoom: action.scrollZoom,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
case SET_MAP_INIT_ERROR:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
mapInitError: action.errorMessage
|
||||||
|
};
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue