Skip to content

Commit

Permalink
Added new Environment Application List and Updated Unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Manas Kalangan committed Mar 14, 2024
1 parent fca21ce commit a991c5d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
<Page x:Class="Ginger.Environments.AddEnvironmentWizardLib.AddNewEnvAppsPage"
<Page x:Class="Ginger.Environments.AddEnvironmentWizardLib.AddNewEnvAppsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Ginger.Environments.AddEnvironmentWizardLib"
xmlns:ginger="clr-namespace:Ginger"
xmlns:Ginger="clr-namespace:Ginger" xmlns:GingerCore="clr-namespace:GingerCore;assembly=GingerCore"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
Title="AddNewEnvAppsPage">

<Grid Background="{StaticResource $BackgroundColor_White}">
<StackPanel>
<Button x:Name="xAddAppBtn" Content="Add" ToolTip="Add New Environment Application" Style="{StaticResource @InputButtonStyle}" Width="50" HorizontalAlignment="Right" Margin="0,20,20,0" Click="xAddAppBtn_Click"/>
<ListBox x:Name="xAppsListBox" Margin="0,10,0,0" Grid.Row="1">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<CheckBox Content="{Binding Name}" IsChecked="{Binding Active}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>

<Ginger:ucGrid x:Name="SelectApplicationGrid" IsReadOnly="true"
ShowTitle="Collapsed" ShowRefresh="Collapsed" ShowEdit="Collapsed" ShowAdd="Collapsed" ShowClearAll="Collapsed" ShowDelete="Collapsed" ShowUpDown="Collapsed"/>


<Label Margin="0,0,0,0" VerticalAlignment="Bottom">
<Label.Content>
<GingerCore:ucTextDicResource Text="Note: If the application you want is not there in this list then go to Configurations -> Target Applications page to add the new Application" FontSize="13" FontWeight="Bold"/>
</Label.Content>
</Label>

</Grid>
</Page>
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ limitations under the License.
#endregion

using amdocs.ginger.GingerCoreNET;
using Amdocs.Ginger.Common;
using Ginger.UserControls;
using GingerCore.Environments;
using GingerCoreNET.SolutionRepositoryLib.RepositoryObjectsLib.PlatformsLib;
using GingerWPF.WizardLib;
Expand All @@ -36,6 +38,15 @@ public partial class AddNewEnvAppsPage : Page, IWizardPage
public AddNewEnvAppsPage()
{
InitializeComponent();
GridViewDef view = new GridViewDef(GridViewDef.DefaultViewName);
view.GridColsView = new ObservableList<GridColView>();
view.GridColsView.Add(new GridColView() { Field = nameof(EnvApplication.Active), Header = " " , StyleType = GridColView.eGridColStyleType.CheckBox });
view.GridColsView.Add(new GridColView() { Field = nameof(EnvApplication.Name), Header = "Target Application", WidthWeight = 60});
view.GridColsView.Add(new GridColView() { Field = nameof(EnvApplication.ItemImageType), Header = " ", StyleType = GridColView.eGridColStyleType.ImageMaker, WidthWeight = 5, MaxWidth = 16 });
view.GridColsView.Add(new GridColView() { Field = nameof(EnvApplication.Platform),Header = "Platform Type" , WidthWeight = 40 });

SelectApplicationGrid.SetAllColumnsDefaultView(view);
SelectApplicationGrid.InitViewItems();
}

public void WizardEvent(WizardEventArgs WizardEventArgs)
Expand All @@ -47,19 +58,18 @@ public void WizardEvent(WizardEventArgs WizardEventArgs)

foreach (ApplicationPlatform appPlat in WorkSpace.Instance.Solution.ApplicationPlatforms)
{
EnvApplication envApp = new EnvApplication() { Name = appPlat.AppName };
EnvApplication envApp = new EnvApplication() { Name = appPlat.AppName, Platform = appPlat.Platform, ParentGuid = appPlat.Guid, ItemImageType = appPlat.PlatformImage };
envApp.Active = true;
mWizard.apps.Add(envApp);
}

if (mWizard.apps.Count == 0)
{
mWizard.apps.Add(new EnvApplication() { Name = "MyApplication" });
mWizard.apps.Add(new EnvApplication() { Name = "MyApplication", Platform = ePlatformType.NA });
}

xAppsListBox.ItemsSource = mWizard.apps;
SelectApplicationGrid.DataSourceList = mWizard.apps;
break;

}

}
Expand Down
6 changes: 5 additions & 1 deletion Ginger/GingerCoreCommon/EnvironmentLib/EnvApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ public override string ItemNameField
return nameof(this.Name);
}
}

public ePlatformType Platform
{
get;
set;
}
public void SetPlatFormImage(ObservableList<ApplicationPlatform> ApplicationPlatforms)
{
ApplicationPlatform applicationPlatform = ApplicationPlatforms.FirstOrDefault((app)=>app.Guid.Equals(this.ParentGuid));
Expand Down
1 change: 1 addition & 0 deletions Ginger/GingerTest/EnvironemntsLib/EnvsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public void AddEnvUsingWizard()

// assert
Assert.AreEqual("bbb", bbbEnv.Name);
Assert.AreEqual(bbbEnv.Applications.Count, WorkSpace.Instance.Solution.ApplicationPlatforms.Count);
}


Expand Down

0 comments on commit a991c5d

Please sign in to comment.