Parcourir la source

Fix Dashboard metric not update #811 (#819)

master
luox78 il y a 3 ans
committed by GitHub
Parent
révision
75e9df813f
Aucune clé connue n'a été trouvée dans la base pour cette signature ID de la clé GPG: 4AEE18F83AFDEB23
3 fichiers modifiés avec 19 ajouts et 6 suppressions
  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 Voir le fichier

@@ -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 Voir le fichier

@@ -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 Voir le fichier

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


Chargement…
Annuler
Enregistrer