Skip to content
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

fix alert link on alerting rule details page to keep the user in same perspective #6186

Merged
merged 1 commit into from Aug 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 16 additions & 4 deletions frontend/public/components/monitoring/alerting.tsx
Expand Up @@ -693,7 +693,11 @@ export const AlertsDetailsPage = withFallback(
<div className="co-resource-item">
<MonitoringResourceIcon resource={RuleResource} />
<Link
to={ruleURL(rule)}
to={
namespace
? `/dev-monitoring/ns/${namespace}/rules/${rule?.id}`
: ruleURL(rule)
}
data-test="alert-rules-detail-resource-link"
className="co-resource-item__resource-name"
>
Expand Down Expand Up @@ -730,7 +734,7 @@ export const AlertsDetailsPage = withFallback(
}),
);

const ActiveAlerts = ({ alerts, ruleID }) => (
const ActiveAlerts = ({ alerts, ruleID, namespace }) => (
<div className="co-m-table-grid co-m-table-grid--bordered">
<div className="row co-m-table-grid__head">
<div className="col-xs-6">Description</div>
Expand All @@ -742,7 +746,15 @@ const ActiveAlerts = ({ alerts, ruleID }) => (
{_.sortBy(alerts, alertDescription).map((a, i) => (
<div className="row co-resource-list__item" key={i}>
<div className="col-xs-6">
<Link className="co-resource-item" data-test="active-alerts" to={alertURL(a, ruleID)}>
<Link
className="co-resource-item"
data-test="active-alerts"
to={
namespace
? `/dev-monitoring/ns/${namespace}/alerts/${ruleID}?${labelsToParams(a.labels)}`
: alertURL(a, ruleID)
}
>
{alertDescription(a)}
</Link>
</div>
Expand Down Expand Up @@ -883,7 +895,7 @@ export const AlertRulesDetailsPage = withFallback(
{_.isEmpty(alerts) ? (
<div className="text-center">None Found</div>
) : (
<ActiveAlerts alerts={alerts} ruleID={rule.id} />
<ActiveAlerts alerts={alerts} ruleID={rule.id} namespace={namespace} />
)}
</div>
</div>
Expand Down