Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix/enhancement with status color #3892

Merged
merged 5 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 64 additions & 67 deletions Ginger/Ginger/Actions/ActionEditPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ limitations under the License.
using Amdocs.Ginger.Common.Expressions;
using Amdocs.Ginger.Common.GeneralLib;
using Amdocs.Ginger.Common.UIElement;
using Amdocs.Ginger.CoreNET.Execution;
using Amdocs.Ginger.Repository;
using Ginger.Actions.UserControls;
using Ginger.BusinessFlowPages;
Expand Down Expand Up @@ -220,7 +221,7 @@ public void Clear()
CollectionChangedEventManager.RemoveHandler(source: mAction.FlowControls, handler: FlowControls_CollectionChanged);
CollectionChangedEventManager.RemoveHandler(source: mAction.ReturnValues, handler: ReturnValues_CollectionChanged);
CollectionChangedEventManager.RemoveHandler(source: mAction.ScreenShots, handler: ScreenShots_CollectionChanged);
CollectionChangedEventManager.RemoveHandler(source: mAction.Artifacts, handler: Artifacts__CollectionChanged);
CollectionChangedEventManager.RemoveHandler(source: mAction.Artifacts, handler: Artifacts__CollectionChanged);
}

xDetailsTab.Tag = false;
Expand Down Expand Up @@ -254,12 +255,12 @@ public void Clear()
xOutputValuesGrid.ToolsTray.Visibility = Visibility.Visible;
xOutputValuesGrid.EnableGridColumns();

WeakEventManager<Selector, SelectionChangedEventArgs>.RemoveHandler(source: xdsOutputParamMapType, eventName: nameof(Selector.SelectionChanged), handler: OutDSParamType_SelectionChanged);
WeakEventManager<Selector, SelectionChangedEventArgs>.RemoveHandler(source: xDataSourceNameCombo, eventName: nameof(Selector.SelectionChanged), handler: cmbDataSourceName_SelectionChanged);
WeakEventManager<Selector, SelectionChangedEventArgs>.RemoveHandler(source: xDataSourceTableNameCombo, eventName: nameof(Selector.SelectionChanged), handler: cmbDataSourceTableName_SelectionChanged);
WeakEventManager<ToggleButton, RoutedEventArgs>.RemoveHandler(source: xAddOutToDSCheckbox, eventName: nameof(ToggleButton.Checked), handler: AddOutDS_Checked);
WeakEventManager<ToggleButton, RoutedEventArgs>.RemoveHandler(source: xAddOutToDSCheckbox, eventName: nameof(ToggleButton.Unchecked), handler: AddOutDS_Unchecked);

WeakEventManager<Selector, SelectionChangedEventArgs>.RemoveHandler(source: xdsOutputParamMapType, eventName: nameof(Selector.SelectionChanged), handler: OutDSParamType_SelectionChanged);
WeakEventManager<Selector, SelectionChangedEventArgs>.RemoveHandler(source: xDataSourceNameCombo, eventName: nameof(Selector.SelectionChanged), handler: cmbDataSourceName_SelectionChanged);
WeakEventManager<Selector, SelectionChangedEventArgs>.RemoveHandler(source: xDataSourceTableNameCombo, eventName: nameof(Selector.SelectionChanged), handler: cmbDataSourceTableName_SelectionChanged);
WeakEventManager<ToggleButton, RoutedEventArgs>.RemoveHandler(source: xAddOutToDSCheckbox, eventName: nameof(ToggleButton.Checked), handler: AddOutDS_Checked);
WeakEventManager<ToggleButton, RoutedEventArgs>.RemoveHandler(source: xAddOutToDSCheckbox, eventName: nameof(ToggleButton.Unchecked), handler: AddOutDS_Unchecked);



