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

mendersoftware / gui / 963002358

pending completion
963002358

Pull #3870

gitlab-ci

mzedel
chore: cleaned up left over onboarding tooltips & aligned with updated design

Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
Pull Request #3870: MEN-5413

4348 of 6319 branches covered (68.81%)

95 of 122 new or added lines in 24 files covered. (77.87%)

1734 existing lines in 160 files now uncovered.

8174 of 9951 relevant lines covered (82.14%)

178.12 hits per line

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

89.61
/src/js/selectors/index.js
1
// Copyright 2020 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 { createSelector } from '@reduxjs/toolkit';
15

16
import { defaultReports } from '../actions/deviceActions';
17
import { mapUserRolesToUiPermissions } from '../actions/userActions';
18
import { PLANS } from '../constants/appConstants';
19
import { DEPLOYMENT_STATES } from '../constants/deploymentConstants';
20
import {
21
  ALL_DEVICES,
22
  ATTRIBUTE_SCOPES,
23
  DEVICE_ISSUE_OPTIONS,
24
  DEVICE_LIST_MAXIMUM_LENGTH,
25
  DEVICE_ONLINE_CUTOFF,
26
  DEVICE_STATES,
27
  EXTERNAL_PROVIDER,
28
  UNGROUPED_GROUP
29
} from '../constants/deviceConstants';
30
import { rolesByName, twoFAStates, uiPermissionsById } from '../constants/userConstants';
31
import { attributeDuplicateFilter, duplicateFilter, getDemoDeviceAddress as getDemoDeviceAddressHelper, versionCompare } from '../helpers';
32

33
const getAppDocsVersion = state => state.app.docsVersion;
1,396✔
34
export const getFeatures = state => state.app.features;
15,826✔
35
export const getRolesById = state => state.users.rolesById;
1,619✔
36
export const getOrganization = state => state.organization.organization;
6,708✔
37
export const getAcceptedDevices = state => state.devices.byStatus.accepted;
7,398✔
38
const getDevicesByStatus = state => state.devices.byStatus;
1,462✔
39
export const getDevicesById = state => state.devices.byId;
26,214✔
40
export const getDeviceReports = state => state.devices.reports;
3,527✔
41
export const getGroupsById = state => state.devices.groups.byId;
2,959✔
42
const getSelectedGroup = state => state.devices.groups.selectedGroup;
185✔
43
const getSearchedDevices = state => state.app.searchState.deviceIds;
1,036✔
44
const getListedDevices = state => state.devices.deviceList.deviceIds;
185✔
45
const getFilteringAttributes = state => state.devices.filteringAttributes;
1,174✔
46
export const getDeviceFilters = state => state.devices.filters || [];
205!
47
const getFilteringAttributesFromConfig = state => state.devices.filteringAttributesConfig.attributes;
1,144✔
48
export const getSortedFilteringAttributes = createSelector([getFilteringAttributes], filteringAttributes => ({
185✔
49
  ...filteringAttributes,
50
  identityAttributes: [...filteringAttributes.identityAttributes, 'id']
51
}));
52
export const getDeviceLimit = state => state.devices.limit;
1,947✔
53
const getDevicesList = state => Object.values(state.devices.byId);
185✔
54
const getOnboarding = state => state.onboarding;
1,496✔
55
export const getShowHelptips = state => state.users.showHelptips;
5,636✔
56
export const getGlobalSettings = state => state.users.globalSettings;
3,817✔
57
const getIssueCountsByType = state => state.monitor.issueCounts.byType;
1,152✔
58
export const getReleasesById = state => state.releases.byId;
2,096✔
59
const getReleaseTags = state => state.releases.releaseTags;
185✔
60
const getListedReleases = state => state.releases.releasesList.releaseIds;
185✔
61
export const getExternalIntegrations = state => state.organization.externalDeviceIntegrations;
185✔
62
const getDeploymentsById = state => state.deployments.byId;
2,658✔
63
export const getDeploymentsByStatus = state => state.deployments.byStatus;
1,917✔
64
export const getVersionInformation = state => state.app.versionInformation;
1,125✔
65
const getCurrentUserId = state => state.users.currentUser;
2,834✔
66
const getUsersById = state => state.users.byId;
1,690✔
67
export const getCurrentUser = createSelector([getUsersById, getCurrentUserId], (usersById, userId) => usersById[userId] ?? {});
185✔
68
export const getUserSettings = state => state.users.userSettings;
9,073✔
69
export const getIsPreview = createSelector([getVersionInformation], ({ Integration }) => versionCompare(Integration, 'next') > -1);
185✔
70

