-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: empty widget is handled (#3830)
* fix: empty widget is updated * chore: widget is updated * fix: handling is updated
- Loading branch information
1 parent
7603e0e
commit 2d60805
Showing
4 changed files
with
35 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { PANEL_TYPES } from 'constants/queryBuilder'; | ||
import { Layout } from 'react-grid-layout'; | ||
|
||
export const getUpdatedLayout = (layout?: Layout[]): Layout[] => { | ||
let widgetLayout = layout; | ||
|
||
// filter empty from i from i due to previous version of signoz | ||
widgetLayout = layout?.filter((i) => i.i !== 'empty'); | ||
|
||
const seen = new Set(); | ||
|
||
// filter duplicate i values | ||
widgetLayout = widgetLayout?.filter((i) => { | ||
const duplicate = seen.has(i.i); | ||
seen.add(i.i); | ||
return !duplicate; | ||
}); | ||
|
||
// filter EMPTY_WIDGET from i due to previous version of signoz | ||
widgetLayout = widgetLayout?.filter((i) => i.i !== PANEL_TYPES.EMPTY_WIDGET); | ||
|
||
return widgetLayout || []; | ||
}; |
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