Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: requestBuffer #49

Merged
merged 12 commits into from
Feb 11, 2022
Merged

fix: requestBuffer #49

merged 12 commits into from
Feb 11, 2022

Conversation

NorbertNader
Copy link
Contributor

@NorbertNader NorbertNader commented Feb 4, 2022

Overview

  • Fix requestBuffer
  • Remove legacy sitewise data source
  • Remove fetchAgggreagtedData boolean from settings
  • Fix requests to only be made for uncached data
  • Fix gesture tests

Tests

updated unit tests and integration tests

Legal

This project is available under the Apache 2.0 License.

@NorbertNader NorbertNader added the bug Something isn't working label Feb 4, 2022
@NorbertNader NorbertNader self-assigned this Feb 4, 2022
@@ -177,32 +190,41 @@ export class IotAppKitDataModule implements DataModule {

const updatedSubscription = Object.assign({}, subscription, subscriptionUpdate) as Subscription;

const request = this.getAdjustedRequest(updatedSubscription.request);

const viewport = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part is important because we want the actual "visible" viewport not the request viewport that might be buffered. E.g. in the iot-connector component we listen for dateRangeChange which invokes the update method with the chart viewport, not the requested viewport. This means that if we are looking at a chart for a 10 minute range but actually request 30 minutes of data, we will still request raw data, although the resolution mapping is set to request '1m' resolution above 15 minute viewport range.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes a lot of sense.

dataSource.initiateRequest(
{
onError,
onSuccess,
query,
request: {
viewport: {
duration: FIFTY_FIVE_MINUTES,
duration: HOUR_IN_MS * 65,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test makes sure we determine the resolution to request based on the visible viewport, not the requested viewport, which might be buffered.

})
});

this.registerRequest({ queries, request: { ...request, viewport: { start: reqStart, end: reqEnd } }, viewport });
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We register a request only for time ranges of uncached data. Covered by tests.

* remove legacy sitewise resource
* remove requestInformations from initiateRequest signature
* fix requests to only be made for uncached data
});
});

it('only fetches uncached data for multiple properties', async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a full e2e test for the changes made in this CR. Basically making sure we do not over request.

queries,
start,
end,
viewport,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about calling this bufferedViewport for clarity?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to avoid that because the viewport might not actually be buffered.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm potentiallyBufferedViewport? Just kidding, makes sense :)

@@ -130,19 +128,15 @@ export const createDataSource = (siteWise: IoTSiteWiseClient): DataSource<SiteWi
const client = new SiteWiseClient(siteWise);
return {
name: SITEWISE_DATA_SOURCE,
initiateRequest: ({ query, request, onSuccess, onError }) => {
initiateRequest: ({ query, request, onSuccess, onError }, requestInformations) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, finally using it as intended :)

@NorbertNader NorbertNader merged commit 4702ad5 into main Feb 11, 2022
Copy link
Contributor

@boweihan boweihan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This CR looks good. The only request I have is - can we have a quick test to ensure that our data source is using requestBuffer properly? The jest integration test we currently have for requestBuffer stops at checks parameters to initiateRequest.

@NorbertNader NorbertNader deleted the fix-request-buffer branch February 16, 2022 23:50
sheilaXu pushed a commit that referenced this pull request Sep 23, 2022
See all commit messages below

 Fixes the nested camera view locations for activeCameraSettings (#102)

* Fixes the nested camera view locations for activeCameraSettings

The problem is that the node.transform is not in world coordinates.
To accurately represent this we create the transform from the actualy object3D world position, rotation, and scale

* Clean up based on feedback

* Rebase needed

Fix target calculation for Camera settings (#104)

Have the Camera Preview pull from the selected node rather than using active camera settings (#101)

Adjusting the active Camera settings also affected the main camera's settings and was a bug.
Utilizing the camera component on the selected node allowed for the same render without the issue as the active Camera settings aren't necessarily set to active by editing anyway

Update the camera component inspector editor to match the UX (#99)

Visual restructuring
Bug fixes
Code clean up

Adds a CameraPreview component (#97)

This performs a LateRender to a smaller viewport designated by the tracked div element
When a camera is selected the div and the render of the camera's view will appear when in edit mode

Adds the activeCamera property (#66)

Based on this property we set the active camera unless we have a selected data binding as that should take precedence

Make TopBar always visible and Add Camera list (#64)

Clicking a camera name in the list will set that camera as the active camera in either editing or viewing
Add an incremental count to the Camera object to give unique names since creation

Revert "Add activeCamera Property to Scene Viewer (#56)" (#61)

This reverts commit 98bce138a4bf572b6f25562c458ace8d7ac3f560.

Add activeCamera Property to Scene Viewer (#56)

State setup seems to appear incorrectly in storybook such that the Camera View
is not utlizing the activeCamera unless the store has already been created.
This is something that will need to be looked into further.

Add Set from current view, button to inspector (#52)

Also refactors how we set the object from the current view
Fixes the bug where we only support one parent for rotational transform

Add basic Inspector Editor for the Camera Component (#49)

Change Camera creation mode to View Camera (From current) as in design (#46)

Update the CameraComponent to be creatable and selectable (#45)

This introduces the ability to set a globally stored active camera which can alter the settings and viewing location of the main camera. These are less cameras themselves than editor and data representations
TheEvilDev pushed a commit that referenced this pull request Nov 2, 2022
* Fix requestBuffer
* Remove legacy sitewise data source
* Remove fetchAgggreagtedData boolean from settings
* Fix requests to only be made for uncached data
* Fix gesture tests

Co-authored-by: Norbert Nader <nnader@amazon.com>
This was referenced Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants