Skip to content

Comments

feat: mini charts for safeguards#11082

Merged
kwasniew merged 7 commits intomainfrom
safeguard-mini-chart-version-2
Dec 4, 2025
Merged

feat: mini charts for safeguards#11082
kwasniew merged 7 commits intomainfrom
safeguard-mini-chart-version-2

Conversation

@kwasniew
Copy link
Contributor

@kwasniew kwasniew commented Dec 4, 2025

About the changes

mini chart when configuring safeguard. auto updates on a change to any form field
Screenshot 2025-12-04 at 11 20 39

on hover you get full chart with a link to feature impact metrics
Screenshot 2025-12-04 at 11 20 44

Important files

Discussion points

@vercel
Copy link

vercel bot commented Dec 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
unleash-docs Ready Ready Preview Dec 4, 2025 11:16am

@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

metricName={metricName}
timeRange={timeRange}
labelSelectors={labelSelectors}
yAxisMin='auto'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to sync this with backend creating auto charts. @sjaanus do you create auto or starting form zero in the backend code?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is auto


if (!__name__ && !labelParts) {
return 'Series';
return 'Value';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

previous name was misleading when hovering over line and seeing "series"

: undefined;
const maxTime = end ? fromUnixTime(Number.parseInt(end, 10)) : undefined;

const placeholder = metricName ? (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

untangling double nested ternaries

noSeriesPlaceholder?: ReactNode;
isPreview?: boolean;
showComponents?: ChartComponent[];
thresholdCondition?: ThresholdCondition;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need threshold and operator anymore, only threshold value to draw the line

};

// This is matching backend logic which looks for a single outlier
const isThresholdConditionMet = (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't change line color based on threshold exceeded anymore

@kwasniew kwasniew requested a review from sjaanus December 4, 2025 10:46
Comment on lines 62 to 74
sx={{
display: 'flex',
alignItems: 'center',
gap: 0.25,
whiteSpace: 'nowrap',
textDecoration: 'none',
fontWeight: 'bold',
fontSize: 'body2.fontSize',
color: 'primary.main',
'&:hover': {
textDecoration: 'none',
},
}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use styled component, not such huge sx.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeap, had it stashed locally

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you are touching this file, SafeguardFormBase should have props type defined, not inlined. It already has 7 properties.

Comment on lines 403 to 404
metricOptions.find((m) => m.name === metricName)
?.displayName
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a variable declared before.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call

Copy link
Contributor

@sjaanus sjaanus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG, but with minor code style issues.

@github-project-automation github-project-automation bot moved this from New to Approved PRs in Issues and PRs Dec 4, 2025
@kwasniew kwasniew added the 👤🤝🤖 half-half Roughly equal human-LLM collaboration label Dec 4, 2025
@kwasniew kwasniew merged commit 8491d34 into main Dec 4, 2025
9 checks passed
@kwasniew kwasniew deleted the safeguard-mini-chart-version-2 branch December 4, 2025 11:21
@github-project-automation github-project-automation bot moved this from Approved PRs to Done in Issues and PRs Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

👤🤝🤖 half-half Roughly equal human-LLM collaboration

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants