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: return type for dashboard when include is used #321

Merged
merged 7 commits into from
Aug 27, 2021
Merged

fix: return type for dashboard when include is used #321

merged 7 commits into from
Aug 27, 2021

Conversation

abhi1693
Copy link
Contributor

@abhi1693 abhi1693 commented Aug 25, 2021

Closes #

Proposed Changes

Briefly describe your proposed changes:
I have only updated the return type for the GET operation on the dashboard service. When the parameter include=properties is passed to the methods, even though the correct API calls are made, the returned object does not include cell properties.

To fix the issue, DashboardWithViewProperties is returned instead of Dashboard. Using this without include returns None for cell properties thereby keeping the original code intact.

Checklist

  • CHANGELOG.md updated
  • Rebased/mergeable
  • A test has been added if appropriate
  • pytest tests completes successfully
  • Commit messages are in semantic format
  • Sign CLA (if not already signed)

@abhi1693 abhi1693 changed the title Fixed return type when include is used fix: return type for dashboard when include is used Aug 25, 2021
@codecov-commenter
Copy link

codecov-commenter commented Aug 25, 2021

Codecov Report

Merging #321 (c902f07) into master (d22a361) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #321   +/-   ##
=======================================
  Coverage   92.53%   92.53%           
=======================================
  Files          27       27           
  Lines        2211     2211           
=======================================
  Hits         2046     2046           
  Misses        165      165           

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 d22a361...c902f07. Read the comment docs.

Copy link
Contributor

@bednar bednar left a comment

Choose a reason for hiding this comment

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

Thanks for your PR 👍. There are a few requirements that should be satisfy before we accept the PR:

  1. Please update CHANGELOG.md
  2. Please add test for your changes into test_Dashboards.py. Something like following code will be pretty fine:
def test_get_dashboard_with_cell_with_properties(self):
    unique_id = str(datetime.datetime.now().timestamp())

    dashboard = self.dashboards_service.post_dashboards(
        create_dashboard_request=CreateDashboardRequest(org_id=self.find_my_org().id, name=f"Dashboard_{unique_id}_IT"))

    # create cell
    CellsService(self.client.api_client).post_dashboards_id_cells(
        dashboard_id=dashboard.id, create_cell=CreateCell(name=f"Cell_{unique_id}_IT", h=3, w=12))

    # retrieve dashboard
    dashboard = self.dashboards_service.get_dashboards_id(dashboard.id)

    from influxdb_client import DashboardWithViewProperties, CellWithViewProperties
    self.assertEqual(DashboardWithViewProperties, type(dashboard))
    self.assertEqual(1, len(dashboard.cells))
    self.assertEqual(CellWithViewProperties, type(dashboard.cells[0]))

@abhi1693 abhi1693 requested a review from bednar August 26, 2021 13:43
Copy link
Contributor

@bednar bednar left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@bednar bednar merged commit 4a16049 into influxdata:master Aug 27, 2021
@bednar bednar added this to the 1.21.0 milestone Aug 27, 2021
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