• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

geosolutions-it / MapStore2 / 19710972030

26 Nov 2025 03:38PM UTC coverage: 76.665% (-0.3%) from 76.929%
19710972030

Pull #11119

github

web-flow
Fix maven publish (#11739)
Pull Request #11119: Layer Selection Plugin on ArcGIS, WFS & WMS layers

32272 of 50209 branches covered (64.28%)

3 of 3 new or added lines in 2 files covered. (100.0%)

3018 existing lines in 249 files now uncovered.

40157 of 52380 relevant lines covered (76.66%)

37.9 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

22.22
/web/client/reducers/query.js
1
/**
2
 * Copyright 2016, GeoSolutions Sas.
3
 * All rights reserved.
4
 *
5
 * This source code is licensed under the BSD-style license found in the
6
 * LICENSE file in the root directory of this source tree.
7
 */
8

9
import {
10
    FEATURE_TYPE_SELECTED,
11
    FEATURE_TYPE_LOADED,
12
    FEATURE_TYPE_ERROR,
13
    FEATURE_LOADING,
14
    FEATURE_LOADED,
15
    FEATURE_ERROR,
16
    QUERY_CREATE,
17
    QUERY_RESULT,
18
    QUERY_ERROR,
19
    RESET_QUERY,
20
    UPDATE_QUERY,
21
    TOGGLE_SYNC_WMS,
22
    TOGGLE_LAYER_FILTER
23
} from '../actions/wfsquery';
24
import { SET_SYNC_TOOL } from '../actions/featuregrid';
25
import { QUERY_FORM_RESET } from '../actions/queryform';
26
import { RESET_CONTROLS } from '../actions/controls';
27

28
const extractData = (feature) => {
1✔
UNCOV
29
    return ['STATE_NAME', 'STATE_ABBR', 'SUB_REGION', 'STATE_FIPS' ].map((attribute) => ({
×
30
        attribute,
31
        values: feature.features.reduce((previous, current) => {
UNCOV
32
            if (previous.indexOf(current.properties[attribute]) === -1) {
×
33
                return [...previous, current.properties[attribute]].sort();
×
34
            }
UNCOV
35
            return previous;
×
36
        }, [])
37
    })).reduce((previous, current) => {
UNCOV
38
        return Object.assign(previous, {
×
39
            [current.attribute]: current.values.map((value) => ({
×
40
                id: value,
41
                name: value
42
            }))
43
        });
44
    }, {});
45
};
46

47
const initialState = {
1✔
48
    featureTypes: {},
49
    data: {},
50
    result: null,
51
    resultError: null,
52
    syncWmsFilter: false,
53
    isLayerFilter: false
54
};
55

56
function query(state = initialState, action) {
×
57
    switch (action.type) {
2!
58
    case FEATURE_TYPE_SELECTED: {
UNCOV
59
        return Object.assign({}, state, {
×
60
            typeName: action.typeName,
61
            url: action.url
62
        });
63
    }
64
    case FEATURE_TYPE_LOADED: {
UNCOV
65
        return Object.assign({}, state, {
×
66
            featureTypes: Object.assign({}, state.featureTypes, {[action.typeName]: action.featureType})
67
        });
68
    }
69
    case FEATURE_TYPE_ERROR: {
UNCOV
70
        return Object.assign({}, state, {
×
71
            featureTypes: Object.assign({}, state.featureTypes, {[action.typeName]: {error: action.error}})
72
        });
73
    }
74
    case FEATURE_LOADING: {
UNCOV
75
        return Object.assign({}, state, {
×
76
            featureLoading: action.isLoading
77
        });
78
    }
79
    case FEATURE_LOADED: {
UNCOV
80
        return Object.assign({}, state, {
×
81
            featureLoading: false,
82
            data: Object.assign({}, state.data, {[action.typeName]: extractData(action.feature)})
83
        });
84
    }
85
    case FEATURE_ERROR: {
UNCOV
86
        return Object.assign({}, state, {
×
87
            featureLoading: false,
88
            featureTypes: Object.assign({}, state.data, {[action.typeName]: {error: action.error}})
89
        });
90
    }
91
    case QUERY_CREATE: {
UNCOV
92
        return Object.assign({}, state, {
×
93
            isNew: true,
94
            searchUrl: action.searchUrl,
95
            filterObj: action.filterObj
96
        });
97
    }
98
    case UPDATE_QUERY: {
UNCOV
99
        return Object.assign({}, state, {
×
100
            filterObj: Object.assign({}, state.filterObj, action.updates)
101
        });
102
    }
103
    case QUERY_RESULT: {
UNCOV
104
        return Object.assign({}, state, {
×
105
            isNew: false,
106
            result: action.result,
107
            searchUrl: action.searchUrl,
108
            filterObj: action.filterObj,
109
            resultError: null
110
        });
111
    }
112
    case QUERY_ERROR: {
UNCOV
113
        return Object.assign({}, state, {
×
114
            isNew: false,
115
            result: null,
116
            resultError: action.error
117
        });
118
    }
119
    case RESET_CONTROLS:
120
    case QUERY_FORM_RESET:
121
        if (action.skip && action.skip.indexOf("query") >= 0) {
1!
122
            return state;
1✔
123
        }
UNCOV
124
        return Object.assign({}, state, {
×
125
            isNew: false,
126
            result: null,
127
            filterObj: null,
128
            searchUrl: null,
129
            filters: null
130
        });
131
    case RESET_QUERY: {
UNCOV
132
        return Object.assign({}, state, {
×
133
            result: null,
134
            resultError: null
135
        });
136
    }
137
    case TOGGLE_SYNC_WMS:
UNCOV
138
        return Object.assign({}, state, {syncWmsFilter: !state.syncWmsFilter});
×
139
    case SET_SYNC_TOOL:
UNCOV
140
        return Object.assign({}, state, {syncWmsFilter: action.syncWmsFilter});
×
141
    case TOGGLE_LAYER_FILTER:
142
        return Object.assign({}, state, {isLayerFilter: !state.isLayerFilter});
1✔
143
    default:
UNCOV
144
        return state;
×
145
    }
146
}
147

148
export default query;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc