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

Alerting: Fixes clone url for instances hosted on sub path #70543

Merged
merged 1 commit into from Jun 23, 2023

Conversation

gillesdemey
Copy link
Member

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.

: H.createBrowserHistory({ basename: config.appSubUrl ?? '/' }));

@gillesdemey gillesdemey added this to the 10.1.x milestone Jun 22, 2023
@gillesdemey gillesdemey requested a review from a team as a code owner June 22, 2023 18:22
@@ -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);
Copy link
Member Author

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.

Copy link
Contributor

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!

@gillesdemey gillesdemey changed the title Alerting: fixes the clone url for Grafana instances hosted on a sub path Alerting: Fixes clone url for instances hosted on sub path Jun 22, 2023
@konrad147
Copy link
Contributor

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.

Does it mean we should verify all other places where we create URLs?

Copy link
Contributor

@konrad147 konrad147 left a comment

Choose a reason for hiding this comment

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

LGTM!

@gillesdemey
Copy link
Member Author

Does it mean we should verify all other places where we create URLs?

We probably could, but I've a feeling wherever we use createUrl() we're not using passing that in to history.push()

@gillesdemey gillesdemey merged commit dc7e967 into main Jun 23, 2023
21 checks passed
@gillesdemey gillesdemey deleted the alerting/fix-clone-button-url branch June 23, 2023 12:29
@ricky-undeadcoders ricky-undeadcoders modified the milestones: 10.1.x, 10.1.0 Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants