Skip to content

Update the Reservation Car Demo#102

Merged
VenyaBrodetskiy merged 12 commits intomasterfrom
alon/demo-ui
May 4, 2025
Merged

Update the Reservation Car Demo#102
VenyaBrodetskiy merged 12 commits intomasterfrom
alon/demo-ui

Conversation

@alonf
Copy link
Collaborator

@alonf alonf commented May 4, 2025

PR Classification

Upgrade to .NET 9.0 and enhancements for reservation management and UI.

PR Summary

This pull request upgrades the project to .NET 9.0, improves reservation handling, and enhances the Blazor UI components for better user experience. Key changes include:

  • IntegrationTest.yaml: Updated .NET SDK version to 9.0.x and modified SignalR Dapr secret store.
  • Dockerfile: Changed base image to .NET 9.0 for both build stages.
  • Program.cs: Added methods for managing state and handling reservations.
  • ReservationState.cs and SignalRService.cs: Updated to include new properties and methods for reservations and messaging.
  • Blazor UI components (App.razor, NavMenu.razor, MainLayout.razor): Improved user interface and functionalities for managing car reservations.

alonf added 12 commits April 20, 2025 12:36
…r to 1.15.3

Upgrade .NET SDK and dependencies; update tests

Updated `IntegrationTest.yaml` to use .NET SDK 9.0.x

Updated Dapr package references from `1.15.0-rc02` to `1.15.3` and Polly from `8.4.1` to `8.5.2` in multiple `.csproj` files. Changed target frameworks from `net8.0` to `net9.0` across several projects.

Modified `Dockerfile` to use .NET 9.0 base images for compatibility. Various package references in integration test projects were also updated to the latest versions, including OpenTelemetry and Swashbuckle.
The test files `test_a_failed_on_2_no_callback.received.txt` and `test_a_failed_on_2_no_callback_revert.received.txt` have been updated to remove several OpenTelemetry logging entries related to saga operations and their outcomes. The changes reflect the execution flow of the saga, including retries and final outcomes. Additionally, the revert test file has been modified to indicate the success of the revert operation, which was previously absent.
Update .gitignore for integration test files

Added entries to ignore three .received.txt files from the
Sagaway.IntegrationTests project to keep the repository clean
and prevent unnecessary tracking of generated approval test
files.
Enhanced the codebase with a new Blazor component for car reservations, including customer and car class selection. Updated the `.gitignore` for web artifacts, modified test files for saga logs, and added new classes for managing reservations.

Updated `docker-compose.yml` to include a new service for the reservation UI and adjusted the `Program.cs` for service registration. Configured Nginx in `nginx.conf` to serve the Blazor app and proxy API requests. Added Tailwind CSS support with `package.json` and `package-lock.json`.

Overall, these changes improve functionality, performance, and maintainability of the application.
- Replaced asynchronous callback methods in `CarReservationActor` and `CarReservationCancellationActor` with synchronous versions for simplification.
- Updated saga completion methods to save saga logs to Dapr state store with a 5-minute TTL.
- Added a new endpoint in `Program.cs` for retrieving saga logs by reservation ID.
- Modified reservation request logic in `App.razor` to directly call the API client without simulated delays.
- Enhanced `ReservationStatusDisplay.razor` to display reservation statuses in a table format and added UI elements for refreshing and debugging.
- Updated `IReservationApiClient` to include a method for fetching saga logs, implemented in `ReservationApiClient`.
- Renamed and updated `ReservationStatus` class for consistency with client-side data representation.
- Modified Nginx configuration to handle saga log requests.
- Updated `docker-compose.yml` and `launchSettings.json` for service configuration changes.
- Improved UI elements in `ReservationStatusDisplay.razor` for better user experience.
This commit introduces several key improvements to the reservation system. A `CarClass` property has been added to the `ReservationState` and `BookingInfo` records to better represent the type of car associated with reservations. The TTL for state saving in the `CarReservationActor` and `CarReservationCancellationActor` classes has been increased from 5 to 15 minutes for improved data retention.

The `ReservationStatusDisplay.razor` component has been restructured for better loading state handling and user-friendly display of reservation statuses, including cancellation actions. Error handling in API calls has been refined for clearer logging and user feedback.

New methods, `HandleCancelReservation`, `GetCarClassNameForCode`, and `GetCarImageForClass`, have been introduced to enhance user interaction and display. Additionally, the `FormatSagaLogAsHtml` method improves the readability of saga logs in the UI.

The project file has been updated to ensure the inclusion of the `DefaultCar.png` image, and the Nginx configuration has been modified to handle cancellation requests appropriately.
The TTL for entries in the metadata dictionary has been changed from 5 minutes to 1 minute in the `/booking-queue` and `/inventory-queue` endpoints. This adjustment alters the data retention policy.

Additionally, the error handling for the `/customer-reservations` endpoint has been updated to specifically catch `DaprException`, enhancing robustness against known issues with Dapr's state management, particularly addressing bug #3787 related to invalid output.
Updated retry intervals to seconds, enhanced user experience in App.razor with better error handling and loading states. Refactored ReservationStatusDisplay for clearer status presentation. Introduced IReservationManager for centralized reservation logic and added System.Reactive for observable state management. Moved DTO classes to a new namespace for better organization. Overall, these changes enhance functionality, maintainability, and user interaction.
This commit introduces new endpoints for managing car inventory, including `/car-inventory` for fetching current inventory and `/update-allocation` for updating maximum allocations. The reservation management logic has been refactored to use enums for reservation statuses, enhancing clarity and maintainability.

Additionally, the handling of car class reservations now dynamically checks maximum allocations, and the UI has been updated to provide an inventory management interface with improved user experience. Dapr client interactions have been refined for better state management, and the Nginx configuration has been updated to support the new routes. Overall, these changes improve the robustness and maintainability of the car reservation system.
- Introduced `MakeStateStoreKey` for consistent key creation.
- Improved logging messages for better action tracking.
- Updated state retrieval and saving in Dapr for consistency.
- Enhanced saga log UI with better styling and interactivity.
- Added JavaScript functions for managing saga log display.
- Improved Blazor component for reservation status with better error handling.
- Modified HTML structure and CSS for improved user experience.
- Updated billing status logic for refunds.
- Enhanced customer reservations retrieval with JSON and pagination.
- Adjusted car reservation cancellation to use exponential backoff.
- Improved logging for customer reservations and pagination.
- Refactored App.razor to load predefined customers and handle errors.
- Enhanced UI in ReservationStatusDisplay for better user experience.
- Improved saga log retrieval error handling.
- Modified IReservationApiClient to return success status and HTTP code.
- Simplified customer management in ReservationManager.
- Updated cancellation process to handle already cancelled cases.
- Enhanced overall structure and error handling in ReservationManager.
Copy link
Collaborator

@VenyaBrodetskiy VenyaBrodetskiy left a comment

Choose a reason for hiding this comment

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

good!

mostly small comments, not urgent and not important.

! few important comments are about test files changes and test files in gitignore. Just don't know if everything is ok, or not, could you check please? that's the only reason why didn't approve yet

P.S
do you think upgrading dotnet can hold trialkit from upgrading to newer version of sagaway? some of their services still use dotnet 8, and some are already dotnet9

P.P.S
thinks to decide in future - maybe it is a good idea to move demo project outside of this repo in some other repo. but not now of course

# Fody - auto-generated XML schema
FodyWeavers.xsd No newline at end of file
FodyWeavers.xsd
/Sagaway.IntegrationTests/Sagaway.IntegrationTests.TestProject/ApprovalFiles/test_a_1_failed_wait10_2_failed_b_1_success.received.txt
Copy link
Collaborator

Choose a reason for hiding this comment

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

why tests results are in gitignore? is it right?

[*time*][CallA]: Registering reminder CallA:Retry for CallA with interval 00:00:10
[*time*]The Saga is deactivated.
[*time*]The Saga is activated.
[*time*][CallB]: CallB Success
Copy link
Collaborator

Choose a reason for hiding this comment

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

are these changes ok?

[*time*][CallA]: Wake by a reminder
[*time*][CallA]: OnReminderAsync: Validation for CallA returned false, retrying action.
[*time*][CallA]: CallA Failed. Retries exhausted.
[*time*][CallA]: CallA Success
Copy link
Collaborator

Choose a reason for hiding this comment

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

are these changes ok?

@@ -20,8 +20,6 @@ Saga Log:
[*time*][CallA]: Registering reminder CallA:Retry for Revert CallA with interval 00:00:05
[*time*]The Saga is deactivated.
[*time*]The Saga is activated.
Copy link
Collaborator

Choose a reason for hiding this comment

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

are these changes ok?

CustomerName = _reservationInfo.CustomerName
};

await _sagaResultPublisher.PublishMessageToSignalRAsync(sagaResult);
Copy link
Collaborator

Choose a reason for hiding this comment

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

not very nice to do operations without catch in this block OnSagaCompletedAsync, because they will be unhandled, but for demo I don't think this is very important

index index.html index.htm;

# Proxy API requests to the reservation-manager service
location /reserve {
Copy link
Collaborator

Choose a reason for hiding this comment

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

do you really need to proxy_pass endpoint by endpoint here? might be easier to open everything. less secure, but for demo not critical.
but if you already did it, I don't think it worth investing any time, just wonder why

Copy link
Collaborator

Choose a reason for hiding this comment

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

don't like this file :DD

@alonf
Copy link
Collaborator Author

alonf commented May 4, 2025 via email

@VenyaBrodetskiy VenyaBrodetskiy merged commit fb55a23 into master May 4, 2025
1 check passed
@VenyaBrodetskiy VenyaBrodetskiy deleted the alon/demo-ui branch May 4, 2025 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants