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

Prometheus: Fix link to Prometheus graph in dashboard #29543

Merged
merged 5 commits into from Dec 4, 2020

Conversation

ivanahuckova
Copy link
Member

What this PR does / why we need it:
The href was set only in componentDidUpdate. Therefore to have href correct, you've had to interact with editor. This PR fixes it + adds test coverage.

Which issue(s) this PR fixes:
Fixes #29444

@ivanahuckova ivanahuckova requested a review from a team as a code owner December 2, 2020 17:17
@ivanahuckova ivanahuckova requested review from davkal, zoltanbedi and torkelo and removed request for a team and torkelo December 2, 2020 17:17
@@ -18,6 +18,14 @@ interface State {
export default class PromLink extends Component<Props, State> {
Copy link
Member

Choose a reason for hiding this comment

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

Would it be too much to ask to refactor this component to a function component? 😄

2 things I noticed

  • the same logic is used in componentDidMount and componentDidUpdate
  • getExternalLink is async because?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, not much work at all. And you are totally right ⭐️ - leave the code in better shape than.... So I refactored it to hooks + as I was adding tests, I switched to react-testing-library. 🙂

Copy link
Member Author

Choose a reason for hiding this comment

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

Also async was not necessary.

Copy link
Member

@zoltanbedi zoltanbedi left a comment

Choose a reason for hiding this comment

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

Thank you! This looks awesome with the refactor. Good job. 🐥

@ivanahuckova ivanahuckova self-assigned this Dec 4, 2020
@ivanahuckova ivanahuckova added this to the 7.4.0 milestone Dec 4, 2020
@ivanahuckova ivanahuckova merged commit 3018c6a into master Dec 4, 2020
Observability (deprecated, use Observability Squad) automation moved this from Under review to Done Dec 4, 2020
@ivanahuckova ivanahuckova deleted the ivana/prom-link branch December 4, 2020 16:01
ryantxu pushed a commit that referenced this pull request Dec 8, 2020
* Fix Promlink to have href after componentDidMount

* Refactor to hooks and react testing library

* Update

* Update snapshot test
@mjseaman mjseaman added this to the 7.4.0 milestone Jan 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Link to Prometheus graph in edit mode not always working
3 participants