mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-02-23 15:14:49 +01:00
BTCPay Extensions Part 2 (#2001)
* BTCPay Extensions Part 2 This PR cleans up the extension system a bit in that: * It renames the test extension to a more uniform name * Allows yo uto have system extensions, which are extensions but bundled by default with the release (and cannot be removed) * Adds a tool to help you generate an extension package from a csproj * Refactors the UI extension points to a view component * Moves some more interfaces to the Abstractions csproj * Rename to plugins
This commit is contained in:
50
BTCPayServer.Abstractions/Models/StatusMessageModel.cs
Normal file
50
BTCPayServer.Abstractions/Models/StatusMessageModel.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
|
||||
namespace BTCPayServer.Models
|
||||
{
|
||||
public class StatusMessageModel
|
||||
{
|
||||
public StatusMessageModel()
|
||||
{
|
||||
}
|
||||
public string Message { get; set; }
|
||||
public string Html { get; set; }
|
||||
public StatusSeverity Severity { get; set; }
|
||||
public bool AllowDismiss { get; set; } = true;
|
||||
|
||||
public string SeverityCSS => ToString(Severity);
|
||||
|
||||
private void ParseNonJsonStatus(string s)
|
||||
{
|
||||
Message = s;
|
||||
Severity = s.StartsWith("Error", StringComparison.InvariantCultureIgnoreCase)
|
||||
? StatusSeverity.Error
|
||||
: StatusSeverity.Success;
|
||||
}
|
||||
|
||||
public static string ToString(StatusSeverity severity)
|
||||
{
|
||||
switch (severity)
|
||||
{
|
||||
case StatusSeverity.Info:
|
||||
return "info";
|
||||
case StatusSeverity.Error:
|
||||
return "danger";
|
||||
case StatusSeverity.Success:
|
||||
return "success";
|
||||
case StatusSeverity.Warning:
|
||||
return "warning";
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
public enum StatusSeverity
|
||||
{
|
||||
Info,
|
||||
Error,
|
||||
Success,
|
||||
Warning
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user