Skip to content
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

Fardin #32225

Closed
wants to merge 10 commits into from
2 changes: 2 additions & 0 deletions superset-frontend/src/dashboard/actions/dashboardLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ export function handleComponentDrop(dropResult) {
};
}

export const clearDashboardHistory = () => UndoActionCreators.clearHistory();

// Undo redo ------------------------------------------------------------------
export function undoLayoutAction() {
return (dispatch, getState) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import {
import {
deleteTopLevelTabs,
handleComponentDrop,
clearDashboardHistory,
} from 'src/dashboard/actions/dashboardLayout';
import {
DASHBOARD_GRID_ID,
Expand Down Expand Up @@ -675,7 +676,10 @@ const DashboardBuilder = () => {
)
}
buttonText={canEdit && t('Edit the dashboard')}
buttonAction={() => dispatch(setEditMode(true))}
buttonAction={() => {
dispatch(setEditMode(true));
dispatch(clearDashboardHistory());
}}
image="dashboard.svg"
/>
)}
Expand Down
8 changes: 7 additions & 1 deletion superset-frontend/src/dashboard/components/Header/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ import {
redoLayoutAction,
undoLayoutAction,
updateDashboardTitle,
clearDashboardHistory,
} from '../../actions/dashboardLayout';
import {
fetchCharts,
Expand Down Expand Up @@ -221,6 +222,7 @@ const Header = () => {
addWarningToast,
onUndo: undoLayoutAction,
onRedo: redoLayoutAction,
clearDashboardHistory,
setEditMode,
setUnsavedChanges,
fetchFaveStar,
Expand Down Expand Up @@ -651,7 +653,10 @@ const Header = () => {
{userCanEdit && (
<Button
buttonStyle="secondary"
onClick={toggleEditMode}
onClick={() => {
toggleEditMode();
boundActionCreators.clearDashboardHistory?.(); // Resets the `past` as an empty array
}}
data-test="edit-dashboard-button"
className="action-button"
css={editButtonStyle}
Expand All @@ -668,6 +673,7 @@ const Header = () => {
NavExtension,
boundActionCreators.onRedo,
boundActionCreators.onUndo,
boundActionCreators.clearDashboardHistory,
editMode,
emphasizeRedo,
emphasizeUndo,
Expand Down
2 changes: 1 addition & 1 deletion superset/row_level_security/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class RLSListSchema(Schema):
tables = fields.List(fields.Nested(TablesSchema))
clause = fields.String(metadata={"description": "clause_description"})
changed_on_delta_humanized = fields.Function(
RowLevelSecurityFilter.created_on_delta_humanized
RowLevelSecurityFilter.changed_on_delta_humanized
)
group_key = fields.String(metadata={"description": "group_key_description"})
description = fields.String(metadata={"description": "description_description"})
Expand Down
Loading