-
Notifications
You must be signed in to change notification settings - Fork 13.8k
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(alerts): enable tab selection for dashboard alerts/reports #29096
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #29096 +/- ##
==========================================
+ Coverage 60.48% 70.39% +9.91%
==========================================
Files 1931 1969 +38
Lines 76236 78935 +2699
Branches 8568 9014 +446
==========================================
+ Hits 46114 55570 +9456
+ Misses 28017 21150 -6867
- Partials 2105 2215 +110
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
7984f28
to
43a0fa6
Compare
0361493
to
0cbe1ac
Compare
ebf1fdd
to
9cf1063
Compare
9cf1063
to
9860098
Compare
9860098
to
a86e642
Compare
a86e642
to
5f88f9b
Compare
892e267
to
8a14c24
Compare
if dashboard_state := self._report_schedule.extra.get("dashboard"): | ||
if ( | ||
dashboard_state := self._report_schedule.extra.get("dashboard") | ||
) and feature_flag_manager.is_feature_enabled("ALERT_REPORT_TABS"): |
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 this supposed to be an and
?
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.
yes, the logic here is saying that if there is dashboard metadata and the feature flag is enabled, open in a stateful permalink, else open in the normal url without permalinks.
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.
What I am saying is that now this is only applied if the ALERT_REPORT_TABS
is enabled but shouldn't it be applied anyway if there is an extra
parameter? Is there a reason to tie this to the ALERT_REPORT_TABS
FF?
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.
My rationale for hiding that functionality behind the ALERT_REPORT_TABS
FF was that if a report was saved with an extra
parameter, then the FF was turned off, there would no longer be an interface for viewing/updating the currently selected tab. It seemed more intuitive to have the behavior default to ignoring the extra
parameter altogether while the FF was disabled.
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.
If we are confident that extra is only used for this use case, then it's good.
/testenv up FLAG_ALERT_REPORTS = True |
@yousoph Ephemeral environment spinning up at http://35.94.63.93:8080. Credentials are |
/testenv up FEATURE_ALERT_REPORTS = True |
@yousoph Ephemeral environment spinning up at http://34.221.90.242:8080. Credentials are |
/testenv up FEATURE_ALERT_REPORTS=True |
@yousoph Ephemeral environment spinning up at http://35.94.142.6:8080. Credentials are |
8b6f683
to
db7c487
Compare
db7c487
to
803ffc0
Compare
/testenv up FEATURE_ALERT_REPORTS=True |
@yousoph Ephemeral environment spinning up at http://34.214.205.147:8080. Credentials are |
const { tab_tree: tabTree, all_tabs: allTabs } = response.json.result; | ||
setTabOptions(tabTree); | ||
if (currentAlert?.extra?.dashboard?.anchor) { | ||
if (!(currentAlert?.extra?.dashboard?.anchor in allTabs)) { |
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.
You are already checking above if this exists. Maybe it would help readability to move it inside a const.
const anchor = currentAlert?.extra?.dashboard?.anchor
if (anchor && !anchor in allTabs)...
if dashboard_state := self._report_schedule.extra.get("dashboard"): | ||
if ( | ||
dashboard_state := self._report_schedule.extra.get("dashboard") | ||
) and feature_flag_manager.is_feature_enabled("ALERT_REPORT_TABS"): |
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.
What I am saying is that now this is only applied if the ALERT_REPORT_TABS
is enabled but shouldn't it be applied anyway if there is an extra
parameter? Is there a reason to tie this to the ALERT_REPORT_TABS
FF?
Functionality wise - looks good! Thanks @fisjac |
@@ -593,6 +605,22 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({ | |||
setNotificationAddState('active'); | |||
}; | |||
|
|||
const updateAnchorState = (value: any) => { |
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.
Can we use more specific type?
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.
Ideally, I'd like for this to be typed as string | undefined
, but I'm running into issues from antd's typing for the onSelect
prop which is typed as 'RawValueType | LabelValueType'
and throws an error on compile when typed as such. I've used any
as a workaround.
/testenv up FEATURE_ALERT_REPORTS=True FEATURE_ALERT_REPORT_TABS = True |
@yousoph Ephemeral environment spinning up at http://54.213.240.222:8080. Credentials are |
/testenv up FEATURE_ALERT_REPORTS=True FEATURE_ALERT_REPORT_TABS=True |
@yousoph Ephemeral environment spinning up at http://54.213.76.60:8080. Credentials are |
Any reason not to merge this? Itchy trigger finger kicking in ;) |
there are only reasons to merge it 🤠 |
Ephemeral environment shutdown and build artifacts deleted. |
SUMMARY
Implements a new feature enabling a tab to be selected as a view for an alert/report. When a dashboard is selected as the content for a report, an antd TreeSelect component is rendered to load and select tab options. When selected, the tab selection is added to the report payload as an anchor.
On execution, the feature takes advantage of existing logic for the report.extra.dashboard.anchor_tab attribute of the ReportSchedule SQLA model. When extra metadata are attached to the report schedule, a permalink is generated with the metadata included, and this permalink is then used to generate screenshots of the selected dashboard.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
https://www.loom.com/share/e075b22bd5574e30bcf3bbec5984884f?sid=aeefd476-bf0a-4289-b13f-6b5fe2854156
TESTING INSTRUCTIONS
Create a tab or tabs within an existing dashboard
Navigate to the alerts and reports listview from the settings menu
Create a new report
Under the content section select the dashboard
A selection field for tabs should appear with the tabs available within the select options
select a tab and save the report with the other required fields
at the selected interval, a report should be sent out with the selected tab in focus
ADDITIONAL INFORMATION