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

Retrieve dashboard by name/title #9

Merged
merged 4 commits into from
Feb 10, 2022
Merged

Retrieve dashboard by name/title #9

merged 4 commits into from
Feb 10, 2022

Conversation

luixx
Copy link
Contributor

@luixx luixx commented Feb 9, 2022

Description

Coming from m0nhawk/grafana_api#91, there is the new function get_dashboard_by_name introduced so the dashboards can be found by name and not only id.

Checklist

  • The patch has appropriate test coverage
  • The patch follows the style guidelines of this project
  • The patch has appropriate comments, particularly in hard-to-understand areas
  • The documentation was updated corresponding to the patch
  • I have performed a self-review of this patch

@luixx luixx requested a review from amotl as a code owner February 9, 2022 12:02
@codecov-commenter
Copy link

codecov-commenter commented Feb 9, 2022

Codecov Report

Merging #9 (9b12c99) into main (ee27df3) will decrease coverage by 0.37%.
The diff coverage is 25.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main       #9      +/-   ##
==========================================
- Coverage   87.55%   87.17%   -0.38%     
==========================================
  Files          17       17              
  Lines         659      663       +4     
==========================================
+ Hits          577      578       +1     
- Misses         82       85       +3     
Impacted Files Coverage Δ
grafana_client/elements/dashboard.py 92.68% <25.00%> (-7.32%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update afa73dc...9b12c99. Read the comment docs.

@amotl
Copy link
Contributor

amotl commented Feb 9, 2022

Dear @luixx,

thanks a stack for your contribution. Do you believe you can add a corresponding test case?

With kind regards,
Andreas.

@luixx
Copy link
Contributor Author

luixx commented Feb 9, 2022

Dear @luixx,

thanks a stack for your contribution. Do you believe you can add a corresponding test case?

With kind regards, Andreas.

Hi, yes i will do this. It probabl takes a little bit.

Greetings Karsten

:return:
"""
get_dashboard_path = "/dashboards/db/%s" % dashboard_name
r = self.api.GET(get_dashboard_path)
Copy link
Contributor

@amotl amotl Feb 9, 2022

Choose a reason for hiding this comment

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

Hi Karsten,

thank you for adding a test case. Currently, it croaks on this line with AttributeError: 'Dashboard' object has no attribute 'api' 1.

While refactoring the package, we slightly changed its internals, so on this spot, self.api became self.client:

Suggested change
r = self.api.GET(get_dashboard_path)
r = self.client.GET(get_dashboard_path)

Can you amend your patch correspondingly? If everything goes right after that, the tests should succeed 2.

With kind regards,
Andreas.

Footnotes

  1. https://github.com/panodata/grafana-client/runs/5128322276

  2. In order to verify it, you can run the test suite on your workstation, like documented in the README 3.
    If that is not possible, you can also inspect the outcome from the test suite by following the links in the "checks" section below.
    image

  3. https://github.com/panodata/grafana-client#software-tests

@amotl amotl changed the title introduced function get_dashboard_by_name Retrieve dashboard by name/title Feb 9, 2022
@luixx
Copy link
Contributor Author

luixx commented Feb 10, 2022

So, i hope everything is fine now.

@amotl
Copy link
Contributor

amotl commented Feb 10, 2022

So, i hope everything is fine now.

Excellent. Thank you again!

@amotl amotl merged commit 170121a into grafana-toolbox:main Feb 10, 2022
@amotl
Copy link
Contributor

amotl commented Mar 16, 2022

Dear Karsten,

we just relased grafana-client==2.2.0, including your contribution. Thank you again!

With kind regards,
Andreas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants