Skip to content

Commit

Permalink
Merge pull request #1665 from Ginger-Automation/Bugfix/Improve-Perfor…
Browse files Browse the repository at this point in the history
…mance-Merged-Changes

Bugfix/improve performance merged changes
  • Loading branch information
MeniKadosh1 authored Aug 9, 2020
2 parents 84a0f9d + 8558e7c commit c8bf792
Show file tree
Hide file tree
Showing 52 changed files with 1,544 additions and 559 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -330,3 +330,4 @@ ASALocalRun/
.mfractor/
/Ginger/GingerCore/Plugins/Jenkins/gingerPlugin/work
/Ginger/GingerCore/Drivers/JavaDriverLib/GingerJavaAgent/.externalToolBuilders
/Ginger/GingerCoreNETUnitTest/TestResources/Solutions/BasicSimple/ExecutionResults/GingerExecutionResults.db
8 changes: 6 additions & 2 deletions Ginger/Ginger/Activities/ActivitiesListViewPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ limitations under the License.
using GingerCore;
using GingerCore.Activities;
using GingerWPF.DragDropLib;
using System.Threading.Tasks;
using System;
using System.Collections.Generic;
using System.Windows.Controls;
Expand Down Expand Up @@ -87,15 +88,18 @@ private void SetListView()
}
}

