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

mendersoftware / mender-server / 1539946168

13 Nov 2024 09:11AM UTC coverage: 72.77% (+0.03%) from 72.743%
1539946168

push

gitlab-ci

web-flow
Merge pull request #191 from mzedel/MEN-7570

MEN-7570 - SP RBAC + ensured linter runs on all TS files

4170 of 6064 branches covered (68.77%)

Branch coverage included in aggregate %.

182 of 199 new or added lines in 18 files covered. (91.46%)

2 existing lines in 1 file now uncovered.

42469 of 58027 relevant lines covered (73.19%)

16.79 hits per line

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

94.12
/frontend/src/js/store/organizationSlice/index.ts
1
// Copyright 2023 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 { DEVICE_LIST_DEFAULTS, SORTING_OPTIONS, TENANT_LIST_DEFAULT } from '@northern.tech/store/constants';
15
import { createSlice } from '@reduxjs/toolkit';
16

17
export const sliceName = 'organization';
190✔
18

19
export const initialState = {
190✔
20
  card: {
21
    last4: '',
22
    expiration: { month: 1, year: 2020 },
23
    brand: ''
24
  },
25
  intentId: null,
26
  tenantList: {
27
    ...TENANT_LIST_DEFAULT,
28
    total: 0,
29
    tenants: [],
30
    selectedTenant: null,
31
    sort: {
32
      direction: SORTING_OPTIONS.desc,
33
      key: 'name'
34
    }
35
  },
36
  organization: {
37
    // id, name, status, tenant_token, plan
38
  },
39
  auditlog: {
40
    events: [],
41
    selectionState: {
42
      ...DEVICE_LIST_DEFAULTS,
43
      detail: undefined,
44
      endDate: undefined,
45
      selectedIssue: undefined,
46
      sort: { direction: SORTING_OPTIONS.desc },
47
      startDate: undefined,
48
      total: 0,
49
      type: undefined,
50
      user: undefined
51
    }
52
  },
53
  externalDeviceIntegrations: [
54
    // { <connection_string|x509|...>, id, provider }
55
  ],
56
  ssoConfigs: [],
57
  webhooks: {
58
    // [id]: { events: [] }
59
    // for now:
60
    events: [],
61
    eventsTotal: 0
62
  }
63
};
64

65
export const organizationSlice = createSlice({
190✔
66
  name: sliceName,
67
  initialState,
68
  reducers: {
69
    receiveAuditLogs: (state, action) => {
70
      const { events, total } = action.payload;
7✔
71
      state.auditlog.events = events;
7✔
72
      state.auditlog.selectionState.total = total;
7✔
73
    },
74
    setAuditLogState: (state, action) => {
75
      state.auditlog.selectionState = {
8✔
76
        ...state.auditlog.selectionState,
77
        ...action.payload
78
      };
79
    },
80
    receiveCurrentCard: (state, action) => {
81
      state.card = action.payload;
3✔
82
    },
83
    receiveSetupIntent: (state, action) => {
84
      state.intentId = action.payload;
2✔
85
    },
86
    setOrganization: (state, action) => {
87
      state.organization = { ...state.organization, ...action.payload };
6✔
88
    },
89
    setTenantListState: (state, action) => {
NEW
90
      state.tenantList = action.payload;
×
91
    },
92
    receiveExternalDeviceIntegrations: (state, action) => {
93
      state.externalDeviceIntegrations = action.payload;
8✔
94
    },
95
    receiveSsoConfigs: (state, action) => {
96
      state.ssoConfigs = action.payload;
4✔
97
    },
98
    receiveWebhookEvents: (state, action) => {
99
      const { value, total } = action.payload;
3✔
100
      state.webhooks.events = value;
3✔
101
      state.webhooks.eventsTotal = total;
3✔
102
    }
103
  }
104
});
105

106
export const actions = organizationSlice.actions;
190✔
107
export default organizationSlice.reducer;
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