diff --git a/CHANGELOG.md b/CHANGELOG.md
index c0317b1f30..77abac7224 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [8.2.4] - Unreleased
- Add New Find & Replace, currently available via User Settings
+- Add instance setting to prompt for cohort versioning when comitting
+- Improve Cohort Versioning Interface
## [8.2.3] - 2024-08-05
@@ -29,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add Release status options to the ticketing system
- Improve Interface for Lookup table generation
+- Improve read/write access to plugin files for linux systems
- Add directory validity checking to data loads
- Open plugin files read-only to avoid permissions errors on Linux
- Improve PK mapping for ExtractionIdentifiers when extracting data
diff --git a/Directory.Packages.props b/Directory.Packages.props
index 7041c2a867..29ce8ab908 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -3,7 +3,7 @@
-
+
@@ -23,7 +23,7 @@
-
+
@@ -39,4 +39,4 @@
-
\ No newline at end of file
+
diff --git a/Rdmp.Core/CommandExecution/AtomicCommands/CohortCreationCommands/ExecuteCommandCreateNewCohortByExecutingACohortIdentificationConfiguration.cs b/Rdmp.Core/CommandExecution/AtomicCommands/CohortCreationCommands/ExecuteCommandCreateNewCohortByExecutingACohortIdentificationConfiguration.cs
index 87797b899a..4cb46e7163 100644
--- a/Rdmp.Core/CommandExecution/AtomicCommands/CohortCreationCommands/ExecuteCommandCreateNewCohortByExecutingACohortIdentificationConfiguration.cs
+++ b/Rdmp.Core/CommandExecution/AtomicCommands/CohortCreationCommands/ExecuteCommandCreateNewCohortByExecutingACohortIdentificationConfiguration.cs
@@ -1,9 +1,10 @@
-// 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.
// You should have received a copy of the GNU General Public License along with RDMP. If not, see .
+using System;
using System.Linq;
using Rdmp.Core.Curation.Data;
using Rdmp.Core.Curation.Data.Cohort;
@@ -13,6 +14,7 @@
using Rdmp.Core.Providers;
using Rdmp.Core.Repositories.Construction;
using Rdmp.Core.ReusableLibraryCode.Icons.IconProvision;
+using Rdmp.Core.Setting;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
@@ -68,7 +70,19 @@ public override void Execute()
if (cic == null)
return;
+ if (BasicActivator.IsInteractive) {
+ var PromptForVersionOnCohortCommit = false;
+ var PromptForVersionOnCohortCommitSetting = BasicActivator.RepositoryLocator.CatalogueRepository.GetAllObjects().Where(s => s.Key == "PromptForVersionOnCohortCommit").FirstOrDefault();
+ if (PromptForVersionOnCohortCommitSetting is not null) PromptForVersionOnCohortCommit = Convert.ToBoolean(PromptForVersionOnCohortCommitSetting.Value);
+ if (PromptForVersionOnCohortCommit && BasicActivator.YesNo("It is recommended to save your cohort as a new version before committing. Would you like to do this?", "Save cohort as new version before committing?"))
+ {
+ var newVersion = new ExecuteCommandCreateVersionOfCohortConfiguration(BasicActivator, cic);
+ newVersion.Execute();
+ var versions = cic.GetVersions();
+ cic = versions.Last();
+ }
+ }
if (Project == null && BasicActivator.CoreChildProvider is DataExportChildProvider dx)
{
var projAssociations = dx.AllProjectAssociatedCics
diff --git a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandCloneCohortIdentificationConfiguration.cs b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandCloneCohortIdentificationConfiguration.cs
index d8b6e3d3be..66c7e79e07 100644
--- a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandCloneCohortIdentificationConfiguration.cs
+++ b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandCloneCohortIdentificationConfiguration.cs
@@ -83,7 +83,8 @@ public override void Execute()
{
CloneCreatedIfAny.Version = _version;
//If no name is provided, use the existing name, but repalce the "(Clone) with the version number"
- CloneCreatedIfAny.Name = _name ?? $"{CloneCreatedIfAny.Name[..^7]}:{CloneCreatedIfAny.Version}";
+ if(CloneCreatedIfAny.Version != null)
+ CloneCreatedIfAny.Name = _name ?? $"{CloneCreatedIfAny.Name[..^7]}:{CloneCreatedIfAny.Version}";
if (_version is not null)
CloneCreatedIfAny.Frozen = true;
CloneCreatedIfAny.SaveToDatabase();
diff --git a/Rdmp.UI/Collections/CohortIdentificationCollectionUI.cs b/Rdmp.UI/Collections/CohortIdentificationCollectionUI.cs
index e2dc958b73..1103534376 100644
--- a/Rdmp.UI/Collections/CohortIdentificationCollectionUI.cs
+++ b/Rdmp.UI/Collections/CohortIdentificationCollectionUI.cs
@@ -70,6 +70,27 @@ public override void SetItemActivator(IActivateItems activator)
tlvCohortIdentificationConfigurations.AddObject(Activator.CoreChildProvider
.TemplateAggregateConfigurationsNode);
+
+ tlvCohortIdentificationConfigurations.CanExpandGetter = delegate (object x)
+ {
+ if (x is CohortIdentificationConfiguration)
+ {
+ return ((CohortIdentificationConfiguration)x).GetVersions().Count > 0;
+ }
+
+ return Activator.CoreChildProvider.GetChildren(x).Length > 0;
+ };
+
+ tlvCohortIdentificationConfigurations.ChildrenGetter = delegate (object x)
+ {
+ if (x is CohortIdentificationConfiguration)
+ {
+ CohortIdentificationConfiguration cic = (CohortIdentificationConfiguration)x;
+ return cic.GetVersions();
+ }
+ return Activator.CoreChildProvider.GetChildren(x);
+ };
+
CommonTreeFunctionality.WhitespaceRightClickMenuCommandsGetter = a => new IAtomicCommand[]
{
new ExecuteCommandCreateNewCohortIdentificationConfiguration(a),
@@ -99,7 +120,8 @@ public override void SetItemActivator(IActivateItems activator)
Alignment = ToolStripItemAlignment.Right,
ToolTipText = "Refresh Object"
};
- _refresh.Click += delegate (object sender, EventArgs e) {
+ _refresh.Click += delegate (object sender, EventArgs e)
+ {
var cic = Activator.CoreChildProvider.AllCohortIdentificationConfigurations.First();
if (cic is not null)
{
diff --git a/Rdmp.UI/LocationsMenu/Versioning/VersioningControlUI.Designer.cs b/Rdmp.UI/LocationsMenu/Versioning/VersioningControlUI.Designer.cs
index 7b7623b85e..726e466d48 100644
--- a/Rdmp.UI/LocationsMenu/Versioning/VersioningControlUI.Designer.cs
+++ b/Rdmp.UI/LocationsMenu/Versioning/VersioningControlUI.Designer.cs
@@ -1,16 +1,9 @@
-using NPOI.OpenXmlFormats.Spreadsheet;
-using Rdmp.Core.CommandExecution.AtomicCommands;
+using Rdmp.Core.CommandExecution.AtomicCommands;
using Rdmp.Core.Curation.Data.Cohort;
-using Rdmp.UI.ChecksUI;
using Rdmp.UI.ItemActivation;
-using Rdmp.UI.SimpleDialogs;
-using Rdmp.UI.SubComponents;
using System;
-using System.Drawing;
using System.Linq;
using System.Windows.Forms;
-using Terminal.Gui;
-using static Azure.Core.HttpHeader;
namespace Rdmp.UI.LocationsMenu.Versioning
{
@@ -43,31 +36,16 @@ protected override void Dispose(bool disposing)
///
private void InitializeComponent()
{
- gbTicketing = new System.Windows.Forms.GroupBox();
- btnShowTicket = new System.Windows.Forms.Button();
- tbTicket = new System.Windows.Forms.ComboBox();
- label6 = new System.Windows.Forms.Label();
+ btnShowTicket = new Button();
+ gbTicketing = new GroupBox();
+ label1 = new Label();
gbTicketing.SuspendLayout();
SuspendLayout();
//
- // gbTicketing
- //
- gbTicketing.Controls.Add(btnShowTicket);
- gbTicketing.Controls.Add(tbTicket);
- gbTicketing.Controls.Add(label6);
- gbTicketing.Location = new System.Drawing.Point(4, 3);
- gbTicketing.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
- gbTicketing.Name = "gbTicketing";
- gbTicketing.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3);
- gbTicketing.Size = new System.Drawing.Size(343, 53);
- gbTicketing.TabIndex = 37;
- gbTicketing.TabStop = false;
- gbTicketing.Text = "Versioning";
- //
// btnShowTicket
//
- btnShowTicket.Location = new System.Drawing.Point(241, 19);
- btnShowTicket.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ btnShowTicket.Location = new System.Drawing.Point(67, 13);
+ btnShowTicket.Margin = new Padding(4, 3, 4, 3);
btnShowTicket.Name = "btnShowTicket";
btnShowTicket.Size = new System.Drawing.Size(94, 25);
btnShowTicket.TabIndex = 32;
@@ -75,64 +53,40 @@ private void InitializeComponent()
btnShowTicket.UseVisualStyleBackColor = true;
btnShowTicket.Click += CommitNewVersion;
//
- // tbTicket
+ // gbTicketing
//
- tbTicket.Location = new System.Drawing.Point(50, 20);
- tbTicket.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
- tbTicket.Name = "tbTicket";
- tbTicket.Size = new System.Drawing.Size(187, 23);
- tbTicket.TabIndex = 30;
- tbTicket.SelectionChangeCommitted += VersionChange;
- tbTicket.MouseHover += tbTicket_MouseOver;
+ gbTicketing.Controls.Add(label1);
+ gbTicketing.Controls.Add(btnShowTicket);
+ gbTicketing.Location = new System.Drawing.Point(0, -8);
+ gbTicketing.Margin = new Padding(4, 3, 4, 3);
+ gbTicketing.Name = "gbTicketing";
+ gbTicketing.Padding = new Padding(4, 3, 4, 3);
+ gbTicketing.Size = new System.Drawing.Size(168, 41);
+ gbTicketing.TabIndex = 37;
+ gbTicketing.TabStop = false;
//
- // label6
+ // label1
//
- label6.AutoSize = true;
- label6.Location = new System.Drawing.Point(6, 23);
- label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
- label6.Name = "label6";
- label6.Size = new System.Drawing.Size(48, 15);
- label6.TabIndex = 31;
- label6.Text = "Version:";
+ label1.AutoSize = true;
+ label1.Location = new System.Drawing.Point(3, 18);
+ label1.Name = "label1";
+ label1.Size = new System.Drawing.Size(65, 15);
+ label1.TabIndex = 33;
+ label1.Text = "Versioning:";
//
// VersioningControlUI
//
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
- AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ AutoScaleMode = AutoScaleMode.Font;
Controls.Add(gbTicketing);
- Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ Margin = new Padding(4, 3, 4, 3);
Name = "VersioningControlUI";
- Size = new System.Drawing.Size(354, 62);
+ Size = new System.Drawing.Size(168, 33);
gbTicketing.ResumeLayout(false);
gbTicketing.PerformLayout();
ResumeLayout(false);
}
- private void VersionChange(object sender, EventArgs e)
- {
- if (tbTicket.SelectedItem is CohortIdentificationConfiguration ei && ei.ID != _cic.ID)
- {
- _activator.Activate(ei);
- //reset current dropdown
- tbTicket.SelectedIndex = 0;
- }
- }
-
- private void tbTicket_MouseOver(object sender, EventArgs e)
- {
- ToolTip buttonToolTip = new ToolTip();
- buttonToolTip.ToolTipTitle = "Value";
- buttonToolTip.UseFading = true;
- buttonToolTip.UseAnimation = true;
- buttonToolTip.IsBalloon = true;
- buttonToolTip.ShowAlways = true;
- buttonToolTip.AutoPopDelay = 5000;
- buttonToolTip.InitialDelay = 1000;
- buttonToolTip.ReshowDelay = 0;
-
- buttonToolTip.SetToolTip(tbTicket, tbTicket.Text);
- }
-
private void CommitNewVersion(object sender, EventArgs e)
{
if (_cic.Version != null)
@@ -152,10 +106,6 @@ private void CommitNewVersion(object sender, EventArgs e)
var addedNewDescription = _activator.TypeText("Add a description of this new version", "Would you like to update the description of this new cohort version?", 250, _cic.Description, out string newDescription, false);
var cmd = new ExecuteCommandCreateVersionOfCohortConfiguration(_activator, _cic, $"{_cic.Name}-v{versions.Count + 1}-{DateTime.Now.ToString("yyyy-MM-dd")}", addedNewDescription ? newDescription : null);
cmd.Execute();
- versions = _cic.GetVersions();
- versions.Insert(0, _cic);
- tbTicket.DataSource = versions;
- tbTicket.Enabled = true;
}
@@ -163,36 +113,16 @@ public void Setup(CohortIdentificationConfiguration databaseObject, IActivateIte
{
_cic = databaseObject;
_activator = activator;
- tbTicket.DropDownStyle = ComboBoxStyle.DropDownList;
- int cbWidth = (int)tbTicket.DropDownWidth;
var versions = databaseObject.GetVersions();
- if (!versions.Any() || databaseObject.Version is not null)
- {
- tbTicket.Enabled = false;
- label6.Enabled = false;
- }
if (_cic is not null)
btnShowTicket.Text = _cic.Version is null ? "Save Version" : "Restore";
versions.Insert(0, databaseObject);
- tbTicket.DataSource = versions;
- foreach (var version in versions)
- {
- var longestItem = CreateGraphics().MeasureString(version.Name, SystemFonts.MessageBoxFont).Width;
- if (longestItem > cbWidth)
- {
- cbWidth = (int)longestItem + 1;
- }
-
- }
- tbTicket.DropDownWidth = cbWidth;
-
}
- #endregion
- private System.Windows.Forms.GroupBox gbTicketing;
- private System.Windows.Forms.Button btnShowTicket;
- private System.Windows.Forms.ComboBox tbTicket;
- private System.Windows.Forms.Label label6;
+ #endregion
+ private Button btnShowTicket;
+ private GroupBox gbTicketing;
+ private Label label1;
}
}
diff --git a/Rdmp.UI/SimpleDialogs/InstanceSettings.Designer.cs b/Rdmp.UI/SimpleDialogs/InstanceSettings.Designer.cs
index 8a7b4da3c8..da422a5588 100644
--- a/Rdmp.UI/SimpleDialogs/InstanceSettings.Designer.cs
+++ b/Rdmp.UI/SimpleDialogs/InstanceSettings.Designer.cs
@@ -32,6 +32,7 @@ private void InitializeComponent()
cbAutoSuggestProjectNumbers = new System.Windows.Forms.CheckBox();
instanceSettingsToolTips = new System.Windows.Forms.ToolTip(components);
label1 = new System.Windows.Forms.Label();
+ cbCohortVersioningOnCommit = new System.Windows.Forms.CheckBox();
SuspendLayout();
//
// cbAutoSuggestProjectNumbers
@@ -54,11 +55,22 @@ private void InitializeComponent()
label1.TabIndex = 2;
label1.Text = "Settings will automatically be Saved as you change them ";
//
+ // cbCohortVersioningOnCommit
+ //
+ cbCohortVersioningOnCommit.AutoSize = true;
+ cbCohortVersioningOnCommit.Location = new System.Drawing.Point(12, 65);
+ cbCohortVersioningOnCommit.Name = "cbCohortVersioningOnCommit";
+ cbCohortVersioningOnCommit.Size = new System.Drawing.Size(364, 19);
+ cbCohortVersioningOnCommit.TabIndex = 3;
+ cbCohortVersioningOnCommit.Text = "Prompt user to create a new version of the cohort before committing it";
+ cbCohortVersioningOnCommit.UseVisualStyleBackColor = true;
+ //
// InstanceSettings
//
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
ClientSize = new System.Drawing.Size(800, 450);
+ Controls.Add(cbCohortVersioningOnCommit);
Controls.Add(label1);
Controls.Add(cbAutoSuggestProjectNumbers);
Name = "InstanceSettings";
@@ -72,5 +84,6 @@ private void InitializeComponent()
private System.Windows.Forms.CheckBox cbAutoSuggestProjectNumbers;
private System.Windows.Forms.ToolTip instanceSettingsToolTips;
private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.CheckBox cbCohortVersioningOnCommit;
}
}
\ No newline at end of file
diff --git a/Rdmp.UI/SimpleDialogs/InstanceSettings.cs b/Rdmp.UI/SimpleDialogs/InstanceSettings.cs
index 6026a808a4..9cf1eee4b3 100644
--- a/Rdmp.UI/SimpleDialogs/InstanceSettings.cs
+++ b/Rdmp.UI/SimpleDialogs/InstanceSettings.cs
@@ -26,6 +26,7 @@ public InstanceSettings(IActivateItems activator)
_settings = _activator.RepositoryLocator.CatalogueRepository.GetAllObjects();
RegisterCheckbox(cbAutoSuggestProjectNumbers, "AutoSuggestProjectNumbers");
+ RegisterCheckbox(cbCohortVersioningOnCommit, "PromptForVersionOnCohortCommit");
_loaded = true;
}
diff --git a/Rdmp.UI/SubComponents/CohortIdentificationConfigurationUI.Designer.cs b/Rdmp.UI/SubComponents/CohortIdentificationConfigurationUI.Designer.cs
index 52942b8e22..51e0d5b18b 100644
--- a/Rdmp.UI/SubComponents/CohortIdentificationConfigurationUI.Designer.cs
+++ b/Rdmp.UI/SubComponents/CohortIdentificationConfigurationUI.Designer.cs
@@ -168,11 +168,10 @@ private void InitializeComponent()
//
// version
//
- version.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
- version.Location = new System.Drawing.Point(1097, 50);
+ version.Location = new System.Drawing.Point(4, 74);
version.Margin = new System.Windows.Forms.Padding(0);
version.Name = "version";
- version.Size = new System.Drawing.Size(348, 81);
+ version.Size = new System.Drawing.Size(170, 33);
version.TabIndex = 55;
//
// btnAbortLoad