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

geosolutions-it / MapStore2 / 14534587011

18 Apr 2025 11:41AM UTC coverage: 76.977% (-0.02%) from 76.993%
14534587011

Pull #11037

github

web-flow
Merge f22d700f6 into 48d6a1a15
Pull Request #11037: Remove object assign pollyfills

30792 of 47937 branches covered (64.23%)

446 of 556 new or added lines in 94 files covered. (80.22%)

8 existing lines in 4 files now uncovered.

38277 of 49725 relevant lines covered (76.98%)

36.07 hits per line

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

73.68
/web/client/utils/MapHistoryUtils.js
1
/**
2
 * Copyright 2015, 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
import undoable, {ActionTypes} from 'redux-undo';
9
import { isEqual } from 'lodash';
10

11
const mapConfigHistoryUtil = (reducer) => {
1✔
12
    return (state, action) => {
1✔
13
        let newState = reducer(state, action);
23✔
14
        let unredoState;
15
        // If undo modified the state we change mapStateSource
16
        if (action.type === ActionTypes.UNDO && state.past.length > 0) {
23!
NEW
17
            let mapC = Object.assign({}, newState.present, {mapStateSource: "undoredo", style: state.present.style, resize: state.present.resize});
×
NEW
18
            unredoState = Object.assign({}, newState, {present: mapC});
×
19
        } else if (action.type === ActionTypes.REDO && state.future.length > 0) {
23!
NEW
20
            let mapC = Object.assign({}, newState.present, {mapStateSource: "undoredo", style: state.present.style, resize: state.present.resize});
×
NEW
21
            unredoState = Object.assign({}, newState, {present: mapC});
×
22
        }
23
        return unredoState || {past: newState.past, present: newState.present, future: newState.future};
23✔
24
    };
25
};
26

27

28
export const createHistory = (mapState) => {
1✔
29
    if (mapState && mapState.map && mapState.map.center) {
63✔
30
        return Object.assign({}, mapState, {
4✔
31
            map: {
32
                past: [],
33
                present: mapState.map,
34
                future: []
35
            }
36
        });
37
    }
38
    return mapState;
59✔
39
};
40

41
export const mapConfigHistory = (reducer) => mapConfigHistoryUtil(undoable(reducer, {
1✔
42
    filter: (action, currentState, previousState) => {
43
        let bool = false;
23✔
44
        if (previousState && previousState.mapStateSource && previousState.mapStateSource === 'map'
23!
45
                && previousState.center && previousState.zoom !== undefined) {
46
            // Check geometry part
47
            bool = !(isEqual(currentState.center, previousState.center) && currentState.zoom === previousState.zoom);
×
48
        }
49
        return bool;
23✔
50
    }
51
}));
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

© 2026 Coveralls, Inc