-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove viewport and query from widget render key
- Loading branch information
1 parent
08e608d
commit 1587e2a
Showing
9 changed files
with
52 additions
and
49 deletions.
There are no files selected for viewing
14 changes: 12 additions & 2 deletions
14
packages/dashboard/src/components/dashboard/queryContext.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,6 +1,16 @@ | ||
import { createContext, useContext } from 'react'; | ||
import { DashboardIotSiteWiseQueries } from '~/types'; | ||
import { DashboardIotSiteWiseQueries, IoTSiteWiseDataStreamQuery } from '~/types'; | ||
|
||
export const QueryContext = createContext<Partial<DashboardIotSiteWiseQueries>>({}); | ||
|
||
export const useQueries = () => useContext(QueryContext); | ||
export const useQueries = ({ assets = [], properties = [] }: IoTSiteWiseDataStreamQuery = {}) => { | ||
const { iotSiteWiseQuery } = useContext(QueryContext); | ||
|
||
if (iotSiteWiseQuery == null || (assets.length === 0 && properties.length === 0)) { | ||
return []; | ||
} | ||
|
||
const queries = [iotSiteWiseQuery.timeSeriesData({ assets, properties })] ?? []; | ||
|
||
return queries; | ||
}; |
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
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
9 changes: 0 additions & 9 deletions
9
packages/dashboard/src/customization/widgets/utils/computeQueryConfigKey.ts
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
packages/dashboard/src/customization/widgets/utils/createWidgetRenderKey.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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export function createWidgetRenderKey(widgetId: string): string { | ||
const renderKey = widgetId; | ||
|
||
return renderKey; | ||
} |