\\d+)(?;\\d+)*m", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.IgnoreCase);
+
+ public string Parse(string input)
+ {
+ var htmlText = _rule.Replace(input, match =>
+ {
+ var code = Convert.ToInt32(match.Groups["code"].Value);
+ var args = match.Groups["args"].Value;
+ List attributes = args.Split(';').ToList();
+
+ var tagBuilder = new StringBuilder();
+ if (code == Constants.SelectGraphicRenditionParameters.Reset)
+ {
+ tagBuilder.Append("");
+ }
+ else
+ {
+ var color = Constants.White;
+ if (attributes.Count > 0)
+ {
+ string colorCode = attributes.Last();
+ if (Constants.ColorMap.ContainsKey(colorCode))
+ {
+ color = Constants.ColorMap[colorCode];
+ }
+ }
+
+ tagBuilder.Append("");
+ }
+
+ return tagBuilder.ToString();
+ });
+
+ return htmlText;
+ }
+ }
+}
diff --git a/src/Microsoft.Tye.Hosting/Dashboard/Pages/Index.razor b/src/Microsoft.Tye.Hosting/Dashboard/Pages/Index.razor
index cf06ba18b..c63736df1 100644
--- a/src/Microsoft.Tye.Hosting/Dashboard/Pages/Index.razor
+++ b/src/Microsoft.Tye.Hosting/Dashboard/Pages/Index.razor
@@ -12,13 +12,14 @@
+
Name
Type
Source
Bindings
Replicas
Restarts
- Logs
+
@@ -26,7 +27,11 @@
{
var logsPath = $"logs/{service.Description.Name}";
var servicePath = $"services/{service.Description.Name}";
+ var serviceState = service.State;
+
+ @serviceState
+
@if(service.ServiceType == ServiceType.External)
{
@@ -34,7 +39,7 @@
}
else
{
- @service.Description.Name
+ @service.Description.Name
}
@@ -91,7 +96,7 @@
{
@service.Replicas.Count/@service.Description.Replicas
@service.Restarts
- View
+ Logs | Metrics
}
}
@@ -102,6 +107,16 @@
private List _subscriptions = new List();
+ string GetServiceStateClass(ServiceState serviceState) => serviceState switch
+ {
+ ServiceState.Starting => "badge-secondary",
+ ServiceState.Started => "badge-success",
+ ServiceState.Degraded => "badge-danger",
+ ServiceState.Failed => "badge-warning",
+ ServiceState.Stopped => "badge-light",
+ _ => "badge-dark"
+ };
+
string GetUrl(ServiceBinding b)
{
return $"{(b.Protocol ?? "tcp")}://{b.Host ?? "localhost"}:{b.Port}";
diff --git a/src/Microsoft.Tye.Hosting/Dashboard/Pages/Logs.razor b/src/Microsoft.Tye.Hosting/Dashboard/Pages/Logs.razor
index 34130514f..f801f10b8 100644
--- a/src/Microsoft.Tye.Hosting/Dashboard/Pages/Logs.razor
+++ b/src/Microsoft.Tye.Hosting/Dashboard/Pages/Logs.razor
@@ -1,6 +1,8 @@
@page "/logs/{ServiceName}"
+@using Microsoft.Tye.Hosting.Ansi2Html;
@inject IJSRuntime JS
@inject Application application
+@inject Converter ansi2HtmlParser
@implements IDisposable