-
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: add active email toggle and dropdown on dashboard #15852
feat: add active email toggle and dropdown on dashboard #15852
Conversation
e6cff06
to
f09ac62
Compare
Codecov Report
@@ Coverage Diff @@
## selfSubscribeReports #15852 +/- ##
========================================================
- Coverage 77.02% 76.97% -0.06%
========================================================
Files 988 989 +1
Lines 51955 51997 +42
Branches 7090 7093 +3
========================================================
+ Hits 40020 40026 +6
- Misses 11710 11746 +36
Partials 225 225
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
import React, { useState } from 'react'; |
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.
do you think we can put this dropdown in the same root folder as the report modal?
}: { | ||
showReportModal: () => void; | ||
hideReportModal: () => void; | ||
report: JsonObject; |
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 define a type for the report?
// useOnClickOutside(ref, () => setVisible(false)); | ||
|
||
const toggleActive = async (data: AlertObject, checked: boolean) => { | ||
if (data && data.id) { |
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.
optional chaining
const toggleActive = async (data: AlertObject, checked: boolean) => { | ||
if (data && data.id) { | ||
const update_id = data.id; | ||
await updateResource(update_id, { active: checked }).then(() => { |
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.
the resource hooks should automatically update the state and return them. Can you use that instead of having separate state here?
@@ -156,7 +157,7 @@ class Header extends React.PureComponent { | |||
this.hidePropertiesModal = this.hidePropertiesModal.bind(this); | |||
this.showReportModal = this.showReportModal.bind(this); | |||
this.hideReportModal = this.hideReportModal.bind(this); | |||
this.handleReportClick = this.handleReportClick.bind(this); | |||
this.reportModal = this.reportModal.bind(this); |
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 make this more "action/verb" sounding for a method, like renderReportModal, or else we can make it a separate component outside the header (could be the same file)
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.
yeah I wasn't happy with this and couldn't place my finger on it, I had spaced on using render, sorry.
if (!attachedReportExists) { | ||
this.showReportModal(); | ||
} | ||
return !attachedReportExists ? ( |
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 you flip the return logic so that you can lead with the positive statement rather than negative? Just for ease of readability.
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, that makes so much sense.
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.
looks good. Just a few small things
751bf99
to
4be1a8f
Compare
cb3896e
to
b81f120
Compare
report={this.props.report.result} | ||
/> | ||
) : ( | ||
<> |
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.
nit for another iteration, but I don't think you need these extra brackets since you only have one child
Just need to rebase some extra commits out of here before we merge. |
f52816a
to
522a161
Compare
c71c4b5
to
fac1f59
Compare
fac1f59
to
bffde76
Compare
* first draft * added testing props * created Api call * added click logic * made the fetch report into a action/reducer * abstracted report action * first commit * toggle started * on blue * event listener * toggle * toggle active + dropdown * fixed cypress tests * revisions * removed useState * added toggle active to state
SUMMARY
This is part of a redesign of how users can add reports in superset. Specifically, that people can add a report on a dashboard. This feature adds a dropdown when there is a report present, so that you can toggle its active status.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Screen.Recording.2021-07-21.at.4.34.02.PM.mov
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION