-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
feat: custom favorite filter for dashboards, charts and saved queries #11083
Conversation
Codecov Report
@@ Coverage Diff @@
## master #11083 +/- ##
==========================================
+ Coverage 61.64% 65.81% +4.17%
==========================================
Files 815 815
Lines 38498 38512 +14
Branches 3620 3620
==========================================
+ Hits 23733 25348 +1615
+ Misses 14579 13054 -1525
+ Partials 186 110 -76
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment on API consistency, but other than that looks good!
""" | ||
|
||
name = _("Is favorite") | ||
arg_name = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could even leverage this default and leave it blank in the subclasses :) (re: favorited
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, nice catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would create a BaseOuterJoinFilter with "where" and "on" arguments and then extend it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's interesting can you add more detail or an example?
Added @rusackas as his team will be consuming these API changes as well. |
And on that note, a ping to @pkdotson |
data = json.loads(rv.data.decode("utf-8")) | ||
self.assertEqual(data["count"], len(expected_models)) | ||
assert rv.status_code == 200 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use self.assert200(rv)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it's used nowhere on the test codebase, not written in stone but with pytest
now, we are slowly refactoring to use assert
data = json.loads(rv.data.decode("utf-8")) | ||
self.assertEqual(data["count"], len(expected_models)) | ||
assert rv.status_code == 200 | ||
assert len(expected_models) == data["count"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you change it to basic assert?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not written in stone but with pytest now, we are slowly refactoring to use assert
yield dashboards | ||
|
||
# rollback changes | ||
for dashboard in dashboards: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that rollback will also remove from dashboard_user table and dashboard_slices ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. But, yes it cleans up after dashboard_user
and no dashboard_slices are added so nothing to do here
) | ||
arguments["filters"][0]["value"] = False | ||
uri = f"api/v1/dashboard/?q={prison.dumps(arguments)}" | ||
rv = self.client.get(uri) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not separate to another test case ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, done that
""" | ||
|
||
name = _("Is favorite") | ||
arg_name = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would create a BaseOuterJoinFilter with "where" and "on" arguments and then extend it
…apache#11083) * feat: custom favorite filter for dashboards * lint and sort * add favored for charts * fix tests and lint * more tests and saved query filter * fix tests * fix tests * lint * lint and fix conflict * remove unnecessary prop * separate tests
SUMMARY
Add a new custom filter to fetch a user's favorite and not favorite dashboards, slices or saved queries
Rison/JSON arguments:
ADDITIONAL INFORMATION