mirror of
https://github.com/coder/coder.git
synced 2025-07-21 01:28:49 +00:00
refactor(site): improve how string values are displayed (#9273)
This commit is contained in:
@ -30,12 +30,12 @@ import { subDays, isToday } from "date-fns"
|
|||||||
import "react-date-range/dist/styles.css"
|
import "react-date-range/dist/styles.css"
|
||||||
import "react-date-range/dist/theme/default.css"
|
import "react-date-range/dist/theme/default.css"
|
||||||
import { DateRange, DateRangeValue } from "./DateRange"
|
import { DateRange, DateRangeValue } from "./DateRange"
|
||||||
import OpenInNewOutlined from "@mui/icons-material/OpenInNewOutlined"
|
|
||||||
import Link from "@mui/material/Link"
|
import Link from "@mui/material/Link"
|
||||||
import CheckCircleOutlined from "@mui/icons-material/CheckCircleOutlined"
|
import CheckCircleOutlined from "@mui/icons-material/CheckCircleOutlined"
|
||||||
import CancelOutlined from "@mui/icons-material/CancelOutlined"
|
import CancelOutlined from "@mui/icons-material/CancelOutlined"
|
||||||
import { getDateRangeFilter } from "./utils"
|
import { getDateRangeFilter } from "./utils"
|
||||||
import Tooltip from "@mui/material/Tooltip"
|
import Tooltip from "@mui/material/Tooltip"
|
||||||
|
import LinkOutlined from "@mui/icons-material/LinkOutlined"
|
||||||
|
|
||||||
export default function TemplateInsightsPage() {
|
export default function TemplateInsightsPage() {
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
@ -393,10 +393,6 @@ const ParameterUsageLabel = ({
|
|||||||
usage: TemplateParameterValue
|
usage: TemplateParameterValue
|
||||||
parameter: TemplateParameterUsage
|
parameter: TemplateParameterUsage
|
||||||
}) => {
|
}) => {
|
||||||
if (usage.value.trim() === "") {
|
|
||||||
return <Box component="span">Not set</Box>
|
|
||||||
}
|
|
||||||
|
|
||||||
if (parameter.options) {
|
if (parameter.options) {
|
||||||
const option = parameter.options.find((o) => o.value === usage.value)!
|
const option = parameter.options.find((o) => o.value === usage.value)!
|
||||||
const icon = option.icon
|
const icon = option.icon
|
||||||
@ -441,8 +437,14 @@ const ParameterUsageLabel = ({
|
|||||||
color: (theme) => theme.palette.text.primary,
|
color: (theme) => theme.palette.text.primary,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<OpenInNewOutlined sx={{ width: 14, height: 14 }} />
|
<TextValue>{usage.value}</TextValue>
|
||||||
{usage.value}
|
<LinkOutlined
|
||||||
|
sx={{
|
||||||
|
width: 14,
|
||||||
|
height: 14,
|
||||||
|
color: (theme) => theme.palette.primary.light,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</Link>
|
</Link>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -506,7 +508,7 @@ const ParameterUsageLabel = ({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return <Box>{usage.value}</Box>
|
return <TextValue>{usage.value}</TextValue>
|
||||||
}
|
}
|
||||||
|
|
||||||
const Panel = styled(Box)(({ theme }) => ({
|
const Panel = styled(Box)(({ theme }) => ({
|
||||||
@ -553,6 +555,34 @@ const NoDataAvailable = (props: BoxProps) => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const TextValue = ({ children }: { children: ReactNode }) => {
|
||||||
|
return (
|
||||||
|
<Box component="span">
|
||||||
|
<Box
|
||||||
|
component="span"
|
||||||
|
sx={{
|
||||||
|
color: (theme) => theme.palette.text.secondary,
|
||||||
|
weight: 600,
|
||||||
|
mr: 0.25,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
"
|
||||||
|
</Box>
|
||||||
|
{children}
|
||||||
|
<Box
|
||||||
|
component="span"
|
||||||
|
sx={{
|
||||||
|
color: (theme) => theme.palette.text.secondary,
|
||||||
|
weight: 600,
|
||||||
|
ml: 0.25,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
"
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
function mapToDAUsResponse(
|
function mapToDAUsResponse(
|
||||||
data: TemplateInsightsResponse["interval_reports"],
|
data: TemplateInsightsResponse["interval_reports"],
|
||||||
): DAUsResponse {
|
): DAUsResponse {
|
||||||
|
Reference in New Issue
Block a user