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

Enhancement/lite db upgrade #3389

Merged
merged 21 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
418 changes: 21 additions & 397 deletions Ginger/Ginger/Actions/ActionEditPages/ActDataSourcePage.xaml.cs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Ginger/Ginger/Ginger.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@
<PackageReference Include="FontAwesome5" Version="2.1.11" />
<PackageReference Include="Gherkin" Version="5.1.0" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.42" />
<PackageReference Include="LiteDB" Version="4.1.4" />
<PackageReference Include="LiteDB" Version="5.0.17" />
<PackageReference Include="LiveCharts.Wpf.NetCore3" Version="0.9.7" />
<PackageReference Include="log4net" Version="2.0.14" />
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="11.1.1" />
Expand Down
3 changes: 1 addition & 2 deletions Ginger/Ginger/Run/RunSetsExecutionsHistoryPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,7 @@ private void DeleteExecutionReports(System.Collections.IList runSetReports)
{
LiteDbManager dbManager = new LiteDbManager(executionLoggerHelper.GetLoggerDirectory(WorkSpace.Instance.Solution.LoggerConfigurations.CalculatedLoggerFolder));
var result = dbManager.GetRunSetLiteData();
List<LiteDbRunSet> filterData = null;
filterData = result.IncludeAll().Find(a => a._id.ToString() == runSetReport.GUID).ToList();
List<LiteDbRunSet> filterData = LiteDbRunSet.IncludeAllReferences(result).Find(a => a._id.Equals(new LiteDB.ObjectId(runSetReport.GUID))).ToList();

LiteDbConnector dbConnector = new LiteDbConnector(Path.Combine(mRunSetExecsRootFolder, "GingerExecutionResults.db"));
dbConnector.DeleteDocumentByLiteDbRunSet(filterData[0]);
Expand Down
2 changes: 1 addition & 1 deletion Ginger/Ginger/RunSetPageLib/RunnerPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ private void GenerateBFReport(BusinessFlow bf)
LiteDbManager dbManager = new LiteDbManager(WorkSpace.Instance.Solution.SolutionOperations.ConvertSolutionRelativePath(WorkSpace.Instance.Solution.LoggerConfigurations.CalculatedLoggerFolder));
var result = dbManager.GetRunSetLiteData();

List<LiteDbRunSet> filterData = dbManager.FilterCollection(result, Query.All());
List<LiteDbRunSet> filterData = dbManager.FilterCollection<LiteDbRunSet>(LiteDbRunSet.IncludeAllReferences(result), Query.All());

LiteDbRunSet runSetLast = filterData.Last();
//runSetLast._id = new ObjectId();
Comment on lines 433 to 439
Copy link
Contributor

@coderabbitai coderabbitai bot Dec 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: This review was outside the patches, and no patch overlapping with it was found. Original lines [440-440]

The catch block in the GenerateBFReport method is empty. It's recommended to at least log the exception to aid in debugging if an error occurs.

try
{
    // ... existing code ...
}
catch (Exception ex)
{
+   Reporter.ToLog(eLogLevel.ERROR, "Failed to generate business flow report", ex);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, will make the necessary changes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@manas-droid Great, glad to hear that you'll make the changes. If you need any more assistance, feel free to ask!

🎉


New Learnings Added
User: manas-droid
PR: Ginger-Automation/Ginger#3389
File: Ginger/Ginger/RunSetPageLib/RunnerPage.xaml.cs:433-439
Timestamp: 2024-01-09T13:58:48.982Z
Learning: The user has agreed to add logging within the empty catch block in the `GenerateBFReport` method as suggested.

If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!

Expand Down
2 changes: 1 addition & 1 deletion Ginger/GingerCoreCommon/GingerCoreCommon.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

<ItemGroup>
<PackageReference Include="Ginger.External" Version="1.0.0" />
<PackageReference Include="LiteDB" Version="4.1.4" />
<PackageReference Include="LiteDB" Version="5.0.17" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The HintPath for LiteDB.dll is still pointing to the old version. This should be updated or removed if it's no longer necessary due to the package reference.

- <HintPath>..\..\..\..\..\.nuget\packages\litedb\4.1.4\lib\net40\LiteDB.dll</HintPath>
+ <HintPath>..\..\..\..\..\.nuget\packages\litedb\5.0.17\lib\netstandard2.0\LiteDB.dll</HintPath>

Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
<PackageReference Include="LiteDB" Version="5.0.17" />
<PackageReference Include="LiteDB" Version="5.0.17" />
<HintPath>..\..\..\..\..\.nuget\packages\litedb\5.0.17\lib\netstandard2.0\LiteDB.dll</HintPath>

<PackageReference Include="Microsoft.CodeAnalysis" Version="3.7.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="3.7.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.7.0" />
Expand Down
30 changes: 28 additions & 2 deletions Ginger/GingerCoreNET/DataSource/ActDSTableElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ limitations under the License.

using amdocs.ginger.GingerCoreNET;
using Amdocs.Ginger.Common;
using Amdocs.Ginger.Common.Enums;
using Amdocs.Ginger.Common.InterfacesLib;
using Amdocs.Ginger.CoreNET.DataSource;
using Amdocs.Ginger.Repository;
using GingerCore.DataSource;
using GingerCoreNET.SolutionRepositoryLib.RepositoryObjectsLib.PlatformsLib;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Data;
Expand Down Expand Up @@ -86,6 +84,16 @@ public override void Execute()
if (DataSource.DSType == DataSourceBase.eDSType.LiteDataBase)
{
GingerCoreNET.DataSource.GingerLiteDB liteDB = new GingerCoreNET.DataSource.GingerLiteDB();
string value = GetInputParamValue("Value");
if (!string.IsNullOrEmpty(value))
{
ValueExpression mValueExpression = new(WorkSpace.Instance.RunsetExecutor.RunsetExecutionEnvironment, RunOnBusinessFlow, WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems<DataSourceBase>());
mValueExpression.Value = value;
ValueUC = mValueExpression.ValueCalculated;
}

LiteDBSQLTranslator liteDBSQLTranslator = new (this);
this.ValueExp = liteDBSQLTranslator.CreateValueExpression();
string Query = ValueExp.Substring(ValueExp.IndexOf("QUERY=") + 6, ValueExp.Length - (ValueExp.IndexOf("QUERY=") + 7));
liteDB.FileFullPath = WorkSpace.Instance.Solution.SolutionOperations.ConvertSolutionRelativePath(DataSource.FileFullPath);

Expand Down Expand Up @@ -281,6 +289,24 @@ public override void Execute()

}


private string mKeyName;
[IsSerializedForLocalRepository]
public string KeyName
{
get
{
return mKeyName;
}
set
{
if(!string.Equals(mKeyName , value))
{
mKeyName = value;
OnPropertyChanged(nameof(KeyName));
}
}
}
private eControlAction mControlAction;
[IsSerializedForLocalRepository]
public eControlAction ControlAction
Expand Down
Loading
Loading