Closed elmiomar closed 7 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?
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.
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.
This PR improves error handling and UI feedback for dataset availability within the datacart.
Changes:
Added a property to track success or failure: in the data cart component isCartLoadedSuccessfully is used to track if the cart was loaded successfully. isCartLoadedSuccessfully is set to true if the result is successfully received and it's not null or empty. If there's an error or the result is null, we set it to false.
Added *ngIf directive to the app-treetable* element: in the datacart component's HTML template, we use the ngIf directive to conditionally render the app-treetable element based on the isCartLoadedSuccessfully** property.
Updated the error handling logic in the getRpaCart() of the datacart service: when an error occurs, we check the error status and message. If it matches our criteria (a 404 status and the specific message about metadata not being found), we propagate a specific error message back to the component. In the datacart component, we handle this specific error by displaying a user-friendly message based on the error information received from the service.
Used RxJS's catchError operator in the service to intercept 404 errors and convert them into observable streams with custom error messages.
Testing