From 9a236342c049948e9ee248cf8b63cb0d889ad808 Mon Sep 17 00:00:00 2001 From: Sky Brewer <sky.brewer@ess.eu> Date: Thu, 23 May 2024 10:54:52 +0200 Subject: [PATCH] Use EmptyValue instead of --- --- package-lock.json | 14 ++++++------- package.json | 2 +- .../IOC/IOCLiveStatus/IOCLiveStatus.js | 13 ++++++------ src/components/IOC/IOCTable/IOCDescription.js | 10 +++++++-- src/components/IOC/IOCTable/IOCTable.js | 18 ++++++++++++---- src/components/Job/JobDetails.js | 21 ++++++++++++------- src/components/records/RecordHostLink.js | 5 +++-- src/components/records/RecordTable.js | 15 +++++++++++-- src/views/host/details/HostDetailsTable.js | 4 ++-- src/views/records/RecordDetailsView.js | 5 +++-- 10 files changed, 71 insertions(+), 36 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5a5a6a1e..f14bb3fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "@ahooksjs/use-url-state": "^3.5.0", "@emotion/react": "^11.11.1", "@emotion/styled": "^11.11.0", - "@ess-ics/ce-ui-common": "^5.0.0", + "@ess-ics/ce-ui-common": "^5.2.0", "@fontsource/roboto": "^4.1.0", "@mui/icons-material": "^5.14.1", "@mui/material": "^5.14.1", @@ -3023,9 +3023,9 @@ } }, "node_modules/@ess-ics/ce-ui-common": { - "version": "5.0.0", - "resolved": "https://artifactory.esss.lu.se/artifactory/api/npm/ics-npm/@ess-ics/ce-ui-common/-/ce-ui-common-5.0.0.tgz", - "integrity": "sha1-8kLUz3Zl9TA3sYsL34k0ydGS3PY=", + "version": "5.2.0", + "resolved": "https://artifactory.esss.lu.se/artifactory/api/npm/ics-npm/@ess-ics/ce-ui-common/-/ce-ui-common-5.2.0.tgz", + "integrity": "sha1-yb/dn2ntQOYGnr92xcXpAS0a9vA=", "dependencies": { "@fontsource/titillium-web": "^4.5.9", "@mui/x-data-grid-pro": "^6.5.0", @@ -38829,9 +38829,9 @@ "dev": true }, "@ess-ics/ce-ui-common": { - "version": "5.0.0", - "resolved": "https://artifactory.esss.lu.se/artifactory/api/npm/ics-npm/@ess-ics/ce-ui-common/-/ce-ui-common-5.0.0.tgz", - "integrity": "sha1-8kLUz3Zl9TA3sYsL34k0ydGS3PY=", + "version": "5.2.0", + "resolved": "https://artifactory.esss.lu.se/artifactory/api/npm/ics-npm/@ess-ics/ce-ui-common/-/ce-ui-common-5.2.0.tgz", + "integrity": "sha1-yb/dn2ntQOYGnr92xcXpAS0a9vA=", "requires": { "@fontsource/titillium-web": "^4.5.9", "@mui/x-data-grid-pro": "^6.5.0", diff --git a/package.json b/package.json index dd153311..3daaa213 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "@ahooksjs/use-url-state": "^3.5.0", "@emotion/react": "^11.11.1", "@emotion/styled": "^11.11.0", - "@ess-ics/ce-ui-common": "^5.0.0", + "@ess-ics/ce-ui-common": "^5.2.0", "@fontsource/roboto": "^4.1.0", "@mui/icons-material": "^5.14.1", "@mui/material": "^5.14.1", diff --git a/src/components/IOC/IOCLiveStatus/IOCLiveStatus.js b/src/components/IOC/IOCLiveStatus/IOCLiveStatus.js index c5f44535..39c98c63 100644 --- a/src/components/IOC/IOCLiveStatus/IOCLiveStatus.js +++ b/src/components/IOC/IOCLiveStatus/IOCLiveStatus.js @@ -1,6 +1,10 @@ import React, { useCallback } from "react"; import { Typography } from "@mui/material"; -import { SimpleAccordion, InternalLink } from "@ess-ics/ce-ui-common"; +import { + SimpleAccordion, + InternalLink, + EmptyValue +} from "@ess-ics/ce-ui-common"; import { IOCDetails } from "../IOCDetails"; import { LokiContainer } from "../../common/Loki/LokiContainer"; import { RecordSearch } from "../../records/RecordSearch"; @@ -28,9 +32,6 @@ export function IOCLiveStatus({ ioc }) { ioc.activeDeployment ).hasDeployment(); - // if IOC is not deployed some fields has to show '---' value - const grayOutNoText = <Typography color="gray">---</Typography>; - let subset = { Description: ioc.description, Revision: iocHasDeployment ? ( @@ -39,7 +40,7 @@ export function IOCLiveStatus({ ioc }) { revision={ioc.activeDeployment?.sourceVersion} /> ) : ( - grayOutNoText + <EmptyValue /> ), "Deployed on": iocHasDeployment && ioc.activeDeployment?.host.csEntryIdValid ? ( @@ -56,7 +57,7 @@ export function IOCLiveStatus({ ioc }) { )} </Typography> ) : ( - grayOutNoText + <EmptyValue /> ) }; diff --git a/src/components/IOC/IOCTable/IOCDescription.js b/src/components/IOC/IOCTable/IOCDescription.js index b53308c0..55813cc2 100644 --- a/src/components/IOC/IOCTable/IOCDescription.js +++ b/src/components/IOC/IOCTable/IOCDescription.js @@ -1,11 +1,17 @@ import React, { useContext, useMemo } from "react"; import { apiContext } from "../../../api/DeployApi"; import { Skeleton } from "@mui/material"; -import { useAPIMethod, EllipsisText } from "@ess-ics/ce-ui-common"; +import { useAPIMethod, EllipsisText, EmptyValue } from "@ess-ics/ce-ui-common"; function createIocDescription(description) { return ( - <>{description ? <EllipsisText>{description}</EllipsisText> : "---"}</> + <> + {description ? ( + <EllipsisText>{description}</EllipsisText> + ) : ( + <EmptyValue /> + )} + </> ); } diff --git a/src/components/IOC/IOCTable/IOCTable.js b/src/components/IOC/IOCTable/IOCTable.js index 326d745e..ad960c0d 100644 --- a/src/components/IOC/IOCTable/IOCTable.js +++ b/src/components/IOC/IOCTable/IOCTable.js @@ -1,5 +1,10 @@ import React from "react"; -import { Table, InternalLink, EllipsisText } from "@ess-ics/ce-ui-common"; +import { + Table, + InternalLink, + EllipsisText, + EmptyValue +} from "@ess-ics/ce-ui-common"; import { IOCDescription } from "./IOCDescription"; import { IOCStatus } from "./IOCStatus"; @@ -31,7 +36,11 @@ const exploreIocsColumns = [ headerName: "Network", width: "10ch", renderCell: (params) => { - return <EllipsisText>{params.value ?? "---"}</EllipsisText>; + return params.value ? ( + <EllipsisText>{params.value}</EllipsisText> + ) : ( + <EmptyValue /> + ); }, valueGetter: (params) => { return params.value; @@ -68,12 +77,13 @@ function createHostLink(host) { label={`Host details, ${host?.hostName}`} width="100%" > - <EllipsisText>{host?.hostName ?? "---"}</EllipsisText> + host?.hostName ? <EllipsisText>{host?.hostName}</EllipsisText> :{" "} + <EmptyValue /> </InternalLink> ); } - return "---"; + return <EmptyValue />; } function createIocLink(id, name) { diff --git a/src/components/Job/JobDetails.js b/src/components/Job/JobDetails.js index c764d916..4e586540 100644 --- a/src/components/Job/JobDetails.js +++ b/src/components/Job/JobDetails.js @@ -6,7 +6,8 @@ import { AlertBannerList, ExternalLink, InternalLink, - formatDateAndTime + formatDateAndTime, + EmptyValue } from "@ess-ics/ce-ui-common"; import { JobBadge } from "./JobBadge"; import { DeploymentJobOutput } from "../deployments/DeploymentJobOutput"; @@ -81,19 +82,23 @@ export function JobDetails({ operation, job }) { {operation.awxJobUrl} </ExternalLink> ), - "created time": operation?.createdAt - ? formatDateAndTime(operation.createdAt) - : "-", - "AWX job start time": operation?.startTime - ? formatDateAndTime(operation.startTime) - : "-", + "created time": operation?.createdAt ? ( + formatDateAndTime(operation.createdAt) + ) : ( + <EmptyValue /> + ), + "AWX job start time": operation?.startTime ? ( + formatDateAndTime(operation.startTime) + ) : ( + <EmptyValue /> + ), duration: operation?.finishedAt ? ( <JobDuration job={operation} renderContents={(duration) => duration} /> ) : ( - "-" + <EmptyValue /> ) }; diff --git a/src/components/records/RecordHostLink.js b/src/components/records/RecordHostLink.js index 355b86a6..cacc6359 100644 --- a/src/components/records/RecordHostLink.js +++ b/src/components/records/RecordHostLink.js @@ -4,7 +4,8 @@ import { apiContext } from "../../api/DeployApi"; import { useAPIMethod, InternalLink, - EllipsisText + EllipsisText, + EmptyValue } from "@ess-ics/ce-ui-common"; function createRequest(fqdn) { @@ -20,7 +21,7 @@ function shortenFqdn(fqdn) { function createHostLink(fqdn, hostInfo) { // if the fqdn field is empty for some reason if (fqdn === null || fqdn.trim() === "") { - return <Typography>{"---"}</Typography>; + return <EmptyValue />; } // create host link only if the host exists in CSEntry diff --git a/src/components/records/RecordTable.js b/src/components/records/RecordTable.js index eab95e64..a927315a 100644 --- a/src/components/records/RecordTable.js +++ b/src/components/records/RecordTable.js @@ -1,5 +1,10 @@ import React from "react"; -import { Table, InternalLink, EllipsisText } from "@ess-ics/ce-ui-common"; +import { + Table, + InternalLink, + EllipsisText, + EmptyValue +} from "@ess-ics/ce-ui-common"; import { RecordStatusIcon } from "./RecordIcons"; import { Grid } from "@mui/material"; import { RecordHostLink } from "./RecordHostLink"; @@ -75,7 +80,13 @@ function createRecordName(record) { function createRecordDescription(description) { return ( - <>{description ? <EllipsisText>{description}</EllipsisText> : "---"}</> + <> + {description ? ( + <EllipsisText>{description}</EllipsisText> + ) : ( + <EmptyValue /> + )} + </> ); } diff --git a/src/views/host/details/HostDetailsTable.js b/src/views/host/details/HostDetailsTable.js index 39e97c3d..9fa9109d 100644 --- a/src/views/host/details/HostDetailsTable.js +++ b/src/views/host/details/HostDetailsTable.js @@ -1,5 +1,5 @@ import React from "react"; -import { KeyValueTable, InternalLink } from "@ess-ics/ce-ui-common"; +import { KeyValueTable, InternalLink, EmptyValue } from "@ess-ics/ce-ui-common"; import { Stack, Typography } from "@mui/material"; export const HostDetailsTable = ({ host }) => { @@ -34,7 +34,7 @@ export const HostDetailsTable = ({ host }) => { </Stack> ); } else { - return "---"; + return <EmptyValue />; } } diff --git a/src/views/records/RecordDetailsView.js b/src/views/records/RecordDetailsView.js index c0986348..4d518391 100644 --- a/src/views/records/RecordDetailsView.js +++ b/src/views/records/RecordDetailsView.js @@ -11,7 +11,8 @@ import { RootPaper, KeyValueTable, GlobalAppBarContext, - InternalLink + InternalLink, + EmptyValue } from "@ess-ics/ce-ui-common"; import { RecordBadge } from "../../components/records/RecordBadge"; import { applicationTitle } from "../../components/common/Helper"; @@ -91,7 +92,7 @@ export function RecordDetailsView() { </InternalLink> </Typography> ) : ( - record?.alias + <EmptyValue /> ), Description: record?.description, Version: record?.iocVersion, -- GitLab