mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 18:11:36 +01:00
53 lines
1.4 KiB
C#
53 lines
1.4 KiB
C#
using System;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
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
|
|
}
|
|
}
|
|
}
|