From 986d5fe7c950f111757b0bd89e5c91b226481149 Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Sun, 1 Sep 2024 18:08:25 +0900 Subject: [PATCH 01/35] =?UTF-8?q?Feat:=20=EC=96=B4=EB=93=9C=EB=AF=BC=20UI?= =?UTF-8?q?=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20Page=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UI/Admin/NewEventDetailsComponent.razor | 107 ++++++++++++++++++ .../Models/AdminEventDetails.cs | 52 +++++++++ .../Models/EventDetails.cs | 32 ++++++ 3 files changed, 191 insertions(+) create mode 100644 src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor create mode 100644 src/AzureOpenAIProxy.PlaygroundApp/Models/AdminEventDetails.cs create mode 100644 src/AzureOpenAIProxy.PlaygroundApp/Models/EventDetails.cs diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor new file mode 100644 index 00000000..73826813 --- /dev/null +++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor @@ -0,0 +1,107 @@ +@using AzureOpenAIProxy.PlaygroundApp.Models; + + + + + Create Event + +
+

Event Infomation

+ + + Title + + + + + Summary + + + + + Description + + + + + Event Start Date + + + + + + Event End Date + + + + + + Time Zone + + Korea + US + + +
+ +
+

Event Organizer

+
+ + Organizer Name + + + + + + Organizer Email + @@ + +
+
+ +
+

Event Coorganizers

+
+ +
+ +
+ test +
+
+ +
+

Event Configuration

+ + + Max Token Cap + + + + + Daily Request Cap + + +
+
+
+ + +@code { + private AdminEventDetails? adminEventDetails; + + +} + diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Models/AdminEventDetails.cs b/src/AzureOpenAIProxy.PlaygroundApp/Models/AdminEventDetails.cs new file mode 100644 index 00000000..bbee0857 --- /dev/null +++ b/src/AzureOpenAIProxy.PlaygroundApp/Models/AdminEventDetails.cs @@ -0,0 +1,52 @@ +namespace AzureOpenAIProxy.PlaygroundApp.Models; + +/// +/// This represent the event detail data for response by admin event endpoint. +/// +public class AdminEventDetails : EventDetails +{ + /// + /// Gets or sets the event description. + /// + public string? Description { get; set; } + + /// + /// Gets or sets the event start date. + /// + public required DateTimeOffset? DateStart { get; set; } + + /// + /// Gets or sets the event end date. + /// + public required DateTimeOffset? DateEnd { get; set; } + + /// + /// Gets or sets the event start to end date timezone. + /// + public required string? TimeZone { get; set; } + + /// + /// Gets or sets the event active status. + /// + public required bool? IsActive { get; set; } + + /// + /// Gets or sets the event organizer name. + /// + public required string? OrganizerName { get; set; } + + /// + /// Gets or sets the event organizer email. + /// + public required string? OrganizerEmail { get; set; } + + /// + /// Gets or sets the event coorganizer name. + /// + public string? CoorganizerName { get; set; } + + /// + /// Gets or sets the event coorganizer email. + /// + public string? CoorganizerEmail { get; set; } +} \ No newline at end of file diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Models/EventDetails.cs b/src/AzureOpenAIProxy.PlaygroundApp/Models/EventDetails.cs new file mode 100644 index 00000000..56bb1d1b --- /dev/null +++ b/src/AzureOpenAIProxy.PlaygroundApp/Models/EventDetails.cs @@ -0,0 +1,32 @@ +namespace AzureOpenAIProxy.PlaygroundApp.Models; + +/// +/// This represents the event's detailed data for response by EventEndpoint. +/// +public class EventDetails +{ + /// + /// Gets or sets the event id. + /// + public required string? EventId { get; set; } + + /// + /// Gets or sets the event title name. + /// + public required string? Title { get; set; } + + /// + /// Gets or sets the event summary. + /// + public required string? Summary { get; set; } + + /// + /// Gets or sets the Azure OpenAI Service request max token capacity. + /// + public required int? MaxTokenCap { get; set; } + + /// + /// Gets or sets the Azure OpenAI Service daily request capacity. + /// + public required int? DailyRequestCap { get; set; } +} \ No newline at end of file From aa36c46577acd4d8447c93f747469e4b11a5c922 Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Sun, 1 Sep 2024 18:09:03 +0900 Subject: [PATCH 02/35] =?UTF-8?q?Test:=20=EC=96=B4=EB=93=9C=EB=AF=BC=20UI?= =?UTF-8?q?=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AzureOpenAIProxy.sln | 4 +-- .../Pages/NewEventDetailsTests.cs | 28 +++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsTests.cs diff --git a/AzureOpenAIProxy.sln b/AzureOpenAIProxy.sln index bd88d76b..73247a99 100644 --- a/AzureOpenAIProxy.sln +++ b/AzureOpenAIProxy.sln @@ -17,9 +17,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{A69C5782-F EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AzureOpenAIProxy.AppHost.Tests", "test\AzureOpenAIProxy.AppHost.Tests\AzureOpenAIProxy.AppHost.Tests.csproj", "{E8994388-24FA-4221-8E46-4CD1DA96C585}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AzureOpenAIProxy.PlaygroundApp.Tests", "test\AzureOpenAIProxy.PlaygroundApp.Tests\AzureOpenAIProxy.PlaygroundApp.Tests.csproj", "{0AE9860A-0F8D-49EF-B375-BF95374A1EDA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AzureOpenAIProxy.PlaygroundApp.Tests", "test\AzureOpenAIProxy.PlaygroundApp.Tests\AzureOpenAIProxy.PlaygroundApp.Tests.csproj", "{0AE9860A-0F8D-49EF-B375-BF95374A1EDA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AzureOpenAIProxy.ApiApp.Tests", "test\AzureOpenAIProxy.ApiApp.Tests\AzureOpenAIProxy.ApiApp.Tests.csproj", "{0E772300-9263-49CA-8E26-D0B9CC584202}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AzureOpenAIProxy.ApiApp.Tests", "test\AzureOpenAIProxy.ApiApp.Tests\AzureOpenAIProxy.ApiApp.Tests.csproj", "{0E772300-9263-49CA-8E26-D0B9CC584202}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsTests.cs b/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsTests.cs new file mode 100644 index 00000000..f3afe893 --- /dev/null +++ b/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsTests.cs @@ -0,0 +1,28 @@ +using Microsoft.Playwright; +using Microsoft.Playwright.NUnit; + +namespace AzureOpenAIProxy.PlaygroundApp.Tests.Pages; + +[Parallelizable(ParallelScope.Self)] +[TestFixture] +[Property("Category", "Integration")] +public class NewEventDetailsTests : PageTest +{ + public override BrowserNewContextOptions ContextOptions() => new() + { + IgnoreHTTPSErrors = true, + }; + + [Test] + public async Task Given_Root_Page_When_Navigated_Then_It_Should_No_Sidebar() + { + // Arrange + await this.Page.GotoAsync("https://localhost:5001"); + + // Act + var sidebar = this.Page.Locator("div.sidebar"); + + // Assert + Expect(sidebar).Equals(null); + } +} From b6d13d1a0647ed6098d6bfe19819fa13c706fe87 Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Sun, 1 Sep 2024 19:07:56 +0900 Subject: [PATCH 03/35] =?UTF-8?q?Feat:=20=EB=B2=84=ED=8A=BC=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UI/Admin/NewEventDetailsComponent.razor | 56 ++++++++++++------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor index 73826813..245b2a2e 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor +++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor @@ -4,13 +4,24 @@ section { margin-bottom: 100px } - .create-input-label{ + .create-input-label { width: 200px; --type-ramp-base-font-size: 22px; } - .create-fluent-stack{ + .create-fluent-stack { height: 100px; } + .button-section { + display: flex; + justify-content: center; + gap: 50px; + } + .button { + width: 150px; + height: 50px; + font-size: 16px; + margin: 0 10px; + } @@ -57,29 +68,31 @@

