-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
364d21b
commit b3fcd54
Showing
5 changed files
with
28 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 9 additions & 3 deletions
12
web-common/src/features/dashboards/state-managers/actions/comparison.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,23 @@ | ||
import type { DashboardMutables } from "./types"; | ||
|
||
export const setComparisonDimension = ( | ||
export const toggleComparisonDimension = ( | ||
{ dashboard }: DashboardMutables, | ||
dimensionName: string | undefined, | ||
) => { | ||
// Temporary until we make these not mutually exclusive | ||
dashboard.showTimeComparison = false; | ||
dashboard.selectedComparisonDimension = dimensionName; | ||
const isCurrentDimension = | ||
dashboard.selectedComparisonDimension === dimensionName; | ||
if (!isCurrentDimension) { | ||
dashboard.selectedComparisonDimension = dimensionName; | ||
} else { | ||
dashboard.selectedComparisonDimension = undefined; | ||
} | ||
}; | ||
|
||
export const comparisonActions = { | ||
/** | ||
* Sets the comparison dimension for the dashboard. | ||
*/ | ||
setComparisonDimension, | ||
toggleComparisonDimension, | ||
}; |