-
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
[dashboard] Fix save issue at Force_V2_Edit mode #5360
[dashboard] Fix save issue at Force_V2_Edit mode #5360
Conversation
@@ -144,6 +144,7 @@ class Controls extends React.PureComponent { | |||
} | |||
/> | |||
{dashboard.dash_save_perm && | |||
dashboard.force_v2_edit && |
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 this be negated? !dashboard.force_v2_edit
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.
force_v2_edit is true when CAN_FALLBACK_TO_DASH_V1_EDIT_MODE is false. Here is to overrule user level save_perm and hide save button.
@@ -43,25 +43,11 @@ class Header extends React.PureComponent { | |||
showV2PromptModal: props.dashboard.promptV2Conversion, | |||
}; | |||
this.toggleShowV2PromptModal = this.toggleShowV2PromptModal.bind(this); | |||
this.handleConvertToV2 = this.handleConvertToV2.bind(this); | |||
this.handleConvertToV2 = props.handleConvertToV2.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.
why do you need to bind a props func? it's already bound at the dashboard level right?
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.
handleConvertToV2
is refactored out into Dashboard component
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.
right but you don't need to bind a function that comes from props.
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.... fixed.
@@ -2169,6 +2169,8 @@ def dashboard(self, dashboard_id): | |||
else: | |||
dashboard_view = 'v1' | |||
prompt_v2_conversion = not force_v1 | |||
if force_v2_edit: |
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 needed for removing the save as
dropdown option in a v1
app? Does this still allow you to click edit when viewing a v1
dashboard to go to the v2
page?
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.
thanks for working on a fix for this! I had a couple questions.
Codecov Report
@@ Coverage Diff @@
## master #5360 +/- ##
==========================================
- Coverage 61.32% 61.31% -0.01%
==========================================
Files 369 369
Lines 23494 23497 +3
Branches 2714 2715 +1
==========================================
Hits 14407 14407
- Misses 9075 9078 +3
Partials 12 12
Continue to review full report at Codecov.
|
} | ||
handleSaveTitle(title) { | ||
this.props.updateDashboardTitle(title); | ||
} | ||
handleConvertToV2(editMode) { |
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.
here, handleConvertToV2
is refactored out into Dashboard component, since this function is called from both Dashboard and Header component.
@@ -2169,6 +2169,8 @@ def dashboard(self, dashboard_id): | |||
else: | |||
dashboard_view = 'v1' | |||
prompt_v2_conversion = not force_v1 | |||
if force_v2_edit: | |||
dash_edit_perm = False |
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 line disallow owner to save original v1 dashboard copy. Edit dashboard
button in Header controls used dash_save_perm
, which is not affected.
84838f7
to
b392e6a
Compare
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.
nice! thanks again for looking at this 🙌
(cherry picked from commit a17f714)
(cherry picked from commit a17f714)
(cherry picked from commit a17f714)
(cherry picked from commit a17f714)
(cherry picked from commit a17f714)
(cherry picked from commit a17f714)
(cherry picked from commit a17f714)
Fix 2 issues for dashboard when set config
CAN_FALLBACK_TO_DASH_V1_EDIT_MODE = False
if dashboard is still in v1 mode:
Edit dashboard
button in V1 mode, we will show dashboard in v2 preview mode, and user can convert and save dashboard to v2 mode.