-
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.
- Loading branch information
1 parent
712c1a7
commit 2b776cc
Showing
11 changed files
with
296 additions
and
110 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
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
34 changes: 34 additions & 0 deletions
34
packages/source-iotsitewise/src/time-series-data/fetchTimeSeriesData.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,34 @@ | ||
import { TimeSeriesDataModule, Viewport, DataStream } from '@iot-app-kit/core'; | ||
import { SiteWiseDataStreamQuery } from './types'; | ||
import { TimeSeriesDataStore } from './store'; | ||
import { completeDataStreams } from '../completeDataStreams'; | ||
|
||
// creates async function which requests cachedDataStreams until all the data for viewport is present | ||
export const fetchTimeSeriesData = | ||
( | ||
siteWiseTimeSeriesModule: TimeSeriesDataModule<SiteWiseDataStreamQuery>, | ||
store: TimeSeriesDataStore | ||
) => | ||
async ({ | ||
query, | ||
viewport, | ||
}: { | ||
query: SiteWiseDataStreamQuery; | ||
viewport: Viewport; | ||
}): Promise<DataStream[]> => { | ||
return new Promise((resolve) => { | ||
siteWiseTimeSeriesModule.getCachedDataStreams({ | ||
queries: [query], | ||
viewport, | ||
emitDataStreams: (ds: DataStream[]) => | ||
resolve( | ||
completeDataStreams({ | ||
modeledDataStreams: store.modeledDataStreams, | ||
dataStreams: ds, | ||
assetModels: store.assetModels, | ||
alarms: store.alarms, | ||
}) | ||
), | ||
}); | ||
}); | ||
}; |
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
Oops, something went wrong.