Event Organizer

-
- - Organizer Name - - - - - - Organizer Email - @@ - -
+ + + Organizer Name + + + + + + Organizer Email + @@ +

Event Coorganizers

-
-
+ + Coorgnizer Name + + -
- test -
+ + Coorgnizer Email + @@ +
@@ -95,6 +108,11 @@
+ +
+ Add Event + Cancel +
From 765a28f95ede4d0aafed0b5151af69227e19a058 Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Wed, 4 Sep 2024 00:36:11 +0900 Subject: [PATCH 04/35] =?UTF-8?q?Fix:=20=ED=94=BC=EB=93=9C=EB=B0=B1=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9=20-=20AzureOpenAIProxy.sln=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=9D=B4=EC=A0=84=20=EB=82=B4=EC=9A=A9=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EB=90=98=EB=8F=8C=EB=A6=AC=EA=B8=B0=20-=20AzureOpe?= =?UTF-8?q?nAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsTests.cs=20?= =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=BD=94=EB=93=9C=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AzureOpenAIProxy.sln | 4 +-- .../Pages/NewEventDetailsTests.cs | 28 ------------------- 2 files changed, 2 insertions(+), 30 deletions(-) delete mode 100644 test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsTests.cs diff --git a/AzureOpenAIProxy.sln b/AzureOpenAIProxy.sln index 73247a99..bd88d76b 100644 --- a/AzureOpenAIProxy.sln +++ b/AzureOpenAIProxy.sln @@ -17,9 +17,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{A69C5782-F EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AzureOpenAIProxy.AppHost.Tests", "test\AzureOpenAIProxy.AppHost.Tests\AzureOpenAIProxy.AppHost.Tests.csproj", "{E8994388-24FA-4221-8E46-4CD1DA96C585}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AzureOpenAIProxy.PlaygroundApp.Tests", "test\AzureOpenAIProxy.PlaygroundApp.Tests\AzureOpenAIProxy.PlaygroundApp.Tests.csproj", "{0AE9860A-0F8D-49EF-B375-BF95374A1EDA}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AzureOpenAIProxy.PlaygroundApp.Tests", "test\AzureOpenAIProxy.PlaygroundApp.Tests\AzureOpenAIProxy.PlaygroundApp.Tests.csproj", "{0AE9860A-0F8D-49EF-B375-BF95374A1EDA}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AzureOpenAIProxy.ApiApp.Tests", "test\AzureOpenAIProxy.ApiApp.Tests\AzureOpenAIProxy.ApiApp.Tests.csproj", "{0E772300-9263-49CA-8E26-D0B9CC584202}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AzureOpenAIProxy.ApiApp.Tests", "test\AzureOpenAIProxy.ApiApp.Tests\AzureOpenAIProxy.ApiApp.Tests.csproj", "{0E772300-9263-49CA-8E26-D0B9CC584202}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsTests.cs b/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsTests.cs deleted file mode 100644 index f3afe893..00000000 --- a/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsTests.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.Playwright; -using Microsoft.Playwright.NUnit; - -namespace AzureOpenAIProxy.PlaygroundApp.Tests.Pages; - -[Parallelizable(ParallelScope.Self)] -[TestFixture] -[Property("Category", "Integration")] -public class NewEventDetailsTests : PageTest -{ - public override BrowserNewContextOptions ContextOptions() => new() - { - IgnoreHTTPSErrors = true, - }; - - [Test] - public async Task Given_Root_Page_When_Navigated_Then_It_Should_No_Sidebar() - { - // Arrange - await this.Page.GotoAsync("https://localhost:5001"); - - // Act - var sidebar = this.Page.Locator("div.sidebar"); - - // Assert - Expect(sidebar).Equals(null); - } -} From 7af315dec376a820474b04c33b6394aa458455a6 Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Wed, 4 Sep 2024 00:38:15 +0900 Subject: [PATCH 05/35] =?UTF-8?q?Update=20PlaygroundApp=20Model=20?= =?UTF-8?q?=EC=B5=9C=EC=8B=A0=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Models/AdminEventDetails.cs | 22 +++++++++++++------ .../Models/EventDetails.cs | 17 +++++++++----- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Models/AdminEventDetails.cs b/src/AzureOpenAIProxy.PlaygroundApp/Models/AdminEventDetails.cs index bbee0857..7783fecb 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/Models/AdminEventDetails.cs +++ b/src/AzureOpenAIProxy.PlaygroundApp/Models/AdminEventDetails.cs @@ -1,4 +1,6 @@ -namespace AzureOpenAIProxy.PlaygroundApp.Models; +using System.Text.Json.Serialization; + +namespace AzureOpenAIProxy.PlaygroundApp.Models; /// /// This represent the event detail data for response by admin event endpoint. @@ -13,32 +15,38 @@ public class AdminEventDetails : EventDetails /// /// Gets or sets the event start date. /// - public required DateTimeOffset? DateStart { get; set; } + [JsonRequired] + public DateTimeOffset DateStart { get; set; } /// /// Gets or sets the event end date. /// - public required DateTimeOffset? DateEnd { get; set; } + [JsonRequired] + public DateTimeOffset DateEnd { get; set; } /// /// Gets or sets the event start to end date timezone. /// - public required string? TimeZone { get; set; } + [JsonRequired] + public string TimeZone { get; set; } = string.Empty; /// /// Gets or sets the event active status. /// - public required bool? IsActive { get; set; } + [JsonRequired] + public bool IsActive { get; set; } /// /// Gets or sets the event organizer name. /// - public required string? OrganizerName { get; set; } + [JsonRequired] + public string OrganizerName { get; set; } = string.Empty; /// /// Gets or sets the event organizer email. /// - public required string? OrganizerEmail { get; set; } + [JsonRequired] + public string OrganizerEmail { get; set; } = string.Empty; /// /// Gets or sets the event coorganizer name. diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Models/EventDetails.cs b/src/AzureOpenAIProxy.PlaygroundApp/Models/EventDetails.cs index 56bb1d1b..bade312c 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/Models/EventDetails.cs +++ b/src/AzureOpenAIProxy.PlaygroundApp/Models/EventDetails.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace AzureOpenAIProxy.PlaygroundApp.Models; /// @@ -8,25 +10,30 @@ public class EventDetails /// /// Gets or sets the event id. /// - public required string? EventId { get; set; } + [JsonRequired] + public Guid EventId { get; set; } /// /// Gets or sets the event title name. /// - public required string? Title { get; set; } + [JsonRequired] + public string Title { get; set; } = string.Empty; /// /// Gets or sets the event summary. /// - public required string? Summary { get; set; } + [JsonRequired] + public string Summary { get; set; } = string.Empty; /// /// Gets or sets the Azure OpenAI Service request max token capacity. /// - public required int? MaxTokenCap { get; set; } + [JsonRequired] + public int MaxTokenCap { get; set; } /// /// Gets or sets the Azure OpenAI Service daily request capacity. /// - public required int? DailyRequestCap { get; set; } + [JsonRequired] + public int DailyRequestCap { get; set; } } \ No newline at end of file From b578fb2157e186517d50ad30f369c5a476caef3d Mon Sep 17 00:00:00 2001 From: KYJ_Laptop Date: Sat, 7 Sep 2024 12:15:28 +0900 Subject: [PATCH 06/35] =?UTF-8?q?Refactor:=20=EC=BB=B4=ED=8F=AC=EB=84=8C?= =?UTF-8?q?=ED=8A=B8=20=EC=88=98=EC=A0=95=20-=20Id=20=ED=8C=8C=EB=9D=BC?= =?UTF-8?q?=EB=AF=B8=ED=84=B0=20=EC=B6=94=EA=B0=80=20-=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20Id=20=EC=B6=94=EA=B0=80=20-=20TextFieldType=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20-=20Id=20=EA=B0=92=20kebab-casing=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UI/Admin/NewEventDetailsComponent.razor | 69 +++++++++++-------- 1 file changed, 39 insertions(+), 30 deletions(-) diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor index 245b2a2e..eade0d8c 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor +++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor @@ -24,42 +24,42 @@ } - - Create Event + + New Event

Event Infomation

- Title - + Title + - Summary - + Summary + - Description - + Description + - Event Start Date - - + Event Start Date + + - Event End Date - - + Event End Date + + - Time Zone - + Time Zone + Korea US @@ -70,14 +70,14 @@

Event Organizer

- Organizer Name - + Organizer Name + - Organizer Email - @@ + Organizer Email +
@@ -85,13 +85,13 @@

Event Coorganizers

- Coorgnizer Name - + Coorgnizer Name + - Coorgnizer Email - @@ + Coorgnizer Email + @@ -99,27 +99,36 @@

Event Configuration

- Max Token Cap - + Max Token Cap + @* *@ + - Daily Request Cap - + Daily Request Cap + @* *@ +
- Add Event - Cancel + Add Event + Cancel
@code { + [Parameter] + public string? Id { get; set; } + private AdminEventDetails? adminEventDetails; + private DateTime? tempEventStartDate; + private DateTime? tempEventEndDate; + private int tempEventMaxTokenCap = 0; + private int tempEventDailyRequestCap = 0; } From 70cbc7c37882d48ef67d9faa3f0448653ef54ab0 Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Tue, 10 Sep 2024 00:54:03 +0900 Subject: [PATCH 07/35] =?UTF-8?q?Feat:=20NodaTime=EC=9D=84=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=ED=95=98=EC=97=AC=20Time=20Zone=20Option=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AzureOpenAIProxy.PlaygroundApp.csproj | 1 + .../UI/Admin/NewEventDetailsComponent.razor | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/AzureOpenAIProxy.PlaygroundApp/AzureOpenAIProxy.PlaygroundApp.csproj b/src/AzureOpenAIProxy.PlaygroundApp/AzureOpenAIProxy.PlaygroundApp.csproj index c9ffe317..84a2b5bf 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/AzureOpenAIProxy.PlaygroundApp.csproj +++ b/src/AzureOpenAIProxy.PlaygroundApp/AzureOpenAIProxy.PlaygroundApp.csproj @@ -10,6 +10,7 @@ + diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor index eade0d8c..00b86464 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor +++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor @@ -1,4 +1,7 @@ @using AzureOpenAIProxy.PlaygroundApp.Models; +@using NodaTime +@using NodaTime.Extensions +@using NodaTime.TimeZones - + New Event
@@ -60,8 +63,10 @@ Time Zone - Korea - US + @foreach (var timeZone in timeZoneList) + { + @timeZone.Id + }
@@ -120,10 +125,16 @@ @code { + private List timeZoneList; + private AdminEventDetails adminEventDetails; + [Parameter] public string? Id { get; set; } - private AdminEventDetails? adminEventDetails; + protected override void OnInitialized() + { + timeZoneList = DateTimeZoneProviders.Tzdb.GetAllZones().ToList(); + } private DateTime? tempEventStartDate; private DateTime? tempEventEndDate; From 59d5eb7dc486adb8937527f394858591a9e02e9a Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Tue, 10 Sep 2024 00:57:34 +0900 Subject: [PATCH 08/35] =?UTF-8?q?Feat:=20=EA=B8=B0=EB=B3=B8=EA=B0=92=20?= =?UTF-8?q?=EB=B0=8F=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=20=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?-=20=EA=B8=B0=EB=B3=B8=20=EB=82=A0=EC=A7=9C/=EC=8B=9C=EA=B0=84?= =?UTF-8?q?=20=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80=20-=20=EC=9D=B4?= =?UTF-8?q?=EB=B2=A4=ED=8A=B8=20=EC=B6=94=EA=B0=80/=EC=B7=A8=EC=86=8C=20?= =?UTF-8?q?=EB=B2=84=ED=8A=BC=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=20=EB=B0=94?= =?UTF-8?q?=EC=9D=B8=EB=94=A9=20=EC=B6=94=EA=B0=80=20-=20Max=20Token=20Cap?= =?UTF-8?q?,=20Daily=20Request=20Cap=20=EA=B0=92=20=EB=B0=94=EC=9D=B8?= =?UTF-8?q?=EB=94=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UI/Admin/NewEventDetailsComponent.razor | 37 +++++++++++++++---- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor index 00b86464..c10b3196 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor +++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor @@ -51,13 +51,13 @@ Event Start Date - + Event End Date - + @@ -105,26 +105,29 @@ Max Token Cap - @* *@ - + Daily Request Cap - @* *@ - +
- Add Event - Cancel + Add Event + Cancel
@code { + + private DateTime? tempEventStartDate; + private DateTime? tempEventEndDate; + private DateTime? tempEventStartTime; + private DateTime? tempEventEndTime; private List timeZoneList; private AdminEventDetails adminEventDetails; @@ -133,7 +136,25 @@ protected override void OnInitialized() { + DateTime currentTime = DateTime.Now; + + tempEventStartDate = currentTime; + tempEventEndDate = currentTime; + tempEventStartTime = currentTime.AddHours(1).AddMinutes(-currentTime.Minute); + tempEventEndTime = currentTime.AddHours(1).AddMinutes(-currentTime.Minute); + timeZoneList = DateTimeZoneProviders.Tzdb.GetAllZones().ToList(); + adminEventDetails = adminEventDetails == null ? new() : adminEventDetails; + } + + private void AddEvent() + { + + } + + private void CancelEvent() + { + } private DateTime? tempEventStartDate; From 6524e01d646a96de9cff67f00eeb86fab928719d Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Tue, 10 Sep 2024 01:08:12 +0900 Subject: [PATCH 09/35] =?UTF-8?q?Refactor:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EC=BD=94=EB=93=9C=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/UI/Admin/NewEventDetailsComponent.razor | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor index c10b3196..ac7daa9b 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor +++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor @@ -115,7 +115,7 @@
- Add Event + Add Event Cancel
@@ -156,11 +156,5 @@ { } - - private DateTime? tempEventStartDate; - private DateTime? tempEventEndDate; - private int tempEventMaxTokenCap = 0; - private int tempEventDailyRequestCap = 0; - } From 77681cc402a1ab1e4beb6bea9af097e7d7adedd8 Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Tue, 10 Sep 2024 01:41:27 +0900 Subject: [PATCH 10/35] =?UTF-8?q?Refactor:=20Time=20Zone=20Select=20?= =?UTF-8?q?=EB=86=92=EC=9D=B4=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/UI/Admin/NewEventDetailsComponent.razor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor index ac7daa9b..b52e85f1 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor +++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor @@ -62,7 +62,7 @@ Time Zone - + @foreach (var timeZone in timeZoneList) { @timeZone.Id From 197d7ee6a44e87411fb4a290df83d2b127ccdd89 Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Tue, 10 Sep 2024 01:54:22 +0900 Subject: [PATCH 11/35] =?UTF-8?q?Refactor:=20CSS=20=EC=A0=81=EC=9A=A9=20?= =?UTF-8?q?=EB=B0=A9=EC=8B=9D=20=EC=88=98=EC=A0=95=20-=20=EC=99=B8?= =?UTF-8?q?=EB=B6=80=20=EC=8A=A4=ED=83=80=EC=9D=BC=20=EC=8B=9C=ED=8A=B8=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UI/Admin/NewEventDetailsComponent.razor | 26 +------------------ .../Admin/NewEventDetailsComponent.razor.css | 25 ++++++++++++++++++ 2 files changed, 26 insertions(+), 25 deletions(-) create mode 100644 src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor.css diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor index b52e85f1..9c8f4437 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor +++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor @@ -3,30 +3,6 @@ @using NodaTime.Extensions @using NodaTime.TimeZones - - New Event @@ -38,7 +14,7 @@ - + Summary diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor.css b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor.css new file mode 100644 index 00000000..339bce45 --- /dev/null +++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor.css @@ -0,0 +1,25 @@ +section { + margin-bottom: 100px +} + +.create-input-label { + width: 200px; + --type-ramp-base-font-size: 22px; +} + +.create-fluent-stack { + height: 100px; +} + +.button-section { + display: flex; + justify-content: center; + gap: 50px; +} + +.button { + width: 150px; + height: 50px; + font-size: 16px; + margin: 0 10px; +} \ No newline at end of file From ecb1b2a4899cca49e175fe5f38aad4d441652f06 Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Tue, 10 Sep 2024 02:08:44 +0900 Subject: [PATCH 12/35] =?UTF-8?q?Revert=20"Refactor:=20CSS=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9=20=EB=B0=A9=EC=8B=9D=20=EC=88=98=EC=A0=95=20-=20?= =?UTF-8?q?=EC=99=B8=EB=B6=80=20=EC=8A=A4=ED=83=80=EC=9D=BC=20=EC=8B=9C?= =?UTF-8?q?=ED=8A=B8=20=EC=A0=81=EC=9A=A9"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 197d7ee6a44e87411fb4a290df83d2b127ccdd89. --- .../UI/Admin/NewEventDetailsComponent.razor | 26 ++++++++++++++++++- .../Admin/NewEventDetailsComponent.razor.css | 25 ------------------ 2 files changed, 25 insertions(+), 26 deletions(-) delete mode 100644 src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor.css diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor index 9c8f4437..b52e85f1 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor +++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor @@ -3,6 +3,30 @@ @using NodaTime.Extensions @using NodaTime.TimeZones + + New Event @@ -14,7 +38,7 @@ - + Summary diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor.css b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor.css deleted file mode 100644 index 339bce45..00000000 --- a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor.css +++ /dev/null @@ -1,25 +0,0 @@ -section { - margin-bottom: 100px -} - -.create-input-label { - width: 200px; - --type-ramp-base-font-size: 22px; -} - -.create-fluent-stack { - height: 100px; -} - -.button-section { - display: flex; - justify-content: center; - gap: 50px; -} - -.button { - width: 150px; - height: 50px; - font-size: 16px; - margin: 0 10px; -} \ No newline at end of file From 0fbcc1f39e7bddfc9d7ecd44894f2422d7909087 Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Tue, 10 Sep 2024 02:13:06 +0900 Subject: [PATCH 13/35] =?UTF-8?q?Refactor:=20=EC=9D=B4=EB=B2=A4=ED=8A=B8?= =?UTF-8?q?=20=EC=A2=85=EB=A3=8C=20=EB=82=A0=EC=A7=9C=20=EA=B8=B0=EB=B3=B8?= =?UTF-8?q?=EA=B0=92=20=EC=88=98=EC=A0=95=20(=EC=98=A4=EB=8A=98=20?= =?UTF-8?q?=EA=B8=B0=EC=A4=80=20=EB=8B=A4=EC=9D=8C=EB=82=A0=EB=A1=9C=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/UI/Admin/NewEventDetailsComponent.razor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor index b52e85f1..8ec1fefa 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor +++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor @@ -139,7 +139,7 @@ DateTime currentTime = DateTime.Now; tempEventStartDate = currentTime; - tempEventEndDate = currentTime; + tempEventEndDate = currentTime.AddDays(1); tempEventStartTime = currentTime.AddHours(1).AddMinutes(-currentTime.Minute); tempEventEndTime = currentTime.AddHours(1).AddMinutes(-currentTime.Minute); From a52fa78cde46646ce5f2ec2de99e2b9b2d65b27e Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Fri, 20 Sep 2024 02:05:31 +0900 Subject: [PATCH 14/35] Refactor: NewEventDetailsComponent.razor --- .../UI/Admin/NewEventDetailsComponent.razor | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor index 8ec1fefa..59313843 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor +++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor @@ -1,4 +1,5 @@ @using AzureOpenAIProxy.PlaygroundApp.Models; + @using NodaTime @using NodaTime.Extensions @using NodaTime.TimeZones @@ -128,14 +129,18 @@ private DateTime? tempEventEndDate; private DateTime? tempEventStartTime; private DateTime? tempEventEndTime; - private List timeZoneList; - private AdminEventDetails adminEventDetails; + private List? timeZoneList; + private AdminEventDetails? adminEventDetails; [Parameter] public string? Id { get; set; } - protected override void OnInitialized() + protected override async Task OnInitializedAsync() { + // Simulate asynchronous loading to demonstrate streaming rendering + await Task.Delay(500); + + adminEventDetails = adminEventDetails == null ? new() : adminEventDetails; DateTime currentTime = DateTime.Now; tempEventStartDate = currentTime; @@ -144,15 +149,14 @@ tempEventEndTime = currentTime.AddHours(1).AddMinutes(-currentTime.Minute); timeZoneList = DateTimeZoneProviders.Tzdb.GetAllZones().ToList(); - adminEventDetails = adminEventDetails == null ? new() : adminEventDetails; } - private void AddEvent() + private async Task AddEvent() { } - private void CancelEvent() + private async Task CancelEvent() { } From ad18000eb6c23a18bd67a1e6ba833e07cfe83a2c Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Fri, 20 Sep 2024 03:09:13 +0900 Subject: [PATCH 15/35] Refactor: Remove @temp~ variables --- .../Components/Pages/AdminNewEvent.razor | 2 + .../UI/Admin/NewEventDetailsComponent.razor | 200 +++++++++--------- 2 files changed, 102 insertions(+), 100 deletions(-) diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/Pages/AdminNewEvent.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/Pages/AdminNewEvent.razor index 6341ab35..7d0fec79 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/Components/Pages/AdminNewEvent.razor +++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/Pages/AdminNewEvent.razor @@ -3,3 +3,5 @@ New event

New event

+ + \ No newline at end of file diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor index 59313843..a20fd782 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor +++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor @@ -29,106 +29,108 @@ - New Event - -
-

Event Infomation

+ @if (adminEventDetails == null) + { +

Loading...

+ } + else + { + New Event + +
+

Event Infomation

- - Title - - - - - Summary - - - - - Description - - - - - Event Start Date - - - - - - Event End Date - - - - - - Time Zone - - @foreach (var timeZone in timeZoneList) - { - @timeZone.Id - } - - -
- -
-

Event Organizer

- - - Organizer Name - - - - - - Organizer Email - - -
+ + Title + + + + + Summary + + + + + Description + + + + + Event Start Date + + + + + + Event End Date + + + + + + Time Zone + + @foreach (var timeZone in timeZoneList) + { + @timeZone.Id + } + + +
+ +
+

Event Organizer

+ + + Organizer Name + + + + + + Organizer Email + + +
-
-

Event Coorganizers

- - - Coorgnizer Name - - - - - Coorgnizer Email - - -
- -
-

Event Configuration

- - - Max Token Cap - - - - - Daily Request Cap - - -
- -
- Add Event - Cancel -
-
+
+

Event Coorganizers

+ + + Coorgnizer Name + + + + + Coorgnizer Email + + +
+ +
+

Event Configuration

+ + + Max Token Cap + + + + + Daily Request Cap + + +
+ +
+ Add Event + Cancel +
+ + }
@code { - - private DateTime? tempEventStartDate; - private DateTime? tempEventEndDate; - private DateTime? tempEventStartTime; - private DateTime? tempEventEndTime; private List? timeZoneList; private AdminEventDetails? adminEventDetails; @@ -138,22 +140,20 @@ protected override async Task OnInitializedAsync() { // Simulate asynchronous loading to demonstrate streaming rendering - await Task.Delay(500); + await Task.Delay(100); adminEventDetails = adminEventDetails == null ? new() : adminEventDetails; DateTime currentTime = DateTime.Now; - tempEventStartDate = currentTime; - tempEventEndDate = currentTime.AddDays(1); - tempEventStartTime = currentTime.AddHours(1).AddMinutes(-currentTime.Minute); - tempEventEndTime = currentTime.AddHours(1).AddMinutes(-currentTime.Minute); + adminEventDetails.DateStart = currentTime.AddHours(1).AddMinutes(-currentTime.Minute); + adminEventDetails.DateEnd = currentTime.AddDays(1).AddMinutes(-currentTime.Minute).AddHours(1); timeZoneList = DateTimeZoneProviders.Tzdb.GetAllZones().ToList(); } private async Task AddEvent() { - + } private async Task CancelEvent() From a4b8b4ef81d21fe3e6e759de2f5320ef53e32d1a Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Fri, 20 Sep 2024 03:24:58 +0900 Subject: [PATCH 16/35] Fix: FluentDatePicker, FluentTimePicker ValueChanged error fix --- .../Components/UI/Admin/NewEventDetailsComponent.razor | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor index a20fd782..1298c875 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor +++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor @@ -57,14 +57,14 @@ Event Start Date - - + + Event End Date - - + + From 4597c160c2f5edf153b9d020cde8f46b5f88e010 Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Sat, 28 Sep 2024 23:30:49 +0900 Subject: [PATCH 17/35] Refactor: NewEventDetailsComponent.razor --- .../Components/Pages/AdminNewEvent.razor | 2 +- .../UI/Admin/NewEventDetailsComponent.razor | 98 +++++++------------ .../Admin/NewEventDetailsComponent.razor.css | 25 +++++ 3 files changed, 63 insertions(+), 62 deletions(-) create mode 100644 src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor.css diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/Pages/AdminNewEvent.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/Pages/AdminNewEvent.razor index 7d0fec79..f1b5b32f 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/Components/Pages/AdminNewEvent.razor +++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/Pages/AdminNewEvent.razor @@ -4,4 +4,4 @@

New event

- \ No newline at end of file + \ No newline at end of file diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor index 1298c875..4aa78f01 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor +++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor @@ -1,32 +1,11 @@ -@using AzureOpenAIProxy.PlaygroundApp.Models; +@using AzureOpenAIProxy.PlaygroundApp.Clients +@using AzureOpenAIProxy.PlaygroundApp.Models; @using NodaTime @using NodaTime.Extensions @using NodaTime.TimeZones - +@inject BrowserTimeProvider browserTimeProvider @if (adminEventDetails == null) @@ -40,35 +19,35 @@

Event Infomation

- - Title + + Title - - Summary + + Summary - - Description + + Description - - Event Start Date - - + + Event Start Date + + - - Event End Date - - + + Event End Date + + - - Time Zone + + Time Zone @foreach (var timeZone in timeZoneList) { @@ -81,14 +60,14 @@

Event Organizer

- - Organizer Name + + Organizer Name - - Organizer Email + + Organizer Email
@@ -96,13 +75,13 @@

Event Coorganizers

- - Coorgnizer Name + + Coorgnizer Name - - Coorgnizer Email + + Coorgnizer Email
@@ -110,20 +89,20 @@

Event Configuration

- - Max Token Cap + + Max Token Cap - - Daily Request Cap + + Daily Request Cap
- Add Event - Cancel + Add Event + Cancel
} @@ -139,26 +118,23 @@ protected override async Task OnInitializedAsync() { - // Simulate asynchronous loading to demonstrate streaming rendering - await Task.Delay(100); - adminEventDetails = adminEventDetails == null ? new() : adminEventDetails; - DateTime currentTime = DateTime.Now; + DateTimeOffset currentTime = DateTimeOffset.UtcNow; adminEventDetails.DateStart = currentTime.AddHours(1).AddMinutes(-currentTime.Minute); - adminEventDetails.DateEnd = currentTime.AddDays(1).AddMinutes(-currentTime.Minute).AddHours(1); + adminEventDetails.DateEnd = currentTime.AddDays(1).AddHours(1).AddMinutes(-currentTime.Minute); timeZoneList = DateTimeZoneProviders.Tzdb.GetAllZones().ToList(); } private async Task AddEvent() { - + await Task.CompletedTask; } private async Task CancelEvent() { - + await Task.CompletedTask; } } diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor.css b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor.css new file mode 100644 index 00000000..b6975111 --- /dev/null +++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor.css @@ -0,0 +1,25 @@ +section { + margin-bottom: 100px +} + +::deep .create-input-label { + width: 200px; + --type-ramp-base-font-size: 22px; +} + +::deep .create-fluent-stack { + height: 100px; +} + +.button-section { + display: flex; + justify-content: center; + gap: 50px; +} + +.button { + width: 150px; + height: 50px; + font-size: 16px; + margin: 0 10px; +} From 57475f53b7ac285657bcb27b9ecb04de2973404c Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Sun, 29 Sep 2024 00:01:04 +0900 Subject: [PATCH 18/35] Test: Add NewEventDetailsComponent.razor test --- .../Pages/NewEventDetailsPageTests.cs | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsPageTests.cs diff --git a/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsPageTests.cs b/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsPageTests.cs new file mode 100644 index 00000000..1a2f269c --- /dev/null +++ b/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsPageTests.cs @@ -0,0 +1,45 @@ +using FluentAssertions; + +using Microsoft.Playwright; +using Microsoft.Playwright.NUnit; + +namespace AzureOpenAIProxy.PlaygroundApp.Tests.Pages; + +[Parallelizable(ParallelScope.Self)] +[TestFixture] +[Property("Category", "Integration")] + +public class NewEventDetailsPageTests : PageTest +{ + public override BrowserNewContextOptions ContextOptions() => new() + { + IgnoreHTTPSErrors = true, + }; + + [SetUp] + public async Task Init() + { + await Page.GotoAsync("https://localhost:5001/admin/events/new"); + await Page.WaitForLoadStateAsync(LoadState.NetworkIdle); + } + + [Test] + public async Task Given_New_Event_Details_Page_When_Navigated_Then_It_Should_Load_Correctly() + { + // Act + var header = await Page.QuerySelectorAsync("fluent-header"); + var addButton = await Page.QuerySelectorAsync("#admin-event-detail-add"); + var cancelButton = await Page.QuerySelectorAsync("#admin-event-detail-cancel"); + + // Assert + header.Should().NotBeNull(); + addButton.Should().NotBeNull(); + cancelButton.Should().NotBeNull(); + } + + [TearDown] + public async Task CleanUp() + { + await Page.CloseAsync(); + } +} From 41ce7143924d49fec58c818cb6f2374843a6da82 Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Sun, 29 Sep 2024 05:40:45 +0900 Subject: [PATCH 19/35] Test: Add input test --- .../Pages/NewEventDetailsPageTests.cs | 39 ++++++++++++++++--- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsPageTests.cs b/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsPageTests.cs index 1a2f269c..2b3180cf 100644 --- a/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsPageTests.cs +++ b/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsPageTests.cs @@ -2,6 +2,7 @@ using Microsoft.Playwright; using Microsoft.Playwright.NUnit; +using Microsoft.VisualBasic; namespace AzureOpenAIProxy.PlaygroundApp.Tests.Pages; @@ -27,14 +28,40 @@ public async Task Init() public async Task Given_New_Event_Details_Page_When_Navigated_Then_It_Should_Load_Correctly() { // Act - var header = await Page.QuerySelectorAsync("fluent-header"); - var addButton = await Page.QuerySelectorAsync("#admin-event-detail-add"); - var cancelButton = await Page.QuerySelectorAsync("#admin-event-detail-cancel"); + var inputTitle = await Page.QuerySelectorAsync("#event-title"); + var inputSummary = await Page.QuerySelectorAsync("#event-summary"); + var inputDescription = await Page.QuerySelectorAsync("#event-description"); + var inputStartDate = await Page.QuerySelectorAsync("#event-start-date"); + var inputStartTime = await Page.QuerySelectorAsync("#event-start-time"); + var inputEndDate = await Page.QuerySelectorAsync("#event-end-date"); + var inputEndTime = await Page.QuerySelectorAsync("#event-end-time"); + var inputTimezone = await Page.QuerySelectorAsync("#event-timezone"); + var inputOrganizerName = await Page.QuerySelectorAsync("#event-organizer-name"); + var inputOrganizerEmail = await Page.QuerySelectorAsync("#event-organizer-email"); + var inputCoorgnizerName = await Page.QuerySelectorAsync("#event-coorgnizer-name"); + var inputCoorgnizerEmail = await Page.QuerySelectorAsync("#event-coorgnizer-email"); + var inputMaxTokenCap = await Page.QuerySelectorAsync("#event-max-token-cap"); + var inputDailyRequestCap = await Page.QuerySelectorAsync("#event-daily-request-cap"); + var buttonAdd = await Page.QuerySelectorAsync("#admin-event-detail-add"); + var buttonCancel = await Page.QuerySelectorAsync("#admin-event-detail-cancel"); // Assert - header.Should().NotBeNull(); - addButton.Should().NotBeNull(); - cancelButton.Should().NotBeNull(); + inputTitle.Should().NotBeNull(); + inputSummary.Should().NotBeNull(); + inputDescription.Should().NotBeNull(); + inputStartDate.Should().NotBeNull(); + inputStartTime.Should().NotBeNull(); + inputEndDate.Should().NotBeNull(); + inputEndTime.Should().NotBeNull(); + inputTimezone.Should().NotBeNull(); + inputOrganizerName.Should().NotBeNull(); + inputOrganizerEmail.Should().NotBeNull(); + inputCoorgnizerName.Should().NotBeNull(); + inputCoorgnizerEmail.Should().NotBeNull(); + inputMaxTokenCap.Should().NotBeNull(); + inputDailyRequestCap.Should().NotBeNull(); + buttonAdd.Should().NotBeNull(); + buttonCancel.Should().NotBeNull(); } [TearDown] From 19fc5a17972ab05cfda903fd4d038fb69719dfdd Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Sun, 29 Sep 2024 05:41:48 +0900 Subject: [PATCH 20/35] Fix: delete inject --- .../Components/UI/Admin/NewEventDetailsComponent.razor | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor index 4aa78f01..d6c4e450 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor +++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor @@ -5,8 +5,6 @@ @using NodaTime.Extensions @using NodaTime.TimeZones -@inject BrowserTimeProvider browserTimeProvider - @if (adminEventDetails == null) { From 9181344728243019706f09f2d40d5e64796afa83 Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Sun, 29 Sep 2024 16:59:19 +0900 Subject: [PATCH 21/35] Feat: Get local browser timezone --- .../UI/Admin/NewEventDetailsComponent.razor | 50 ++++++++++++++++--- .../wwwroot/timezone.js | 4 ++ 2 files changed, 47 insertions(+), 7 deletions(-) create mode 100644 src/AzureOpenAIProxy.PlaygroundApp/wwwroot/timezone.js diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor index d6c4e450..73c8576b 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor +++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor @@ -34,8 +34,8 @@ Event Start Date - - + + @@ -46,7 +46,7 @@ Time Zone - + @foreach (var timeZone in timeZoneList) { @timeZone.Id @@ -110,21 +110,39 @@ @code { private List? timeZoneList; private AdminEventDetails? adminEventDetails; + private DateTimeOffset currentTime = DateTimeOffset.UtcNow; [Parameter] public string? Id { get; set; } + [Inject] + public IJSRuntime JSRuntime { get; set; } = default!; + + protected override async Task OnInitializedAsync() { adminEventDetails = adminEventDetails == null ? new() : adminEventDetails; - DateTimeOffset currentTime = DateTimeOffset.UtcNow; - - adminEventDetails.DateStart = currentTime.AddHours(1).AddMinutes(-currentTime.Minute); - adminEventDetails.DateEnd = currentTime.AddDays(1).AddHours(1).AddMinutes(-currentTime.Minute); timeZoneList = DateTimeZoneProviders.Tzdb.GetAllZones().ToList(); } + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + var timezoneId = await GetLocalTimezoneId(); + var timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(timezoneId); + + currentTime = TimeZoneInfo.ConvertTime(currentTime, timeZoneInfo); + + adminEventDetails.DateStart = currentTime.AddHours(1).AddMinutes(-currentTime.Minute); + adminEventDetails.DateEnd = currentTime.AddDays(1).AddHours(1).AddMinutes(-currentTime.Minute); + adminEventDetails.TimeZone = timezoneId; + + await InvokeAsync(StateHasChanged); + } + } + private async Task AddEvent() { await Task.CompletedTask; @@ -134,5 +152,23 @@ { await Task.CompletedTask; } + + private async Task GetLocalTimezoneId() + { + string timezoneId = ""; + + try + { + await using var module = await JSRuntime.InvokeAsync("import", "./timezone.js"); + timezoneId = await module.InvokeAsync("getBrowserTimeZone"); + + } + catch (JSDisconnectedException) + { + + } + + return timezoneId; + } } diff --git a/src/AzureOpenAIProxy.PlaygroundApp/wwwroot/timezone.js b/src/AzureOpenAIProxy.PlaygroundApp/wwwroot/timezone.js new file mode 100644 index 00000000..44ebda69 --- /dev/null +++ b/src/AzureOpenAIProxy.PlaygroundApp/wwwroot/timezone.js @@ -0,0 +1,4 @@ +export function getBrowserTimeZone() { + const options = Intl.DateTimeFormat().resolvedOptions(); + return options.timeZone; +} \ No newline at end of file From 88f32ef3d76ca5815922706cd7452fa258c71916 Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Sun, 29 Sep 2024 17:13:07 +0900 Subject: [PATCH 22/35] Refactor: Add JS error handling --- .../Components/UI/Admin/NewEventDetailsComponent.razor | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor index 73c8576b..e0868916 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor +++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor @@ -161,11 +161,11 @@ { await using var module = await JSRuntime.InvokeAsync("import", "./timezone.js"); timezoneId = await module.InvokeAsync("getBrowserTimeZone"); - } - catch (JSDisconnectedException) + catch (JSDisconnectedException ex) { - + Console.WriteLine($"Unable to connect javascript: {ex.Message}"); + timezoneId = TimeZoneInfo.Local.Id; } return timezoneId; From 60e851a3fabb1203560b42a02f7956663fc4b365 Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Wed, 2 Oct 2024 01:13:09 +0900 Subject: [PATCH 23/35] Refactor: NewEventDetailsComponent.razor --- .../UI/Admin/NewEventDetailsComponent.razor | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor index e0868916..f8e619ad 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor +++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor @@ -34,14 +34,14 @@ Event Start Date - - + + Event End Date - - + + @@ -155,7 +155,7 @@ private async Task GetLocalTimezoneId() { - string timezoneId = ""; + string timezoneId = TimeZoneInfo.Local.Id; try { @@ -165,7 +165,6 @@ catch (JSDisconnectedException ex) { Console.WriteLine($"Unable to connect javascript: {ex.Message}"); - timezoneId = TimeZoneInfo.Local.Id; } return timezoneId; From c636124d428a323147acabf1db553b8fc1b52ab9 Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Wed, 2 Oct 2024 01:14:11 +0900 Subject: [PATCH 24/35] Test: Add init timezone test --- .../Pages/NewEventDetailsPageTests.cs | 63 ++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsPageTests.cs b/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsPageTests.cs index 2b3180cf..3941991c 100644 --- a/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsPageTests.cs +++ b/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsPageTests.cs @@ -1,4 +1,6 @@ -using FluentAssertions; +using System; + +using FluentAssertions; using Microsoft.Playwright; using Microsoft.Playwright.NUnit; @@ -64,6 +66,65 @@ public async Task Given_New_Event_Details_Page_When_Navigated_Then_It_Should_Loa buttonCancel.Should().NotBeNull(); } + [Test] + public async Task Given_Input_Event_Timezone_When_Initialized_Timezone_Then_It_Should_Update_Value() + { + // Arrange + await Page.WaitForSelectorAsync("#event-timezone"); + + string timeZone = await Page.EvaluateAsync(@"() => Intl.DateTimeFormat().resolvedOptions().timeZone"); + + // Act + string inputTimezoneValue = await Page.GetAttributeAsync("#event-timezone", "current-value"); + + // Assert + inputTimezoneValue.Should().Be(timeZone); + } + + [Test] + public async Task Given_Input_Event_Start_DateTime_When_Initialized_Timezone_Then_It_Should_Update_Value() + { + // Arrange + await Page.WaitForSelectorAsync("#event-start-date"); + await Page.WaitForSelectorAsync("#event-start-time"); + + string timezoneId = await Page.EvaluateAsync(@"() => Intl.DateTimeFormat().resolvedOptions().timeZone"); + var timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(timezoneId); + DateTimeOffset currentTime = TimeZoneInfo.ConvertTime(DateTime.Now, timeZoneInfo); + var startTime = currentTime.AddHours(1).AddMinutes(-currentTime.Minute); + + + // Act + var inputStartDateValue = await Page.GetAttributeAsync("#event-start-date", "current-value"); + var inputStartTimeValue = await Page.GetAttributeAsync("#event-start-time", "current-value"); + + // Assert + inputStartDateValue.Should().Be(startTime.ToString("yyyy-MM-dd")); + inputStartTimeValue.Should().Be(startTime.ToString("HH:mm")); + } + + [Test] + public async Task Given_Input_Event_End_DateTime_When_Initialized_Timezone_Then_It_Should_Update_Value() + { + // Arrange + await Page.WaitForSelectorAsync("#event-end-date"); + await Page.WaitForSelectorAsync("#event-end-time"); + + string timezoneId = await Page.EvaluateAsync(@"() => Intl.DateTimeFormat().resolvedOptions().timeZone"); + var timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(timezoneId); + DateTimeOffset currentTime = TimeZoneInfo.ConvertTime(DateTime.Now, timeZoneInfo); + var endTime = currentTime.AddDays(1).AddHours(1).AddMinutes(-currentTime.Minute); + + + // Act + var inputEndDateValue = await Page.GetAttributeAsync("#event-end-date", "current-value"); + var inputEndTimeValue = await Page.GetAttributeAsync("#event-end-time", "current-value"); + + // Assert + inputEndDateValue.Should().Be(endTime.ToString("yyyy-MM-dd")); + inputEndTimeValue.Should().Be(endTime.ToString("HH:mm")); + } + [TearDown] public async Task CleanUp() { From 6bf9e4f08decff9945913ceb893d8d6309174819 Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Fri, 4 Oct 2024 00:58:46 +0900 Subject: [PATCH 25/35] Fix: Browser Timezone > System Timezone --- .../UI/Admin/NewEventDetailsComponent.razor | 23 +------------------ .../wwwroot/timezone.js | 4 ---- .../Pages/NewEventDetailsPageTests.cs | 9 +++----- 3 files changed, 4 insertions(+), 32 deletions(-) delete mode 100644 src/AzureOpenAIProxy.PlaygroundApp/wwwroot/timezone.js diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor index f8e619ad..19373579 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor +++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor @@ -115,10 +115,6 @@ [Parameter] public string? Id { get; set; } - [Inject] - public IJSRuntime JSRuntime { get; set; } = default!; - - protected override async Task OnInitializedAsync() { adminEventDetails = adminEventDetails == null ? new() : adminEventDetails; @@ -130,7 +126,7 @@ { if (firstRender) { - var timezoneId = await GetLocalTimezoneId(); + var timezoneId = TimeZoneInfo.Local.Id; var timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(timezoneId); currentTime = TimeZoneInfo.ConvertTime(currentTime, timeZoneInfo); @@ -152,22 +148,5 @@ { await Task.CompletedTask; } - - private async Task GetLocalTimezoneId() - { - string timezoneId = TimeZoneInfo.Local.Id; - - try - { - await using var module = await JSRuntime.InvokeAsync("import", "./timezone.js"); - timezoneId = await module.InvokeAsync("getBrowserTimeZone"); - } - catch (JSDisconnectedException ex) - { - Console.WriteLine($"Unable to connect javascript: {ex.Message}"); - } - - return timezoneId; - } } diff --git a/src/AzureOpenAIProxy.PlaygroundApp/wwwroot/timezone.js b/src/AzureOpenAIProxy.PlaygroundApp/wwwroot/timezone.js deleted file mode 100644 index 44ebda69..00000000 --- a/src/AzureOpenAIProxy.PlaygroundApp/wwwroot/timezone.js +++ /dev/null @@ -1,4 +0,0 @@ -export function getBrowserTimeZone() { - const options = Intl.DateTimeFormat().resolvedOptions(); - return options.timeZone; -} \ No newline at end of file diff --git a/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsPageTests.cs b/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsPageTests.cs index 3941991c..f04299a4 100644 --- a/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsPageTests.cs +++ b/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsPageTests.cs @@ -71,8 +71,7 @@ public async Task Given_Input_Event_Timezone_When_Initialized_Timezone_Then_It_S { // Arrange await Page.WaitForSelectorAsync("#event-timezone"); - - string timeZone = await Page.EvaluateAsync(@"() => Intl.DateTimeFormat().resolvedOptions().timeZone"); + string timeZone = TimeZoneInfo.Local.Id; // Act string inputTimezoneValue = await Page.GetAttributeAsync("#event-timezone", "current-value"); @@ -88,12 +87,11 @@ public async Task Given_Input_Event_Start_DateTime_When_Initialized_Timezone_The await Page.WaitForSelectorAsync("#event-start-date"); await Page.WaitForSelectorAsync("#event-start-time"); - string timezoneId = await Page.EvaluateAsync(@"() => Intl.DateTimeFormat().resolvedOptions().timeZone"); + string timezoneId = TimeZoneInfo.Local.Id; var timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(timezoneId); DateTimeOffset currentTime = TimeZoneInfo.ConvertTime(DateTime.Now, timeZoneInfo); var startTime = currentTime.AddHours(1).AddMinutes(-currentTime.Minute); - // Act var inputStartDateValue = await Page.GetAttributeAsync("#event-start-date", "current-value"); var inputStartTimeValue = await Page.GetAttributeAsync("#event-start-time", "current-value"); @@ -110,12 +108,11 @@ public async Task Given_Input_Event_End_DateTime_When_Initialized_Timezone_Then_ await Page.WaitForSelectorAsync("#event-end-date"); await Page.WaitForSelectorAsync("#event-end-time"); - string timezoneId = await Page.EvaluateAsync(@"() => Intl.DateTimeFormat().resolvedOptions().timeZone"); + string timezoneId = TimeZoneInfo.Local.Id; var timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(timezoneId); DateTimeOffset currentTime = TimeZoneInfo.ConvertTime(DateTime.Now, timeZoneInfo); var endTime = currentTime.AddDays(1).AddHours(1).AddMinutes(-currentTime.Minute); - // Act var inputEndDateValue = await Page.GetAttributeAsync("#event-end-date", "current-value"); var inputEndTimeValue = await Page.GetAttributeAsync("#event-end-time", "current-value"); From 7c134768e38223127de979efb999b1e2d8129c6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=97=B0=EC=A4=91?= Date: Fri, 4 Oct 2024 13:33:46 +0900 Subject: [PATCH 26/35] Fix: Test error fix (Now > UtcNow) --- .../Pages/NewEventDetailsPageTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsPageTests.cs b/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsPageTests.cs index f04299a4..e3bbb948 100644 --- a/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsPageTests.cs +++ b/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/NewEventDetailsPageTests.cs @@ -89,7 +89,7 @@ public async Task Given_Input_Event_Start_DateTime_When_Initialized_Timezone_The string timezoneId = TimeZoneInfo.Local.Id; var timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(timezoneId); - DateTimeOffset currentTime = TimeZoneInfo.ConvertTime(DateTime.Now, timeZoneInfo); + DateTimeOffset currentTime = TimeZoneInfo.ConvertTime(DateTimeOffset.UtcNow, timeZoneInfo); var startTime = currentTime.AddHours(1).AddMinutes(-currentTime.Minute); // Act @@ -110,7 +110,7 @@ public async Task Given_Input_Event_End_DateTime_When_Initialized_Timezone_Then_ string timezoneId = TimeZoneInfo.Local.Id; var timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(timezoneId); - DateTimeOffset currentTime = TimeZoneInfo.ConvertTime(DateTime.Now, timeZoneInfo); + DateTimeOffset currentTime = TimeZoneInfo.ConvertTime(DateTimeOffset.UtcNow, timeZoneInfo); var endTime = currentTime.AddDays(1).AddHours(1).AddMinutes(-currentTime.Minute); // Act From 77fd77301cf76e5b40da4cc4be34e0c91076254c Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Sat, 5 Oct 2024 12:29:05 +0900 Subject: [PATCH 27/35] Fix: add attribute Culture to FluentDatePicker --- .../Components/UI/Admin/NewEventDetailsComponent.razor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor index 19373579..966aac93 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor +++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor @@ -34,13 +34,13 @@ Event Start Date - + Event End Date - + From d5b9d02c7e323a1dcd7a65a62c5a3971c6f6d06b Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Sat, 5 Oct 2024 13:04:54 +0900 Subject: [PATCH 28/35] Fix: Add culture info in OnAfterRenderAsync --- .../Components/UI/Admin/NewEventDetailsComponent.razor | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor index 966aac93..af1b009f 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor +++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor @@ -1,6 +1,8 @@ @using AzureOpenAIProxy.PlaygroundApp.Clients @using AzureOpenAIProxy.PlaygroundApp.Models; +@using System.Globalization + @using NodaTime @using NodaTime.Extensions @using NodaTime.TimeZones @@ -120,6 +122,13 @@ adminEventDetails = adminEventDetails == null ? new() : adminEventDetails; timeZoneList = DateTimeZoneProviders.Tzdb.GetAllZones().ToList(); + + CultureInfo customCulture = (CultureInfo)CultureInfo.CurrentCulture.Clone(); + customCulture.DateTimeFormat.ShortDatePattern = "yyyy-MM-dd"; + customCulture.DateTimeFormat.ShortTimePattern = "HH:mm"; + + CultureInfo.DefaultThreadCurrentCulture = customCulture; + CultureInfo.DefaultThreadCurrentUICulture = customCulture; } protected override async Task OnAfterRenderAsync(bool firstRender) From 4587101c1cea87bad49c9ab1e8207e5dff95ae03 Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Sat, 5 Oct 2024 14:33:02 +0900 Subject: [PATCH 29/35] Feat: Convert from Windows timezone to IANA timezone using TimeZoneConverter --- .../AzureOpenAIProxy.PlaygroundApp.csproj | 1 + .../Components/UI/Admin/NewEventDetailsComponent.razor | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/AzureOpenAIProxy.PlaygroundApp/AzureOpenAIProxy.PlaygroundApp.csproj b/src/AzureOpenAIProxy.PlaygroundApp/AzureOpenAIProxy.PlaygroundApp.csproj index 84a2b5bf..52f53703 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/AzureOpenAIProxy.PlaygroundApp.csproj +++ b/src/AzureOpenAIProxy.PlaygroundApp/AzureOpenAIProxy.PlaygroundApp.csproj @@ -11,6 +11,7 @@ + diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor index af1b009f..96e7f978 100644 --- a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor +++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/NewEventDetailsComponent.razor @@ -6,6 +6,7 @@ @using NodaTime @using NodaTime.Extensions @using NodaTime.TimeZones +@using TimeZoneConverter @if (adminEventDetails == null) @@ -135,7 +136,7 @@ { if (firstRender) { - var timezoneId = TimeZoneInfo.Local.Id; + var timezoneId = TZConvert.WindowsToIana(TimeZoneInfo.Local.Id); var timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(timezoneId); currentTime = TimeZoneInfo.ConvertTime(currentTime, timeZoneInfo); From 225ff36a7739e624cb5a7b0b54ae108c9cebc5b4 Mon Sep 17 00:00:00 2001 From: PC_KYJ Date: Sat, 5 Oct 2024 14:38:26 +0900 Subject: [PATCH 30/35] Test: Convert from Windows timezone to IANA timezone using TimeZoneConverter --- .../AzureOpenAIProxy.PlaygroundApp.Tests.csproj | 1 + .../Pages/NewEventDetailsPageTests.cs | 13 ++++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/AzureOpenAIProxy.PlaygroundApp.Tests/AzureOpenAIProxy.PlaygroundApp.Tests.csproj b/test/AzureOpenAIProxy.PlaygroundApp.Tests/AzureOpenAIProxy.PlaygroundApp.Tests.csproj index 0ed50954..3c76abc3 100644 --- a/test/AzureOpenAIProxy.PlaygroundApp.Tests/AzureOpenAIProxy.PlaygroundApp.Tests.csproj +++ b/test/AzureOpenAIProxy.PlaygroundApp.Tests/AzureOpenAIProxy.PlaygroundApp.Tests.csproj @@ -21,6 +21,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive +