fixes dashboard permissions
This commit is contained in:
parent
485af03367
commit
75228c815d
|
@ -20,7 +20,11 @@ namespace DistTestCore.Metrics
|
||||||
//GF_<SectionName>_<KeyName>__FILE
|
//GF_<SectionName>_<KeyName>__FILE
|
||||||
|
|
||||||
AddEnvVar("GF_AUTH_ANONYMOUS_ENABLED", "true");
|
AddEnvVar("GF_AUTH_ANONYMOUS_ENABLED", "true");
|
||||||
AddEnvVar("GF_AUTH_DISABLE_LOGIN_FORM", "true");
|
AddEnvVar("GF_AUTH_ANONYMOUS_ORG_NAME", "Main Org.");
|
||||||
|
AddEnvVar("GF_AUTH_ANONYMOUS_ORG_ROLE", "Editor");
|
||||||
|
|
||||||
|
//AddEnvVar("GF_AUTH_DISABLE_LOGIN_FORM", "true");
|
||||||
|
//AddEnvVar("GF_FEATURE_TOGGLES_ENABLE", "publicDashboards");
|
||||||
|
|
||||||
//[auth]
|
//[auth]
|
||||||
//disable_login_form = true
|
//disable_login_form = true
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
{
|
{
|
||||||
"dashboard": {
|
|
||||||
"annotations": {
|
"annotations": {
|
||||||
"list": [
|
"list": [
|
||||||
{
|
{
|
||||||
|
@ -132,7 +131,4 @@
|
||||||
"uid": null,
|
"uid": null,
|
||||||
"version": 2,
|
"version": 2,
|
||||||
"weekStart": ""
|
"weekStart": ""
|
||||||
},
|
|
||||||
"message": "Default Codex Dashboard",
|
|
||||||
"overwrite": false
|
|
||||||
}
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
using DistTestCore.Metrics;
|
using DistTestCore.Metrics;
|
||||||
using KubernetesWorkflow;
|
using KubernetesWorkflow;
|
||||||
using Logging;
|
using Logging;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
|
@ -51,8 +52,9 @@ namespace DistTestCore
|
||||||
});
|
});
|
||||||
|
|
||||||
var response2 = http.HttpPostString("dashboards/db", GetDashboardJson());
|
var response2 = http.HttpPostString("dashboards/db", GetDashboardJson());
|
||||||
|
var jsonResponse = JsonConvert.DeserializeObject<GrafanaPostDashboardResponse>(response2);
|
||||||
|
|
||||||
var grafanaUrl = c.Host + ":" + c.Port;
|
var grafanaUrl = c.Host + ":" + c.Port + jsonResponse.url;
|
||||||
System.Diagnostics.Process.Start("C:\\Users\\Ben\\AppData\\Local\\Programs\\Opera\\opera.exe", grafanaUrl);
|
System.Diagnostics.Process.Start("C:\\Users\\Ben\\AppData\\Local\\Programs\\Opera\\opera.exe", grafanaUrl);
|
||||||
|
|
||||||
LogEnd("Metrics server started.");
|
LogEnd("Metrics server started.");
|
||||||
|
@ -76,6 +78,16 @@ namespace DistTestCore
|
||||||
public string httpMethod { get; set; } = string.Empty;
|
public string httpMethod { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class GrafanaPostDashboardResponse
|
||||||
|
{
|
||||||
|
public int id { get; set; }
|
||||||
|
public string slug { get; set; } = string.Empty;
|
||||||
|
public string status { get; set; } = string.Empty;
|
||||||
|
public string uid { get; set; } = string.Empty;
|
||||||
|
public string url { get; set; } = string.Empty;
|
||||||
|
public int version { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
private string GetDashboardJson()
|
private string GetDashboardJson()
|
||||||
{
|
{
|
||||||
var assembly = Assembly.GetExecutingAssembly();
|
var assembly = Assembly.GetExecutingAssembly();
|
||||||
|
@ -86,7 +98,9 @@ namespace DistTestCore
|
||||||
using (Stream stream = assembly.GetManifestResourceStream(resourceName))
|
using (Stream stream = assembly.GetManifestResourceStream(resourceName))
|
||||||
using (StreamReader reader = new StreamReader(stream))
|
using (StreamReader reader = new StreamReader(stream))
|
||||||
{
|
{
|
||||||
return reader.ReadToEnd();
|
var dashboard = reader.ReadToEnd();
|
||||||
|
|
||||||
|
return $"{{\"dashboard\": {dashboard} ,\"message\": \"Default Codex Dashboard\",\"overwrite\": false}}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue