Introducing the useAlarms hook that takes a list of alarm requests and outputs a a construct AlarmData for each alarm in the response.
This differs from our original design in the following ways:
All AlarmData content is optional except for the status
AlarmDataStatus error is now errors with a list of errors of all queries for fetching alarms
sourcePropertyId is now called inputPropertyId so it doesn't get confused with the source alarm property
AlarmSourcePropertyRequest is now called AlarmInputPropertyRequest for the same reason
Alarm properties for state, type, and source are AssetProperty | AssetModelProperty for flexibility depending on the request
There are overloaded definitions for useAlarms to ensure strict types: when the transform callback is not provided the hook return type is AlarmData, otherwise the return type is defined by the transform return type
The useAlarms hook right now just fetches the asset or assetModel alarm info for each request. In the future we will add the following:
Fetch latest alarm property data for state, type, source
Fetch IoT Events alarm models for each alarm
Fetch state and threshold history
Verifying Changes
Added a storybook story and wrote unit tests
Scene Composer
For scene-composer package changes specifically, you can preview the component in the published storybook artifact. To do this, wait for the Publish Storybook action to complete below.
Click on the workflow details
Select the Summary item on the left
Download the zip file
To run the storybook build locally, you need a local static web server:
npm install -g httpserver
cd <Extracted Zip Directory>
httpserver
Discussed various comments, will create a follow-up PR for them. Going to merge now to unblock development of the resource explorer variant for alarms.
Overview
Introducing the
useAlarms
hook that takes a list of alarm requests and outputs a a constructAlarmData
for each alarm in the response.This differs from our original design in the following ways:
status
error
is nowerrors
with a list of errors of all queries for fetching alarmssourcePropertyId
is now calledinputPropertyId
so it doesn't get confused with thesource
alarm propertyAlarmSourcePropertyRequest
is now calledAlarmInputPropertyRequest
for the same reasonAssetProperty | AssetModelProperty
for flexibility depending on the requestuseAlarms
to ensure strict types: when thetransform
callback is not provided the hook return type isAlarmData
, otherwise the return type is defined by thetransform
return typeThe
useAlarms
hook right now just fetches the asset or assetModel alarm info for each request. In the future we will add the following:Verifying Changes
Added a storybook story and wrote unit tests
Scene Composer
For
scene-composer
package changes specifically, you can preview the component in the published storybook artifact. To do this, wait for thePublish Storybook
action to complete below.To run the storybook build locally, you need a local static web server:
Then open the website http://localhost:8080 to run the doc site.
Legal
This project is available under the Apache 2.0 License.