-
Notifications
You must be signed in to change notification settings - Fork 383
/
highlight.js
40 lines (35 loc) · 1.08 KB
/
highlight.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
/*
* Copyright 2017, GeoSolutions Sas.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
import { HIGHLIGHT_STATUS, UPDATE_HIGHLIGHTED, SET_HIGHLIGHT_FEATURES_PATH } from '../actions/highlight';
import assign from 'object-assign';
const initialState = {
status: 'disabled',
layer: 'featureselector',
features: [],
highlighted: 0,
featuresPath: "highlight.emptyFeatures",
emptyFeatures: []
};
function highlight(state = initialState, action) {
switch (action.type) {
case SET_HIGHLIGHT_FEATURES_PATH: {
return assign({}, state, {
featuresPath: action.featuresPath || "highlight.emptyFeatures"
});
}
case HIGHLIGHT_STATUS: {
return {...state, status: action.status};
}
case UPDATE_HIGHLIGHTED: {
return {...state, highlighted: action.features.length, features: action.features, status: action.status || state.status};
}
default:
return state;
}
}
export default highlight;