Skip to content

Commit

Permalink
Merge branch 'develop' into task/RDMP-165-setup-using-yaml-file
Browse files Browse the repository at this point in the history
  • Loading branch information
JFriel authored Apr 30, 2024
2 parents 323e7c9 + 3f2fd35 commit 9573472
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# Changelog
All notable changes to this project will be documented in this file.

Expand All @@ -9,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Changed

- Add Microsoft.Bcl.AsyncInterfaces 6.0.0 for plugin dependancy tree
- Add prompt to reanem container when adding a cohort filter

## [8.1.5] - 2024-04-03

Expand Down
8 changes: 4 additions & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
<PackageVersion Include="FluentFTP" Version="50.0.1"/>
<PackageVersion Include="HIC.BadMedicine" Version="1.2.1"/>
<PackageVersion Include="HIC.FAnsiSql" Version="3.2.2"/>
<PackageVersion Include="LibArchive.Net" Version="0.1.4"/>
<PackageVersion Include="LibArchive.Net" Version="0.1.5"/>
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
<PackageVersion Include="MongoDB.Driver" Version="2.25.0"/>
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3"/>
<PackageVersion Include="NPOI" Version="2.7.0"/>
<PackageVersion Include="NLog" Version="5.2.8"/>
<PackageVersion Include="NLog" Version="5.3.1"/>
<PackageVersion Include="SixLabors.ImageSharp" Version="3.1.4"/>
<PackageVersion Include="SixLabors.ImageSharp.Drawing" Version="2.1.3"/>
<PackageVersion Include="Spectre.Console" Version="0.48.0"/>
<PackageVersion Include="Spectre.Console" Version="0.49.1"/>
<PackageVersion Include="SSH.NET" Version="2024.0.0"/>
<PackageVersion Include="Terminal.Gui" Version="1.16.0"/>
<PackageVersion Include="YamlDotNet" Version="15.1.2"/>
Expand All @@ -34,7 +34,7 @@
<PackageVersion Include="HIC.System.Windows.Forms.DataVisualization" Version="1.0.1"/>
<PackageVersion Include="NunitXml.TestLogger" Version="3.1.20"/>
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0"/>
<PackageVersion Include="NUnit.Analyzers" Version="4.1.0"/>
<PackageVersion Include="NUnit.Analyzers" Version="4.2.0"/>
<PackageVersion Include="NSubstitute" Version="5.1.0"/>
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0"/>
<PackageVersion Include="coverlet.collector" Version="6.0.2"/>
Expand Down
9 changes: 8 additions & 1 deletion Rdmp.Core/ReusableLibraryCode/Settings/UserSettings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) The University of Dundee 2018-2019
// Copyright (c) The University of Dundee 2018-2024
// This file is part of the Research Data Management Platform (RDMP).
// RDMP is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
// RDMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Expand Down Expand Up @@ -171,6 +171,13 @@ public static bool EnableCommits
}


public static bool PromptRenameOnCohortFilterChange
{
get => AppSettings.GetValueOrDefault("PromptRenameOnCohortFilterChange", true);
set => AppSettings.AddOrUpdateValue("PromptRenameOnCohortFilterChange", value);
}


#region Catalogue flag visibility settings

public static bool ShowInternalCatalogues
Expand Down
4 changes: 3 additions & 1 deletion Rdmp.UI/SimpleControls/ObjectSaverButton.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) The University of Dundee 2018-2019
// Copyright (c) The University of Dundee 2018-2024
// This file is part of the Research Data Management Platform (RDMP).
// RDMP is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
// RDMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Expand Down Expand Up @@ -237,4 +237,6 @@ public void CheckForUnsavedChangesAnOfferToSave()
else
_o.RevertToDatabaseState();
}

public bool IsEnabled => _isEnabled;
}
15 changes: 15 additions & 0 deletions Rdmp.UI/SimpleDialogs/UserSettingsUI.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Rdmp.UI/SimpleDialogs/UserSettingsUI.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) The University of Dundee 2018-2019
// Copyright (c) The University of Dundee 2018-2024
// This file is part of the Research Data Management Platform (RDMP).
// RDMP is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
// RDMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Expand Down Expand Up @@ -103,6 +103,7 @@ public UserSettingsFileUI(IActivateItems activator)
RegisterCheckbox(cbAlwaysJoinEverything, nameof(UserSettings.AlwaysJoinEverything));
RegisterCheckbox(cbAutoRunSqlQueries, nameof(UserSettings.AutoRunSqlQueries));
RegisterCheckbox(cbExpandAllInCohortBuilder, nameof(UserSettings.ExpandAllInCohortBuilder));
RegisterCheckbox(cbPromptFilterRename, nameof(UserSettings.PromptRenameOnCohortFilterChange));
RegisterCheckbox(cbUseAliasInsteadOfTransformInGroupByAggregateGraphs,
nameof(UserSettings.UseAliasInsteadOfTransformInGroupByAggregateGraphs));
RegisterCheckbox(cbUseLocalFileSystem, nameof(UserSettings.UseLocalFileSystem));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) The University of Dundee 2018-2019
// Copyright (c) The University of Dundee 2018-2024
// This file is part of the Research Data Management Platform (RDMP).
// RDMP is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
// RDMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Expand All @@ -12,7 +12,12 @@
using Rdmp.Core.CommandExecution;
using Rdmp.Core.CommandExecution.AtomicCommands;
using Rdmp.Core.Curation.Data;
using Rdmp.Core.Curation.Data.Aggregation;
using Rdmp.Core.Curation.Data.Cohort;
using Rdmp.Core.MapsDirectlyToDatabaseTable;
using Rdmp.Core.Repositories;
using Rdmp.Core.ReusableLibraryCode.Settings;
using Rdmp.UI.ExtractionUIs.FilterUIs;
using Rdmp.UI.ItemActivation;
using Rdmp.UI.Refreshing;
using Rdmp.UI.Rules;
Expand Down Expand Up @@ -128,6 +133,11 @@ public virtual void SetDatabaseObject(IActivateItems activator, T databaseObject
ObjectSaverButton1.BeforeSave += BeforeSave_FinishCommitInProgressIfAny;
ObjectSaverButton1.AfterSave += AfterSave_BeginNewCommitIfApplicable;
}
if (this.GetType() == typeof(ExtractionFilterUI) && UserSettings.PromptRenameOnCohortFilterChange)
{
ObjectSaverButton1.BeforeSave -= BeforeSave_PromptRenameOfExtractionFilterContainer;
ObjectSaverButton1.BeforeSave += BeforeSave_PromptRenameOfExtractionFilterContainer;
}

ObjectSaverButton1.SetupFor(this, databaseObject, activator);
}
Expand All @@ -141,6 +151,32 @@ public virtual void SetDatabaseObject(IActivateItems activator, T databaseObject
}
}

protected bool BeforeSave_PromptRenameOfExtractionFilterContainer(DatabaseEntity _)
{
if (!ObjectSaverButton1.IsEnabled) return true;
AggregateFilter af;
try
{
af = (AggregateFilter)_;
}
catch (Exception)
{
//DatabaseEntity was not an aggregateFilter
return true;
}
AggregateFilterContainer afc = af.CatalogueRepository.GetAllObjectsWhere<AggregateFilterContainer>("ID", af.FilterContainer_ID).FirstOrDefault();
if (afc != null)
{
AggregateConfiguration ac = afc.GetAggregate();
if (ac != null)
{
var rename = new ExecuteCommandRename(Activator, ac);
rename.Execute();
}
}
return true;
}


protected bool BeforeSave_FinishCommitInProgressIfAny(DatabaseEntity _)
{
Expand Down Expand Up @@ -308,6 +344,7 @@ protected override void Dispose(bool disposing)
if (ObjectSaverButton1 != null)
{
ObjectSaverButton1.BeforeSave -= BeforeSave_FinishCommitInProgressIfAny;
ObjectSaverButton1.BeforeSave -= BeforeSave_PromptRenameOfExtractionFilterContainer;
ObjectSaverButton1.AfterSave -= AfterSave_BeginNewCommitIfApplicable;
}
}
Expand Down

0 comments on commit 9573472

Please sign in to comment.