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

mendersoftware / gui / 897326496

pending completion
897326496

Pull #3752

gitlab-ci

mzedel
chore(e2e): made use of shared timeout & login checking values to remove code duplication

Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
Pull Request #3752: chore(e2e-tests): slightly simplified log in test + separated log out test

4395 of 6392 branches covered (68.76%)

8060 of 9780 relevant lines covered (82.41%)

126.17 hits per line

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

97.92
/src/js/constants/deviceConstants.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 React from 'react';
15

16
import { mdiAws as AWS, mdiMicrosoftAzure as Azure } from '@mdi/js';
17

18
const credentialTypes = {
190✔
19
  aws: 'aws',
20
  http: 'http',
21
  sas: 'sas',
22
  x509: 'x509'
23
};
24

25
export const offlineThresholds = ['minutes', 'hours', 'days'];
190✔
26

27
export const DEVICE_FILTERING_OPTIONS = {
190✔
28
  $eq: { key: '$eq', title: 'equals', shortform: '=' },
29
  $ne: { key: '$ne', title: 'not equal', shortform: '!=' },
30
  $gt: {
31
    key: '$gt',
32
    title: '>',
33
    shortform: '>',
34
    help: 'The "greater than" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'
35
  },
36
  $gte: {
37
    title: '>=',
38
    shortform: '>=',
39
    help: 'The "greater than or equal" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'
40
  },
41
  $lt: {
42
    key: '$lt',
43
    title: '<',
44
    shortform: '<',
45
    help: 'The "lesser than" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'
46
  },
47
  $lte: {
48
    title: '<=',
49
    shortform: '<=',
50
    help: 'The "lesser than or equal" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'
51
  },
52
  $in: {
53
    key: '$in',
54
    title: 'in',
55
    shortform: 'in',
56
    help: 'The "in" operator accepts a list of comma-separated values. It matches if the selected field is equal to one of the specified values.'
57
  },
58
  $nin: {
59
    key: '$nin',
60
    title: 'not in',
61
    shortform: 'not in',
62
    help: `The "not in" operator accepts a list of comma-separated values. It matches if the selected field's value is not equal to any of the specified options.`
63
  },
64
  $exists: {
65
    key: '$exists',
66
    title: 'exists',
67
    shortform: 'exists',
68
    value: true,
69
    help: `The "exists" operator matches if the selected field's value has a value. No value needs to be provided for this operator.`
70
  },
71
  $nexists: {
72
    key: '$nexists',
73
    title: `doesn't exist`,
74
    shortform: `doesn't exist`,
75
    value: true,
76
    help: `The "doesn't exist" operator matches if the selected field's value has no value. No value needs to be provided for this operator.`
77
  },
78
  $regex: {
79
    key: '$regex',
80
    title: `matches regular expression`,
81
    shortform: `matches`,
82
    help: `The "regular expression" operator matches the selected field's value with a Perl compatible regular expression (PCRE), automatically anchored by ^. If the regular expression is not valid, the filter will produce no results. If you need to specify options and flags, you can provide the full regex in the format of /regex/flags, for example.`
83
  }
84
};
85
export const emptyFilter = { key: null, value: '', operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: 'inventory' };
190✔
86

87
export const SELECT_GROUP = 'SELECT_GROUP';
190✔
88
export const ADD_TO_GROUP = 'ADD_TO_GROUP';
190✔
89
export const ADD_DYNAMIC_GROUP = 'ADD_DYNAMIC_GROUP';
190✔
90
export const ADD_STATIC_GROUP = 'ADD_STATIC_GROUP';
190✔
91
export const REMOVE_DYNAMIC_GROUP = 'REMOVE_DYNAMIC_GROUP';
190✔
92
export const REMOVE_STATIC_GROUP = 'REMOVE_STATIC_GROUP';
190✔
93
export const REMOVE_FROM_GROUP = 'REMOVE_FROM_GROUP';
190✔
94
export const RECEIVE_GROUPS = 'RECEIVE_GROUPS';
190✔
95
export const RECEIVE_DYNAMIC_GROUPS = 'RECEIVE_DYNAMIC_GROUPS';
190✔
96
export const RECEIVE_DEVICE = 'RECEIVE_DEVICE';
190✔
97
export const RECEIVE_DEVICES = 'RECEIVE_DEVICES';
190✔
98
export const RECEIVE_DEVICE_CONFIG = 'RECEIVE_DEVICE_CONFIG';
190✔
99
export const RECEIVE_DEVICE_CONNECT = 'RECEIVE_DEVICE_CONNECT';
190✔
100
export const RECEIVE_GROUP_DEVICES = 'RECEIVE_GROUP_DEVICES';
190✔
101
export const SET_TOTAL_DEVICES = 'SET_TOTAL_DEVICES';
190✔
102
export const SET_ACCEPTED_DEVICES_COUNT = 'SET_ACCEPTED_DEVICES_COUNT';
190✔
103
export const SET_PENDING_DEVICES_COUNT = 'SET_PENDING_DEVICES_COUNT';
190✔
104
export const SET_REJECTED_DEVICES_COUNT = 'SET_REJECTED_DEVICES_COUNT';
190✔
105
export const SET_PREAUTHORIZED_DEVICES_COUNT = 'SET_PREAUTHORIZED_DEVICES_COUNT';
190✔
106
export const SET_FILTER_ATTRIBUTES = 'SET_FILTER_ATTRIBUTES';
190✔
107
export const SET_FILTERABLES_CONFIG = 'SET_FILTERABLES_CONFIG';
190✔
108
export const SET_DEVICE_FILTERS = 'SET_DEVICE_FILTERS';
190✔
109

110
export const SET_ACCEPTED_DEVICES = 'SET_ACCEPTED_DEVICES';
190✔
111
export const SET_PENDING_DEVICES = 'SET_PENDING_DEVICES';
190✔
112
export const SET_REJECTED_DEVICES = 'SET_REJECTED_DEVICES';
190✔
113
export const SET_PREAUTHORIZED_DEVICES = 'SET_PREAUTHORIZED_DEVICES';
190✔
114

115
export const SET_INACTIVE_DEVICES = 'SET_INACTIVE_DEVICES';
190✔
116
export const SET_DEVICE_LIST_STATE = 'SET_DEVICE_LIST_STATE';
190✔
117

118
export const SET_DEVICE_LIMIT = 'SET_DEVICE_LIMIT';
190✔
119

120
export const SET_DEVICE_REPORTS = 'SET_DEVICE_REPORTS';
190✔
121

122
export const EXTERNAL_PROVIDER = {
190✔
123
  'iot-core': {
124
    credentialsType: credentialTypes.aws,
125
    icon: AWS,
126
    title: 'AWS IoT Core',
127
    twinTitle: 'Device Shadow',
128
    provider: 'iot-core',
129
    enabled: true,
130
    deviceTwin: true,
131
    configHint: <>For help finding your AWS IoT Core connection string, check the AWS IoT documentation.</>
132
  },
133
  'iot-hub': {
134
    credentialsType: credentialTypes.sas,
135
    icon: Azure,
136
    title: 'Azure IoT Hub',
137
    twinTitle: 'Device Twin',
138
    provider: 'iot-hub',
139
    enabled: true,
140
    deviceTwin: true,
141
    configHint: (
142
      <span>
143
        For help finding your Azure IoT Hub connection string, look under &apos;Shared access policies&apos; in the Microsoft Azure UI as described{' '}
144
        {
145
          <a
146
            href="https://devblogs.microsoft.com/iotdev/understand-different-connection-strings-in-azure-iot-hub/#iothubconn"
147
            target="_blank"
148
            rel="noopener noreferrer"
149
          >
150
            here
151
          </a>
152
        }
153
        .
154
      </span>
155
    )
156
  },
157
  webhook: {
158
    credentialsType: credentialTypes.http,
159
    deviceTwin: false,
160
    // disable the webhook provider here, since it is treated different than other integrations, with a custom configuration & management view, etc.
161
    enabled: false,
162
    provider: 'webhook'
163
  }
164
};
165

