-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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(dashboard): confirm overwrite to prevent unintended changes #21819
feat(dashboard): confirm overwrite to prevent unintended changes #21819
Conversation
Codecov Report
@@ Coverage Diff @@
## master #21819 +/- ##
==========================================
+ Coverage 65.72% 66.94% +1.22%
==========================================
Files 1809 1809
Lines 69335 69178 -157
Branches 7413 7401 -12
==========================================
+ Hits 45571 46313 +742
+ Misses 21853 20952 -901
- Partials 1911 1913 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
{ | ||
keyPath: 'json_metadata.filter_scopes', | ||
oldValue: | ||
'{\n "122": {\n "ethnic_minority": {\n "scope": [\n "ROOT_ID"\n ],\n "immune": []\n },\n "gender": {\n "scope": [\n "ROOT_ID"\n ],\n "immune": []\n },\n "developer_type": {\n "scope": [\n "ROOT_ID"\n ],\n "immune": []\n },\n "lang_at_home": {\n "scope": [\n "ROOT_ID"\n ],\n "immune": []\n },\n "country_live": {\n "scope": [\n "ROOT_ID"\n ],\n "immune": []\n }\n }\n}', |
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.
Should we add \t
here and/or compare the old/new without the formatting, i.e., as a parsed JSON blob?
Thanks for this exciting feature @justinpark! Some first-pass comments: 1 - Can we rename the feature flag to a shorter name like 2 - Can you add the new feature flag to 3 - Can we set a min/max width/height to the modal to avoid the situation where it takes the whole screen? 4 - Can we make the modal appear only when there's a change to the scope or CSS? Unrelated changes shouldn't present it. 5 - Is it possible to make the scope changes more user-friendly? It's showing ID diffs that are not traceable to the screen. Maybe add the chart names to the diff or use a different kind of scope representation when comparing. |
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.
++ to @michael-s-molina 's comments.
A diff modal is a useful add when some of the updates may be implicit but I agree more visual diffs would be nice. I'm also wondering if in the long run we should strive for not requiring diff confirmation as we get more confident that the updates would not accidentally make unwanted changes.
If this is only meant to be temporary---which I'd assume is the case since it's in a feature flag, I think it'd be okay to just show JSON diffs.
@@ -48,6 +48,7 @@ export enum FeatureFlag { | |||
ENABLE_JAVASCRIPT_CONTROLS = 'ENABLE_JAVASCRIPT_CONTROLS', | |||
ENABLE_TEMPLATE_PROCESSING = 'ENABLE_TEMPLATE_PROCESSING', | |||
ENABLE_TEMPLATE_REMOVE_FILTERS = 'ENABLE_TEMPLATE_REMOVE_FILTERS', | |||
ENABLE_CONFIRM_OVERWRITE_DASHBOARD_METADATA = 'ENABLE_CONFIRM_OVERWRITE_DASHBOARD_METADATA', |
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.
ENABLE_CONFIRM_OVERWRITE_DASHBOARD_METADATA = 'ENABLE_CONFIRM_OVERWRITE_DASHBOARD_METADATA', | |
CONFIRM_DASHBOARD_DIFF = 'CONFIRM_DASHBOARD_DIFF', |
keyPath: 'css', | ||
oldValue: '', | ||
newValue: | ||
".navbar {\n transition: opacity 0.5s ease;\n opacity: 0.05;\n}\n.navbar:hover {\n opacity: 1;\n}\n.chart-header .header{\n font-weight: @font-weight-normal;\n font-size: 12px;\n}\n/*\nvar bnbColors = [\n //rausch hackb kazan babu lima beach tirol\n '#ff5a5f', '#7b0051', '#007A87', '#00d1c1', '#8ce071', '#ffb400', '#b4a76c',\n '#ff8083', '#cc0086', '#00a1b3', '#00ffeb', '#bbedab', '#ffd266', '#cbc29a',\n '#ff3339', '#ff1ab1', '#005c66', '#00b3a5', '#55d12e', '#b37e00', '#988b4e',\n ];\n*/\n", |
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 this file is manually generated, could we use template literals to display multiline strings instead?
latestUpdatedAt: '2022-10-07T16:35:30.924212', | ||
latestUpdatedBy: 'Superset Admin', |
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.
latestUpdatedAt: '2022-10-07T16:35:30.924212', | |
latestUpdatedBy: 'Superset Admin', | |
updatedAt: '2022-10-07T16:35:30.924212', | |
updatedBy: 'Superset Admin' |
Nit: I think this is clear enough.
|
||
return SupersetClient.put({ |
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 this dispatch function returns a promise, can we just rewrite it with async/await
?
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.
It should be better to have a separate PR for the async/await
migration.
} | ||
onHide={onHide} | ||
> | ||
<> |
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 fragment needed?
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 catch. removed
title={t('Confirm overwrite')} | ||
footer={ | ||
<> | ||
{t('* Scroll down to the bottom to complete the review. ')} |
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.
{t('* Scroll down to the bottom to complete the review. ')} | |
{t('Scroll down to the bottom to complete the review. ')} |
Not sure if *
is needed.
cta | ||
buttonStyle="primary" | ||
onClick={onConfirmOverwrite} | ||
disabled={!hasReviewed} |
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.
Add a tooltip to explain the disabled state?
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.
`} | ||
`; | ||
|
||
const StackableHeader = styled(Button)<{ top: number }>` |
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.
This header is currently rendered as all caps (probably inherited style from Button
). Is that what we want?
I updated to
Yes. updated.
Yes I added the maxWidth using
Sure. The modal only pops up when the following values are changed.
as @ktmud commented, it becomes complicated to access the scope labels and its hierarchy. I'll follow up this improvement in the next step. |
c6e9b24
to
0ca291d
Compare
@michael-s-molina do you have any objections with the approach? We'd like to kick off the feature with JSON diffs first. (and then will follow up the improved labels version) |
No problem 👍🏼 |
Great! can you approve the change? (it's blocked by the reviewers) |
…che#21819) (cherry picked from commit ef6b9a9)
SUMMARY
At Airbnb, there's reasonable amount of reporting about unintended overwritten of filter scopes settings.
We believe there must be unknown overwriting on json_metadata by other authors during editing. (json_metadata can be easily overwritten since it passes all attributes including unchanged values.)
This commit introduces the inspection step for this high volatility value changes and then proceed to update with the user's confirmation. (the inspection items are defined here)
This commit also adds the logging for the user confirmation.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
review-overwrite-values.mov
TESTING INSTRUCTIONS
ENABLE_CONFIRM_OVERWRITE_DASHBOARD_METADATA
feature flag to trueADDITIONAL INFORMATION
ENABLE_CONFIRM_OVERWRITE_DASHBOARD_METADATA
cc: @ktmud @john-bodley