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

mendersoftware / mender-server / 1495380963

14 Oct 2024 03:35PM UTC coverage: 70.373% (-2.5%) from 72.904%
1495380963

Pull #101

gitlab-ci

mineralsfree
feat: tenant list added

Ticket: MEN-7568
Changelog: None

Signed-off-by: Mikita Pilinka <mikita.pilinka@northern.tech>
Pull Request #101: feat: tenant list added

4406 of 6391 branches covered (68.94%)

Branch coverage included in aggregate %.

88 of 183 new or added lines in 10 files covered. (48.09%)

2623 existing lines in 65 files now uncovered.

36673 of 51982 relevant lines covered (70.55%)

31.07 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 } from '@northern.tech/store/commonConstants';
15
import { TENANT_LIST_DEFAULT } from '@northern.tech/store/organizationSlice/constants';
16
import { createSlice } from '@reduxjs/toolkit';
17

18
export const sliceName = 'organization';
187✔
19

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

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

106
export const actions = organizationSlice.actions;
187✔
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