Skip to content
Closed
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
21 changes: 12 additions & 9 deletions x-pack/plugins/maps/public/actions/store_actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ export function addLayer(layerDescriptor) {
};
}

export function setLayerErrorStatus(id, errorMessage) {
export function setLayerErrorStatus(layerId, errorMessage) {
return dispatch => {
dispatch({
type: SET_LAYER_ERROR_STATUS,
layerId: id,
layerId,
errorMessage,
});
};
Expand Down Expand Up @@ -318,13 +318,16 @@ export function endDataLoad(layerId, dataId, requestToken, data, meta) {
}

export function onDataLoadError(layerId, dataId, requestToken, errorMessage) {
return ({
type: LAYER_DATA_LOAD_ERROR,
layerId,
dataId,
requestToken,
errorMessage
});
return async (dispatch) => {
dispatch({
type: LAYER_DATA_LOAD_ERROR,
layerId,
dataId,
requestToken,
});

dispatch(setLayerErrorStatus(layerId, errorMessage));
};
}

export function updateSourceProp(layerId, propName, value) {
Expand Down
13 changes: 0 additions & 13 deletions x-pack/plugins/maps/public/actions/ui_actions.js

This file was deleted.

1 change: 0 additions & 1 deletion x-pack/plugins/maps/public/components/_index.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@import './gis_map/gis_map';
@import './layer_addpanel/layer_addpanel';
@import './layer_panel/index';
@import './toasts/toasts';
@import './widget_overlay/index';
2 changes: 0 additions & 2 deletions x-pack/plugins/maps/public/components/gis_map/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { WidgetOverlay } from '../widget_overlay/index';
import { LayerPanel } from '../layer_panel/index';
import { AddLayerPanel } from '../layer_addpanel/index';
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { Toasts } from '../toasts';
import { ExitFullScreenButton } from 'ui/exit_full_screen';

export class GisMap extends Component {
Expand Down Expand Up @@ -99,7 +98,6 @@ export class GisMap extends Component {
{currentPanel}
</EuiFlexItem>

<Toasts/>
{exitFullScreenButton}
</EuiFlexGroup>
);
Expand Down
4 changes: 0 additions & 4 deletions x-pack/plugins/maps/public/components/toasts/_toasts.scss

This file was deleted.

34 changes: 0 additions & 34 deletions x-pack/plugins/maps/public/components/toasts/index.js

This file was deleted.

24 changes: 0 additions & 24 deletions x-pack/plugins/maps/public/components/toasts/view.js

This file was deleted.

33 changes: 20 additions & 13 deletions x-pack/plugins/maps/public/store/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,29 @@ export function map(state = INITIAL_STATE, action) {
...state,
goto: null,
};
case SET_LAYER_ERROR_STATUS:
const { layerList } = state;
const layerIdx = getLayerIndex(layerList, action.layerId);
if (layerIdx === -1) {
return state;
}

return {
...state,
layerList: [
...layerList.slice(0, layerIdx),
{
...layerList[layerIdx],
__isInErrorState: true,
__errorMessage: action.errorMessage
},
...layerList.slice(layerIdx + 1)
]
};
case LAYER_DATA_LOAD_STARTED:
return updateWithDataRequest(state, action);
case SET_LAYER_ERROR_STATUS:
return setErrorStatus(state, action);
case LAYER_DATA_LOAD_ERROR:
const errorRequestResetState = resetDataRequest(state, action);
return setErrorStatus(errorRequestResetState, action);
return resetDataRequest(state, action);
case LAYER_DATA_LOAD_ENDED:
return updateWithDataResponse(state, action);
case TOUCH_LAYER:
Expand Down Expand Up @@ -270,15 +286,6 @@ export function map(state = INITIAL_STATE, action) {
}
}

function setErrorStatus(state, { layerId, errorMessage }) {
const tmsErrorLayer = state.layerList.find(({ id }) => id === layerId);
return tmsErrorLayer
? updateLayerInList(
updateLayerInList(state, tmsErrorLayer.id, 'isInErrorState', true),
tmsErrorLayer.id, 'errorMessage', errorMessage)
: state;
}

function findDataRequest(layerDescriptor, dataRequestAction) {

if (!layerDescriptor.dataRequests) {
Expand Down
21 changes: 0 additions & 21 deletions x-pack/plugins/maps/public/store/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/
import _ from 'lodash';
import { PROMOTE_TEMPORARY_LAYERS, LAYER_DATA_LOAD_ERROR }
from '../actions/store_actions';
import { RESET_LAYER_LOAD } from '../actions/ui_actions';

export const UPDATE_FLYOUT = 'UPDATE_FLYOUT';
export const CLOSE_SET_VIEW = 'CLOSE_SET_VIEW';
Expand All @@ -17,33 +14,15 @@ export const FLYOUT_STATE = {
LAYER_PANEL: 'LAYER_PANEL',
ADD_LAYER_WIZARD: 'ADD_LAYER_WIZARD'
};
export const LAYER_LOAD_STATE = {
complete: 'complete',
error: 'error',
inactive: 'inactive'
};

const INITIAL_STATE = {
flyoutDisplay: FLYOUT_STATE.NONE,
layerLoad: {
status: LAYER_LOAD_STATE.inactive,
time: Date()
},
isFullScreen: false,
};

// Reducer
function ui(state = INITIAL_STATE, action) {
switch (action.type) {
case PROMOTE_TEMPORARY_LAYERS:
return { ...state, layerLoad: { status: LAYER_LOAD_STATE.complete,
time: Date() } };
case LAYER_DATA_LOAD_ERROR:
return { ...state, layerLoad: { status: LAYER_LOAD_STATE.error,
time: Date() } };
case RESET_LAYER_LOAD:
return { ...state, layerLoad: { status: LAYER_LOAD_STATE.inactive,
time: Date() } };
case UPDATE_FLYOUT:
return { ...state, flyoutDisplay: action.display };
case CLOSE_SET_VIEW:
Expand Down