Ver a proveniência

Fix Dashboard metric not update #811 (#819)

master
luox78 há 3 anos
committed by GitHub
ascendente
cometimento
75e9df813f
Não foi encontrada uma chave conhecida para esta assinatura, na base de dados ID da chave GPG: 4AEE18F83AFDEB23
3 ficheiros alterados com 19 adições e 6 eliminações
  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 Ver ficheiro

@@ -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 Ver ficheiro

@@ -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 Ver ficheiro

@@ -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>


Carregando…
Cancelar
Guardar