usnistgov / oar-pdr

The NIST Open Access to Research (OAR) Public Data Repository (PDR) system software
12 stars 10 forks source link

Improve Error Handling and UI Feedback for Dataset Availability #327

Closed elmiomar closed 7 months ago

elmiomar commented 8 months ago

This PR improves error handling and UI feedback for dataset availability within the datacart.

Changes:

Testing

chuanlin2018 commented 8 months ago

If this branch is for non-rpa cases as well, http://localhost:4200/datacart/global_datacart does not appear to be working because the data tree component is hidden. Can you check?

chuanlin2018 commented 8 months ago

Suggest something like *ngIf="!isRpa || isCartLoadedSuccessfully" - add a boolean variable to tell if this is RPA record so it dosplay normally for non-rpa records.

elmiomar commented 7 months ago

To ensure the isCartLoadedSuccessfully flag is set to true when the global dataCart is successfully loaded, and not just for the RPA one, I adjusted the logic within the subscription to handle both cases: when it's an RPA cart and when it's any other type of cart. The idea is to set isCartLoadedSuccessfully to true as long as this.cartService.getCart(cartName) successfully retrieves a cart, regardless of whether it's an RPA cart or another type.

This implementation assumes that getCart synchronously returns a valid DataCart object or null if the cart does not exist or cannot be retrieved for some reason. The flag isCartLoadedSuccessfully is set to true immediately after a successful retrieval of a cart, so that the treetable will appear for global datacarts as well.