Skip to content

Commit

Permalink
Merge pull request #2132 from HicServices/bugfix/RDMP-280-delete-coho…
Browse files Browse the repository at this point in the history
…rt-versions

fix up cohort freezing and warning UI alert
  • Loading branch information
rdteviotdale authored Feb 10, 2025
2 parents 3e4a7ee + 9556eda commit 527a45d
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@ public override void Publish(IMapsDirectlyToDatabaseTable databaseEntity)
RefreshBus.Publish(this, new RefreshObjectEventArgs(de));
}

public override void ShowWarning(string message)
{
// if on wrong Thread
if (_mainDockPanel?.InvokeRequired ?? false)
{
_mainDockPanel.Invoke(() => ShowWarning(message));
return;
}

WideMessageBox.Show("Message", message, Environment.StackTrace, true, null, WideMessageBoxTheme.Warning);
}

public override void Show(string title, string message)
{
// if on wrong Thread
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improve cohort deprecation override test
- Add Filters for CatalogueItems to Dashboard graphs
- Add ability to use cohort temp table during extractions
- Fix bug where cohort configuration versions could not be deleted
- Extraction UI alerts are now marked as warnings as opposed to information

## [8.4.2] - 2024-12-18

Expand Down
3 changes: 3 additions & 0 deletions Rdmp.Core/CommandExecution/BasicActivateItems.cs
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@ public void Show(string message)
Show("Message", message);
}

/// <inheritdoc/>
public abstract void ShowWarning(string message);

public abstract void Show(string title, string message);

/// <inheritdoc/>
Expand Down
7 changes: 7 additions & 0 deletions Rdmp.Core/CommandExecution/IBasicActivateItems.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,13 @@ bool SelectObjects<T>(string prompt, T[] available, out T[] selected, string ini
/// <param name="message"></param>
void Show(string message);

/// <summary>
/// Display the given message to the user (e.g. in a MessageBox or out into the Console) as a warning
/// </summary>
/// <param name="message"></param>
void ShowWarning(string message);


/// <summary>
/// Display the given message to the user (e.g. in a MessageBox or out into the Console). If provided <paramref name="title"/> may also be featured in the presentation
/// </summary>
Expand Down
5 changes: 5 additions & 0 deletions Rdmp.Core/CommandExecution/ThrowImmediatelyActivator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ public override void Show(string title, string message)
{
}

public override void ShowWarning(string message)
{
}


public override bool TypeText(DialogArgs args, int maxLength, string initialText, out string text,
bool requireSaneHeaderText)
{
Expand Down
5 changes: 5 additions & 0 deletions Rdmp.Core/CommandLine/Interactive/ConsoleInputManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ public override void Show(string title, string message)
Console.WriteLine(message);
}

public override void ShowWarning(string message)
{
Console.WriteLine(message);
}

public override bool TypeText(DialogArgs args, int maxLength, string initialText, out string text,
bool requireSaneHeaderText)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ public void CreateRootContainerIfNotExists()

public bool ShouldBeReadOnly(out string reason)
{
if (Frozen)
if (Frozen && Version is null)
{
reason = $"{Name} is Frozen";
return true;
Expand Down
5 changes: 3 additions & 2 deletions Rdmp.Core/DataFlowPipeline/DataFlowPipelineEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Rdmp.Core.DataFlowPipeline.Requirements;
using Rdmp.Core.ReusableLibraryCode.Checks;
using Rdmp.Core.ReusableLibraryCode.Progress;
using Renci.SshNet.Messages;

namespace Rdmp.Core.DataFlowPipeline;

Expand Down Expand Up @@ -96,11 +97,11 @@ public void Initialize(params object[] initializationObjects)
private void UIAlert(string alert, IBasicActivateItems activator)
{
if (!activator.IsInteractive) return;

new Thread(() =>
{
// run as a separate thread to not halt the UI
activator.Show(alert);
activator.ShowWarning(alert);

})
{
IsBackground = true
Expand Down
5 changes: 5 additions & 0 deletions Rdmp.UI.Tests/TestActivateItems.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,11 @@ public override void ShowData(System.Data.DataTable collection)
{
throw new NotImplementedException();
}

public override void ShowWarning(string message)
{
Show("Message", message);
}
}

public class TestActivateItemsResults : ICheckNotifier
Expand Down
5 changes: 5 additions & 0 deletions Tools/rdmp/CommandLine/Gui/ConsoleGuiActivator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -388,4 +388,9 @@ public override void LaunchSubprocess(ProcessStartInfo startInfo)
{
throw new NotSupportedException();
}

public override void ShowWarning(string message)
{
Show("Message", message);
}
}

0 comments on commit 527a45d

Please sign in to comment.