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

geosolutions-it / MapStore2 / 19735587487

27 Nov 2025 09:59AM UTC coverage: 76.667% (-0.3%) from 76.929%
19735587487

Pull #11119

github

web-flow
Fix: #11712 Support for template format on vector layers to visualize embedded conent (#11720)
Pull Request #11119: Layer Selection Plugin on ArcGIS, WFS & WMS layers

32268 of 50209 branches covered (64.27%)

7 of 13 new or added lines in 2 files covered. (53.85%)

3017 existing lines in 248 files now uncovered.

40158 of 52380 relevant lines covered (76.67%)

37.8 hits per line

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

97.37
/web/client/reducers/tutorial.js
1
/*
2
 * Copyright 2017, 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
    START_TUTORIAL,
11
    INIT_TUTORIAL,
12
    SETUP_TUTORIAL,
13
    UPDATE_TUTORIAL,
14
    DISABLE_TUTORIAL,
15
    RESET_TUTORIAL,
16
    CLOSE_TUTORIAL,
17
    TOGGLE_TUTORIAL
18
} from '../actions/tutorial';
19

20
import React from 'react';
21
import I18N from '../components/I18N/I18N';
22

23
const initialState = {
1✔
24
    run: false,
25
    start: false,
26
    steps: [],
27
    enabled: false,
28
    disabled: false,
29
    status: 'close',
30
    stepIndex: 0,
31
    tourAction: 'next',
32
    id: '',
33
    presetList: {}
34
};
35
import { getApi } from '../api/userPersistedStorage';
36

37
function tutorial(state = initialState, action) {
1✔
38
    switch (action.type) {
15✔
39
    case START_TUTORIAL:
40
        return Object.assign({}, state, {
1✔
41
            run: true,
42
            start: true,
43
            status: 'run'
44
        });
45
    case INIT_TUTORIAL:
46
        return Object.assign({}, state, {
1✔
47
            style: action.style,
48
            defaultStep: action.defaultStep,
49
            checkbox: action.checkbox,
50
            presetList: action.presetList
51
        });
52
    case SETUP_TUTORIAL:
53
        let setup = {};
3✔
54
        setup.steps = [].concat(action.steps);
3✔
55
        setup.id = action.id;
3✔
56
        setup.checkbox = action.checkbox ? action.checkbox : Object.assign({}, state.checkbox);
3!
57
        setup.style = action.style ? action.style : Object.assign({}, state.style);
3!
58
        setup.defaultStep = action.defaultStep ? action.defaultStep : Object.assign({}, state.defaultStep);
3!
59
        setup.disabled = false;
3✔
60
        setup.presetGroup = action.presetGroup;
3✔
61
        let isActuallyDisabled = false;
3✔
62
        try {
3✔
63
            isActuallyDisabled = getApi().getItem('mapstore.plugin.tutorial.' + action.id + '.disabled') === 'true';
3✔
64
        } catch (e) {
UNCOV
65
            console.error(e);
×
66
        }
67

68
        setup.steps = setup.steps.filter((step) => {
3✔
69
            return step?.selector?.substring(0, 1) === '#' || step?.selector?.substring(0, 1) === '.';
11✔
70
        }).map((step, index) => {
71
            let title = step.title ? step.title : '';
8✔
72
            title = step.translation ? <I18N.Message msgId = {"tutorial." + step.translation + ".title"}/> : title;
8✔
73
            title = step.translationHTML ? <I18N.HTML msgId = {"tutorial." + step.translationHTML + ".title"}/> : title;
8✔
74
            let text = step.text ? step.text : '';
8✔
75
            text = step.translation ? <I18N.Message msgId = {"tutorial." + step.translation + ".text"}/> : text;
8✔
76
            text = step.translationHTML ? <I18N.HTML msgId = {"tutorial." + step.translationHTML + ".text"}/> : text;
8✔
77
            text = (step.selector === '#intro-tutorial') && !isActuallyDisabled ? <div><div>{text}</div>{setup.checkbox}</div> : text;
8✔
78
            let style = (step.selector === '#intro-tutorial') ? setup.style : {};
8✔
79
            let isFixed = (step.selector === '#intro-tutorial') ? true : step.isFixed || false;
8✔
80
            Object.assign(style, step.style);
8✔
81
            return Object.assign({}, setup.defaultStep, step, {
8✔
82
                index,
83
                title,
84
                text,
85
                style,
86
                isFixed
87
            });
88
        });
89

90
        const isDisabled = isActuallyDisabled && !action.ignoreDisabled;
3!
91
        let hasIntro = false;
3✔
92
        setup.steps.forEach((step) => {
3✔
93
            if (step.selector === '#intro-tutorial') {
8✔
94
                hasIntro = true;
2✔
95
            }
96
        });
97

98
        setup.run = true;
3✔
99
        setup.start = true;
3✔
100
        setup.status = 'run';
3✔
101

102
        if (isDisabled || !hasIntro || action.stop) {
3✔
103
            setup.steps = setup.steps.filter((step) => {
2✔
104
                return step.selector !== '#intro-tutorial';
5✔
105
            }).map((step, index) => {
106
                return Object.assign({}, step, {index});
4✔
107
            });
108

109
            setup.run = false;
2✔
110
            setup.start = false;
2✔
111
            setup.status = 'close';
2✔
112
        }
113

114
        return Object.assign({}, state, setup);
3✔
115
    case UPDATE_TUTORIAL:
116
        let update = {};
5✔
117
        update.steps = [].concat(action.steps);
5✔
118
        update.run = true;
5✔
119
        update.start = true;
5✔
120
        update.status = 'run';
5✔
121
        update.stepIndex = state.stepIndex;
5✔
122
        update.tourAction = state.tourAction;
5✔
123

124
        if (action.tour) {
5✔
125
            if (action.tour.action === 'close' || action.tour.type === 'finished') {
4✔
126
                update.run = false;
2✔
127
                update.start = false;
2✔
128
                update.status = 'close';
2✔
129
                update.steps = update.steps.filter((step) => {
2✔
130
                    return step.selector !== '#intro-tutorial';
3✔
131
                }).map((step, index) => {
132
                    return Object.assign({}, step, {index});
1✔
133
                });
134
            } else if (action.tour.type === 'error:target_not_found') {
2✔
135
                update.status = 'error';
1✔
136
                update.stepIndex = action.tour.index;
1✔
137
                update.tourAction = action.tour.action;
1✔
138
            }
139
        }
140
        return Object.assign({}, state, update);
5✔
141
    case DISABLE_TUTORIAL:
142
        let disabled = !state.disabled;
1✔
143
        const presetGroup = state.presetGroup || [state.id];
1✔
144

145
        presetGroup.forEach(curId => {
1✔
146
            try {
1✔
147
                getApi().setItem('mapstore.plugin.tutorial.' + curId + '.disabled', disabled);
1✔
148
            } catch (e) {
UNCOV
149
                console.error(e);
×
150
            }
151
        });
152

153
        return Object.assign({}, state, {
1✔
154
            disabled
155
        });
156
    case RESET_TUTORIAL:
157
        return Object.assign({}, state, {
1✔
158
            steps: [],
159
            run: false,
160
            start: false,
161
            status: 'close',
162
            enabled: false
163
        });
164
    case CLOSE_TUTORIAL:
165
        return Object.assign({}, state, {
1✔
166
            run: false,
167
            start: false,
168
            status: 'close',
169
            enabled: false
170
        });
171
    case TOGGLE_TUTORIAL:
172
        return Object.assign({}, state, { enabled: !state.enabled });
1✔
173
    default:
174
        return state;
1✔
175
    }
176
}
177

178
export default tutorial;
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