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
Alerting: Fixes clone url for instances hosted on sub path #70543
Conversation
@@ -20,10 +19,10 @@ export const CloneRuleButton = React.forwardRef<HTMLAnchorElement, CloneRuleButt | |||
({ text, ruleIdentifier, isProvisioned, className }, ref) => { | |||
// For provisioned rules an additional confirmation step is required | |||
// Users have to be aware that the cloned rule will NOT be marked as provisioned | |||
const [provRuleCloneUrl, setProvRuleCloneUrl] = useState<string | undefined>(undefined); | |||
const [showModal, setShowModal] = useState(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why the state was previously tracking the same value as cloneUrl
, it's always computed when the component is rendered and we were always using a boolean check for this value anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me neither 😅 The change looks good!
Does it mean we should verify all other places where we create URLs? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
We probably could, but I've a feeling wherever we use |
What is this feature?
A small fix for cloning alert rules when Grafana is hosted on a sub path.
Special notes for your reviewer:
The code changes will seem counter-intuitive because I'm no longer using the function that prepends the sub path. This is because
history.push
already accounts for the sub path on which Grafana is currently mounted.grafana/packages/grafana-runtime/src/services/LocationService.ts
Line 40 in cda5a0c