mirror of https://github.com/statping/statping
apexcharts - heatmap
parent
30b6a2df6b
commit
7aac686c84
|
@ -261,7 +261,7 @@ func (db *DbConfig) Connect(retry bool, location string) error {
|
|||
if postgresSSL {
|
||||
sslMode = "enabled"
|
||||
}
|
||||
conn = fmt.Sprintf("host=%v port=%v user=%v dbname=%v password=%v timezone=UTC sslmode=%t", Configs.DbHost, Configs.DbPort, Configs.DbUser, Configs.DbData, Configs.DbPass, sslMode)
|
||||
conn = fmt.Sprintf("host=%v port=%v user=%v dbname=%v password=%v timezone=UTC sslmode=%v", Configs.DbHost, Configs.DbPort, Configs.DbUser, Configs.DbData, Configs.DbPass, sslMode)
|
||||
case "mssql":
|
||||
host := fmt.Sprintf("%v:%v", Configs.DbHost, Configs.DbPort)
|
||||
conn = fmt.Sprintf("sqlserver://%v:%v@%v?database=%v", Configs.DbUser, Configs.DbPass, host, Configs.DbData)
|
||||
|
|
|
@ -73,12 +73,11 @@ func TestSetupRoutes(t *testing.T) {
|
|||
|
||||
for _, v := range tests {
|
||||
t.Run(v.Name, func(t *testing.T) {
|
||||
body, t, err := RunHTTPTest(v, t)
|
||||
_, t, err := RunHTTPTest(v, t)
|
||||
assert.Nil(t, err)
|
||||
if err != nil {
|
||||
t.FailNow()
|
||||
}
|
||||
t.Logf("Test %v got: %v\n", v.Name, string(body))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -95,12 +94,12 @@ func TestMainApiRoutes(t *testing.T) {
|
|||
|
||||
for _, v := range tests {
|
||||
t.Run(v.Name, func(t *testing.T) {
|
||||
body, t, err := RunHTTPTest(v, t)
|
||||
_, t, err := RunHTTPTest(v, t)
|
||||
assert.Nil(t, err)
|
||||
if err != nil {
|
||||
t.FailNow()
|
||||
}
|
||||
t.Logf("Test %v got: %v\n", v.Name, string(body))
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -195,12 +194,12 @@ func TestApiServiceRoutes(t *testing.T) {
|
|||
|
||||
for _, v := range tests {
|
||||
t.Run(v.Name, func(t *testing.T) {
|
||||
body, t, err := RunHTTPTest(v, t)
|
||||
_, t, err := RunHTTPTest(v, t)
|
||||
assert.Nil(t, err)
|
||||
if err != nil {
|
||||
t.FailNow()
|
||||
}
|
||||
t.Logf("Test %v got: %v\n", v.Name, string(body))
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -239,12 +238,12 @@ func TestGroupAPIRoutes(t *testing.T) {
|
|||
|
||||
for _, v := range tests {
|
||||
t.Run(v.Name, func(t *testing.T) {
|
||||
body, t, err := RunHTTPTest(v, t)
|
||||
_, t, err := RunHTTPTest(v, t)
|
||||
assert.Nil(t, err)
|
||||
if err != nil {
|
||||
t.FailNow()
|
||||
}
|
||||
t.Logf("Test %v got: %v\n", v.Name, string(body))
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -293,12 +292,12 @@ func TestApiUsersRoutes(t *testing.T) {
|
|||
|
||||
for _, v := range tests {
|
||||
t.Run(v.Name, func(t *testing.T) {
|
||||
body, t, err := RunHTTPTest(v, t)
|
||||
_, t, err := RunHTTPTest(v, t)
|
||||
assert.Nil(t, err)
|
||||
if err != nil {
|
||||
t.FailNow()
|
||||
}
|
||||
t.Logf("Test %v got: %v\n", v.Name, string(body))
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -330,12 +329,12 @@ func TestApiNotifiersRoutes(t *testing.T) {
|
|||
|
||||
for _, v := range tests {
|
||||
t.Run(v.Name, func(t *testing.T) {
|
||||
body, t, err := RunHTTPTest(v, t)
|
||||
_, t, err := RunHTTPTest(v, t)
|
||||
assert.Nil(t, err)
|
||||
if err != nil {
|
||||
t.FailNow()
|
||||
}
|
||||
t.Logf("Test %v got: %v\n", v.Name, string(body))
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -400,12 +399,12 @@ func TestMessagesApiRoutes(t *testing.T) {
|
|||
|
||||
for _, v := range tests {
|
||||
t.Run(v.Name, func(t *testing.T) {
|
||||
body, t, err := RunHTTPTest(v, t)
|
||||
_, t, err := RunHTTPTest(v, t)
|
||||
assert.Nil(t, err)
|
||||
if err != nil {
|
||||
t.FailNow()
|
||||
}
|
||||
t.Logf("Test %v got: %v\n", v.Name, string(body))
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -439,12 +438,12 @@ func TestApiCheckinRoutes(t *testing.T) {
|
|||
|
||||
for _, v := range tests {
|
||||
t.Run(v.Name, func(t *testing.T) {
|
||||
body, t, err := RunHTTPTest(v, t)
|
||||
_, t, err := RunHTTPTest(v, t)
|
||||
assert.Nil(t, err)
|
||||
if err != nil {
|
||||
t.FailNow()
|
||||
}
|
||||
t.Logf("Test %v got: %v\n", v.Name, string(body))
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
webhookTestUrl = "https://demo.statping.com"
|
||||
webhookTestUrl = "https://statping.com"
|
||||
webhookMessage = `{"id": "%service.Id","name": "%service.Name","online": "%service.Online","issue": "%failure.Issue"}`
|
||||
apiKey = "application/json"
|
||||
fullMsg string
|
||||
|
|
|
@ -26,6 +26,25 @@ const axisOptions = {
|
|||
}
|
||||
};
|
||||
|
||||
const annotationColor = {
|
||||
strokeDashArray: 0,
|
||||
borderColor: "#d0222d",
|
||||
label: {
|
||||
show: false,
|
||||
}
|
||||
};
|
||||
|
||||
let annotation = {
|
||||
annotations: {
|
||||
xaxis: [
|
||||
{
|
||||
// in a datetime series, the x value should be a timestamp, just like it is generated below
|
||||
x: new Date("01/29/2019").getTime(),
|
||||
...annotationColor
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
let options = {
|
||||
chart: {
|
||||
height: 210,
|
||||
|
@ -126,7 +145,8 @@ let options = {
|
|||
},
|
||||
yaxis: {
|
||||
...axisOptions
|
||||
}
|
||||
},
|
||||
...annotation
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -132,6 +132,29 @@ function AjaxChart(chart, service, start=0, end=9999999999, group="hour", retry=
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
function FailureAnnotations(chart, service, start=0, end=9999999999, group="hour", retry=true) {
|
||||
const annotationColor = {
|
||||
strokeDashArray: 0,
|
||||
borderColor: "#d0222d",
|
||||
label: {
|
||||
show: false,
|
||||
}
|
||||
};
|
||||
var dataArr = [];
|
||||
$.ajax({
|
||||
url: "/api/services/"+service+"/failures?start="+start+"&end="+end+"&group="+group,
|
||||
type: 'GET',
|
||||
success: function(data) {
|
||||
data.forEach(function (d) {
|
||||
dataArr.push({x: d.created_at, ...annotationColor})
|
||||
});
|
||||
chart.addXaxisAnnotation(dataArr);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('input[type=checkbox]').on('change', function() {
|
||||
var element = $(this).attr('id');
|
||||
$("#"+element+"-value").val(this.checked ? "true" : "false")
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Code generated by go generate; DO NOT EDIT.
|
||||
// This file was generated by robots at
|
||||
// 2019-01-29 04:01:15.747029 -0800 PST m=+0.799396747
|
||||
// 2019-01-29 04:39:16.168164 -0800 PST m=+0.838449535
|
||||
//
|
||||
// This contains the most recently Markdown source for the Statping Wiki.
|
||||
package source
|
||||
|
|
Loading…
Reference in New Issue