awslabs / iot-app-kit

A development library for creating web applications to visualize industrial data
Apache License 2.0
117 stars 60 forks source link

feat(sitewise-alarms): find inputProperty for an alarm and clean up hooks and tests #2997

Closed hwandersman closed 2 months ago

hwandersman commented 2 months ago

Overview

Major changes:

Why?

Did not implement setting the inputProperty of AlarmData correctly. There are two use cases:

  1. Alarm request has an inputPropertyId Need to collect all alarms for an asset, then after fetching each alarm's IoT Events alarm model we can determine which alarm actually has the input property. The easiest way to do this with the cascade of hook calls in useAlarms is to keep track of the original request for each alarm and the asset/assetModel properties so the property object can be set in the inputProperty field.
  2. Alarm request does not have an inputPropertyId inputProperty will be resolved after the alarm models are fetched. The AlarmDataInternal.properties field will be filtered down to the property that matches the alarm model input property.

Minor changes:

Verifying Changes

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.

To run the storybook build locally, you need a local static web server:

npm install -g httpserver
cd <Extracted Zip Directory>
httpserver

Then open the website http://localhost:8080 to run the doc site.

Legal

This project is available under the Apache 2.0 License.