Skip to content

Commit

Permalink
fixed getIsDirty, used function for disabling save button (#93328) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomThomson authored Mar 3, 2021
1 parent c344fe3 commit fd3285d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/plugins/dashboard/public/application/dashboard_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export function DashboardApp({
);

dashboardStateManager.registerChangeListener(() => {
setUnsavedChanges(dashboardStateManager?.hasUnsavedPanelState());
setUnsavedChanges(dashboardStateManager.getIsDirty(data.query.timefilter.timefilter));
// we aren't checking dirty state because there are changes the container needs to know about
// that won't make the dashboard "dirty" - like a view mode change.
triggerRefresh$.next();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,10 @@ export class DashboardStateManager {
// Filter bar comparison is done manually (see cleanFiltersForComparison for the reason) and time picker
// changes are not tracked by the state monitor.
const hasTimeFilterChanged = timeFilter ? this.getFiltersChanged(timeFilter) : false;
return this.getIsEditMode() && (this.isDirty || hasTimeFilterChanged);
return (
this.hasUnsavedPanelState() ||
(this.getIsEditMode() && (this.isDirty || hasTimeFilterChanged))
);
}

public getPanels(): SavedDashboardPanel[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ export function DashboardTopNav({
const topNav = getTopNavConfig(viewMode, dashboardTopNavActions, {
hideWriteControls: dashboardCapabilities.hideWriteControls,
isNewDashboard: !savedDashboard.id,
isDirty: dashboardStateManager.isDirty,
isDirty: dashboardStateManager.getIsDirty(timefilter),
isSaveInProgress,
});

Expand Down

0 comments on commit fd3285d

Please sign in to comment.