71
export const getDeploymentsSelectionState = state => state.deployments.selectionState;
2,315✔
72

73
export const getMappedDeploymentSelection = createSelector(
185✔
74
  [getDeploymentsSelectionState, (_, deploymentsState) => deploymentsState, getDeploymentsById],
1,197✔
75
  (selectionState, deploymentsState, deploymentsById) => {
76
    const { selection = [] } = selectionState[deploymentsState] ?? {};
1,163!
77
    return selection.reduce((accu, id) => {
1,163✔
78
      if (deploymentsById[id]) {
2,105!
79
        accu.push(deploymentsById[id]);
2,105✔
80
      }
81
      return accu;
2,105✔
82
    }, []);
83
  }
84
);
85

86
export const getDeploymentRelease = createSelector(
185✔
87
  [getDeploymentsById, getDeploymentsSelectionState, getReleasesById],
88
  (deploymentsById, { selectedId }, releasesById) => {
89
    const deployment = deploymentsById[selectedId] || {};
160✔
90
    return deployment.artifact_name && releasesById[deployment.artifact_name] ? releasesById[deployment.artifact_name] : { device_types_compatible: [] };
160✔
91
  }
92
);
93

94
export const getHas2FA = createSelector(
185✔
95
  [getCurrentUser],
96
  currentUser => currentUser.hasOwnProperty('tfa_status') && currentUser.tfa_status === twoFAStates.enabled
5✔
97
);
98

99
export const getDemoDeviceAddress = createSelector([getDevicesList, getOnboarding], (devices, { approach, demoArtifactPort }) => {
185✔
100
  const demoDeviceAddress = `http://${getDemoDeviceAddressHelper(devices, approach)}`;
3✔
101
  return demoArtifactPort ? `${demoDeviceAddress}:${demoArtifactPort}` : demoDeviceAddress;
3!
102
});
103

104
export const getDeviceReportsForUser = createSelector(
185✔
105
  [getUserSettings, getCurrentUserId, getGlobalSettings, getDevicesById],
106
  ({ reports }, currentUserId, globalSettings, devicesById) => {
107
    return reports || globalSettings[`${currentUserId}-reports`] || (Object.keys(devicesById).length ? defaultReports : []);
49✔
108
  }
109
);
110

111
const listItemMapper = (byId, ids, { defaultObject = {}, cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH }) => {
185✔
112
  return ids.slice(0, cutOffSize).reduce((accu, id) => {
1,090✔
113
    if (id && byId[id]) {
184!
114
      accu.push({ ...defaultObject, ...byId[id] });
184✔
115
    }
116
    return accu;
184✔
117
  }, []);
118
};
119

120
const listTypeDeviceIdMap = {
185✔
121
  deviceList: getListedDevices,
122
  search: getSearchedDevices
123
};
124
const getDeviceMappingDefaults = () => ({ defaultObject: { auth_sets: [] }, cutOffSize: DEVICE_LIST_MAXIMUM_LENGTH });
1,064✔
125
export const getMappedDevicesList = createSelector(
185✔
126
  [getDevicesById, (state, listType) => listTypeDeviceIdMap[listType](state), getDeviceMappingDefaults],
1,064✔
127
  listItemMapper
128
);
129

130
export const getDeviceCountsByStatus = createSelector([getDevicesByStatus], byStatus =>
185✔
131
  Object.values(DEVICE_STATES).reduce((accu, state) => {
412✔
132
    accu[state] = byStatus[state].total || 0;
1,648✔
133
    return accu;
1,648✔
134
  }, {})
135
);
136