Expand Down Expand Up @@ -441,7 +442,7 @@ private void InitFlowControlTabView()
private void InitOutputValuesTabView()
{
xOutputValuesTab.Tag = true;//marking that bindings were done
LoadArticats();
LoadArtifacts();
if (!datasourceGridToolbarItemsAdded)
{
datasourceGridToolbarItemsAdded = true;
Expand Down Expand Up @@ -492,11 +493,11 @@ private void InitOutputValuesTabView()
updateDSOutGrid();
}

WeakEventManager<Selector, SelectionChangedEventArgs>.AddHandler(source: xdsOutputParamMapType, eventName: nameof(Selector.SelectionChanged), handler: OutDSParamType_SelectionChanged);
WeakEventManager<Selector, SelectionChangedEventArgs>.AddHandler(source: xDataSourceNameCombo, eventName: nameof(Selector.SelectionChanged), handler: cmbDataSourceName_SelectionChanged);
WeakEventManager<Selector, SelectionChangedEventArgs>.AddHandler(source: xDataSourceTableNameCombo, eventName: nameof(Selector.SelectionChanged), handler: cmbDataSourceTableName_SelectionChanged);
WeakEventManager<ToggleButton, RoutedEventArgs>.AddHandler(source: xAddOutToDSCheckbox, eventName: nameof(ToggleButton.Checked), handler: AddOutDS_Checked);
WeakEventManager<ToggleButton, RoutedEventArgs>.AddHandler(source: xAddOutToDSCheckbox, eventName: nameof(ToggleButton.Unchecked), handler: AddOutDS_Unchecked);
WeakEventManager<Selector, SelectionChangedEventArgs>.AddHandler(source: xdsOutputParamMapType, eventName: nameof(Selector.SelectionChanged), handler: OutDSParamType_SelectionChanged);
WeakEventManager<Selector, SelectionChangedEventArgs>.AddHandler(source: xDataSourceNameCombo, eventName: nameof(Selector.SelectionChanged), handler: cmbDataSourceName_SelectionChanged);
WeakEventManager<Selector, SelectionChangedEventArgs>.AddHandler(source: xDataSourceTableNameCombo, eventName: nameof(Selector.SelectionChanged), handler: cmbDataSourceTableName_SelectionChanged);
WeakEventManager<ToggleButton, RoutedEventArgs>.AddHandler(source: xAddOutToDSCheckbox, eventName: nameof(ToggleButton.Checked), handler: AddOutDS_Checked);
WeakEventManager<ToggleButton, RoutedEventArgs>.AddHandler(source: xAddOutToDSCheckbox, eventName: nameof(ToggleButton.Unchecked), handler: AddOutDS_Unchecked);



Expand All @@ -519,7 +520,7 @@ private void InitOutputValuesTabView()

SetActReturnValuesGrid();

if(mAction.ActReturnValues.Count > 0 || mAction.Artifacts.Count > 0)
if (mAction.ActReturnValues.Count > 0 || mAction.Artifacts.Count > 0)
{
xOutputValuesExpander.IsExpanded = true;
}
Expand All @@ -540,7 +541,7 @@ private void InitExecutionReportTabView()
BindingHandler.ObjFieldBinding(xFailIgnoreCheckBox, CheckBox.IsCheckedProperty, mAction, nameof(Act.FailIgnored));

BindingHandler.ObjFieldBinding(xEnableActionLogConfigCheckBox, CheckBox.IsCheckedProperty, mAction, nameof(Act.EnableActionLogConfig));
InitActionLog();
InitActionLog();
//execution details section
if (EditMode == General.eRIPageViewMode.Automation || EditMode == General.eRIPageViewMode.View ||
EditMode == General.eRIPageViewMode.ViewAndExecute || EditMode == General.eRIPageViewMode.Explorer || EditMode == General.eRIPageViewMode.SharedReposiotry)
Expand All @@ -559,12 +560,12 @@ private void InitExecutionReportTabView()
if (mActParentActivity != null && mActParentActivity.GetType() == typeof(ErrorHandler))
{
xScreenshotsConfigsPnl.Visibility = Visibility.Collapsed;
xScreenShotsPnl.Visibility = Visibility.Collapsed;
xScreenShotsPnl.Visibility = Visibility.Collapsed;
}
else
{
BindingHandler.ObjFieldBinding(xTakeScreenShotCheckBox, CheckBox.IsCheckedProperty, mAction, nameof(Act.TakeScreenShot));

BindingHandler.ObjFieldBinding(xAutoScreenShotOnFailureCheckBox, CheckBox.IsCheckedProperty, mAction, nameof(Act.AutoScreenShotOnFailure));

xWindowsToCaptureCombo.BindControl(mAction, nameof(Act.WindowsToCapture));
Expand All @@ -584,30 +585,32 @@ private void InitExecutionReportTabView()
}
}