private void SetListViewData()
private async void SetListViewData()
{
if (mBusinessFlow != null)
{
//List Data
xActivitiesListView.DataSourceList = mBusinessFlow.Activities;

//List Grouping
xActivitiesListView.AddGrouping(nameof(Activity.ActivitiesGroupID));
SetSharedRepositoryMark();

//shared repo indicator
await Task.Run(() => this.SetSharedRepositoryMark());
}
else
{
Expand Down
86 changes: 51 additions & 35 deletions Ginger/Ginger/Activities/ActivityPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ namespace GingerWPF.BusinessFlowsLib
public partial class ActivityPage : Page
{
Activity mActivity;
public Activity Activity { get { return mActivity; } }

Context mContext;
Ginger.General.eRIPageViewMode mPageViewMode;

Expand Down Expand Up @@ -72,6 +74,19 @@ public ActivityPage(Activity activity, Context context, Ginger.General.eRIPageVi
BindControlsToActivity();
}

public void SetUIElementsBehaverBasedOnRunnerStatus(bool IsRunning)
{
Dispatcher.Invoke(() =>
{
xUndoBtn.IsEnabled = IsRunning;
xExtraOperationsMenu.IsEnabled = IsRunning;
xContinueRunBtn.IsEnabled = IsRunning;
xRunBtn.IsEnabled = IsRunning;
xRunSelectedActionBtn.IsEnabled = IsRunning;
xResetBtn.IsEnabled = IsRunning;
});
}

private void SetUIView()
{
if (mPageViewMode != Ginger.General.eRIPageViewMode.Automation)
Expand Down Expand Up @@ -272,7 +287,7 @@ private void ClearActivityBindings()
// mConfigurationsPage = null;
// }
//}

private void mActivity_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
UpdateDescription();
Expand All @@ -285,36 +300,36 @@ private void UpdateDescription()
xDescriptionTextBlock.Text = string.Empty;
TextBlockHelper xDescTextBlockHelper = new TextBlockHelper(xDescriptionTextBlock);
SolidColorBrush foregroundColor = (SolidColorBrush)new BrushConverter().ConvertFromString((TryFindResource("$Color_DarkBlue")).ToString());
if (mActivity != null)
{
//Application info
//if (!string.IsNullOrEmpty(mActivity.Description))
//{
// if (mActivity.Description.Length > 100)
// {
// xDescTextBlockHelper.AddText("Description: " + mActivity.Description.Substring(0,99) + "...");
// }
// else
// {
// xDescTextBlockHelper.AddText("Description: " + mActivity.Description);
// }
// xDescTextBlockHelper.AddText(" " + Ginger.General.GetTagsListAsString(mActivity.Tags));
// xDescTextBlockHelper.AddLineBreak();
//}
//if (!string.IsNullOrEmpty(mActivity.RunDescription))
//{
// xDescTextBlockHelper.AddText("Run Description: " + mActivity.RunDescription);
// xDescTextBlockHelper.AddLineBreak();
//}
//if (!string.IsNullOrEmpty(mActivity.ActivitiesGroupID))
//{
// xDescTextBlockHelper.AddText("Parent Group: " + mActivity.ActivitiesGroupID);
// xDescTextBlockHelper.AddLineBreak();
//}
xDescTextBlockHelper.AddText("Target: " + mActivity.TargetApplication);
}
if (mActivity != null)
{
//Application info
//if (!string.IsNullOrEmpty(mActivity.Description))
//{
// if (mActivity.Description.Length > 100)
// {
// xDescTextBlockHelper.AddText("Description: " + mActivity.Description.Substring(0,99) + "...");
// }
// else
// {
// xDescTextBlockHelper.AddText("Description: " + mActivity.Description);
// }
// xDescTextBlockHelper.AddText(" " + Ginger.General.GetTagsListAsString(mActivity.Tags));
// xDescTextBlockHelper.AddLineBreak();
//}
//if (!string.IsNullOrEmpty(mActivity.RunDescription))
//{
// xDescTextBlockHelper.AddText("Run Description: " + mActivity.RunDescription);
// xDescTextBlockHelper.AddLineBreak();
//}
//if (!string.IsNullOrEmpty(mActivity.ActivitiesGroupID))
//{
// xDescTextBlockHelper.AddText("Parent Group: " + mActivity.ActivitiesGroupID);
// xDescTextBlockHelper.AddLineBreak();
//}
xDescTextBlockHelper.AddText("Target: " + mActivity.TargetApplication);
}
});

}

private void xUploadToShareRepoMenuItem_Click(object sender, System.Windows.RoutedEventArgs e)
Expand All @@ -325,12 +340,12 @@ private void xUploadToShareRepoMenuItem_Click(object sender, System.Windows.Rout
}

private void xRunBtn_Click(object sender, System.Windows.RoutedEventArgs e)
{
{
App.OnAutomateBusinessFlowEvent(AutomateEventArgs.eEventType.RunCurrentActivity, mActivity);
}

private void xContinueRunBtn_Click(object sender, System.Windows.RoutedEventArgs e)
{
{
App.OnAutomateBusinessFlowEvent(AutomateEventArgs.eEventType.ContinueActivityRun, mActivity);
}

Expand Down Expand Up @@ -363,7 +378,7 @@ private void xRunActionBtn_Click(object sender, RoutedEventArgs e)
{
if (mActionsPage.ListView.CurrentItem != null)
{
App.OnAutomateBusinessFlowEvent(AutomateEventArgs.eEventType.RunCurrentActionAndMoveOn, new Tuple<Activity, Act>(mActivity, (Act)mActionsPage.ListView.CurrentItem));
App.OnAutomateBusinessFlowEvent(AutomateEventArgs.eEventType.RunCurrentActionAndMoveOn, new Tuple<Activity, Act>(mActivity, (Act)mActionsPage.ListView.CurrentItem));
}
else
{
Expand Down Expand Up @@ -395,7 +410,7 @@ public bool ShowAsWindow(eWindowShowStyle windowStyle = eWindowShowStyle.Dialog,
string closeContent = "Undo & Close";

Button okBtn = new Button();
okBtn.Content = "Ok";
okBtn.Content = "Ok";
okBtn.Click += new RoutedEventHandler(OkBtn_Click);

Button undoBtn = new Button();
Expand Down Expand Up @@ -427,7 +442,7 @@ public bool ShowAsWindow(eWindowShowStyle windowStyle = eWindowShowStyle.Dialog,
title = "View " + GingerDicser.GetTermResValue(eTermResKey.Activity);
winButtons.Add(okBtn);
CloseHandler = new RoutedEventHandler(OkBtn_Click);
closeContent = okBtn.Content.ToString();
closeContent = okBtn.Content.ToString();
break;
}

Expand Down Expand Up @@ -492,6 +507,7 @@ private void xUndoBtn_Click(object sender, RoutedEventArgs e)
{
if (Ginger.General.UndoChangesInRepositoryItem(mActivity, true))
{
mActionsPage.xGoToActionsList.DoClick();
mActivity.SaveBackup();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ private void FindUsages()
//TODO: check that retrieve also sub folder business flows
ObservableList<BusinessFlow> BizFlows = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems<BusinessFlow>();

foreach (BusinessFlow BF in BizFlows)
//foreach (BusinessFlow BF in BizFlows)
Parallel.ForEach(BizFlows, BF =>
{
string businessFlowName = Amdocs.Ginger.Common.GeneralLib.General.RemoveInvalidFileNameChars(BF.Name);
if (mRepoItem is Activity)
Expand All @@ -92,7 +93,7 @@ private void FindUsages()
else
type = RepositoryItemUsage.eUsageTypes.Instance;

RepositoryItemUsage itemUsage = new RepositoryItemUsage() { HostBusinessFlow = BF, HostBizFlowPath = Path.Combine(BF.ContainingFolder, businessFlowName), UsageItem = a, UsageItemName = a.ActivityName, UsageExtraDetails = "Number of Actions: " + a.Acts.Count().ToString(), UsageItemType = type, Selected = true, Status = RepositoryItemUsage.eStatus.NotUpdated};
RepositoryItemUsage itemUsage = new RepositoryItemUsage() { HostBusinessFlow = BF, HostBizFlowPath = Path.Combine(BF.ContainingFolder, businessFlowName), UsageItem = a, UsageItemName = a.ActivityName, UsageExtraDetails = "Number of Actions: " + a.Acts.Count().ToString(), UsageItemType = type, Selected = true, Status = RepositoryItemUsage.eStatus.NotUpdated };
itemUsage.SetItemPartesFromEnum(typeof(eItemParts));
RepoItemUsages.Add(itemUsage);
}
Expand Down Expand Up @@ -195,7 +196,7 @@ private void FindUsages()
}
}
}
}
});
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,21 +276,22 @@ public static RepositoryItemBase GetMatchingRepoItem(RepositoryItemBase item, IE

public static bool CheckIfSureDoingChange(RepositoryItemBase item, string changeType)
{
RepositoryItemUsagePage usagePage = null;
usagePage = new RepositoryItemUsagePage(item, true);
if (usagePage.RepoItemUsages.Count > 0)//TODO: check if only one instance exist for showing the pop up for better performance
//RepositoryItemUsagePage usagePage = null;
//usagePage = new RepositoryItemUsagePage(item, true);
//if (usagePage.RepoItemUsages.Count > 0)//TODO: check if only one instance exist for showing the pop up for better performance
//{
//if (Reporter.ToUser(eUserMsgKey.AskIfWantsToChangeeRepoItem, item.GetNameForFileName(), usagePage.RepoItemUsages.Count, changeType) == Amdocs.Ginger.Common.eUserMsgSelection.Yes)
if (Reporter.ToUser(eUserMsgKey.AskIfWantsToChangeeRepoItem2, item.GetNameForFileName(), changeType) == Amdocs.Ginger.Common.eUserMsgSelection.Yes)
{
if (Reporter.ToUser(eUserMsgKey.AskIfWantsToChangeeRepoItem, item.GetNameForFileName(), usagePage.RepoItemUsages.Count, changeType) == Amdocs.Ginger.Common.eUserMsgSelection.Yes)
{
return true;
}
else
{
return false;
}
return true;
}
else
{
return false;
}
// }

return true;
//return true;
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public BusinessFlowsAutomatePage()
Reset();
}

private void App_AutomateBusinessFlowEvent(AutomateEventArgs args)
private async void App_AutomateBusinessFlowEvent(AutomateEventArgs args)
{
if (args.EventType == AutomateEventArgs.eEventType.Automate)
{
Expand All @@ -58,9 +58,10 @@ private void App_AutomateBusinessFlowEvent(AutomateEventArgs args)
Reporter.ToStatus(eStatusMsgKey.StaticStatusProcess, null, "Loading Automate Page...");
if (mNewAutomatePage == null)
{
mNewAutomatePage = new NewAutomatePage((BusinessFlow)args.Object);
mNewAutomatePage = new NewAutomatePage((BusinessFlow)args.Object);
}
xContentFrame.Content = mNewAutomatePage;
xContentFrame.Content = mNewAutomatePage;
await mNewAutomatePage.LoadBusinessFlowToAutomate((BusinessFlow)args.Object);
}
finally
{
Expand Down
Loading

0 comments on commit c8bf792

Please sign in to comment.