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

mendersoftware / gui / 1057188406

01 Nov 2023 04:24AM UTC coverage: 82.824% (-17.1%) from 99.964%
1057188406

Pull #4134

gitlab-ci

web-flow
chore: Bump uuid from 9.0.0 to 9.0.1

Bumps [uuid](https://github.com/uuidjs/uuid) from 9.0.0 to 9.0.1.
- [Changelog](https://github.com/uuidjs/uuid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/uuidjs/uuid/compare/v9.0.0...v9.0.1)

---
updated-dependencies:
- dependency-name: uuid
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #4134: chore: Bump uuid from 9.0.0 to 9.0.1

4349 of 6284 branches covered (0.0%)

8313 of 10037 relevant lines covered (82.82%)

200.97 hits per line

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

95.45
/src/js/reducers/userReducer.js
1
// Copyright 2019 Northern.tech AS
2
//
3
//    Licensed under the Apache License, Version 2.0 (the "License");
4
//    you may not use this file except in compliance with the License.
5
//    You may obtain a copy of the License at
6
//
7
//        http://www.apache.org/licenses/LICENSE-2.0
8
//
9
//    Unless required by applicable law or agreed to in writing, software
10
//    distributed under the License is distributed on an "AS IS" BASIS,
11
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
//    See the License for the specific language governing permissions and
13
//    limitations under the License.
14
import * as UserConstants from '../constants/userConstants';
15

16
export const initialState = {
184✔
17
  byId: {},
18
  currentUser: null,
19
  customColumns: [],
20
  jwtToken: null,
21
  qrCode: null,
22
  globalSettings: {
23
    id_attribute: undefined,
24
    previousFilters: [],
25
    previousPhases: [],
26
    retries: 0
27
  },
28
  permissionSetsById: {
29
    ...UserConstants.defaultPermissionSets
30
  },
31
  rolesById: {
32
    ...UserConstants.rolesById
33
  },
34
  tooltips: {
35
    byId: {
36
      // <id>: { readState: <read|unread> } // this object is getting enhanced by the tooltip texts in the app constants
37
    }
38
  },
39
  userSettings: {
40
    columnSelection: [],
41
    onboarding: {}
42
  }
43
};
44

45
const userReducer = (state = initialState, action) => {
184✔
46
  switch (action.type) {
2,700!
47
    case UserConstants.RECEIVED_QR_CODE:
48
      return {
3✔
49
        ...state,
50
        qrCode: action.value
51
      };
52
    case UserConstants.SUCCESSFULLY_LOGGED_IN:
53
      return {
3✔
54
        ...state,
55
        jwtToken: action.value
56
      };
57
    case UserConstants.RECEIVED_USER_LIST:
58
      return {
11✔
59
        ...state,
60
        byId: { ...action.users }
61
      };
62
    case UserConstants.RECEIVED_ACTIVATION_CODE:
63
      return {
2✔
64
        ...state,
65
        activationCode: action.code
66
      };
67
    case UserConstants.RECEIVED_USER:
68
      return {
7✔
69
        ...state,
70
        byId: {
71
          ...state.byId,
72
          [action.user.id]: {
73
            ...action.user
74
          }
75
        },
76
        currentUser: action.user.id
77
      };
78
    case UserConstants.CREATED_USER:
79
      // the new user gets a 0 as id, since this will be overwritten by the retrieved userlist anyway + there is no way to know the id before
80
      return {
3✔
81
        ...state,
82
        byId: {
83
          ...state.byId,
84
          0: action.user
85
        }
86
      };
87
    case UserConstants.REMOVED_USER: {
88
      // eslint-disable-next-line no-unused-vars
89
      const { [action.userId]: removedUser, ...byId } = state.byId;
2✔
90
      return {
2✔
91
        ...state,
92
        byId,
93
        currentUser: state.currentUser === action.userId ? null : state.currentUser
2!
94
      };
95
    }
96
    case UserConstants.UPDATED_USER:
97
      return {
13✔
98
        ...state,
99
        byId: {
100
          ...state.byId,
101
          [action.userId]: {
102
            ...state.byId[action.userId],
103
            ...action.user
104
          }
105
        }
106
      };
107
    case UserConstants.RECEIVED_PERMISSION_SETS:
108
      return {
4✔
109
        ...state,
110
        permissionSetsById: action.value
111
      };
112
    case UserConstants.RECEIVED_ROLES:
113
    case UserConstants.REMOVED_ROLE:
114
      return {
9✔
115
        ...state,
116
        rolesById: action.value
117
      };
118
    case UserConstants.CREATED_ROLE:
119
    case UserConstants.UPDATED_ROLE:
120
      return {
4✔
121
        ...state,
122
        rolesById: {
123
          ...state.rolesById,
124
          [action.roleId]: {
125
            ...state.rolesById[action.roleId],
126
            ...action.role
127
          }
128
        }
129
      };
130
    case UserConstants.SET_CUSTOM_COLUMNS:
131
      return {
8✔
132
        ...state,
133
        customColumns: action.value
134
      };
135
    case UserConstants.SET_GLOBAL_SETTINGS:
136
      return {
11✔
137
        ...state,
138
        settingsInitialized: true,
139
        globalSettings: {
140
          ...state.globalSettings,
141
          ...action.settings
142
        }
143
      };
144
    case UserConstants.SET_USER_SETTINGS:
145
      return {
33✔
146
        ...state,
147
        userSettingsInitialized: true,
148
        userSettings: {
149
          ...state.userSettings,
150
          ...action.settings
151
        }
152
      };
153
    case UserConstants.SET_SHOW_CONNECT_DEVICE:
154
      return {
2✔
155
        ...state,
156
        showConnectDeviceDialog: action.show
157
      };
158
    case UserConstants.SET_TOOLTIP_STATE:
159
      return {
×
160
        ...state,
161
        tooltips: {
162
          ...state.tooltips,
163
          byId: {
164
            ...state.tooltips.byId,
165
            [action.id]: action.value
166
          }
167
        }
168
      };
169
    case UserConstants.SET_TOOLTIPS_STATE:
170
      return {
1✔
171
        ...state,
172
        tooltips: {
173
          ...state.tooltips,
174
          byId: action.value
175
        }
176
      };
177
    default:
178
      return state;
2,584✔
179
  }
180
};
181

182
export default userReducer;
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