137
export const getDeviceById = createSelector([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = '') => devicesById[deviceId] ?? {});
185✔
138

139
export const getDeviceConfigDeployment = createSelector([getDeviceById, getDeploymentsById], (device, deploymentsById) => {
185✔
140
  const { config = {} } = device;
7✔
141
  const { deployment_id: configDeploymentId } = config;
7✔
142
  const deviceConfigDeployment = deploymentsById[configDeploymentId] || {};
7✔
143
  return { device, deviceConfigDeployment };
7✔
144
});
145

146
export const getSelectedGroupInfo = createSelector(
185✔
147
  [getAcceptedDevices, getGroupsById, getSelectedGroup],
148
  ({ total: acceptedDeviceTotal }, groupsById, selectedGroup) => {
149
    let groupCount = acceptedDeviceTotal;
7✔
150
    let groupFilters = [];
7✔
151
    if (selectedGroup && groupsById[selectedGroup]) {
7✔
152
      groupCount = groupsById[selectedGroup].total;
2✔
153
      groupFilters = groupsById[selectedGroup].filters || [];
2!
154
    }
155
    return { groupCount, selectedGroup, groupFilters };
7✔
156
  }
157
);
158

159
const defaultIdAttribute = Object.freeze({ attribute: 'id', scope: ATTRIBUTE_SCOPES.identity });
185✔
160
export const getIdAttribute = createSelector([getGlobalSettings], ({ id_attribute = { ...defaultIdAttribute } }) => id_attribute);
185✔
161

162
export const getLimitMaxed = createSelector([getAcceptedDevices, getDeviceLimit], ({ total: acceptedDevices = 0 }, deviceLimit) =>
185!
163
  Boolean(deviceLimit && deviceLimit <= acceptedDevices)
7✔
164
);
165

166
export const getFilterAttributes = createSelector(
185✔
167
  [getGlobalSettings, getFilteringAttributes],
168
  ({ previousFilters }, { identityAttributes, inventoryAttributes, systemAttributes, tagAttributes }) => {
169
    const deviceNameAttribute = { key: 'name', value: 'Name', scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 1 };
4✔
170
    const deviceIdAttribute = { key: 'id', value: 'Device ID', scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 };
4✔
171
    const checkInAttribute = { key: 'check_in_time', value: 'Latest activity', scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
4✔
172
    const updateAttribute = { ...checkInAttribute, key: 'updated_ts', value: 'Last inventory update' };
4✔
173
    const firstRequestAttribute = { key: 'created_ts', value: 'First request', scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
4✔
174
    const attributes = [
4✔
UNCOV
175
      ...previousFilters.map(item => ({
×
176
        ...item,
177
        value: deviceIdAttribute.key === item.key ? deviceIdAttribute.value : item.key,
×
178
        category: 'recently used',
179
        priority: 0
180
      })),
181
      deviceNameAttribute,
182
      deviceIdAttribute,
183
      ...identityAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 })),
5✔
184
      ...inventoryAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.inventory, category: ATTRIBUTE_SCOPES.inventory, priority: 2 })),
18✔
UNCOV
185
      ...tagAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 3 })),
×
186
      checkInAttribute,
187
      updateAttribute,
188
      firstRequestAttribute,
189
      ...systemAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 }))
3✔
190
    ];
191
    return attributeDuplicateFilter(attributes, 'key');
4✔
192
  }
193
);
194

