From e85b737c99795a04cbccce12909016a45eae6615 Mon Sep 17 00:00:00 2001 From: ssgueye2 <127868584+ssgueye2@users.noreply.github.com> Date: Tue, 20 Jun 2023 10:18:36 +0200 Subject: [PATCH] hide configuration menu for AWS Support (#2235) --- src/IoTHub.Portal.Client/Shared/NavMenu.razor | 19 ++++++++++++------- .../Client/Pages/Shared/MainLayoutTests.cs | 14 +++++++------- .../Client/Pages/Shared/NavMenuTests.cs | 17 +++++++++-------- 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/src/IoTHub.Portal.Client/Shared/NavMenu.razor b/src/IoTHub.Portal.Client/Shared/NavMenu.razor index 0fcace23d..d93dc5542 100644 --- a/src/IoTHub.Portal.Client/Shared/NavMenu.razor +++ b/src/IoTHub.Portal.Client/Shared/NavMenu.razor @@ -2,6 +2,7 @@ @using Microsoft.AspNetCore.Components.Authorization @using IoTHub.Portal.Models.v10 @using Blazored.LocalStorage +@using IoTHub.Portal.Shared.Constants @inject NavigationManager navigationManager @inject PortalSettings Portal @inject ILayoutService LayoutService @@ -32,13 +33,17 @@ - - Configurations - - - - - + @if (Portal.CloudProvider.Equals(CloudProviders.Azure)) + { + + Configurations + + + + + + } + (); _ = TestContext?.AddTestAuthorization().SetAuthorized(Guid.NewGuid().ToString()); + } [TestCase("Devices", "Devices")] @@ -42,7 +43,7 @@ public override void Setup() public async Task CollapseButtonNavGroupShouldSaveNewState(string title, string property) { // Arrange - _ = Services.AddSingleton(new PortalSettings { IsLoRaSupported = true }); + _ = Services.AddSingleton(new PortalSettings { IsLoRaSupported = true, CloudProvider = "Azure" }); var cut = RenderComponent(); var navGroups = cut.FindComponents(); @@ -63,7 +64,7 @@ public async Task CollapseButtonNavGroupShouldSaveNewState(string title, string public async Task ExpandButtonNavGroupShouldSaveState(string title, string property) { // Arrange - _ = Services.AddSingleton(new PortalSettings { IsLoRaSupported = true }); + _ = Services.AddSingleton(new PortalSettings { IsLoRaSupported = true, CloudProvider = "Azure" }); var dic = new Dictionary { @@ -94,7 +95,7 @@ public async Task ExpandButtonNavGroupShouldSaveState(string title, string prope public async Task CollapseButtonNavGroupShouldSaveState(string title, string property) { // Arrange - _ = Services.AddSingleton(new PortalSettings { IsLoRaSupported = true }); + _ = Services.AddSingleton(new PortalSettings { IsLoRaSupported = true, CloudProvider = "Azure" }); var dic = new Dictionary { { property, true } @@ -124,7 +125,7 @@ public async Task CollapseButtonNavGroupShouldSaveState(string title, string pro public async Task WhenFalseCollapseNavGroupShouldBeCollapsed(string title, string property) { // Arrange - _ = Services.AddSingleton(new PortalSettings { IsLoRaSupported = true }); + _ = Services.AddSingleton(new PortalSettings { IsLoRaSupported = true, CloudProvider = "Azure" }); var dic = new Dictionary { { property, false } @@ -150,7 +151,7 @@ public async Task WhenFalseCollapseNavGroupShouldBeCollapsed(string title, strin public async Task WhenTrueCollapseNavGroupShouldBeExpanded(string title, string property) { // Arrange - _ = Services.AddSingleton(new PortalSettings { IsLoRaSupported = true }); + _ = Services.AddSingleton(new PortalSettings { IsLoRaSupported = true, CloudProvider = "Azure" }); var dic = new Dictionary { { property, true } @@ -170,7 +171,7 @@ public async Task WhenTrueCollapseNavGroupShouldBeExpanded(string title, string public async Task NavGroupsExpendedValuesShouldBeTrueWhenFirstTime() { // Arrange - _ = Services.AddSingleton(new PortalSettings { IsLoRaSupported = true }); + _ = Services.AddSingleton(new PortalSettings { IsLoRaSupported = true, CloudProvider = "Azure" }); // Act var cut = RenderComponent(); @@ -191,7 +192,7 @@ public async Task NavGroupsExpendedValuesShouldBeTrueWhenFirstTime() public void LoRaNavGroupShouldBeDisplayedOnlyIfSupported(bool supported) { // Arrange - _ = Services.AddSingleton(new PortalSettings { IsLoRaSupported = supported }); + _ = Services.AddSingleton(new PortalSettings { IsLoRaSupported = supported, CloudProvider = "Azure" }); // Act var cut = RenderComponent(); @@ -215,7 +216,7 @@ public void LoRaNavGroupShouldBeDisplayedOnlyIfSupported(bool supported) public void WhenClickToNewButtonShouldNavigate(string buttonName, string path) { // Arrange - _ = Services.AddSingleton(new PortalSettings { IsLoRaSupported = false }); + _ = Services.AddSingleton(new PortalSettings { IsLoRaSupported = false, CloudProvider = "Azure" }); var cut = RenderComponent(); var button = cut.WaitForElement($"#{buttonName}");