Skip to content

Commit

Permalink
Merge pull request #3927 from Ginger-Automation/BugFix/GingerOps
Browse files Browse the repository at this point in the history
Bug fix/ginger ops
  • Loading branch information
Maheshkale447 authored Sep 25, 2024
2 parents d0369bc + c1b58e9 commit 6a7bc84
Show file tree
Hide file tree
Showing 17 changed files with 95 additions and 42 deletions.
6 changes: 4 additions & 2 deletions Ginger/Ginger/Environments/AppsListPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@
<DockPanel>
<Label Style="{StaticResource $LabelStyle}" Content="Release:"/>
<ComboBox x:Name="xReleaseCombobox" IsEnabled="True" Style="{StaticResource $FlatEditInputComboBoxStyle}" Margin="0,0,0,20" MinWidth="300px" HorizontalAlignment="Left"></ComboBox>
<usercontrols2:ImageMakerControl x:Name="xProcessingImage" ImageType="Processing" Margin="630,-30,0,0" HorizontalAlignment="Left" Height="30" Width="20" Visibility="Hidden"></usercontrols2:ImageMakerControl>
<usercontrols2:ucButton x:Name="xGASyncBtn" IsEnabled="True" Width="200" Margin="0,-30,0,0" DockPanel.Dock="Top" HorizontalAlignment="Right" Visibility="Collapsed" ButtonType="RoundTextAndImageButton" ButtonText="Sync with GingerOps" ButtonImageType="Retry" ButtonFontImageSize="12" ButtonImageWidth="12" ButtonImageHeight="12" Click="xGASyncBtn_Click" ButtonStyle="{StaticResource $RoundTextAndImageButtonStyle}" ToolTip="Sync with GingerOps"/>
<Grid x:Name="xGOpsSyncBtnGrid">
<usercontrols2:ImageMakerControl x:Name="xProcessingImage" ImageType="Processing" Margin="0,0,205,0" HorizontalAlignment="Right" Height="30" Width="20" Visibility="Hidden"></usercontrols2:ImageMakerControl>
<usercontrols2:ucButton x:Name="xGASyncBtn" IsEnabled="True" Width="205" Padding="0,0,0,0" HorizontalAlignment="Right" Visibility="Collapsed" ButtonType="RoundTextAndImageButton" ButtonText="Sync with GingerOps" ButtonImageType="Retry" ButtonFontImageSize="18" ButtonImageWidth="18" ButtonImageHeight="18" Click="xGASyncBtn_Click" ButtonStyle="{StaticResource $RoundTextAndImageButtonStyle}" ToolTip="Sync with GingerOps"/>
</Grid>
</DockPanel>

<CheckBox x:Name="xPublishcheckbox" IsEnabled="True" Content="Publish" ToolTip="Publish to third party applications" DockPanel.Dock="Top" HorizontalAlignment="Left" Margin="0,-5,0,0" Style="{StaticResource $CeckBoxStyle}"/>
Expand Down
23 changes: 12 additions & 11 deletions Ginger/Ginger/Environments/AppsListPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ public AppsListPage(ProjEnvironment env)
xPublishcheckbox.IsEnabled = true;
xGASyncBtn.Visibility = Visibility.Collapsed;
InitReleaseComboBox();
grdApps.AddToolbarTool("@Share_16x16.png", "Add Selected Applications to All Environments", new RoutedEventHandler(AddAppsToOtherEnvironments));
}

grdApps.AddToolbarTool("@Share_16x16.png", "Add Selected Applications to All Environments", new RoutedEventHandler(AddAppsToOtherEnvironments));
BindingHandler.ObjFieldBinding(EnvNameTextBox, TextBox.TextProperty, env, ProjEnvironment.Fields.Name);
EnvNameTextBox.AddValidationRule(new EnvironemntNameValidationRule());
xShowIDUC.Init(AppEnvironment);
Expand Down Expand Up @@ -108,7 +108,7 @@ private void InitReleaseComboBox()
private void SetGridView()
{
//Set the grid name
grdApps.Title = $"'{AppEnvironment.Name}' Environment Applications";
grdApps.Title = GetGrdAppsTitle();
grdApps.SetTitleLightStyle = true;

//Set the Tool Bar look
Expand Down Expand Up @@ -139,13 +139,8 @@ private void SetGridData()
if (AppEnvironment.GOpsFlag)
{
grdApps.DisableGridColoumns();
grdApps.btnDelete.IsEnabled = false;
grdApps.btnAdd.IsEnabled = false;
grdApps.btnCut.IsEnabled = false;
grdApps.btnUndo.IsEnabled = false;
grdApps.btnClearAll.IsEnabled = false;
grdApps.btnDuplicate.Visibility = Visibility.Collapsed;
grdApps.btnCopy.IsEnabled = false;
grdApps.btnDelete.IsEnabled = false;
}
}

