瀏覽代碼

Fix Dashboard metric not update #811 (#819)

master
luox78 3 年之前
committed by GitHub
父節點
當前提交
75e9df813f
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: 4AEE18F83AFDEB23
共有 3 個檔案被更改,包括 19 行新增6 行删除
  1. +12
    -0
      src/DotNetCore.CAP.Dashboard/JsonSerializeOptions.cs
  2. +2
    -2
      src/DotNetCore.CAP.Dashboard/JsonStats.cs
  3. +5
    -4
      src/DotNetCore.CAP.Dashboard/Pages/HomePage.cshtml

+ 12
- 0
src/DotNetCore.CAP.Dashboard/JsonSerializeOptions.cs 查看文件

@@ -0,0 +1,12 @@
using System.Text.Json;

namespace DotNetCore.CAP.Dashboard
{
public static class JsonSerializeOptions
{
public static JsonSerializerOptions Default = new JsonSerializerOptions
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
};
}
}

+ 2
- 2
src/DotNetCore.CAP.Dashboard/JsonStats.cs 查看文件

@@ -24,8 +24,8 @@ namespace DotNetCore.CAP.Dashboard
var value = metric.Func(page);
result.Add(metric.Name, value);
}
var serialized = JsonSerializer.Serialize(result);
var serialized = JsonSerializer.Serialize(result, JsonSerializeOptions.Default);

context.Response.ContentType = "application/json";
await context.Response.WriteAsync(serialized);


+ 5
- 4
src/DotNetCore.CAP.Dashboard/Pages/HomePage.cshtml 查看文件

@@ -1,5 +1,6 @@
@* Generator: Template TypeVisibility: Internal GeneratePrettyNames: True *@
@using System.Text.Json
@using DotNetCore.CAP.Dashboard
@using DotNetCore.CAP.Dashboard.Pages
@using DotNetCore.CAP.Dashboard.Resources
@using DotNetCore.CAP.Messages
@@ -52,12 +53,12 @@
</h3>

<div id="historyGraph"
data-published-succeeded="@JsonSerializer.Serialize(publishedSucceeded)"
data-published-failed="@JsonSerializer.Serialize(publishedFailed)"
data-published-succeeded="@JsonSerializer.Serialize(publishedSucceeded, JsonSerializeOptions.Default)"
data-published-failed="@JsonSerializer.Serialize(publishedFailed, JsonSerializeOptions.Default)"
data-published-succeeded-string="@Strings.HomePage_GraphHover_PSucceeded"
data-published-failed-string="@Strings.HomePage_GraphHover_PFailed"
data-received-succeeded="@JsonSerializer.Serialize(receivedSucceeded)"
data-received-failed="@JsonSerializer.Serialize(receivedFailed)"
data-received-succeeded="@JsonSerializer.Serialize(receivedSucceeded, JsonSerializeOptions.Default)"
data-received-failed="@JsonSerializer.Serialize(receivedFailed, JsonSerializeOptions.Default)"
data-received-succeeded-string="@Strings.HomePage_GraphHover_RSucceeded"
data-received-failed-string="@Strings.HomePage_GraphHover_RFailed">
</div>


Loading…
取消
儲存