Skip to content

refactor(site): remove template parameters insights out of experimental #9126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 16, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add usage list header
  • Loading branch information
BrunoQuaresma committed Aug 16, 2023
commit e65fedcc170fecfc89f53d3f7aceadf703b09ca8
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ 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 { HelpOutlineOutlined } from "@mui/icons-material"
import Tooltip from "@mui/material/Tooltip"

export default function TemplateInsightsPage() {
const now = new Date()
Expand Down Expand Up @@ -339,25 +341,34 @@ const TemplateParametersUsagePanel = ({
</Box>
</Box>
<Box sx={{ flex: 1, fontSize: 14 }}>
<ParameterUsageRow
sx={{
color: (theme) => theme.palette.text.secondary,
fontWeight: 500,
fontSize: 13,
cursor: "default",
}}
>
<Box>Value</Box>
<Tooltip
title="The number of workspaces using this value"
placement="top"
>
<Box>Count</Box>
</Tooltip>
</ParameterUsageRow>
{parameter.values
.sort((a, b) => b.count - a.count)
.map((usage, usageIndex) => (
<Box
<ParameterUsageRow
key={`${parameterIndex}-${usageIndex}`}
sx={{
display: "flex",
alignItems: "baseline",
justifyContent: "space-between",
py: 0.5,
gap: 5,
}}
>
<ParameterUsageLabel
usage={usage}
parameter={parameter}
/>
<Box sx={{ textAlign: "right" }}>{usage.count}</Box>
</Box>
</ParameterUsageRow>
))}
</Box>
</Box>
Expand All @@ -368,6 +379,14 @@ const TemplateParametersUsagePanel = ({
)
}

const ParameterUsageRow = styled(Box)(({ theme }) => ({
display: "flex",
alignItems: "baseline",
justifyContent: "space-between",
padding: theme.spacing(0.5, 0),
gap: theme.spacing(5),
}))

const ParameterUsageLabel = ({
usage,
parameter,
Expand All @@ -376,16 +395,7 @@ const ParameterUsageLabel = ({
parameter: TemplateParameterUsage
}) => {
if (usage.value.trim() === "") {
return (
<Box
component="span"
sx={{
color: (theme) => theme.palette.text.secondary,
}}
>
Not set
</Box>
)
return <Box component="span">Not set</Box>
}

if (parameter.options) {
Expand Down