Expand Down Expand Up @@ -188,7 +183,13 @@ private void AddAppsToOtherEnvironments(object sender, RoutedEventArgs e)

private void EnvNameTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
grdApps.Title = $"'{EnvNameTextBox.Text}' Environment Applications";
grdApps.Title = GetGrdAppsTitle();
}

private string GetGrdAppsTitle()
{
string grdEnvName = General.EscapeAccessKey(EnvNameTextBox.Text);
return $"'{grdEnvName}' Environment Applications";
}

private async void xGASyncBtn_Click(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -270,7 +271,7 @@ private void UpdateExistingApplication(EnvApplication existingApp, GingerOpsAppl
{
if (param.Name != "Application Type" && param.Name != "Application URL")
{
existingApp.AddVariable(new VariableString() { Name = param.Name, Value = param.Value });
existingApp.AddVariable(new VariableString() { Name = param.Name, Value = param.Value, GOpsFlag = true, SetAsInputValue = false, SetAsOutputValue = false });
}
}
}
Expand All @@ -292,7 +293,7 @@ private void AddNewApplication(GingerOpsApplication item)
{
if (param.Name != "Application Type" && param.Name != "Application URL")
{
newEnvApp.AddVariable(new VariableString() { Name = param.Name, Value = param.Value });
newEnvApp.AddVariable(new VariableString() { Name = param.Name, Value = param.Value, GOpsFlag = true, SetAsInputValue = false, SetAsOutputValue = false });
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public void WizardEvent(WizardEventArgs WizardEventArgs)
{
case EventType.Init:
mWizard = (AddGingerOpsEnvWizard)WizardEventArgs.Wizard;
mWizard.mWizardWindow.SetFinishButtonEnabled(false);
LoadComboBoxData();
foreach (var appPlat in environmentListGOps)
{
Expand All @@ -91,7 +92,10 @@ public void WizardEvent(WizardEventArgs WizardEventArgs)
break;
case EventType.LeavingForNextPage:
xEnvironmentComboBox_SelectionChanged();
break;
break;
case EventType.Prev:
mWizard.mWizardWindow.SetFinishButtonEnabled(false);
break;
default:
break;

Expand Down Expand Up @@ -166,6 +170,11 @@ public async void xEnvironmentComboBox_SelectionChanged()
{
await HandleEnvironmentSelection(env);
}

if (mWizard.ImportedEnvs.Any(k => k.GingerOpsStatus == "Import Successful"))
{
mWizard.mWizardWindow.SetFinishButtonEnabled(true);
}
}
}
catch (Exception ex)
Expand Down Expand Up @@ -251,7 +260,7 @@ private async Task AddApplicationsToEnvironment(GingerOpsAPIResponseInfo.GingerO
{
if (param.Name != "Application Type" && param.Name != "Application URL")
{
envApp.AddVariable(new VariableString() { Name = param.Name, Value = param.Value, GOpsFlag=true });
envApp.AddVariable(new VariableString() { Name = param.Name, Value = param.Value, GOpsFlag=true, SetAsInputValue = false, SetAsOutputValue = false });
}
}
newEnvironment.Applications.Add(envApp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ public void WizardEvent(WizardEventArgs WizardEventArgs)
{
case EventType.Init:
mWizard = (AddGingerOpsEnvWizard)WizardEventArgs.Wizard;
break;
case EventType.Active:
SelectApplicationGrid.DataSourceList = mWizard.ImportedEnvs;
break;
break;
default:
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
</Grid>
<Grid>
<usercontrols:ucButton x:Name="xTestConBtn" IsEnabled="True" DockPanel.Dock="Top" HorizontalAlignment="Left" Margin="10,25,0,0" ButtonType="RoundTextAndImageButton" ButtonText="Test Connection" ButtonImageType="Run" ButtonFontImageSize="12" ButtonImageWidth="12" ButtonImageHeight="12" Click="xTestConBtn_Click" ButtonStyle="{StaticResource $RoundTextAndImageButtonStyle}" ToolTip="Test GingerOps Connection"/>
<usercontrols:ImageMakerControl x:Name="xProcessingImage" ImageType="Processing" Margin="187,12,0,0" HorizontalAlignment="Left" Height="25" Width="20" Visibility="Hidden"></usercontrols:ImageMakerControl>
<usercontrols:ImageMakerControl x:Name="xProcessingImage" ImageType="Processing" Margin="187,28,0,3" HorizontalAlignment="Left" Height="25" Width="20" Visibility="Collapsed"></usercontrols:ImageMakerControl>

</Grid>
</StackPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ private async void xTestConBtn_Click(object sender, RoutedEventArgs e)

GingerCoreNET.GeneralLib.General.CreateGingerOpsConfiguration();


if (GingerOpsAPI.IsTokenValid())
{
Reporter.ToUser(eUserMsgKey.GingerOpsConnectionSuccess);
Expand Down
15 changes: 15 additions & 0 deletions Ginger/Ginger/GeneralLib/General.cs
Original file line number Diff line number Diff line change
Expand Up @@ -640,5 +640,20 @@ public static bool IsAdmin()
}
return false;
}

/// <summary>
/// Escape all underscores ('_') from the provided string <paramref name="s"/> with double underscores ('__'). This is helpful in case of displaying underscore in <see cref="Label"/> controls where the first underscore is considered as Access Key. For more details, https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/issues/1427.
/// </summary>
/// <param name="s">string to escape</param>
/// <returns>Escaped string where all the underscores ('_') is escaped using double underscores ('__').</returns>
public static string EscapeAccessKey(string s)
{
if (string.IsNullOrEmpty(s))
{
return s;
}

return s.Replace("_", "__");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ private void DeleteEnvTreeItems()
}
private void Delete(object sender, RoutedEventArgs e)
{
if (!ProjEnvironment.GOpsFlag)
if (EnvApplication.GOpsFlag)
{
Reporter.ToUser(eUserMsgKey.GingerOpsDeleteDisable);
}
else
{
DeleteEnvTreeItems();
}
Expand Down
19 changes: 2 additions & 17 deletions Ginger/Ginger/UserControlsLib/ConsumerComboBox.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,30 +250,15 @@ private void SetText()
displayText.Append(consumer.Name);
displayText.Append(',');
}
Text = EscapeAccessKey(displayText.ToString().TrimEnd(','));
Text = General.EscapeAccessKey(displayText.ToString().TrimEnd(','));
}
// set DefaultText if nothing else selected
if (string.IsNullOrEmpty(Text))
{
Text = EscapeAccessKey(DefaultText);
Text = General.EscapeAccessKey(DefaultText);
}
}

/// <summary>
/// Escape all underscores ('_') from the provided string <paramref name="s"/> with double underscores ('__'). This is helpful in case of displaying underscore in <see cref="Label"/> controls where the first underscore is considered as Access Key. For more details, https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/issues/1427.
/// </summary>
/// <param name="s">string to escape</param>
/// <returns>Escaped string where all the underscores ('_') is escaped using double underscores ('__').</returns>
private static string EscapeAccessKey(string s)
{
if (string.IsNullOrEmpty(s))
{
return s;
}

return s.Replace("_", "__");
}

private string? GetConsumerName(Guid consumerGuid)
{
return
Expand Down
8 changes: 6 additions & 2 deletions Ginger/Ginger/UserControlsLib/ucGridView/ucGrid.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ limitations under the License.
using Ginger.Help;
using Ginger.UserControls;
using Ginger.UserControlsLib;
using GingerCore.Environments;
using GingerCore.GeneralLib;
using GingerWPF.DragDropLib;
using System;
Expand Down Expand Up @@ -774,6 +775,7 @@ private void btnClearAll_Click(object sender, RoutedEventArgs e)

if ((Reporter.ToUser(eUserMsgKey.SureWantToDeleteAll)) == Amdocs.Ginger.Common.eUserMsgSelection.Yes)
{
// Save undo data before modifying the list
mObjList.SaveUndoData();
mObjList.ClearAll();
}
Expand All @@ -793,10 +795,12 @@ private void btnDelete_Click(object sender, RoutedEventArgs e)

List<object> SelectedItemsList = grdMain.SelectedItems.Cast<object>().ToList();

bool IsItemsDeleted = false;
foreach (object o in SelectedItemsList)
{
mObjList.Remove(o);
RemoveFromLiteDB(o);
mObjList.Remove(o);
RemoveFromLiteDB(o);

}
}
finally
Expand Down
1 change: 0 additions & 1 deletion Ginger/Ginger/Variables/VariableEditPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ public VariableEditPage(VariableBase v, Context context, bool setGeneralConfigsA
{
xVarNameTxtBox.IsEnabled = false;
xVarDescritpiontxtBox.IsEnabled = false;
xPublishcheckbox.IsEnabled = false;
}

if (parent is EnvApplication)
Expand Down
12 changes: 12 additions & 0 deletions Ginger/Ginger/Variables/VariablesListViewHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,13 @@ public List<ListItemOperation> GetItemOperationsList(object item)
itemUsage.OperationHandler = ViewRepositoryItemUsageHandler;
operationsList.Add(itemUsage);

//removing for gingerops
if (item is VariableBase vb && vb.GOpsFlag)
{
operationsList.Remove(edit);
operationsList.Remove(delete);
}

return operationsList;
}

Expand All @@ -467,6 +474,11 @@ public List<ListItemOperation> GetItemExtraOperationsList(object item)
SetItem(item);
List<ListItemOperation> extraOperationsList = new List<ListItemOperation>();

if (item is VariableBase vb && vb.GOpsFlag)
{
return extraOperationsList;
}

if (mVariable.SupportResetValue)
{
ListItemOperation reset = new ListItemOperation();
Expand Down
2 changes: 1 addition & 1 deletion Ginger/Ginger/WizardLib/WizardWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@

<UserControls:ucButton x:Name="xPrevButton" ButtonType="RoundTextAndImageButton" ButtonText="Previous" ButtonImageType="GoBack" ButtonFontImageSize="15" ButtonImageWidth="15" ButtonImageHeight="15" Click="PrevButton_Click" ButtonStyle="{StaticResource $RoundTextAndImageButtonStyle}" IsEnabled="False"/>
<UserControls:ucButton x:Name="xNextButton" ButtonType="RoundTextAndImageButton" ButtonText="Next" ButtonImageType="GoNext" ButtonFontImageSize="15" ButtonImageWidth="15" ButtonImageHeight="15" Click="NextButton_Click" ButtonStyle="{StaticResource $RoundTextAndImageButtonStyle}"/>
<UserControls:ucButton x:Name="xFinishButton" ButtonType="RoundTextAndImageButton" ButtonText="Finish" ButtonImageType="Finish" ButtonFontImageSize="15" ButtonImageWidth="15" ButtonImageHeight="15" Click="FinishButton_Click" ButtonStyle="{StaticResource $RoundTextAndImageButtonStyle}"/>
<UserControls:ucButton x:Name="xFinishButton" ButtonType="RoundTextAndImageButton" ButtonText="Finish" ButtonImageType="Finish" ButtonFontImageSize="15" ButtonImageWidth="15" ButtonImageHeight="15" IsEnabled="True" Click="FinishButton_Click" ButtonStyle="{StaticResource $RoundTextAndImageButtonStyle}"/>
<UserControls:ucButton x:Name="xCancelButton" ButtonType="RoundTextAndImageButton" ButtonText="Cancel" ButtonImageType="Cancel" ButtonFontImageSize="15" ButtonImageWidth="15" ButtonImageHeight="15" Click="CancelButton_Click" ButtonStyle="{StaticResource $RoundTextAndImageButtonStyle}"/>

</StackPanel>
Expand Down
9 changes: 7 additions & 2 deletions Ginger/Ginger/WizardLib/WizardWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ private void UpdatePrevNextButton()
if (mWizard.IsLastPage())
{
xNextButton.IsEnabled = false;
xFinishButton.IsEnabled = true;
if (mWizard.DisableBackBtnOnLastPage == true)

if (mWizard.DisableBackBtnOnLastPage)
{
xPrevButton.IsEnabled = false;
return;
Expand Down Expand Up @@ -424,6 +424,11 @@ void IWizardWindow.NextButton(bool isEnabled)
xNextButton.IsEnabled = isEnabled;
}

void IWizardWindow.SetFinishButtonEnabled(bool isEnabled)
{
xFinishButton.IsEnabled = isEnabled;
}

bool WindowCloseWasHandled = false;

private void CloseWindowClicked(object sender, System.ComponentModel.CancelEventArgs e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public string IdentityServiceURL
{
mIdentityServiceURL = value;
OnPropertyChanged(nameof(IdentityServiceURL));
InvalidateToken();
}
}
}
Expand All @@ -105,6 +106,7 @@ public string ClientId
{
mClientId = value;
OnPropertyChanged(nameof(ClientId));
InvalidateToken();
}
}
}
Expand All @@ -123,6 +125,7 @@ public string ClientSecret
{
mClientSecret = value;
OnPropertyChanged(nameof(ClientSecret));
InvalidateToken();
}
}
}
Expand Down Expand Up @@ -153,6 +156,14 @@ public override string ItemName
}
}

private void InvalidateToken()
{
if (!string.IsNullOrEmpty(mToken))
{
mToken = string.Empty;
}
}

public override string GetNameForFileName() { return Name; }

}
Expand Down
Loading

0 comments on commit 6a7bc84

Please sign in to comment.