• 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

62.5
/web/client/reducers/mapimport.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
    SET_LAYERS,
11
    ON_ERROR,
12
    ON_SELECT_LAYER,
13
    LOADING,
14
    ON_LAYER_ADDED,
15
    UPDATE_BBOX,
16
    ON_SUCCESS,
17
    ON_SHAPE_ERROR,
18
    ON_LAYER_SKIPPED
19
} from '../actions/mapimport';
20

21
import { uniqWith } from 'lodash';
22
import { TOGGLE_CONTROL } from '../actions/controls';
23

24
const initialState = {
1✔
25
    layers: null,
26
    errors: null,
27
    loading: false,
28
    selected: null,
29
    bbox: [190, 190, -190, -190]
30
};
31

32
function mapimport(state = initialState, action) {
8✔
33
    switch (action.type) {
11!
34
    case ON_SHAPE_ERROR: {
UNCOV
35
        return Object.assign({}, state, {error: action.message, success: null});
×
36
    }
37
    case SET_LAYERS: {
38
        let selected = action.layers && action.layers[0] ? action.layers[0] : null;
3✔
39
        const errors = action.layers ? action.errors : null;
3✔
40
        return Object.assign({}, state, {layers: action.layers, selected: selected, bbox: [190, 190, -190, -190], errors}, selected ? {} : {success: null});
3✔
41
    }
42
    case ON_ERROR: {
43
        return Object.assign({}, state, {
3✔
44
            // remove duplicates
45
            errors: uniqWith(
46
                [...(state.errors || []), action.error],
4✔
47
                (a, b) =>
48
                    (a.name && a.name === b.name || a.filename && a.filename === b.fileName) && a.message === b.message
2!
49
            ), success: null});
50
    }
51
    case LOADING: {
52
        return Object.assign({}, state, {loading: action.status});
1✔
53
    }
54
    case ON_SELECT_LAYER: {
55
        return Object.assign({}, state, {selected: action.layer});
1✔
56
    }
57
    case ON_LAYER_ADDED: {
58
        let newLayers = state.layers.filter((l) => {
1✔
59
            return action.layer.name !== l.name;
2✔
60
        }, this);
61
        let selected = newLayers && newLayers[0] ? newLayers[0] : null;
1!
62
        return Object.assign({}, state, {layers: newLayers, selected: selected}, !selected ? {bbox: [190, 190, -190, -190]} : {});
1!
63
    }
64
    case UPDATE_BBOX: {
65
        return Object.assign({}, state, {bbox: action.bbox});
1✔
66
    }
67
    case ON_SUCCESS: {
68
        return Object.assign({}, state, {success: action.message, errors: null, error: null});
1✔
69
    }
70
    case TOGGLE_CONTROL: {
71
        // TODO check this. if it must remain
UNCOV
72
        if (action.control === 'shapefile') {
×
73
            return Object.assign({}, state, {errors: null, success: null});
×
74
        }
UNCOV
75
        return state;
×
76
    }
77
    case ON_LAYER_SKIPPED: {
UNCOV
78
        const newLayers = state.layers.filter((l) => {
×
79
            return action.layer.name !== l.name;
×
80
        }, this);
UNCOV
81
        const selected = newLayers && newLayers[0] ? newLayers[0] : null;
×
82
        return Object.assign({}, state, {layers: newLayers, selected, success: null});
×
83
    }
84
    default:
UNCOV
85
        return state;
×
86
    }
87
}
88

89
export default mapimport;
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