166
// see https://github.com/mendersoftware/go-lib-micro/tree/master/ws
167
//     for the description of proto_header and the consts
168
// *Note*: this needs to be aligned with mender-connect and deviceconnect.
169
export const DEVICE_MESSAGE_PROTOCOLS = {
190✔
170
  Shell: 1
171
};
172
export const DEVICE_MESSAGE_TYPES = {
190✔
173
  Delay: 'delay',
174
  New: 'new',
175
  Ping: 'ping',
176
  Pong: 'pong',
177
  Resize: 'resize',
178
  Shell: 'shell',
179
  Stop: 'stop'
180
};
181
export const DEVICE_LIST_DEFAULTS = {
190✔
182
  page: 1,
183
  perPage: 20
184
};
185
export const DEVICE_LIST_MAXIMUM_LENGTH = 50;
190✔
186
export const DEVICE_ISSUE_OPTIONS = {
190✔
187
  issues: {
188
    isCategory: true,
189
    key: 'issues',
190
    title: 'Devices with issues',
191
    filterRule: {}
192
  },
193
  offline: {
194
    issueCategory: 'issues',
195
    key: 'offline',
196
    needsFullFiltering: true,
197
    needsMonitor: false,
198
    needsReporting: false,
199
    filterRule: {
200
      scope: 'system',
201
      key: 'updated_ts',
202
      operator: DEVICE_FILTERING_OPTIONS.$lt.key,
203
      value: ({ offlineThreshold }) => offlineThreshold
×
204
    },
205
    title: 'Offline devices'
206
  },
207
  failedLastUpdate: {
208
    issueCategory: 'issues',
209
    key: 'failedLastUpdate',
210
    needsFullFiltering: false,
211
    needsMonitor: false,
212
    needsReporting: true,
213
    filterRule: { scope: 'monitor', key: 'failed_last_update', operator: DEVICE_FILTERING_OPTIONS.$eq.key, value: true },
214
    title: 'Deployment failed'
215
  },
216
  monitoring: {
217
    issueCategory: 'issues',
218
    key: 'monitoring',
219
    needsFullFiltering: false,
220
    needsMonitor: true,
221
    needsReporting: false,
222
    filterRule: { scope: 'monitor', key: 'alerts', operator: DEVICE_FILTERING_OPTIONS.$eq.key, value: true },
223
    title: 'Monitoring alert'
224
  },
225
  authRequests: {
226
    key: 'authRequests',
227
    needsFullFiltering: false,
228
    needsMonitor: false,
229
    needsReporting: true,
230
    filterRule: { scope: 'monitor', key: 'auth_requests', operator: DEVICE_FILTERING_OPTIONS.$gt.key, value: 1 },
231
    title: 'Devices with new authentication requests'
232
  },
233
  gatewayDevices: {
234
    key: 'gatewayDevices',
235
    needsFullFiltering: false,
236
    needsMonitor: false,
237
    needsReporting: true,
238
    filterRule: { scope: 'inventory', key: 'mender_is_gateway', operator: DEVICE_FILTERING_OPTIONS.$eq.key, value: 'true' },
239
    title: 'Gateway devices'
240
  }
241
};
242
// we can't include the dismiss state with the rest since this would include dismissed devices in several queries
243
export const DEVICE_DISMISSAL_STATE = 'dismiss';
190✔
244
export const DEVICE_STATES = {
190✔
245
  accepted: 'accepted',
246
  pending: 'pending',
247
  preauth: 'preauthorized',
248
  rejected: 'rejected'
249
};
250
export const DEVICE_CONNECT_STATES = {
190✔
251
  connected: 'connected',
252
  disconnected: 'disconnected',
253
  unknown: 'unknown'
254
};
255
export const DEVICE_ONLINE_CUTOFF = { interval: 24, intervalName: offlineThresholds[1] };
190✔
256
export const ATTRIBUTE_SCOPES = {
190✔
257
  inventory: 'inventory',
258
  identity: 'identity',
259
  monitor: 'monitor',
260
  system: 'system',
261
  tags: 'tags'
262
};
263
export const ALL_DEVICES = 'All devices';
190✔
264
export const UNGROUPED_GROUP = { id: '*|=ungrouped=|*', name: 'Unassigned' };
190✔
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