diff --git a/CHANGELOG.md b/CHANGELOG.md index 221658708a..78fec34c31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ + # Changelog All notable changes to this project will be documented in this file. @@ -10,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add Microsoft.Bcl.AsyncInterfaces 6.0.0 for plugin dependancy tree - Allow for column selection when using the RemoteTableAttacher +- Add prompt to reanem container when adding a cohort filter ## [8.1.5] - 2024-04-03 diff --git a/Directory.Packages.props b/Directory.Packages.props index d2f88d8468..026f653f19 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -6,7 +6,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -14,10 +14,10 @@ - + - + @@ -34,7 +34,7 @@ - + diff --git a/Rdmp.Core/ReusableLibraryCode/Settings/UserSettings.cs b/Rdmp.Core/ReusableLibraryCode/Settings/UserSettings.cs index 94e5bd34a0..d835ff0c42 100644 --- a/Rdmp.Core/ReusableLibraryCode/Settings/UserSettings.cs +++ b/Rdmp.Core/ReusableLibraryCode/Settings/UserSettings.cs @@ -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. @@ -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 diff --git a/Rdmp.UI/SimpleControls/ObjectSaverButton.cs b/Rdmp.UI/SimpleControls/ObjectSaverButton.cs index 4f13b38999..03bd2fcdaa 100644 --- a/Rdmp.UI/SimpleControls/ObjectSaverButton.cs +++ b/Rdmp.UI/SimpleControls/ObjectSaverButton.cs @@ -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. @@ -237,4 +237,6 @@ public void CheckForUnsavedChangesAnOfferToSave() else _o.RevertToDatabaseState(); } + + public bool IsEnabled => _isEnabled; } \ No newline at end of file diff --git a/Rdmp.UI/SimpleDialogs/UserSettingsUI.Designer.cs b/Rdmp.UI/SimpleDialogs/UserSettingsUI.Designer.cs index 2de66db057..acec818087 100644 --- a/Rdmp.UI/SimpleDialogs/UserSettingsUI.Designer.cs +++ b/Rdmp.UI/SimpleDialogs/UserSettingsUI.Designer.cs @@ -93,6 +93,7 @@ private void InitializeComponent() userSettingsToolTips = new System.Windows.Forms.ToolTip(components); tbFind = new System.Windows.Forms.TextBox(); label14 = new System.Windows.Forms.Label(); + cbPromptFilterRename = new System.Windows.Forms.CheckBox(); groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)olvErrorCodes).BeginInit(); groupBox2.SuspendLayout(); @@ -521,6 +522,7 @@ private void InitializeComponent() // // groupBox8 // + groupBox8.Controls.Add(cbPromptFilterRename); groupBox8.Controls.Add(cbExpandAllInCohortBuilder); groupBox8.Controls.Add(cbStrictValidationForCohortBuilderContainers); groupBox8.Controls.Add(cbShowCohortWizard); @@ -766,6 +768,18 @@ private void InitializeComponent() label14.TabIndex = 26; label14.Text = "Find Setting:"; // + // cbPromptFilterRename + // + cbPromptFilterRename.AutoSize = true; + cbPromptFilterRename.Checked = true; + cbPromptFilterRename.CheckState = System.Windows.Forms.CheckState.Checked; + cbPromptFilterRename.Location = new System.Drawing.Point(6, 89); + cbPromptFilterRename.Name = "cbPromptFilterRename"; + cbPromptFilterRename.Size = new System.Drawing.Size(222, 19); + cbPromptFilterRename.TabIndex = 4; + cbPromptFilterRename.Text = "Prompt For Rename on Filter Change"; + cbPromptFilterRename.UseVisualStyleBackColor = true; + // // UserSettingsFileUI // AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); @@ -870,5 +884,6 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox cbUseLocalFileSystem; private System.Windows.Forms.Label label16; private System.Windows.Forms.TextBox tbLogLocation; + private System.Windows.Forms.CheckBox cbPromptFilterRename; } } \ No newline at end of file diff --git a/Rdmp.UI/SimpleDialogs/UserSettingsUI.cs b/Rdmp.UI/SimpleDialogs/UserSettingsUI.cs index d69e474228..8b1a46032f 100644 --- a/Rdmp.UI/SimpleDialogs/UserSettingsUI.cs +++ b/Rdmp.UI/SimpleDialogs/UserSettingsUI.cs @@ -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. @@ -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)); diff --git a/Rdmp.UI/TestsAndSetup/ServicePropogation/RDMPSingleDatabaseObjectControl.cs b/Rdmp.UI/TestsAndSetup/ServicePropogation/RDMPSingleDatabaseObjectControl.cs index 0e6b457d36..ebb4de7600 100644 --- a/Rdmp.UI/TestsAndSetup/ServicePropogation/RDMPSingleDatabaseObjectControl.cs +++ b/Rdmp.UI/TestsAndSetup/ServicePropogation/RDMPSingleDatabaseObjectControl.cs @@ -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. @@ -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; @@ -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); } @@ -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("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 _) { @@ -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; } }