195
// eslint-disable-next-line no-unused-vars
196
export const getGroupsByIdWithoutUngrouped = createSelector([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);
185✔
197

198
export const getGroups = createSelector([getGroupsById], groupsById => {
185✔
199
  const groupNames = Object.keys(groupsById).sort();
13✔
200
  const groupedGroups = Object.entries(groupsById)
13✔
201
    .sort((a, b) => a[0].localeCompare(b[0]))
40✔
202
    .reduce(
203
      (accu, [groupname, group]) => {
204
        const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;
37✔
205
        const groupItem = { ...group, groupId: name, name: groupname };
37✔
206
        if (group.filters.length > 0) {
37✔
207
          if (groupname !== UNGROUPED_GROUP.id) {
24✔
208
            accu.dynamic.push(groupItem);
13✔
209
          } else {
210
            accu.ungrouped.push(groupItem);
11✔
211
          }
212
        } else {
213
          accu.static.push(groupItem);
13✔
214
        }
215
        return accu;
37✔
216
      },
217
      { dynamic: [], static: [], ungrouped: [] }
218
    );
219
  return { groupNames, ...groupedGroups };
13✔
220
});
221

222
export const getDeviceTwinIntegrations = createSelector([getExternalIntegrations], integrations =>
185✔
223
  integrations.filter(integration => integration.id && EXTERNAL_PROVIDER[integration.provider]?.deviceTwin)
4✔
224
);
225

226
export const getOfflineThresholdSettings = createSelector([getGlobalSettings], ({ offlineThreshold }) => ({
185✔
227
  interval: offlineThreshold?.interval || DEVICE_ONLINE_CUTOFF.interval,
26✔
228
  intervalUnit: offlineThreshold?.intervalUnit || DEVICE_ONLINE_CUTOFF.intervalName
26✔
229
}));
230

231
export const getOnboardingState = createSelector(
185✔
232
  [getOnboarding, getShowHelptips, getUserSettings],
233
  ({ complete, progress, showTips, ...remainder }, showHelptips, { onboarding = {} }) => ({
93!
234
    ...remainder,
235
    ...onboarding,
236
    complete,
237
    progress,
238
    showHelptips,
239
    showTips
240
  })
241
);
242

243
export const getDocsVersion = createSelector([getAppDocsVersion, getFeatures], (appDocsVersion, { isHosted }) => {
185✔
244
  // if hosted, use latest docs version
245
  const docsVersion = appDocsVersion ? `${appDocsVersion}/` : 'development/';
36!
246
  return isHosted ? '' : docsVersion;
36✔
247
});
248

249
export const getIsEnterprise = createSelector(
185✔
250
  [getOrganization, getFeatures],
251
  ({ plan = PLANS.os.value }, { isEnterprise, isHosted }) => isEnterprise || (isHosted && plan === PLANS.enterprise.value)
71✔
252
);
253

254
export const getAttributesList = createSelector(
185✔
255
  [getFilteringAttributes, getFilteringAttributesFromConfig],
256
  ({ identityAttributes = [], inventoryAttributes = [] }, { identity = [], inventory = [] }) =>
40!
257
    [...identityAttributes, ...inventoryAttributes, ...identity, ...inventory].filter(duplicateFilter)
20✔
258
);
259

260
export const getRolesList = createSelector([getRolesById], rolesById => Object.entries(rolesById).map(([id, role]) => ({ id, ...role })));
185✔
261

262
export const getUserRoles = createSelector(
185✔
263
  [getCurrentUser, getRolesById, getIsEnterprise, getFeatures, getOrganization],
264
  (currentUser, rolesById, isEnterprise, { isHosted, hasMultitenancy }, { plan = PLANS.os.value }) => {
9✔
265
    const isAdmin = currentUser.roles?.length
68✔
266
      ? currentUser.roles.some(role => role === rolesByName.admin)
61✔
267
      : !(hasMultitenancy || isEnterprise || (isHosted && plan !== PLANS.os.value));
15!
268
    const uiPermissions = isAdmin
68✔
269
      ? mapUserRolesToUiPermissions([rolesByName.admin], rolesById)
270
      : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById);
6✔
271
    return { isAdmin, uiPermissions };
68✔
272
  }
273
);
274

275
const hasPermission = (thing, permission) => Object.values(thing).some(permissions => permissions.includes(permission));
314✔
276