private void LoadArticats()
private void LoadArtifacts()
{
ArtifactsItems = new ObservableList<UCArtifact>();
foreach (ArtifactDetails a in mAction.Artifacts)
{
UCArtifact artifact = new UCArtifact();
artifact.ArtifactPath = a.ArtifactReportStoragePath;
artifact.ArtifactName = a.ArtifactOriginalName;
UCArtifact artifact = new UCArtifact
{
ArtifactPath = a.ArtifactReportStoragePath,
ArtifactName = a.ArtifactOriginalName
};
artifact.IntiArtifact();
ArtifactsItems.Add(artifact);
}
xFilesListView.ItemsSource = ArtifactsItems;

if(ArtifactsItems.Count > 0)
if (ArtifactsItems.Count > 0)
{
xFilesListView.Visibility = Visibility.Visible;
xlbl_msg.Visibility = Visibility.Collapsed;
xlbl_msg.Visibility = Visibility.Collapsed;
}
else
{
xFilesListView.Visibility = Visibility.Collapsed;
xlbl_msg.Visibility = Visibility.Visible;
xlbl_msg.Visibility = Visibility.Visible;
}
xFilesTabTextBlock.Text = string.Concat("Output Files (", ArtifactsItems.Count, ")");
xFilesTabTextBlock.Text = string.Concat("Output Files (", ArtifactsItems.Count, ")");
}
private void RemoveCaptureTypeFromComboItems(Act.eWindowsToCapture captureType)
{
Expand All @@ -634,10 +637,10 @@ private void Artifacts__CollectionChanged(object? sender, System.Collections.Spe
{
this.Dispatcher.Invoke(() =>
{
LoadArticats();
LoadArtifacts();
});
}

public void StopEdit()
{
if (mAFCP != null)
Expand Down Expand Up @@ -668,7 +671,7 @@ private void ReturnValues_CollectionChanged(object? sender, System.Collections.S
mAction.OnPropertyChanged(nameof(Act.ReturnValuesCount));
this.Dispatcher.Invoke(() =>
{
if(mAction.ActReturnValues.Count > 0 || mAction.Artifacts.Count > 0)
if (mAction.ActReturnValues.Count > 0 || mAction.Artifacts.Count > 0)
{
xOutputValuesExpander.IsExpanded = true;
}
Expand Down Expand Up @@ -843,7 +846,7 @@ private void SwitchingInputValueBoxAndGrid(Act a)
else
{
xInputValuesGrid.Visibility = Visibility.Collapsed;
xValueBoxPnl.Visibility = Visibility.Collapsed;
xValueBoxPnl.Visibility = Visibility.Collapsed;
}
}
else if (a.GetType() == typeof(ActConsoleCommand))//TODO: Fix Action implementation to not base on the Action edit page Input values controls- to have it own controls
Expand Down Expand Up @@ -1091,12 +1094,12 @@ private void SetActInputValuesGrid()

xInputValuesGrid.ClearTools();
xInputValuesGrid.ShowDelete = System.Windows.Visibility.Visible;
if(mAction.GetType() == typeof(ActCLIOrchestration))
if (mAction.GetType() == typeof(ActCLIOrchestration))
{
xInputValuesGrid.ShowAdd = System.Windows.Visibility.Visible;
xInputValuesGrid.ShowClearAll = System.Windows.Visibility.Visible;
}

//List<GridColView> view = new List<GridColView>();
GridViewDef view = new GridViewDef(GridViewDef.DefaultViewName);
view.GridColsView = new ObservableList<GridColView>();
Expand All @@ -1119,7 +1122,7 @@ private void LoadOperationSettingsEditPage(Act a)
if (a.ActionEditPage != null)
{
Page actEditPage = ActionsFactory.GetActionEditPage(a, mContext);

if (actEditPage != null)
{
// Load the page
Expand All @@ -1133,7 +1136,7 @@ private void LoadOperationSettingsEditPage(Act a)
}
}



//private void NextActionButton_Click(object sender, RoutedEventArgs e)
//{
Expand Down Expand Up @@ -1317,14 +1320,14 @@ public bool ShowAsWindow(eWindowShowStyle windowStyle = eWindowShowStyle.Free, b
Button okBtn = new Button();
okBtn.Content = "Ok";
WeakEventManager<ButtonBase, RoutedEventArgs>.AddHandler(source: okBtn, eventName: nameof(ButtonBase.Click), handler: okBtn_Click);


Button undoBtn = new Button();
undoBtn.Content = "Undo & Close";
WeakEventManager<ButtonBase, RoutedEventArgs>.AddHandler(source: undoBtn, eventName: nameof(ButtonBase.Click), handler: undoBtn_Click);



Button saveBtn = new Button();
saveBtn.Content = "Save";
switch (EditMode)
Expand Down Expand Up @@ -1352,9 +1355,9 @@ public bool ShowAsWindow(eWindowShowStyle windowStyle = eWindowShowStyle.Free, b
case General.eRIPageViewMode.SharedReposiotry:
title = "Edit Shared Repository " + RemoveActionWord(mAction.ActionDescription) + " Action";
WeakEventManager<ButtonBase, RoutedEventArgs>.AddHandler(source: saveBtn, eventName: nameof(ButtonBase.Click), handler: SharedRepoSaveBtn_Click);



winButtons.Add(saveBtn);
winButtons.Add(undoBtn);
break;
Expand All @@ -1368,9 +1371,9 @@ public bool ShowAsWindow(eWindowShowStyle windowStyle = eWindowShowStyle.Free, b
case General.eRIPageViewMode.ChildWithSave:
title = "Edit " + RemoveActionWord(mAction.ActionDescription) + " Action";
WeakEventManager<ButtonBase, RoutedEventArgs>.AddHandler(source: saveBtn, eventName: nameof(ButtonBase.Click), handler: ParentSaveButton_Click);



winButtons.Add(saveBtn);
winButtons.Add(undoBtn);
break;
Expand Down Expand Up @@ -1688,28 +1691,22 @@ public class ActReturnValueStatusConverter : IValueConverter
public object Convert(object value, Type targetType, object parameter,
System.Globalization.CultureInfo culture)
{
string status = value == null ? "" : value.ToString();
if (status.Equals(ActReturnValue.eStatus.Passed.ToString()))
{
return System.Windows.Media.Brushes.Green;//System.Drawing.Brushes.Green;
}

if (status.Equals(ActReturnValue.eStatus.Failed.ToString()))
{
return System.Windows.Media.Brushes.Red;
}

if (status.Equals(ActReturnValue.eStatus.Pending.ToString()))
{
return System.Windows.Media.Brushes.Orange;
}

if (status.Equals(ActReturnValue.eStatus.Skipped.ToString()))
string? status = value == null ? "" : value.ToString();
#pragma warning disable CS8603 // Possible null reference return.
return status switch
{
return System.Windows.Media.Brushes.Black;
}
nameof(eRunStatus.Passed) => Application.Current.FindResource("$PassedStatusColor") as System.Windows.Media.Brush,
nameof(eRunStatus.Failed) => Application.Current.FindResource("$FailedStatusColor") as System.Windows.Media.Brush,
nameof(eRunStatus.FailIgnored) => Application.Current.FindResource("$IgnoredStatusColor") as System.Windows.Media.Brush,
nameof(eRunStatus.Pending) => Application.Current.FindResource("$PendingStatusColor") as System.Windows.Media.Brush,
nameof(eRunStatus.Running) => Application.Current.FindResource("$RunningStatusColor") as System.Windows.Media.Brush,
nameof(eRunStatus.Stopped) => Application.Current.FindResource("$StoppedStatusColor") as System.Windows.Media.Brush,
nameof(eRunStatus.Blocked) => Application.Current.FindResource("$BlockedStatusColor") as System.Windows.Media.Brush,
nameof(eRunStatus.Skipped) => Application.Current.FindResource("$SkippedStatusColor") as System.Windows.Media.Brush,
_ => Application.Current.FindResource("$PendingStatusColor") as System.Windows.Media.Brush,
};
#pragma warning restore CS8603 // Possible null reference return.

return System.Drawing.Brushes.Gray;
}

public object ConvertBack(object value, Type targetType,
Expand Down Expand Up @@ -2225,13 +2222,13 @@ private void xRawResponseValuesBtn_Click(object sender, RoutedEventArgs e)
{
string tempFilePath = GingerCoreNET.GeneralLib.General.CreateTempTextFile(mAction.RawResponseValues);
if (System.IO.File.Exists(tempFilePath))
{
{
DocumentEditorPage docPage = new DocumentEditorPage(tempFilePath, enableEdit: false, UCTextEditorTitle: string.Empty);
docPage.Width = 800;
docPage.Height = 800;
docPage.ShowAsWindow("Raw Output Values");
System.IO.File.Delete(tempFilePath);
return;
return;
}
}
Reporter.ToUser(eUserMsgKey.StaticErrorMessage, "Failed to load raw response view, see log for details.");
Expand Down Expand Up @@ -2273,6 +2270,6 @@ private void xTimeoutTextBox_PreviewTextInput(object sender, TextCompositionEven

}


}
}
14 changes: 5 additions & 9 deletions Ginger/Ginger/Run/RunSetsExecutionsHistoryPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ limitations under the License.
using Amdocs.Ginger.CoreNET.Reports;
using Amdocs.Ginger.CoreNET.Run.RunListenerLib;
using Amdocs.Ginger.CoreNET.Utility;
using DocumentFormat.OpenXml.Wordprocessing;
using Ginger.Reports;
using Ginger.Repository.AddItemToRepositoryWizard;
using Ginger.Repository.ItemToRepositoryWizard;
Expand All @@ -36,24 +35,20 @@ limitations under the License.
using GingerWPF.WizardLib;
using GraphQL;
using GraphQLClient.Clients;
using MathNet.Numerics.LinearAlgebra.Factorization;
using MongoDB.Driver.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Markup;
using System.Windows.Media;
using static Amdocs.Ginger.CoreNET.BPMN.Exportation.RunSetExecutionHistoryToBPMNExporter;
using static Ginger.Actions.ActionEditPage;

namespace Ginger.Run
{
Expand Down Expand Up @@ -342,7 +337,8 @@ private void SetGridView()
Header = "Status",
WidthWeight = 8,
ReadOnly = true,
BindingMode = BindingMode.OneWay
BindingMode = BindingMode.OneWay,
PropertyConverter = (new ColumnPropertyConverter(new ActReturnValueStatusConverter(), TextBlock.ForegroundProperty))
},
new()
{
Expand Down Expand Up @@ -739,8 +735,8 @@ private void AddRemoteDataToList(GraphQLResponse<GraphQLRunsetResponse> data)
Description = node.Description,
SourceApplication = node.SourceApplication,
SourceApplicationUser = node.SourceApplicationUser,
StartTimeStamp = DateTime.Parse(node.StartTime.ToString(), CultureInfo.InvariantCulture).ToUniversalTime(),
EndTimeStamp = DateTime.Parse(node.EndTime.ToString(), CultureInfo.InvariantCulture).ToUniversalTime(),
StartTimeStamp = node.StartTime.Value.ToUniversalTime(),
EndTimeStamp = node.EndTime.Value.ToUniversalTime(),
Elapsed = node.ElapsedEndTimeStamp,
DataRepMethod = ExecutionLoggerConfiguration.DataRepositoryMethod.Remote
};
Expand Down
Loading
Loading