mirror of https://github.com/statping/statping
grouping
parent
bcedc75c8e
commit
0b7687aa85
|
@ -11,6 +11,10 @@ type Group struct {
|
||||||
|
|
||||||
// Delete will remove a group
|
// Delete will remove a group
|
||||||
func (g *Group) Delete() error {
|
func (g *Group) Delete() error {
|
||||||
|
for _, s := range g.Services() {
|
||||||
|
s.GroupId = 0
|
||||||
|
s.Update(false)
|
||||||
|
}
|
||||||
err := messagesDb().Delete(g)
|
err := messagesDb().Delete(g)
|
||||||
if err.Error != nil {
|
if err.Error != nil {
|
||||||
return err.Error
|
return err.Error
|
||||||
|
@ -18,12 +22,6 @@ func (g *Group) Delete() error {
|
||||||
return err.Error
|
return err.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update will update a group in the database
|
|
||||||
func (g *Group) Update() error {
|
|
||||||
err := servicesDB().Update(&g)
|
|
||||||
return err.Error
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create will create a group and insert it into the database
|
// Create will create a group and insert it into the database
|
||||||
func (g *Group) Create() (int64, error) {
|
func (g *Group) Create() (int64, error) {
|
||||||
g.CreatedAt = time.Now()
|
g.CreatedAt = time.Now()
|
||||||
|
@ -31,6 +29,17 @@ func (g *Group) Create() (int64, error) {
|
||||||
return g.Id, db.Error
|
return g.Id, db.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Services returns all services belonging to a group
|
||||||
|
func (g *Group) Services() []*Service {
|
||||||
|
var services []*Service
|
||||||
|
for _, s := range Services() {
|
||||||
|
if s.Select().GroupId == int(g.Id) {
|
||||||
|
services = append(services, s.(*Service))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return services
|
||||||
|
}
|
||||||
|
|
||||||
// SelectGroups returns all groups
|
// SelectGroups returns all groups
|
||||||
func SelectGroups() []*Group {
|
func SelectGroups() []*Group {
|
||||||
var groups []*Group
|
var groups []*Group
|
||||||
|
|
|
@ -26,6 +26,9 @@ import (
|
||||||
// InsertSampleData will create the example/dummy services for a brand new Statping installation
|
// InsertSampleData will create the example/dummy services for a brand new Statping installation
|
||||||
func InsertSampleData() error {
|
func InsertSampleData() error {
|
||||||
utils.Log(1, "Inserting Sample Data...")
|
utils.Log(1, "Inserting Sample Data...")
|
||||||
|
|
||||||
|
insertSampleGroups()
|
||||||
|
|
||||||
s1 := ReturnService(&types.Service{
|
s1 := ReturnService(&types.Service{
|
||||||
Name: "Google",
|
Name: "Google",
|
||||||
Domain: "https://google.com",
|
Domain: "https://google.com",
|
||||||
|
@ -35,6 +38,7 @@ func InsertSampleData() error {
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
Timeout: 10,
|
Timeout: 10,
|
||||||
Order: 1,
|
Order: 1,
|
||||||
|
GroupId: 1,
|
||||||
})
|
})
|
||||||
s2 := ReturnService(&types.Service{
|
s2 := ReturnService(&types.Service{
|
||||||
Name: "Statping Github",
|
Name: "Statping Github",
|
||||||
|
@ -55,6 +59,8 @@ func InsertSampleData() error {
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
Timeout: 30,
|
Timeout: 30,
|
||||||
Order: 3,
|
Order: 3,
|
||||||
|
Public: types.NewNullBool(true),
|
||||||
|
GroupId: 2,
|
||||||
})
|
})
|
||||||
s4 := ReturnService(&types.Service{
|
s4 := ReturnService(&types.Service{
|
||||||
Name: "JSON API Tester",
|
Name: "JSON API Tester",
|
||||||
|
@ -67,6 +73,8 @@ func InsertSampleData() error {
|
||||||
PostData: types.NewNullString(`{ "title": "statup", "body": "bar", "userId": 19999 }`),
|
PostData: types.NewNullString(`{ "title": "statup", "body": "bar", "userId": 19999 }`),
|
||||||
Timeout: 30,
|
Timeout: 30,
|
||||||
Order: 4,
|
Order: 4,
|
||||||
|
Public: types.NewNullBool(true),
|
||||||
|
GroupId: 2,
|
||||||
})
|
})
|
||||||
s5 := ReturnService(&types.Service{
|
s5 := ReturnService(&types.Service{
|
||||||
Name: "Google DNS",
|
Name: "Google DNS",
|
||||||
|
@ -76,6 +84,8 @@ func InsertSampleData() error {
|
||||||
Port: 53,
|
Port: 53,
|
||||||
Timeout: 120,
|
Timeout: 120,
|
||||||
Order: 5,
|
Order: 5,
|
||||||
|
Public: types.NewNullBool(true),
|
||||||
|
GroupId: 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
s1.Create(false)
|
s1.Create(false)
|
||||||
|
@ -86,8 +96,6 @@ func InsertSampleData() error {
|
||||||
|
|
||||||
insertMessages()
|
insertMessages()
|
||||||
|
|
||||||
insertSampleGroups()
|
|
||||||
|
|
||||||
utils.Log(1, "Sample data has finished importing")
|
utils.Log(1, "Sample data has finished importing")
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -189,6 +189,7 @@ func TestCreateService(t *testing.T) {
|
||||||
Type: "http",
|
Type: "http",
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
Timeout: 20,
|
Timeout: 20,
|
||||||
|
GroupId: 1,
|
||||||
})
|
})
|
||||||
var err error
|
var err error
|
||||||
newServiceId, err = s.Create(false)
|
newServiceId, err = s.Create(false)
|
||||||
|
@ -212,6 +213,7 @@ func TestCreateFailingHTTPService(t *testing.T) {
|
||||||
Type: "http",
|
Type: "http",
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
Timeout: 5,
|
Timeout: 5,
|
||||||
|
GroupId: 1,
|
||||||
})
|
})
|
||||||
var err error
|
var err error
|
||||||
newServiceId, err = s.Create(false)
|
newServiceId, err = s.Create(false)
|
||||||
|
@ -238,6 +240,7 @@ func TestCreateFailingTCPService(t *testing.T) {
|
||||||
Interval: 30,
|
Interval: 30,
|
||||||
Type: "tcp",
|
Type: "tcp",
|
||||||
Timeout: 5,
|
Timeout: 5,
|
||||||
|
GroupId: 1,
|
||||||
})
|
})
|
||||||
var err error
|
var err error
|
||||||
newServiceId, err = s.Create(false)
|
newServiceId, err = s.Create(false)
|
||||||
|
|
|
@ -69,27 +69,6 @@ func apiCreateGroupHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
sendJsonAction(group, "create", w, r)
|
sendJsonAction(group, "create", w, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
func apiGroupUpdateHandler(w http.ResponseWriter, r *http.Request) {
|
|
||||||
if !IsFullAuthenticated(r) {
|
|
||||||
sendUnauthorizedJson(w, r)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
vars := mux.Vars(r)
|
|
||||||
group := core.SelectGroup(utils.ToInt(vars["id"]))
|
|
||||||
if group == nil {
|
|
||||||
sendErrorJson(errors.New("group not found"), w, r)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
decoder := json.NewDecoder(r.Body)
|
|
||||||
decoder.Decode(&group)
|
|
||||||
err := group.Update()
|
|
||||||
if err != nil {
|
|
||||||
sendErrorJson(err, w, r)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
sendJsonAction(group, "update", w, r)
|
|
||||||
}
|
|
||||||
|
|
||||||
func apiGroupDeleteHandler(w http.ResponseWriter, r *http.Request) {
|
func apiGroupDeleteHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if !IsFullAuthenticated(r) {
|
if !IsFullAuthenticated(r) {
|
||||||
sendUnauthorizedJson(w, r)
|
sendUnauthorizedJson(w, r)
|
||||||
|
|
|
@ -195,8 +195,9 @@ var handlerFuncs = func(w http.ResponseWriter, r *http.Request) template.FuncMap
|
||||||
"Groups": func() []*core.Group {
|
"Groups": func() []*core.Group {
|
||||||
return core.SelectGroups()
|
return core.SelectGroups()
|
||||||
},
|
},
|
||||||
"len": func(g []types.ServiceInterface) int {
|
"len": func(g interface{}) int {
|
||||||
return len(g)
|
val := reflect.ValueOf(g)
|
||||||
|
return val.Len()
|
||||||
},
|
},
|
||||||
"IsNil": func(g interface{}) bool {
|
"IsNil": func(g interface{}) bool {
|
||||||
return g == nil
|
return g == nil
|
||||||
|
|
|
@ -89,7 +89,6 @@ func Router() *mux.Router {
|
||||||
r.Handle("/api/groups", http.HandlerFunc(apiAllGroupHandler)).Methods("GET")
|
r.Handle("/api/groups", http.HandlerFunc(apiAllGroupHandler)).Methods("GET")
|
||||||
r.Handle("/api/groups", http.HandlerFunc(apiCreateGroupHandler)).Methods("POST")
|
r.Handle("/api/groups", http.HandlerFunc(apiCreateGroupHandler)).Methods("POST")
|
||||||
r.Handle("/api/groups/{id}", http.HandlerFunc(apiGroupHandler)).Methods("GET")
|
r.Handle("/api/groups/{id}", http.HandlerFunc(apiGroupHandler)).Methods("GET")
|
||||||
r.Handle("/api/groups/{id}", http.HandlerFunc(apiGroupUpdateHandler)).Methods("POST")
|
|
||||||
r.Handle("/api/groups/{id}", http.HandlerFunc(apiGroupDeleteHandler)).Methods("DELETE")
|
r.Handle("/api/groups/{id}", http.HandlerFunc(apiGroupDeleteHandler)).Methods("DELETE")
|
||||||
|
|
||||||
// API Routes
|
// API Routes
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{{define "form_service"}}
|
{{define "form_service"}}
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
{{$s := .}}
|
||||||
{{if ne .Id 0}}
|
{{if ne .Id 0}}
|
||||||
<form class="ajax_form" action="/api/services/{{.Id}}" data-redirect="/services" method="POST">
|
<form class="ajax_form" action="/api/services/{{.Id}}" data-redirect="/services" method="POST">
|
||||||
{{else}}
|
{{else}}
|
||||||
|
@ -104,10 +105,10 @@
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="service_type" class="col-sm-4 col-form-label">Group</label>
|
<label for="service_type" class="col-sm-4 col-form-label">Group</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<select name="group_id" class="form-control" id="group_id" value="{{.GroupId}}">
|
<select name="group_id" class="form-control" id="group_id">
|
||||||
<option value="0" {{if eq .GroupId 0}}selected{{end}}>None</option>
|
<option value="0" {{if eq $s.GroupId 0}}selected{{end}}>None</option>
|
||||||
{{range Groups}}
|
{{range Groups}}
|
||||||
<option value="{{.Id}}">{{.Name}}</option>
|
<option value="{{.Id}}" {{if eq $s.GroupId .Id}}selected{{end}}>{{.Name}}</option>
|
||||||
{{end}}
|
{{end}}
|
||||||
</select>
|
</select>
|
||||||
<small class="form-text text-muted">Attach this service to a group</small>
|
<small class="form-text text-muted">Attach this service to a group</small>
|
||||||
|
|
|
@ -8,21 +8,39 @@
|
||||||
<h5 class="col-12 text-center mb-5 header-desc">{{ .Description }}</h5>
|
<h5 class="col-12 text-center mb-5 header-desc">{{ .Description }}</h5>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<div class="col-12 full-col-12">
|
{{if ne (len Groups) 0}}
|
||||||
|
{{ range Groups }}
|
||||||
<div class="list-group online_list mb-3">
|
<div class="col-12 full-col-12">
|
||||||
{{ range Services }}
|
<h4>{{.Name}}</h4>
|
||||||
<a href="#" class="service_li list-group-item list-group-item-action {{if not .Online}}bg-danger text-white{{ end }}" data-id="{{.Id}}">
|
<div class="list-group online_list mb-3">
|
||||||
{{ .Name }}
|
{{ range .Services }}
|
||||||
{{if .Online}}
|
<a href="#" class="service_li list-group-item list-group-item-action {{if not .Online}}bg-danger text-white{{ end }}" data-id="{{.Id}}">
|
||||||
<span class="badge bg-success float-right pulse-glow">ONLINE</span>
|
{{ .Name }}
|
||||||
{{ else }}
|
{{if .Online}}
|
||||||
<span class="badge bg-white text-black-50 float-right pulse">OFFLINE</span>
|
<span class="badge bg-success float-right pulse-glow">ONLINE</span>
|
||||||
|
{{ else }}
|
||||||
|
<span class="badge bg-white text-black-50 float-right pulse">OFFLINE</span>
|
||||||
|
{{end}}
|
||||||
|
</a>
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</a>
|
{{else}}
|
||||||
{{ end }}
|
<div class="list-group online_list mb-3">
|
||||||
</div>
|
{{ range Services }}
|
||||||
</div>
|
<a href="#" class="service_li list-group-item list-group-item-action {{if not .Online}}bg-danger text-white{{ end }}" data-id="{{.Id}}">
|
||||||
|
{{ .Name }}
|
||||||
|
{{if .Online}}
|
||||||
|
<span class="badge bg-success float-right pulse-glow">ONLINE</span>
|
||||||
|
{{ else }}
|
||||||
|
<span class="badge bg-white text-black-50 float-right pulse">OFFLINE</span>
|
||||||
|
{{end}}
|
||||||
|
</a>
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
|
||||||
{{ if .Messages }}
|
{{ if .Messages }}
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
|
|
|
@ -816,7 +816,7 @@
|
||||||
"groups"
|
"groups"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"description": "View an array of all Services added to your Statping instance."
|
"description": "View an array of all Groups added to your Statping instance."
|
||||||
},
|
},
|
||||||
"response": []
|
"response": []
|
||||||
},
|
},
|
||||||
|
@ -872,58 +872,9 @@
|
||||||
"1"
|
"1"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"description": "View a specific service, this will include the service's failures and checkins."
|
"description": "View a specific group"
|
||||||
},
|
},
|
||||||
"response": [
|
"response": []
|
||||||
{
|
|
||||||
"name": "View Service",
|
|
||||||
"originalRequest": {
|
|
||||||
"method": "GET",
|
|
||||||
"header": [
|
|
||||||
{
|
|
||||||
"key": "Content-Type",
|
|
||||||
"name": "Content-Type",
|
|
||||||
"value": "application/json",
|
|
||||||
"type": "text"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"body": {
|
|
||||||
"mode": "raw",
|
|
||||||
"raw": ""
|
|
||||||
},
|
|
||||||
"url": {
|
|
||||||
"raw": "{{endpoint}}/api/services/1",
|
|
||||||
"host": [
|
|
||||||
"{{endpoint}}"
|
|
||||||
],
|
|
||||||
"path": [
|
|
||||||
"api",
|
|
||||||
"services",
|
|
||||||
"1"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"status": "OK",
|
|
||||||
"code": 200,
|
|
||||||
"_postman_previewlanguage": "json",
|
|
||||||
"header": [
|
|
||||||
{
|
|
||||||
"key": "Content-Type",
|
|
||||||
"value": "application/json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "Date",
|
|
||||||
"value": "Mon, 10 Dec 2018 19:31:19 GMT"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "Content-Length",
|
|
||||||
"value": "482"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"cookie": [],
|
|
||||||
"body": "{\n \"id\": 1,\n \"name\": \"Google\",\n \"domain\": \"https://google.com\",\n \"expected\": null,\n \"expected_status\": 200,\n \"check_interval\": 10,\n \"type\": \"http\",\n \"method\": \"GET\",\n \"post_data\": null,\n \"port\": 0,\n \"timeout\": 10,\n \"order_id\": 1,\n \"allow_notifications\": false,\n \"created_at\": \"2018-12-10T11:15:42.24769-08:00\",\n \"updated_at\": \"2018-12-10T11:15:42.247837-08:00\",\n \"online\": true,\n \"latency\": 0.190599816,\n \"ping_time\": 0.00476598,\n \"online_24_hours\": 0,\n \"avg_response\": \"\",\n \"status_code\": 200,\n \"last_success\": \"2018-12-10T11:31:13.511139-08:00\"\n}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Create Group",
|
"name": "Create Group",
|
||||||
|
@ -975,156 +926,9 @@
|
||||||
"groups"
|
"groups"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"description": "Create a new service and begin monitoring."
|
"description": "Create a new Group to organize services."
|
||||||
},
|
},
|
||||||
"response": [
|
"response": []
|
||||||
{
|
|
||||||
"name": "Create Service",
|
|
||||||
"originalRequest": {
|
|
||||||
"method": "POST",
|
|
||||||
"header": [
|
|
||||||
{
|
|
||||||
"key": "Content-Type",
|
|
||||||
"value": "application/json"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"body": {
|
|
||||||
"mode": "raw",
|
|
||||||
"raw": "{\n \"name\": \"New Service\",\n \"domain\": \"https://statping.com\",\n \"expected\": \"\",\n \"expected_status\": 200,\n \"check_interval\": 30,\n \"type\": \"http\",\n \"method\": \"GET\",\n \"post_data\": \"\",\n \"port\": 0,\n \"timeout\": 30,\n \"order_id\": 0\n}"
|
|
||||||
},
|
|
||||||
"url": {
|
|
||||||
"raw": "{{endpoint}}/api/services",
|
|
||||||
"host": [
|
|
||||||
"{{endpoint}}"
|
|
||||||
],
|
|
||||||
"path": [
|
|
||||||
"api",
|
|
||||||
"services"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"status": "OK",
|
|
||||||
"code": 200,
|
|
||||||
"_postman_previewlanguage": "json",
|
|
||||||
"header": [
|
|
||||||
{
|
|
||||||
"key": "Content-Type",
|
|
||||||
"value": "application/json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "Date",
|
|
||||||
"value": "Mon, 10 Dec 2018 19:31:47 GMT"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "Content-Length",
|
|
||||||
"value": "528"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"cookie": [],
|
|
||||||
"body": "{\n \"status\": \"success\",\n \"type\": \"service\",\n \"method\": \"create\",\n \"id\": 10,\n \"output\": {\n \"id\": 10,\n \"name\": \"New Service\",\n \"domain\": \"https://statping.com\",\n \"expected\": \"\",\n \"expected_status\": 200,\n \"check_interval\": 30,\n \"type\": \"http\",\n \"method\": \"GET\",\n \"post_data\": \"\",\n \"port\": 0,\n \"timeout\": 30,\n \"order_id\": 0,\n \"allow_notifications\": false,\n \"created_at\": \"2018-12-10T11:31:47.535086-08:00\",\n \"updated_at\": \"2018-12-10T11:31:47.535184-08:00\",\n \"online\": false,\n \"latency\": 0,\n \"ping_time\": 0,\n \"online_24_hours\": 0,\n \"avg_response\": \"\",\n \"status_code\": 0,\n \"last_success\": \"0001-01-01T00:00:00Z\"\n }\n}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Update Group",
|
|
||||||
"event": [
|
|
||||||
{
|
|
||||||
"listen": "test",
|
|
||||||
"script": {
|
|
||||||
"id": "b5a67a19-fd08-40b0-a961-3e9474ab78c6",
|
|
||||||
"exec": [
|
|
||||||
"pm.test(\"Update Service\", function () {",
|
|
||||||
" var jsonData = pm.response.json();",
|
|
||||||
" pm.expect(jsonData.output.name).to.eql(\"Updated Group\");",
|
|
||||||
"});"
|
|
||||||
],
|
|
||||||
"type": "text/javascript"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"request": {
|
|
||||||
"auth": {
|
|
||||||
"type": "bearer",
|
|
||||||
"bearer": [
|
|
||||||
{
|
|
||||||
"key": "token",
|
|
||||||
"value": "{{api_key}}",
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"method": "POST",
|
|
||||||
"header": [
|
|
||||||
{
|
|
||||||
"key": "Content-Type",
|
|
||||||
"value": "application/json"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"body": {
|
|
||||||
"mode": "raw",
|
|
||||||
"raw": "{\n \"name\": \"Updated Group\"\n}"
|
|
||||||
},
|
|
||||||
"url": {
|
|
||||||
"raw": "{{endpoint}}/api/groups/{{group_id}}",
|
|
||||||
"host": [
|
|
||||||
"{{endpoint}}"
|
|
||||||
],
|
|
||||||
"path": [
|
|
||||||
"api",
|
|
||||||
"groups",
|
|
||||||
"{{group_id}}"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"description": "Update a service with new values and begin monitoring."
|
|
||||||
},
|
|
||||||
"response": [
|
|
||||||
{
|
|
||||||
"name": "Update Service",
|
|
||||||
"originalRequest": {
|
|
||||||
"method": "POST",
|
|
||||||
"header": [
|
|
||||||
{
|
|
||||||
"key": "Content-Type",
|
|
||||||
"value": "application/json"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"body": {
|
|
||||||
"mode": "raw",
|
|
||||||
"raw": "{\n \"name\": \"Updated New Service\",\n \"domain\": \"https://google.com\",\n \"expected\": \"\",\n \"expected_status\": 200,\n \"check_interval\": 60,\n \"type\": \"http\",\n \"method\": \"GET\",\n \"post_data\": \"\",\n \"port\": 0,\n \"timeout\": 10,\n \"order_id\": 0\n}"
|
|
||||||
},
|
|
||||||
"url": {
|
|
||||||
"raw": "{{endpoint}}/api/services/{{service_id}}",
|
|
||||||
"host": [
|
|
||||||
"{{endpoint}}"
|
|
||||||
],
|
|
||||||
"path": [
|
|
||||||
"api",
|
|
||||||
"services",
|
|
||||||
"{{service_id}}"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"status": "OK",
|
|
||||||
"code": 200,
|
|
||||||
"_postman_previewlanguage": "json",
|
|
||||||
"header": [
|
|
||||||
{
|
|
||||||
"key": "Content-Type",
|
|
||||||
"value": "application/json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "Date",
|
|
||||||
"value": "Mon, 10 Dec 2018 19:31:54 GMT"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "Content-Length",
|
|
||||||
"value": "567"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"cookie": [],
|
|
||||||
"body": "{\n \"status\": \"success\",\n \"type\": \"service\",\n \"method\": \"update\",\n \"id\": 10,\n \"output\": {\n \"id\": 10,\n \"name\": \"Updated New Service\",\n \"domain\": \"https://google.com\",\n \"expected\": \"\",\n \"expected_status\": 200,\n \"check_interval\": 60,\n \"type\": \"http\",\n \"method\": \"GET\",\n \"post_data\": \"\",\n \"port\": 0,\n \"timeout\": 10,\n \"order_id\": 0,\n \"allow_notifications\": false,\n \"created_at\": \"2018-12-10T11:31:47.535086-08:00\",\n \"updated_at\": \"2018-12-10T11:31:47.535184-08:00\",\n \"online\": true,\n \"latency\": 0.550636193,\n \"ping_time\": 0.073339805,\n \"online_24_hours\": 0,\n \"avg_response\": \"\",\n \"status_code\": 200,\n \"last_success\": \"2018-12-10T11:31:49.161389-08:00\"\n }\n}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Delete Group",
|
"name": "Delete Group",
|
||||||
|
@ -1175,49 +979,7 @@
|
||||||
},
|
},
|
||||||
"description": "Delete a group"
|
"description": "Delete a group"
|
||||||
},
|
},
|
||||||
"response": [
|
"response": []
|
||||||
{
|
|
||||||
"name": "Delete Service",
|
|
||||||
"originalRequest": {
|
|
||||||
"method": "DELETE",
|
|
||||||
"header": [],
|
|
||||||
"body": {
|
|
||||||
"mode": "raw",
|
|
||||||
"raw": ""
|
|
||||||
},
|
|
||||||
"url": {
|
|
||||||
"raw": "{{endpoint}}/api/services/{{service_id}}",
|
|
||||||
"host": [
|
|
||||||
"{{endpoint}}"
|
|
||||||
],
|
|
||||||
"path": [
|
|
||||||
"api",
|
|
||||||
"services",
|
|
||||||
"{{service_id}}"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"status": "OK",
|
|
||||||
"code": 200,
|
|
||||||
"_postman_previewlanguage": "json",
|
|
||||||
"header": [
|
|
||||||
{
|
|
||||||
"key": "Content-Type",
|
|
||||||
"value": "application/json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "Date",
|
|
||||||
"value": "Mon, 10 Dec 2018 19:32:06 GMT"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "Content-Length",
|
|
||||||
"value": "567"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"cookie": [],
|
|
||||||
"body": "{\n \"status\": \"success\",\n \"type\": \"service\",\n \"method\": \"delete\",\n \"id\": 10,\n \"output\": {\n \"id\": 10,\n \"name\": \"Updated New Service\",\n \"domain\": \"https://google.com\",\n \"expected\": \"\",\n \"expected_status\": 200,\n \"check_interval\": 60,\n \"type\": \"http\",\n \"method\": \"GET\",\n \"post_data\": \"\",\n \"port\": 0,\n \"timeout\": 10,\n \"order_id\": 0,\n \"allow_notifications\": false,\n \"created_at\": \"2018-12-10T11:31:47.535086-08:00\",\n \"updated_at\": \"2018-12-10T11:31:47.535184-08:00\",\n \"online\": true,\n \"latency\": 0.203382878,\n \"ping_time\": 0.001664491,\n \"online_24_hours\": 0,\n \"avg_response\": \"\",\n \"status_code\": 200,\n \"last_success\": \"2018-12-10T11:31:55.455091-08:00\"\n }\n}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"auth": {
|
"auth": {
|
||||||
|
|
|
@ -42,13 +42,15 @@
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Name</th>
|
<th scope="col">Name</th>
|
||||||
|
<th scope="col">Services</th>
|
||||||
<th scope="col"></th>
|
<th scope="col"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="sortable" id="groups_table">
|
<tbody id="groups_table">
|
||||||
{{range .Groups}}
|
{{range .Groups}}
|
||||||
<tr id="group_{{.Id}}" data-id="{{.Id}}">
|
<tr id="group_{{.Id}}" data-id="{{.Id}}">
|
||||||
<td>{{.Name}}</td>
|
<td>{{.Name}}</td>
|
||||||
|
<td>{{len .Services}}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
{{if Auth}}<a href="/api/groups/{{.Id}}" class="ajax_delete btn btn-danger" data-method="DELETE" data-obj="group_{{.Id}}" data-id="{{.Id}}"><i class="fas fa-times"></i></a>{{end}}
|
{{if Auth}}<a href="/api/groups/{{.Id}}" class="ajax_delete btn btn-danger" data-method="DELETE" data-obj="group_{{.Id}}" data-id="{{.Id}}"><i class="fas fa-times"></i></a>{{end}}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Code generated by go generate; DO NOT EDIT.
|
// Code generated by go generate; DO NOT EDIT.
|
||||||
// This file was generated by robots at
|
// This file was generated by robots at
|
||||||
// 2019-01-03 07:34:25.019934 -0800 PST m=+0.528929648
|
// 2019-01-03 11:12:03.7014 -0800 PST m=+0.913709962
|
||||||
//
|
//
|
||||||
// This contains the most recently Markdown source for the Statping Wiki.
|
// This contains the most recently Markdown source for the Statping Wiki.
|
||||||
package source
|
package source
|
||||||
|
|
Loading…
Reference in New Issue