277
export const getUserCapabilities = createSelector([getUserRoles], ({ uiPermissions }) => {
185✔
278
  const canManageReleases = hasPermission(uiPermissions.releases, uiPermissionsById.manage.value);
61✔
279
  const canReadReleases = canManageReleases || hasPermission(uiPermissions.releases, uiPermissionsById.read.value);
61✔
280
  const canUploadReleases = canManageReleases || hasPermission(uiPermissions.releases, uiPermissionsById.upload.value);
61✔
281

282
  const canAuditlog = uiPermissions.auditlog.includes(uiPermissionsById.read.value);
61✔
283

284
  const canReadUsers = uiPermissions.userManagement.includes(uiPermissionsById.read.value);
61✔
285
  const canManageUsers = uiPermissions.userManagement.includes(uiPermissionsById.manage.value);
61✔
286

287
  const canReadDevices = hasPermission(uiPermissions.groups, uiPermissionsById.read.value);
61✔
288
  const canWriteDevices = Object.values(uiPermissions.groups).some(
61✔
289
    groupPermissions => groupPermissions.includes(uiPermissionsById.read.value) && groupPermissions.length > 1
58✔
290
  );
291
  const canTroubleshoot = hasPermission(uiPermissions.groups, uiPermissionsById.connect.value);
61✔
292
  const canManageDevices = hasPermission(uiPermissions.groups, uiPermissionsById.manage.value);
61✔
293
  const canConfigure = hasPermission(uiPermissions.groups, uiPermissionsById.configure.value);
61✔
294

295
  const canDeploy = uiPermissions.deployments.includes(uiPermissionsById.deploy.value) || hasPermission(uiPermissions.groups, uiPermissionsById.deploy.value);
61✔
296
  const canReadDeployments = uiPermissions.deployments.includes(uiPermissionsById.read.value);
61✔
297

298
  return {
61✔
299
    canAuditlog,
300
    canConfigure,
301
    canDeploy,
302
    canManageDevices,
303
    canManageReleases,
304
    canManageUsers,
305
    canReadDeployments,
306
    canReadDevices,
307
    canReadReleases,
308
    canReadUsers,
309
    canTroubleshoot,
310
    canUploadReleases,
311
    canWriteDevices,
312
    groupsPermissions: uiPermissions.groups,
313
    releasesPermissions: uiPermissions.releases
314
  };
315
});
316

317
export const getTenantCapabilities = createSelector(
185✔
318
  [getFeatures, getOrganization, getIsEnterprise],
319
  (
320
    {
321
      hasAddons,
322
      hasAuditlogs: isAuditlogEnabled,
323
      hasDeviceConfig: isDeviceConfigEnabled,
324
      hasDeviceConnect: isDeviceConnectEnabled,
325
      hasMonitor: isMonitorEnabled,
326
      isHosted
327
    },
328
    { addons = [], plan },
6✔
329
    isEnterprise
330
  ) => {
331
    const canDelta = isEnterprise || plan === PLANS.professional.value;
38✔
332
    const hasAuditlogs = isAuditlogEnabled && (!isHosted || isEnterprise || plan === PLANS.professional.value);
38!
333
    const hasDeviceConfig = hasAddons || (isDeviceConfigEnabled && (!isHosted || addons.some(addon => addon.name === 'configure' && Boolean(addon.enabled))));
38!
334
    const hasDeviceConnect =
335
      hasAddons || (isDeviceConnectEnabled && (!isHosted || addons.some(addon => addon.name === 'troubleshoot' && Boolean(addon.enabled))));
38!
336
    const hasMonitor = hasAddons || (isMonitorEnabled && (!isHosted || addons.some(addon => addon.name === 'monitor' && Boolean(addon.enabled))));
38!
337
    return {
38✔
338
      canDelta,
339
      canRetry: canDelta,
340
      canSchedule: canDelta,
341
      hasAuditlogs,
342
      hasDeviceConfig,
343
      hasDeviceConnect,
344
      hasFullFiltering: canDelta,
345
      hasMonitor,
346
      isEnterprise
347
    };
348
  }
349
);
350

