From 5f790496390f93bb81bde467a8ae224f9ce0ba43 Mon Sep 17 00:00:00 2001 From: BrunoQuaresma Date: Wed, 23 Aug 2023 13:01:08 +0000 Subject: [PATCH] refactor(site): improve how string values are displayed --- .../TemplateInsightsPage.tsx | 46 +++++++++++++++---- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/site/src/pages/TemplatePage/TemplateInsightsPage/TemplateInsightsPage.tsx b/site/src/pages/TemplatePage/TemplateInsightsPage/TemplateInsightsPage.tsx index 131d13104ded4..2e38cc1f9b081 100644 --- a/site/src/pages/TemplatePage/TemplateInsightsPage/TemplateInsightsPage.tsx +++ b/site/src/pages/TemplatePage/TemplateInsightsPage/TemplateInsightsPage.tsx @@ -30,12 +30,12 @@ import { subDays, isToday } from "date-fns" import "react-date-range/dist/styles.css" import "react-date-range/dist/theme/default.css" import { DateRange, DateRangeValue } from "./DateRange" -import OpenInNewOutlined from "@mui/icons-material/OpenInNewOutlined" import Link from "@mui/material/Link" import CheckCircleOutlined from "@mui/icons-material/CheckCircleOutlined" import CancelOutlined from "@mui/icons-material/CancelOutlined" import { getDateRangeFilter } from "./utils" import Tooltip from "@mui/material/Tooltip" +import LinkOutlined from "@mui/icons-material/LinkOutlined" export default function TemplateInsightsPage() { const now = new Date() @@ -393,10 +393,6 @@ const ParameterUsageLabel = ({ usage: TemplateParameterValue parameter: TemplateParameterUsage }) => { - if (usage.value.trim() === "") { - return Not set - } - if (parameter.options) { const option = parameter.options.find((o) => o.value === usage.value)! const icon = option.icon @@ -441,8 +437,14 @@ const ParameterUsageLabel = ({ color: (theme) => theme.palette.text.primary, }} > - - {usage.value} + {usage.value} + theme.palette.primary.light, + }} + /> ) } @@ -506,7 +508,7 @@ const ParameterUsageLabel = ({ ) } - return {usage.value} + return {usage.value} } const Panel = styled(Box)(({ theme }) => ({ @@ -553,6 +555,34 @@ const NoDataAvailable = (props: BoxProps) => { ) } +const TextValue = ({ children }: { children: ReactNode }) => { + return ( + + theme.palette.text.secondary, + weight: 600, + mr: 0.25, + }} + > + " + + {children} + theme.palette.text.secondary, + weight: 600, + ml: 0.25, + }} + > + " + + + ) +} + function mapToDAUsResponse( data: TemplateInsightsResponse["interval_reports"], ): DAUsResponse {