@flightctl/ui-components 0.6.0 → 0.7.0-rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/components/Device/DeviceDetails/DeviceDetailsTabContent/SystemResourcesContent.js +4 -4
- package/dist/src/components/Device/DeviceDetails/DeviceDetailsTabContent/SystemResourcesContent.js.map +1 -1
- package/dist/src/components/EnrollmentRequest/EnrollmentRequestDetails/EnrollmentRequestDetails.d.ts.map +1 -1
- package/dist/src/components/EnrollmentRequest/EnrollmentRequestDetails/EnrollmentRequestDetails.js +25 -11
- package/dist/src/components/EnrollmentRequest/EnrollmentRequestDetails/EnrollmentRequestDetails.js.map +1 -1
- package/dist/src/components/EnrollmentRequest/EnrollmentRequestDetails/useEnrollmentRequestSystemInfo.d.ts +15 -0
- package/dist/src/components/EnrollmentRequest/EnrollmentRequestDetails/useEnrollmentRequestSystemInfo.d.ts.map +1 -0
- package/dist/src/components/EnrollmentRequest/EnrollmentRequestDetails/useEnrollmentRequestSystemInfo.js +92 -0
- package/dist/src/components/EnrollmentRequest/EnrollmentRequestDetails/useEnrollmentRequestSystemInfo.js.map +1 -0
- package/dist/src/components/Status/DeviceResourceStatus.d.ts +5 -1
- package/dist/src/components/Status/DeviceResourceStatus.d.ts.map +1 -1
- package/dist/src/components/Status/DeviceResourceStatus.js +11 -4
- package/dist/src/components/Status/DeviceResourceStatus.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Device/DeviceDetails/DeviceDetailsTabContent/SystemResourcesContent.tsx +4 -4
- package/src/components/EnrollmentRequest/EnrollmentRequestDetails/EnrollmentRequestDetails.tsx +47 -20
- package/src/components/EnrollmentRequest/EnrollmentRequestDetails/useEnrollmentRequestSystemInfo.tsx +115 -0
- package/src/components/Status/DeviceResourceStatus.tsx +11 -7
package/dist/src/components/Device/DeviceDetails/DeviceDetailsTabContent/SystemResourcesContent.js
CHANGED
|
@@ -6,7 +6,7 @@ const react_core_1 = require("@patternfly/react-core");
|
|
|
6
6
|
const useTranslation_1 = require("../../../../hooks/useTranslation");
|
|
7
7
|
const DetailsPageCard_1 = tslib_1.__importStar(require("../../../DetailsPage/DetailsPageCard"));
|
|
8
8
|
const FlightCtlDescriptionList_1 = tslib_1.__importDefault(require("../../../common/FlightCtlDescriptionList"));
|
|
9
|
-
const DeviceResourceStatus_1 = tslib_1.
|
|
9
|
+
const DeviceResourceStatus_1 = tslib_1.__importStar(require("../../../Status/DeviceResourceStatus"));
|
|
10
10
|
const SystemResourcesContent = ({ device }) => {
|
|
11
11
|
const { t } = (0, useTranslation_1.useTranslation)();
|
|
12
12
|
return (React.createElement(DetailsPageCard_1.default, null,
|
|
@@ -16,15 +16,15 @@ const SystemResourcesContent = ({ device }) => {
|
|
|
16
16
|
React.createElement(react_core_1.DescriptionListGroup, null,
|
|
17
17
|
React.createElement(react_core_1.DescriptionListTerm, null, t('CPU pressure')),
|
|
18
18
|
React.createElement(react_core_1.DescriptionListDescription, null,
|
|
19
|
-
React.createElement(DeviceResourceStatus_1.default, { device: device, monitorType:
|
|
19
|
+
React.createElement(DeviceResourceStatus_1.default, { device: device, monitorType: DeviceResourceStatus_1.MonitorType.cpu }))),
|
|
20
20
|
React.createElement(react_core_1.DescriptionListGroup, null,
|
|
21
21
|
React.createElement(react_core_1.DescriptionListTerm, null, t('Disk pressure')),
|
|
22
22
|
React.createElement(react_core_1.DescriptionListDescription, null,
|
|
23
|
-
React.createElement(DeviceResourceStatus_1.default, { device: device, monitorType:
|
|
23
|
+
React.createElement(DeviceResourceStatus_1.default, { device: device, monitorType: DeviceResourceStatus_1.MonitorType.disk }))),
|
|
24
24
|
React.createElement(react_core_1.DescriptionListGroup, null,
|
|
25
25
|
React.createElement(react_core_1.DescriptionListTerm, null, t('Memory pressure')),
|
|
26
26
|
React.createElement(react_core_1.DescriptionListDescription, null,
|
|
27
|
-
React.createElement(DeviceResourceStatus_1.default, { device: device, monitorType:
|
|
27
|
+
React.createElement(DeviceResourceStatus_1.default, { device: device, monitorType: DeviceResourceStatus_1.MonitorType.memory })))))));
|
|
28
28
|
};
|
|
29
29
|
exports.default = SystemResourcesContent;
|
|
30
30
|
//# sourceMappingURL=SystemResourcesContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SystemResourcesContent.js","sourceRoot":"","sources":["../../../../../../src/components/Device/DeviceDetails/DeviceDetailsTabContent/SystemResourcesContent.tsx"],"names":[],"mappings":";;;AAAA,qDAA+B;AAC/B,uDAKgC;AAGhC,qEAAkE;AAClE,gGAA4F;AAC5F,gHAAoF;AACpF,
|
|
1
|
+
{"version":3,"file":"SystemResourcesContent.js","sourceRoot":"","sources":["../../../../../../src/components/Device/DeviceDetails/DeviceDetailsTabContent/SystemResourcesContent.tsx"],"names":[],"mappings":";;;AAAA,qDAA+B;AAC/B,uDAKgC;AAGhC,qEAAkE;AAClE,gGAA4F;AAC5F,gHAAoF;AACpF,qGAAyF;AAEzF,MAAM,sBAAsB,GAAG,CAAC,EAAE,MAAM,EAAgC,EAAE,EAAE;IAC1E,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,+BAAc,GAAE,CAAC;IAE/B,OAAO,CACL,oBAAC,yBAAe;QACd,oBAAC,sBAAS,QAAE,CAAC,CAAC,iBAAiB,CAAC,CAAa;QAC7C,oBAAC,qCAAmB;YAClB,oBAAC,kCAA4B,IAAC,cAAc,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;gBAC/D,oBAAC,iCAAoB;oBACnB,oBAAC,gCAAmB,QAAE,CAAC,CAAC,cAAc,CAAC,CAAuB;oBAC9D,oBAAC,uCAA0B;wBACzB,oBAAC,8BAAoB,IAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,kCAAW,CAAC,GAAG,GAAI,CAC3C,CACR;gBACvB,oBAAC,iCAAoB;oBACnB,oBAAC,gCAAmB,QAAE,CAAC,CAAC,eAAe,CAAC,CAAuB;oBAC/D,oBAAC,uCAA0B;wBACzB,oBAAC,8BAAoB,IAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,kCAAW,CAAC,IAAI,GAAI,CAC5C,CACR;gBACvB,oBAAC,iCAAoB;oBACnB,oBAAC,gCAAmB,QAAE,CAAC,CAAC,iBAAiB,CAAC,CAAuB;oBACjE,oBAAC,uCAA0B;wBACzB,oBAAC,8BAAoB,IAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,kCAAW,CAAC,MAAM,GAAI,CAC9C,CACR,CACM,CACX,CACN,CACnB,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnrollmentRequestDetails.d.ts","sourceRoot":"","sources":["../../../../../src/components/EnrollmentRequest/EnrollmentRequestDetails/EnrollmentRequestDetails.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"EnrollmentRequestDetails.d.ts","sourceRoot":"","sources":["../../../../../src/components/EnrollmentRequest/EnrollmentRequestDetails/EnrollmentRequestDetails.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAyC/B,OAAO,gCAAgC,CAAC;AAiMxC,QAAA,MAAM,uCAAuC,yBAO5C,CAAC;AAEF,eAAe,uCAAuC,CAAC"}
|
package/dist/src/components/EnrollmentRequest/EnrollmentRequestDetails/EnrollmentRequestDetails.js
CHANGED
|
@@ -22,9 +22,10 @@ const useAppContext_1 = require("../../../hooks/useAppContext");
|
|
|
22
22
|
const useAccessReview_1 = require("../../../hooks/useAccessReview");
|
|
23
23
|
const rbac_1 = require("../../../types/rbac");
|
|
24
24
|
const PageWithPermissions_1 = tslib_1.__importDefault(require("../../common/PageWithPermissions"));
|
|
25
|
+
const useEnrollmentRequestSystemInfo_1 = require("./useEnrollmentRequestSystemInfo");
|
|
25
26
|
require("./EnrollmentRequestDetails.css");
|
|
26
27
|
const EnrollmentRequestDetails = () => {
|
|
27
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
28
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
28
29
|
const { t } = (0, useTranslation_1.useTranslation)();
|
|
29
30
|
const { router: { useParams }, } = (0, useAppContext_1.useAppContext)();
|
|
30
31
|
const { enrollmentRequestId } = useParams();
|
|
@@ -36,6 +37,8 @@ const EnrollmentRequestDetails = () => {
|
|
|
36
37
|
const [canApprove] = (0, useAccessReview_1.useAccessReview)(rbac_1.RESOURCE.ENROLLMENT_REQUEST_APPROVAL, rbac_1.VERB.POST);
|
|
37
38
|
const [canDelete] = (0, useAccessReview_1.useAccessReview)(rbac_1.RESOURCE.ENROLLMENT_REQUEST, rbac_1.VERB.DELETE);
|
|
38
39
|
const [isApprovalModalOpen, setIsApprovalModalOpen] = React.useState(false);
|
|
40
|
+
const erSystemInfo = (0, useEnrollmentRequestSystemInfo_1.useEnrollmentRequestSystemInfo)((_a = er === null || er === void 0 ? void 0 : er.spec.deviceStatus) === null || _a === void 0 ? void 0 : _a.systemInfo, t);
|
|
41
|
+
const hasDefaultLabels = Object.keys((er === null || er === void 0 ? void 0 : er.spec.labels) || {}).length > 0;
|
|
39
42
|
const { deleteAction, deleteModal } = (0, DetailsPageActions_1.useDeleteAction)({
|
|
40
43
|
resourceName: enrollmentRequestId,
|
|
41
44
|
resourceType: 'Enrollment request',
|
|
@@ -63,33 +66,44 @@ const EnrollmentRequestDetails = () => {
|
|
|
63
66
|
React.createElement(react_core_1.DescriptionListTerm, null, t('Last seen')),
|
|
64
67
|
React.createElement(react_core_1.DescriptionListDescription, null, (0, dates_1.timeSinceText)(t, er === null || er === void 0 ? void 0 : er.metadata.creationTimestamp))),
|
|
65
68
|
React.createElement(react_core_1.DescriptionListGroup, null,
|
|
66
|
-
React.createElement(react_core_1.DescriptionListTerm, null, t('
|
|
67
|
-
React.createElement(react_core_1.DescriptionListDescription, null, ((
|
|
69
|
+
React.createElement(react_core_1.DescriptionListTerm, null, t('Operating system')),
|
|
70
|
+
React.createElement(react_core_1.DescriptionListDescription, null, ((_d = (_c = (_b = er === null || er === void 0 ? void 0 : er.spec) === null || _b === void 0 ? void 0 : _b.deviceStatus) === null || _c === void 0 ? void 0 : _c.systemInfo) === null || _d === void 0 ? void 0 : _d.operatingSystem) || '-')),
|
|
68
71
|
React.createElement(react_core_1.DescriptionListGroup, null,
|
|
69
72
|
React.createElement(react_core_1.DescriptionListTerm, null, t('Architecture')),
|
|
70
|
-
React.createElement(react_core_1.DescriptionListDescription, null, ((
|
|
71
|
-
React.createElement(react_core_1.DescriptionListGroup, null,
|
|
72
|
-
React.createElement(react_core_1.DescriptionListTerm, null, t('
|
|
73
|
+
React.createElement(react_core_1.DescriptionListDescription, null, ((_g = (_f = (_e = er === null || er === void 0 ? void 0 : er.spec) === null || _e === void 0 ? void 0 : _e.deviceStatus) === null || _f === void 0 ? void 0 : _f.systemInfo) === null || _g === void 0 ? void 0 : _g.architecture) || '-')),
|
|
74
|
+
hasDefaultLabels && (React.createElement(react_core_1.DescriptionListGroup, null,
|
|
75
|
+
React.createElement(react_core_1.DescriptionListTerm, null, t('Labels')),
|
|
73
76
|
React.createElement(react_core_1.DescriptionListDescription, null,
|
|
74
|
-
React.createElement(LabelsView_1.default, { prefix: "er", labels: er === null || er === void 0 ? void 0 : er.spec.labels }))),
|
|
77
|
+
React.createElement(LabelsView_1.default, { prefix: "er", labels: er === null || er === void 0 ? void 0 : er.spec.labels })))),
|
|
75
78
|
React.createElement(react_core_1.DescriptionListGroup, null,
|
|
76
79
|
React.createElement(react_core_1.DescriptionListTerm, null, t('Status')),
|
|
77
80
|
React.createElement(react_core_1.DescriptionListDescription, null,
|
|
78
|
-
React.createElement(EnrollmentRequestStatus_1.default, { er: er })))
|
|
81
|
+
React.createElement(EnrollmentRequestStatus_1.default, { er: er }))),
|
|
82
|
+
erSystemInfo.baseInfo.map((systemInfo) => (React.createElement(react_core_1.DescriptionListGroup, { key: systemInfo.title },
|
|
83
|
+
React.createElement(react_core_1.DescriptionListTerm, null, systemInfo.title),
|
|
84
|
+
React.createElement(react_core_1.DescriptionListDescription, null, systemInfo.value)))))))),
|
|
85
|
+
erSystemInfo.customInfo.length > 0 && (React.createElement(react_core_1.GridItem, { md: 6 },
|
|
86
|
+
React.createElement(DetailsPageCard_1.default, null,
|
|
87
|
+
React.createElement(react_core_1.CardTitle, null, t('Custom data')),
|
|
88
|
+
React.createElement(react_core_1.CardBody, null,
|
|
89
|
+
React.createElement(FlightCtlDescriptionList_1.default, { columnModifier: { lg: '3Col' } }, erSystemInfo.customInfo.map((systemInfo) => (React.createElement(react_core_1.DescriptionListGroup, { key: systemInfo.title },
|
|
90
|
+
React.createElement(react_core_1.DescriptionListTerm, null, systemInfo.title),
|
|
91
|
+
React.createElement(react_core_1.DescriptionListDescription, null, systemInfo.value))))))))),
|
|
79
92
|
React.createElement(react_core_1.GridItem, { md: 6 },
|
|
80
93
|
React.createElement(DetailsPageCard_1.default, null,
|
|
81
94
|
React.createElement(react_core_1.CardTitle, null,
|
|
82
95
|
React.createElement(WithHelperText_1.default, { label: t('Certificate signing request'), content: t('A PEM-encoded PKCS#10 certificate signing request.') })),
|
|
83
96
|
React.createElement(DetailsPageCard_1.DetailsPageCardBody, null, (er === null || er === void 0 ? void 0 : er.spec.csr) ? (React.createElement(react_core_1.TextArea, { "aria-label": t('Certificate Signing Request'), value: er.spec.csr, readOnlyVariant: "plain", autoResize: true, className: "fctl-enrollment-details__text-area" })) : (React.createElement(react_core_1.Bullseye, null, t('Not available')))))),
|
|
84
|
-
React.createElement(react_core_1.GridItem, { md: 6 },
|
|
97
|
+
((_h = er === null || er === void 0 ? void 0 : er.status) === null || _h === void 0 ? void 0 : _h.certificate) && (React.createElement(react_core_1.GridItem, { md: 6 },
|
|
85
98
|
React.createElement(DetailsPageCard_1.default, null,
|
|
86
99
|
React.createElement(react_core_1.CardTitle, null,
|
|
87
100
|
React.createElement(WithHelperText_1.default, { label: t('Certificate'), content: t('A PEM-encoded signed certificate.') })),
|
|
88
|
-
React.createElement(DetailsPageCard_1.DetailsPageCardBody, null,
|
|
101
|
+
React.createElement(DetailsPageCard_1.DetailsPageCardBody, null,
|
|
102
|
+
React.createElement(react_core_1.TextArea, { "aria-label": t('Certificate'), value: er.status.certificate, readOnlyVariant: "plain", autoResize: true, className: "fctl-enrollment-details__text-area" }))))),
|
|
89
103
|
React.createElement(react_core_1.GridItem, { md: 6 },
|
|
90
104
|
React.createElement(DetailsPageCard_1.default, null,
|
|
91
105
|
React.createElement(react_core_1.CardTitle, null, t('Conditions')),
|
|
92
|
-
React.createElement(DetailsPageCard_1.DetailsPageCardBody, null, er && (React.createElement(ConditionsTable_1.default, { ariaLabel: t('Enrollment request conditions table'), conditions: (
|
|
106
|
+
React.createElement(DetailsPageCard_1.DetailsPageCardBody, null, er && (React.createElement(ConditionsTable_1.default, { ariaLabel: t('Enrollment request conditions table'), conditions: (_j = er.status) === null || _j === void 0 ? void 0 : _j.conditions })))))),
|
|
93
107
|
er && isApprovalModalOpen && (React.createElement(ApproveDeviceModal_1.default, { enrollmentRequest: er, onClose: (updateList) => {
|
|
94
108
|
setIsApprovalModalOpen(false);
|
|
95
109
|
updateList && refetch();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnrollmentRequestDetails.js","sourceRoot":"","sources":["../../../../../src/components/EnrollmentRequest/EnrollmentRequestDetails/EnrollmentRequestDetails.tsx"],"names":[],"mappings":";;;AAAA,qDAA+B;AAC/B,uDAagC;AAGhC,uGAAuE;AACvE,wFAAwD;AACxD,iFAAiD;AACjD,8EAA2E;AAC3E,gDAAqD;AACrD,+EAGiD;AACjD,sDAAmD;AACnD,oHAAoF;AACpF,6FAAyF;AACzF,mGAA2F;AAC3F,2GAA2E;AAC3E,yFAA8D;AAC9D,6GAAiF;AACjF,kEAA+D;AAC/D,4DAAgE;AAChE,gEAA6D;AAC7D,oEAAiE;AACjE,8CAAqD;AACrD,mGAAmE;
|
|
1
|
+
{"version":3,"file":"EnrollmentRequestDetails.js","sourceRoot":"","sources":["../../../../../src/components/EnrollmentRequest/EnrollmentRequestDetails/EnrollmentRequestDetails.tsx"],"names":[],"mappings":";;;AAAA,qDAA+B;AAC/B,uDAagC;AAGhC,uGAAuE;AACvE,wFAAwD;AACxD,iFAAiD;AACjD,8EAA2E;AAC3E,gDAAqD;AACrD,+EAGiD;AACjD,sDAAmD;AACnD,oHAAoF;AACpF,6FAAyF;AACzF,mGAA2F;AAC3F,2GAA2E;AAC3E,yFAA8D;AAC9D,6GAAiF;AACjF,kEAA+D;AAC/D,4DAAgE;AAChE,gEAA6D;AAC7D,oEAAiE;AACjE,8CAAqD;AACrD,mGAAmE;AACnE,qFAAkF;AAElF,0CAAwC;AAExC,MAAM,wBAAwB,GAAG,GAAG,EAAE;;IACpC,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,+BAAc,GAAE,CAAC;IAC/B,MAAM,EACJ,MAAM,EAAE,EAAE,SAAS,EAAE,GACtB,GAAG,IAAA,6BAAa,GAAE,CAAC;IACpB,MAAM,EAAE,mBAAmB,EAAE,GAAG,SAAS,EAAqC,CAAC;IAC/E,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,IAAA,2CAAoB,EAAoB;QAC5E,QAAQ,EAAE,sBAAsB,mBAAmB,EAAE;KACtD,CAAC,CAAC;IACH,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,mBAAQ,GAAE,CAAC;IAC9B,MAAM,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAC;IAC/B,MAAM,CAAC,UAAU,CAAC,GAAG,IAAA,iCAAe,EAAC,eAAQ,CAAC,2BAA2B,EAAE,WAAI,CAAC,IAAI,CAAC,CAAC;IACtF,MAAM,CAAC,SAAS,CAAC,GAAG,IAAA,iCAAe,EAAC,eAAQ,CAAC,kBAAkB,EAAE,WAAI,CAAC,MAAM,CAAC,CAAC;IAE9E,MAAM,CA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AoC,GAC9C,CACkB,CACN,CACT,CACZ;YAED,oBAAC,qBAAQ,IAAC,EAAE,EAAE,CAAC;gBACb,oBAAC,yBAAe;oBACd,oBAAC,sBAAS,QAAE,CAAC,CAAC,YAAY,CAAC,CAAa;oBACxC,oBAAC,qCAAmB,QACjB,EAAE,IAAI,CACL,oBAAC,yBAAe,IACd,SAAS,EAAE,CAAC,CAAC,qCAAqC,CAAC,EACnD,UAAU,EAAE,MAAA,EAAE,CAAC,MAAM,0CAAE,UAAU,GACjC,CACH,CACmB,CACN,CACT,CACN;QACN,EAAE,IAAI,mBAAmB,IAAI,CAC5B,oBAAC,4BAAkB,IACjB,iBAAiB,EAAE,EAAE,EACrB,OAAO,EAAE,CAAC,UAAU,EAAE,EAAE;gBACtB,sBAAsB,CAAC,KAAK,CAAC,CAAC;gBAC9B,UAAU,IAAI,OAAO,EAAE,CAAC;YAC1B,CAAC,GACD,CACH;QACA,WAAW,CACA,CACf,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,uCAAuC,GAAG,GAAG,EAAE;IACnD,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,IAAA,iCAAe,EAAC,eAAQ,CAAC,kBAAkB,EAAE,WAAI,CAAC,GAAG,CAAC,CAAC;IAClF,OAAO,CACL,oBAAC,6BAAmB,IAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO;QACrD,oBAAC,wBAAwB,OAAG,CACR,CACvB,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,uCAAuC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TFunction } from 'react-i18next';
|
|
2
|
+
import { CustomDeviceInfo, DeviceSystemInfo } from '@flightctl/types';
|
|
3
|
+
export type FixedDeviceSystemInfo = DeviceSystemInfo & {
|
|
4
|
+
customInfo?: CustomDeviceInfo;
|
|
5
|
+
};
|
|
6
|
+
type SystemInfoEntry = {
|
|
7
|
+
title: string;
|
|
8
|
+
value: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const useEnrollmentRequestSystemInfo: (systemInfo: FixedDeviceSystemInfo | undefined, t: TFunction) => {
|
|
11
|
+
baseInfo: SystemInfoEntry[];
|
|
12
|
+
customInfo: SystemInfoEntry[];
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=useEnrollmentRequestSystemInfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEnrollmentRequestSystemInfo.d.ts","sourceRoot":"","sources":["../../../../../src/components/EnrollmentRequest/EnrollmentRequestDetails/useEnrollmentRequestSystemInfo.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGtE,MAAM,MAAM,qBAAqB,GAAG,gBAAgB,GAAG;IACrD,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAmCF,eAAO,MAAM,8BAA8B,eAC7B,qBAAqB,GAAG,SAAS,KAC1C,SAAS,KACX;IACD,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,UAAU,EAAE,eAAe,EAAE,CAAC;CA6D/B,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useEnrollmentRequestSystemInfo = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
// Converts a camelCase variable into words. Example: "someInfoData" --> "Some info data"
|
|
7
|
+
// Keeps acronyms together, converted to lowercase. Example: "bootID" --> Boot id
|
|
8
|
+
const propNameToTitle = (input) => {
|
|
9
|
+
const words = input.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2');
|
|
10
|
+
return words.charAt(0).toUpperCase() + words.slice(1).toLowerCase();
|
|
11
|
+
};
|
|
12
|
+
const emptySystemInfo = {
|
|
13
|
+
baseInfo: [],
|
|
14
|
+
customInfo: [],
|
|
15
|
+
};
|
|
16
|
+
const excludedKnownProps = [
|
|
17
|
+
'distroVersion', // It's combined with "distroName"
|
|
18
|
+
'customInfo', // Custom properies are evaluated separately from the predefined, known properties
|
|
19
|
+
'architecture', // Rendered separately by EnrollmentRequestDetails
|
|
20
|
+
'operatingSystem', // Rendered separately by EnrollmentRequestDetails
|
|
21
|
+
];
|
|
22
|
+
const getInfoDataKnownKeys = (t) => ({
|
|
23
|
+
agentVersion: t('Agent version'),
|
|
24
|
+
distroName: t('Distro'),
|
|
25
|
+
hostname: t('Hostname'),
|
|
26
|
+
bootID: t('Boot ID'),
|
|
27
|
+
kernel: t('Kernel'),
|
|
28
|
+
netInterfaceDefault: t('Net interface default'),
|
|
29
|
+
netIpDefault: t('Net IP default'),
|
|
30
|
+
netMacDefault: t('Net MAC default'),
|
|
31
|
+
productName: t('Product name'),
|
|
32
|
+
productSerial: t('Product serial'),
|
|
33
|
+
productUuid: t('Product UUID'),
|
|
34
|
+
});
|
|
35
|
+
const useEnrollmentRequestSystemInfo = (systemInfo, t) => {
|
|
36
|
+
const infoDataKnownKeys = react_1.default.useMemo(() => getInfoDataKnownKeys(t), [t]);
|
|
37
|
+
if (!systemInfo) {
|
|
38
|
+
return emptySystemInfo;
|
|
39
|
+
}
|
|
40
|
+
// First show the properties known to us, and only those that are set
|
|
41
|
+
const baseInfoList = Object.entries(infoDataKnownKeys)
|
|
42
|
+
.filter(([infoKey]) => {
|
|
43
|
+
return !excludedKnownProps.includes(infoKey) && systemInfo[infoKey];
|
|
44
|
+
})
|
|
45
|
+
.map(([infoKey, infoTitle]) => {
|
|
46
|
+
let infoDataValue = systemInfo[infoKey];
|
|
47
|
+
if (infoKey === 'distroName') {
|
|
48
|
+
const version = 'distroVersion' in systemInfo ? ` ${systemInfo['distroVersion']}` : '';
|
|
49
|
+
infoDataValue = `${infoDataValue}${version}`;
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
title: infoTitle,
|
|
53
|
+
value: infoDataValue,
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
// Skip the known properties added in the previous phase. And only add any additional property which has a value
|
|
57
|
+
Object.keys(systemInfo).forEach((infoKey) => {
|
|
58
|
+
if (infoDataKnownKeys[infoKey] || excludedKnownProps.includes(infoKey)) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const value = systemInfo[infoKey];
|
|
62
|
+
if (value) {
|
|
63
|
+
baseInfoList.push({
|
|
64
|
+
title: propNameToTitle(infoKey),
|
|
65
|
+
value,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
const customInfoList = [];
|
|
70
|
+
try {
|
|
71
|
+
const customInfo = systemInfo.customInfo || {};
|
|
72
|
+
Object.keys(customInfo).forEach((customInfoKey) => {
|
|
73
|
+
const value = customInfo[customInfoKey];
|
|
74
|
+
if (value) {
|
|
75
|
+
customInfoList.push({
|
|
76
|
+
title: propNameToTitle(customInfoKey),
|
|
77
|
+
value,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
catch (e) {
|
|
83
|
+
// eslint-disable-next-line no-console
|
|
84
|
+
console.warn('customInfo is not an object:', systemInfo.customInfo);
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
baseInfo: baseInfoList,
|
|
88
|
+
customInfo: customInfoList,
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
exports.useEnrollmentRequestSystemInfo = useEnrollmentRequestSystemInfo;
|
|
92
|
+
//# sourceMappingURL=useEnrollmentRequestSystemInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEnrollmentRequestSystemInfo.js","sourceRoot":"","sources":["../../../../../src/components/EnrollmentRequest/EnrollmentRequestDetails/useEnrollmentRequestSystemInfo.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAe1B,yFAAyF;AACzF,iFAAiF;AACjF,MAAM,eAAe,GAAG,CAAC,KAAa,EAAE,EAAE;IACxC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;IAClG,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;AACtE,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG;IACtB,QAAQ,EAAE,EAAE;IACZ,UAAU,EAAE,EAAE;CACf,CAAC;AAEF,MAAM,kBAAkB,GAAG;IACzB,eAAe,EAAE,kCAAkC;IACnD,YAAY,EAAE,kFAAkF;IAChG,cAAc,EAAE,kDAAkD;IAClE,iBAAiB,EAAE,kDAAkD;CACtE,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,CAAY,EAAE,EAAE,CAAC,CAAC;IAC9C,YAAY,EAAE,CAAC,CAAC,eAAe,CAAC;IAChC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC;IACvB,QAAQ,EAAE,CAAC,CAAC,UAAU,CAAC;IACvB,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC;IACpB,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC;IACnB,mBAAmB,EAAE,CAAC,CAAC,uBAAuB,CAAC;IAC/C,YAAY,EAAE,CAAC,CAAC,gBAAgB,CAAC;IACjC,aAAa,EAAE,CAAC,CAAC,iBAAiB,CAAC;IACnC,WAAW,EAAE,CAAC,CAAC,cAAc,CAAC;IAC9B,aAAa,EAAE,CAAC,CAAC,gBAAgB,CAAC;IAClC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,CAAC;QACD,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;QAClC,IAAI,KAAK,EAAE,CAAC;YACV,YAAY,CAAC,IAAI,CAAC;gBAChB,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC;gBAC/B,KAAK;aACN,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,cAAc,GAAsB,EAAE,CAAC;IAC7C,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,UAAU,CAAC,UAAU,IAAI,EAAE,CAAC;QAC/C,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE;YAChD,MAAM,KAAK,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;YACxC,IAAI,KAAK,EAAE,CAAC;gBACV,cAAc,CAAC,IAAI,CAAC;oBAClB,KAAK,EAAE,eAAe,CAAC,aAAa,CAAC;oBACrC,KAAK;iBACN,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,sCAAsC;QACtC,OAAO,CAAC,IAAI,CAAC,8BAA8B,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;IACtE,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,YAAY;QACtB,UAAU,EAAE,cAAc;KAC3B,CAAC;AACJ,CAAC,CAAC;AAlEW,QAAA,8BAA8B,kCAkEzC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Device, DeviceResourceStatus } from '@flightctl/types';
|
|
3
|
-
|
|
3
|
+
export declare enum MonitorType {
|
|
4
|
+
cpu = "cpu",
|
|
5
|
+
disk = "disk",
|
|
6
|
+
memory = "memory"
|
|
7
|
+
}
|
|
4
8
|
declare const DeviceResourceStatus: ({ device, monitorType }: {
|
|
5
9
|
device: Device | undefined;
|
|
6
10
|
monitorType: MonitorType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceResourceStatus.d.ts","sourceRoot":"","sources":["../../../../src/components/Status/DeviceResourceStatus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EACL,MAAM,EACN,oBAAoB,EAIrB,MAAM,kBAAkB,CAAC;AAM1B,
|
|
1
|
+
{"version":3,"file":"DeviceResourceStatus.d.ts","sourceRoot":"","sources":["../../../../src/components/Status/DeviceResourceStatus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EACL,MAAM,EACN,oBAAoB,EAIrB,MAAM,kBAAkB,CAAC;AAM1B,oBAAY,WAAW;IACrB,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,MAAM,WAAW;CAClB;AA8CD,QAAA,MAAM,oBAAoB;YAAuC,MAAM,GAAG,SAAS;iBAAe,WAAW;uBAkD5G,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MonitorType = void 0;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
5
|
const React = tslib_1.__importStar(require("react"));
|
|
5
6
|
const types_1 = require("@flightctl/types");
|
|
6
7
|
const useTranslation_1 = require("../../hooks/useTranslation");
|
|
7
8
|
const StatusDisplay_1 = require("./StatusDisplay");
|
|
9
|
+
var MonitorType;
|
|
10
|
+
(function (MonitorType) {
|
|
11
|
+
MonitorType["cpu"] = "cpu";
|
|
12
|
+
MonitorType["disk"] = "disk";
|
|
13
|
+
MonitorType["memory"] = "memory";
|
|
14
|
+
})(MonitorType || (exports.MonitorType = MonitorType = {}));
|
|
8
15
|
const getMonitorTypeLabel = (monitorType, t) => {
|
|
9
16
|
switch (monitorType) {
|
|
10
|
-
case
|
|
17
|
+
case MonitorType.cpu:
|
|
11
18
|
return t('CPU');
|
|
12
|
-
case
|
|
19
|
+
case MonitorType.memory:
|
|
13
20
|
return t('Memory');
|
|
14
|
-
case
|
|
21
|
+
case MonitorType.disk:
|
|
15
22
|
return t('Disk');
|
|
16
23
|
}
|
|
17
24
|
};
|
|
@@ -23,7 +30,7 @@ const getTriggeredResourceAlert = (resourcesInfo, monitorType, monitorStatus) =>
|
|
|
23
30
|
].includes(monitorStatus)) {
|
|
24
31
|
return null;
|
|
25
32
|
}
|
|
26
|
-
const monitorDetails = resourcesInfo.find((item) => item.monitorType.toLowerCase() === monitorType
|
|
33
|
+
const monitorDetails = resourcesInfo.find((item) => item.monitorType.toLowerCase() === monitorType && item.alertRules.length > 0);
|
|
27
34
|
if (!monitorDetails) {
|
|
28
35
|
return null;
|
|
29
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceResourceStatus.js","sourceRoot":"","sources":["../../../../src/components/Status/DeviceResourceStatus.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DeviceResourceStatus.js","sourceRoot":"","sources":["../../../../src/components/Status/DeviceResourceStatus.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAG/B,4CAM0B;AAE1B,+DAA4D;AAE5D,mDAAuD;AAEvD,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,0BAAW,CAAA;IACX,4BAAa,CAAA;IACb,gCAAiB,CAAA;AACnB,CAAC,EAJW,WAAW,2BAAX,WAAW,QAItB;AAED,MAAM,mBAAmB,GAAG,CAAC,WAAwB,EAAE,CAAY,EAAE,EAAE;IACrE,QAAQ,WAAW,EAAE,CAAC;QACpB,KAAK,WAAW,CAAC,GAAG;YAClB,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC;QAClB,KAAK,WAAW,CAAC,MAAM;YACrB,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC;QACrB,KAAK,WAAW,CAAC,IAAI;YACnB,OAAO,CAAC,CAAC,MAAM,CAAC,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IACnB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,WAAW,GACpC,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,oBAAoB,CAAC"}
|
package/package.json
CHANGED
package/src/components/Device/DeviceDetails/DeviceDetailsTabContent/SystemResourcesContent.tsx
CHANGED
|
@@ -10,7 +10,7 @@ import { Device } from '@flightctl/types';
|
|
|
10
10
|
import { useTranslation } from '../../../../hooks/useTranslation';
|
|
11
11
|
import DetailsPageCard, { DetailsPageCardBody } from '../../../DetailsPage/DetailsPageCard';
|
|
12
12
|
import FlightControlDescriptionList from '../../../common/FlightCtlDescriptionList';
|
|
13
|
-
import DeviceResourceStatus from '../../../Status/DeviceResourceStatus';
|
|
13
|
+
import DeviceResourceStatus, { MonitorType } from '../../../Status/DeviceResourceStatus';
|
|
14
14
|
|
|
15
15
|
const SystemResourcesContent = ({ device }: { device: Required<Device> }) => {
|
|
16
16
|
const { t } = useTranslation();
|
|
@@ -23,19 +23,19 @@ const SystemResourcesContent = ({ device }: { device: Required<Device> }) => {
|
|
|
23
23
|
<DescriptionListGroup>
|
|
24
24
|
<DescriptionListTerm>{t('CPU pressure')}</DescriptionListTerm>
|
|
25
25
|
<DescriptionListDescription>
|
|
26
|
-
<DeviceResourceStatus device={device} monitorType=
|
|
26
|
+
<DeviceResourceStatus device={device} monitorType={MonitorType.cpu} />
|
|
27
27
|
</DescriptionListDescription>
|
|
28
28
|
</DescriptionListGroup>
|
|
29
29
|
<DescriptionListGroup>
|
|
30
30
|
<DescriptionListTerm>{t('Disk pressure')}</DescriptionListTerm>
|
|
31
31
|
<DescriptionListDescription>
|
|
32
|
-
<DeviceResourceStatus device={device} monitorType=
|
|
32
|
+
<DeviceResourceStatus device={device} monitorType={MonitorType.disk} />
|
|
33
33
|
</DescriptionListDescription>
|
|
34
34
|
</DescriptionListGroup>
|
|
35
35
|
<DescriptionListGroup>
|
|
36
36
|
<DescriptionListTerm>{t('Memory pressure')}</DescriptionListTerm>
|
|
37
37
|
<DescriptionListDescription>
|
|
38
|
-
<DeviceResourceStatus device={device} monitorType=
|
|
38
|
+
<DeviceResourceStatus device={device} monitorType={MonitorType.memory} />
|
|
39
39
|
</DescriptionListDescription>
|
|
40
40
|
</DescriptionListGroup>
|
|
41
41
|
</FlightControlDescriptionList>
|
package/src/components/EnrollmentRequest/EnrollmentRequestDetails/EnrollmentRequestDetails.tsx
CHANGED
|
@@ -37,6 +37,7 @@ import { useAppContext } from '../../../hooks/useAppContext';
|
|
|
37
37
|
import { useAccessReview } from '../../../hooks/useAccessReview';
|
|
38
38
|
import { RESOURCE, VERB } from '../../../types/rbac';
|
|
39
39
|
import PageWithPermissions from '../../common/PageWithPermissions';
|
|
40
|
+
import { useEnrollmentRequestSystemInfo } from './useEnrollmentRequestSystemInfo';
|
|
40
41
|
|
|
41
42
|
import './EnrollmentRequestDetails.css';
|
|
42
43
|
|
|
@@ -55,6 +56,8 @@ const EnrollmentRequestDetails = () => {
|
|
|
55
56
|
const [canDelete] = useAccessReview(RESOURCE.ENROLLMENT_REQUEST, VERB.DELETE);
|
|
56
57
|
|
|
57
58
|
const [isApprovalModalOpen, setIsApprovalModalOpen] = React.useState(false);
|
|
59
|
+
const erSystemInfo = useEnrollmentRequestSystemInfo(er?.spec.deviceStatus?.systemInfo, t);
|
|
60
|
+
const hasDefaultLabels = Object.keys(er?.spec.labels || {}).length > 0;
|
|
58
61
|
|
|
59
62
|
const { deleteAction, deleteModal } = useDeleteAction({
|
|
60
63
|
resourceName: enrollmentRequestId,
|
|
@@ -107,7 +110,7 @@ const EnrollmentRequestDetails = () => {
|
|
|
107
110
|
</DescriptionListDescription>
|
|
108
111
|
</DescriptionListGroup>
|
|
109
112
|
<DescriptionListGroup>
|
|
110
|
-
<DescriptionListTerm>{t('
|
|
113
|
+
<DescriptionListTerm>{t('Operating system')}</DescriptionListTerm>
|
|
111
114
|
<DescriptionListDescription>
|
|
112
115
|
{er?.spec?.deviceStatus?.systemInfo?.operatingSystem || '-'}
|
|
113
116
|
</DescriptionListDescription>
|
|
@@ -118,22 +121,47 @@ const EnrollmentRequestDetails = () => {
|
|
|
118
121
|
{er?.spec?.deviceStatus?.systemInfo?.architecture || '-'}
|
|
119
122
|
</DescriptionListDescription>
|
|
120
123
|
</DescriptionListGroup>
|
|
121
|
-
|
|
122
|
-
<
|
|
123
|
-
|
|
124
|
-
<
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
{hasDefaultLabels && (
|
|
125
|
+
<DescriptionListGroup>
|
|
126
|
+
<DescriptionListTerm>{t('Labels')}</DescriptionListTerm>
|
|
127
|
+
<DescriptionListDescription>
|
|
128
|
+
<LabelsView prefix="er" labels={er?.spec.labels} />
|
|
129
|
+
</DescriptionListDescription>
|
|
130
|
+
</DescriptionListGroup>
|
|
131
|
+
)}
|
|
127
132
|
<DescriptionListGroup>
|
|
128
133
|
<DescriptionListTerm>{t('Status')}</DescriptionListTerm>
|
|
129
134
|
<DescriptionListDescription>
|
|
130
135
|
<EnrollmentRequestStatus er={er} />
|
|
131
136
|
</DescriptionListDescription>
|
|
132
137
|
</DescriptionListGroup>
|
|
138
|
+
{erSystemInfo.baseInfo.map((systemInfo) => (
|
|
139
|
+
<DescriptionListGroup key={systemInfo.title}>
|
|
140
|
+
<DescriptionListTerm>{systemInfo.title}</DescriptionListTerm>
|
|
141
|
+
<DescriptionListDescription>{systemInfo.value}</DescriptionListDescription>
|
|
142
|
+
</DescriptionListGroup>
|
|
143
|
+
))}
|
|
133
144
|
</FlightControlDescriptionList>
|
|
134
145
|
</CardBody>
|
|
135
146
|
</Card>
|
|
136
147
|
</GridItem>
|
|
148
|
+
{erSystemInfo.customInfo.length > 0 && (
|
|
149
|
+
<GridItem md={6}>
|
|
150
|
+
<DetailsPageCard>
|
|
151
|
+
<CardTitle>{t('Custom data')}</CardTitle>
|
|
152
|
+
<CardBody>
|
|
153
|
+
<FlightControlDescriptionList columnModifier={{ lg: '3Col' }}>
|
|
154
|
+
{erSystemInfo.customInfo.map((systemInfo) => (
|
|
155
|
+
<DescriptionListGroup key={systemInfo.title}>
|
|
156
|
+
<DescriptionListTerm>{systemInfo.title}</DescriptionListTerm>
|
|
157
|
+
<DescriptionListDescription>{systemInfo.value}</DescriptionListDescription>
|
|
158
|
+
</DescriptionListGroup>
|
|
159
|
+
))}
|
|
160
|
+
</FlightControlDescriptionList>
|
|
161
|
+
</CardBody>
|
|
162
|
+
</DetailsPageCard>
|
|
163
|
+
</GridItem>
|
|
164
|
+
)}
|
|
137
165
|
<GridItem md={6}>
|
|
138
166
|
<DetailsPageCard>
|
|
139
167
|
<CardTitle>
|
|
@@ -157,13 +185,13 @@ const EnrollmentRequestDetails = () => {
|
|
|
157
185
|
</DetailsPageCardBody>
|
|
158
186
|
</DetailsPageCard>
|
|
159
187
|
</GridItem>
|
|
160
|
-
|
|
161
|
-
<
|
|
162
|
-
<
|
|
163
|
-
<
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
188
|
+
{er?.status?.certificate && (
|
|
189
|
+
<GridItem md={6}>
|
|
190
|
+
<DetailsPageCard>
|
|
191
|
+
<CardTitle>
|
|
192
|
+
<LabelWithHelperText label={t('Certificate')} content={t('A PEM-encoded signed certificate.')} />
|
|
193
|
+
</CardTitle>
|
|
194
|
+
<DetailsPageCardBody>
|
|
167
195
|
<TextArea
|
|
168
196
|
aria-label={t('Certificate')}
|
|
169
197
|
value={er.status.certificate}
|
|
@@ -171,12 +199,11 @@ const EnrollmentRequestDetails = () => {
|
|
|
171
199
|
autoResize
|
|
172
200
|
className="fctl-enrollment-details__text-area"
|
|
173
201
|
/>
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
</GridItem>
|
|
202
|
+
</DetailsPageCardBody>
|
|
203
|
+
</DetailsPageCard>
|
|
204
|
+
</GridItem>
|
|
205
|
+
)}
|
|
206
|
+
|
|
180
207
|
<GridItem md={6}>
|
|
181
208
|
<DetailsPageCard>
|
|
182
209
|
<CardTitle>{t('Conditions')}</CardTitle>
|
package/src/components/EnrollmentRequest/EnrollmentRequestDetails/useEnrollmentRequestSystemInfo.tsx
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TFunction } from 'react-i18next';
|
|
3
|
+
|
|
4
|
+
import { CustomDeviceInfo, DeviceSystemInfo } from '@flightctl/types';
|
|
5
|
+
|
|
6
|
+
// The API definition doesn't handle "customInfo" correctly
|
|
7
|
+
export type FixedDeviceSystemInfo = DeviceSystemInfo & {
|
|
8
|
+
customInfo?: CustomDeviceInfo;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
type SystemInfoEntry = {
|
|
12
|
+
title: string;
|
|
13
|
+
value: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// Converts a camelCase variable into words. Example: "someInfoData" --> "Some info data"
|
|
17
|
+
// Keeps acronyms together, converted to lowercase. Example: "bootID" --> Boot id
|
|
18
|
+
const propNameToTitle = (input: string) => {
|
|
19
|
+
const words = input.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2');
|
|
20
|
+
return words.charAt(0).toUpperCase() + words.slice(1).toLowerCase();
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const emptySystemInfo = {
|
|
24
|
+
baseInfo: [],
|
|
25
|
+
customInfo: [],
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const excludedKnownProps = [
|
|
29
|
+
'distroVersion', // It's combined with "distroName"
|
|
30
|
+
'customInfo', // Custom properies are evaluated separately from the predefined, known properties
|
|
31
|
+
'architecture', // Rendered separately by EnrollmentRequestDetails
|
|
32
|
+
'operatingSystem', // Rendered separately by EnrollmentRequestDetails
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
const getInfoDataKnownKeys = (t: TFunction) => ({
|
|
36
|
+
agentVersion: t('Agent version'),
|
|
37
|
+
distroName: t('Distro'),
|
|
38
|
+
hostname: t('Hostname'),
|
|
39
|
+
bootID: t('Boot ID'),
|
|
40
|
+
kernel: t('Kernel'),
|
|
41
|
+
netInterfaceDefault: t('Net interface default'),
|
|
42
|
+
netIpDefault: t('Net IP default'),
|
|
43
|
+
netMacDefault: t('Net MAC default'),
|
|
44
|
+
productName: t('Product name'),
|
|
45
|
+
productSerial: t('Product serial'),
|
|
46
|
+
productUuid: t('Product UUID'),
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export const useEnrollmentRequestSystemInfo = (
|
|
50
|
+
systemInfo: FixedDeviceSystemInfo | undefined,
|
|
51
|
+
t: TFunction,
|
|
52
|
+
): {
|
|
53
|
+
baseInfo: SystemInfoEntry[];
|
|
54
|
+
customInfo: SystemInfoEntry[];
|
|
55
|
+
} => {
|
|
56
|
+
const infoDataKnownKeys = React.useMemo(() => getInfoDataKnownKeys(t), [t]);
|
|
57
|
+
if (!systemInfo) {
|
|
58
|
+
return emptySystemInfo;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// First show the properties known to us, and only those that are set
|
|
62
|
+
const baseInfoList = Object.entries(infoDataKnownKeys)
|
|
63
|
+
.filter(([infoKey]) => {
|
|
64
|
+
return !excludedKnownProps.includes(infoKey) && systemInfo[infoKey];
|
|
65
|
+
})
|
|
66
|
+
.map(([infoKey, infoTitle]) => {
|
|
67
|
+
let infoDataValue = systemInfo[infoKey];
|
|
68
|
+
|
|
69
|
+
if (infoKey === 'distroName') {
|
|
70
|
+
const version = 'distroVersion' in systemInfo ? ` ${systemInfo['distroVersion']}` : '';
|
|
71
|
+
infoDataValue = `${infoDataValue}${version}`;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
title: infoTitle,
|
|
76
|
+
value: infoDataValue,
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// Skip the known properties added in the previous phase. And only add any additional property which has a value
|
|
81
|
+
Object.keys(systemInfo).forEach((infoKey) => {
|
|
82
|
+
if (infoDataKnownKeys[infoKey] || excludedKnownProps.includes(infoKey)) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const value = systemInfo[infoKey];
|
|
86
|
+
if (value) {
|
|
87
|
+
baseInfoList.push({
|
|
88
|
+
title: propNameToTitle(infoKey),
|
|
89
|
+
value,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const customInfoList: SystemInfoEntry[] = [];
|
|
95
|
+
try {
|
|
96
|
+
const customInfo = systemInfo.customInfo || {};
|
|
97
|
+
Object.keys(customInfo).forEach((customInfoKey) => {
|
|
98
|
+
const value = customInfo[customInfoKey];
|
|
99
|
+
if (value) {
|
|
100
|
+
customInfoList.push({
|
|
101
|
+
title: propNameToTitle(customInfoKey),
|
|
102
|
+
value,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
} catch (e) {
|
|
107
|
+
// eslint-disable-next-line no-console
|
|
108
|
+
console.warn('customInfo is not an object:', systemInfo.customInfo);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
baseInfo: baseInfoList,
|
|
113
|
+
customInfo: customInfoList,
|
|
114
|
+
};
|
|
115
|
+
};
|
|
@@ -6,28 +6,32 @@ import {
|
|
|
6
6
|
DeviceResourceStatus,
|
|
7
7
|
DeviceResourceStatusType,
|
|
8
8
|
ResourceAlertSeverityType,
|
|
9
|
-
|
|
9
|
+
ResourceMonitor,
|
|
10
10
|
} from '@flightctl/types';
|
|
11
11
|
|
|
12
12
|
import { useTranslation } from '../../hooks/useTranslation';
|
|
13
13
|
import { StatusLevel } from '../../utils/status/common';
|
|
14
14
|
import { StatusDisplayContent } from './StatusDisplay';
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
export enum MonitorType {
|
|
17
|
+
cpu = 'cpu',
|
|
18
|
+
disk = 'disk',
|
|
19
|
+
memory = 'memory',
|
|
20
|
+
}
|
|
17
21
|
|
|
18
22
|
const getMonitorTypeLabel = (monitorType: MonitorType, t: TFunction) => {
|
|
19
23
|
switch (monitorType) {
|
|
20
|
-
case
|
|
24
|
+
case MonitorType.cpu:
|
|
21
25
|
return t('CPU');
|
|
22
|
-
case
|
|
26
|
+
case MonitorType.memory:
|
|
23
27
|
return t('Memory');
|
|
24
|
-
case
|
|
28
|
+
case MonitorType.disk:
|
|
25
29
|
return t('Disk');
|
|
26
30
|
}
|
|
27
31
|
};
|
|
28
32
|
|
|
29
33
|
const getTriggeredResourceAlert = (
|
|
30
|
-
resourcesInfo: Array<
|
|
34
|
+
resourcesInfo: Array<ResourceMonitor>,
|
|
31
35
|
monitorType: MonitorType,
|
|
32
36
|
monitorStatus?: DeviceResourceStatusType,
|
|
33
37
|
) => {
|
|
@@ -41,7 +45,7 @@ const getTriggeredResourceAlert = (
|
|
|
41
45
|
return null;
|
|
42
46
|
}
|
|
43
47
|
const monitorDetails = resourcesInfo.find(
|
|
44
|
-
(item) => item.monitorType.toLowerCase() === monitorType
|
|
48
|
+
(item) => item.monitorType.toLowerCase() === monitorType && item.alertRules.length > 0,
|
|
45
49
|
);
|
|
46
50
|
if (!monitorDetails) {
|
|
47
51
|
return null;
|