351
export const getAvailableIssueOptionsByType = createSelector(
185✔
352
  [getFeatures, getTenantCapabilities, getIssueCountsByType],
353
  ({ hasReporting }, { hasFullFiltering, hasMonitor }, issueCounts) =>
354
    Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { isCategory, key, needsFullFiltering, needsMonitor, needsReporting, title }) => {
17✔
355
      if (isCategory || (needsReporting && !hasReporting) || (needsFullFiltering && !hasFullFiltering) || (needsMonitor && !hasMonitor)) {
102✔
356
        return accu;
96✔
357
      }
358
      accu[key] = { count: issueCounts[key].filtered, key, title };
6✔
359
      return accu;
6✔
360
    }, {})
361
);
362

363
export const getDeviceTypes = createSelector([getAcceptedDevices, getDevicesById], ({ deviceIds = [] }, devicesById) =>
185!
364
  Object.keys(
1✔
365
    deviceIds.slice(0, 200).reduce((accu, item) => {
366
      const { device_type: deviceTypes = [] } = devicesById[item] ? devicesById[item].attributes : {};
2!
367
      accu = deviceTypes.reduce((deviceTypeAccu, deviceType) => {
2✔
368
        if (deviceType.length > 1) {
2!
369
          deviceTypeAccu[deviceType] = deviceTypeAccu[deviceType] ? deviceTypeAccu[deviceType] + 1 : 1;
2!
370
        }
371
        return deviceTypeAccu;
2✔
372
      }, accu);
373
      return accu;
2✔
374
    }, {})
375
  )
376
);
377

378
export const getGroupNames = createSelector([getGroupsById, getUserRoles, (_, options = {}) => options], (groupsById, { uiPermissions }, { staticOnly }) => {
1,462✔
379
  // eslint-disable-next-line no-unused-vars
380
  const { [UNGROUPED_GROUP.id]: ungrouped, ...groups } = groupsById;
1,462✔
381
  if (staticOnly) {
1,462!
UNCOV
382
    return Object.keys(uiPermissions.groups).sort();
×
383
  }
384
  return Object.keys(
1,462✔
385
    Object.entries(groups).reduce((accu, [groupName, group]) => {
386
      if (group.filterId || uiPermissions.groups[ALL_DEVICES]) {
2,876✔
387
        accu[groupName] = group;
1,948✔
388
      }
389
      return accu;
2,876✔
390
    }, uiPermissions.groups)
391
  ).sort();
392
});
393

394
const getReleaseMappingDefaults = () => ({});
185✔
395
export const getReleasesList = createSelector([getReleasesById, getListedReleases, getReleaseMappingDefaults], listItemMapper);
185✔
396

397
export const getReleaseTagsById = createSelector([getReleaseTags], releaseTags => releaseTags.reduce((accu, key) => ({ ...accu, [key]: key }), {}));
185✔
398

399
const relevantDeploymentStates = [DEPLOYMENT_STATES.pending, DEPLOYMENT_STATES.inprogress, DEPLOYMENT_STATES.finished];
185✔
400
export const DEPLOYMENT_CUTOFF = 3;
185✔
401
export const getRecentDeployments = createSelector([getDeploymentsById, getDeploymentsByStatus], (deploymentsById, deploymentsByStatus) =>
185✔
402
  Object.entries(deploymentsByStatus).reduce(
409✔
403
    (accu, [state, byStatus]) => {
404
      if (!relevantDeploymentStates.includes(state) || !byStatus.deploymentIds.length) {
1,636✔
405
        return accu;
433✔
406
      }
407
      accu[state] = byStatus.deploymentIds
1,203✔
408
        .reduce((accu, id) => {
409
          if (deploymentsById[id]) {
2,340✔
410
            accu.push(deploymentsById[id]);
2,334✔
411
          }
412
          return accu;
2,340✔
413
        }, [])
414
        .slice(0, DEPLOYMENT_CUTOFF);
415
      accu.total += byStatus.total;
1,203✔
416
      return accu;
1,203✔
417
    },
418
    { total: 0 }
419
  )
420
);
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