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

chore: add changed_on_delta_humanized field on dashboard schema #15542

Merged
merged 2 commits into from
Jul 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions superset/dashboards/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ class DashboardGetResponseSchema(Schema):
owners = fields.List(fields.Nested(UserSchema))
roles = fields.List(fields.Nested(RolesSchema))
table_names = fields.String() # legacy nonsense
changed_on_humanized = fields.String(data_key="changed_on_delta_humanized")
Copy link
Member Author

Choose a reason for hiding this comment

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

  1. superset.models.helps.AuditMixinNullable.changed_on_delta_humanized is a instance method, unable to serializes.
  2. ensure DashboardRestApi list_column and dashboard metadata are the same

Copy link
Member

Choose a reason for hiding this comment

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

to ensure 2. we should add show_columns = list_columns on the REST API class, and follow the same existing pattern

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 will follow this PR, thanks, Daniel.



class DatabaseSchema(Schema):
Expand Down
3 changes: 2 additions & 1 deletion tests/integration_tests/dashboards/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,10 @@ def test_get_dashboard(self):
}
data = json.loads(rv.data.decode("utf-8"))
self.assertIn("changed_on", data["result"])
self.assertIn("changed_on_delta_humanized", data["result"])
for key, value in data["result"].items():
# We can't assert timestamp values
if key != "changed_on":
if key not in ("changed_on", "changed_on_delta_humanized",):
self.assertEqual(value, expected_result[key])
# rollback changes
db.session.delete(dashboard)
Expand Down