mirror of https://github.com/statping/statping
notifications methods updated, notification testing, incident UI updates
parent
1a438a6198
commit
c92fe8a329
|
@ -1,9 +1,9 @@
|
||||||
# 0.90.62 (07-30-2020)
|
# 0.90.62 (07-30-2020)
|
||||||
- Added Notification logs
|
- Added Notification logs
|
||||||
- Fixed issues with notifications
|
- Fixed issues with Notifer After (x) failures for notifications
|
||||||
|
- Modified notifications to not send on initial startup
|
||||||
- Updated Incident UI
|
- Updated Incident UI
|
||||||
- Added additional testing for notifications
|
- Added additional testing for notifications
|
||||||
-
|
|
||||||
|
|
||||||
# 0.90.61 (07-22-2020)
|
# 0.90.61 (07-22-2020)
|
||||||
- Modified sass layouts, organized and split up sections
|
- Modified sass layouts, organized and split up sections
|
||||||
|
|
|
@ -21,13 +21,16 @@
|
||||||
},
|
},
|
||||||
admin: {
|
admin: {
|
||||||
required: true
|
required: true
|
||||||
|
},
|
||||||
|
onUpdate: {
|
||||||
|
required: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async delete_update(update) {
|
async delete_update(update) {
|
||||||
this.res = await Api.incident_update_delete(update)
|
this.res = await Api.incident_update_delete(update)
|
||||||
if (this.res.status === "success") {
|
if (this.res.status === "success") {
|
||||||
await this.loadUpdates()
|
this.onUpdate()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
<span class="font-2 float-right">{{niceDate(incident.created_at)}}</span>
|
<span class="font-2 float-right">{{niceDate(incident.created_at)}}</span>
|
||||||
</h6>
|
</h6>
|
||||||
<div class="font-2 mb-3" v-html="incident.description"></div>
|
<div class="font-2 mb-3" v-html="incident.description"></div>
|
||||||
|
|
||||||
<IncidentUpdate v-for="(update, i) in incident.updates" v-bind:key="i" :update="update" :admin="false"/>
|
<IncidentUpdate v-for="(update, i) in incident.updates" v-bind:key="i" :update="update" :admin="false"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -18,7 +17,9 @@ import IncidentUpdate from "@/components/Elements/IncidentUpdate";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'IncidentsBlock',
|
name: 'IncidentsBlock',
|
||||||
components: {IncidentUpdate},
|
components: {
|
||||||
|
IncidentUpdate
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
service: {
|
service: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
|
|
@ -5,9 +5,11 @@
|
||||||
No updates found, create a new Incident Update below.
|
No updates found, create a new Incident Update below.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-for="update in updates" :key="update.id">
|
<transition-group name="fade" tag="div">
|
||||||
<IncidentUpdate :update="update" :admin="true"/>
|
<div v-for="update in updates.reverse()" :key="update.id">
|
||||||
</div>
|
<IncidentUpdate :update="update" :onUpdate="loadUpdates" :admin="true"/>
|
||||||
|
</div>
|
||||||
|
</transition-group>
|
||||||
|
|
||||||
<form class="row" @submit.prevent="createIncidentUpdate">
|
<form class="row" @submit.prevent="createIncidentUpdate">
|
||||||
<div class="col-12 col-md-3 mb-3 mb-md-0">
|
<div class="col-12 col-md-3 mb-3 mb-md-0">
|
||||||
|
@ -19,7 +21,7 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-7 mb-3 mb-md-0">
|
<div class="col-12 col-md-7 mb-3 mb-md-0">
|
||||||
<input v-model="incident_update.message" rows="5" name="description" class="form-control" id="message" required>
|
<input v-model="incident_update.message" name="description" class="form-control" id="message" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12 col-md-2">
|
<div class="col-12 col-md-2">
|
||||||
|
@ -36,8 +38,6 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Api from "../API";
|
import Api from "../API";
|
||||||
import flatPickr from 'vue-flatpickr-component';
|
|
||||||
import 'flatpickr/dist/flatpickr.css';
|
|
||||||
import IncidentUpdate from "@/components/Elements/IncidentUpdate";
|
import IncidentUpdate from "@/components/Elements/IncidentUpdate";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
|
@ -112,6 +112,9 @@ func TestSetupRoutes(t *testing.T) {
|
||||||
if !core.App.Setup {
|
if !core.App.Setup {
|
||||||
return errors.New("core has not been setup")
|
return errors.New("core has not been setup")
|
||||||
}
|
}
|
||||||
|
if core.App.ApiSecret == "" {
|
||||||
|
return errors.New("API Key has not been set")
|
||||||
|
}
|
||||||
if len(services.AllInOrder()) == 0 {
|
if len(services.AllInOrder()) == 0 {
|
||||||
return errors.New("no services where found")
|
return errors.New("no services where found")
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ func (c *Core) AfterFind() {
|
||||||
|
|
||||||
func Select() (*Core, error) {
|
func Select() (*Core, error) {
|
||||||
var c Core
|
var c Core
|
||||||
// SelectCore will return the CoreApp global variable and the settings/configs for Statping
|
|
||||||
if err := db.DB().Ping(); err != nil {
|
if err := db.DB().Ping(); err != nil {
|
||||||
return nil, errors.New("database has not been initiated yet.")
|
return nil, errors.New("database has not been initiated yet.")
|
||||||
}
|
}
|
||||||
|
@ -47,6 +46,9 @@ func Select() (*Core, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Core) Create() error {
|
func (c *Core) Create() error {
|
||||||
|
if c.ApiSecret == "" {
|
||||||
|
c.ApiSecret = utils.RandomString(16)
|
||||||
|
}
|
||||||
q := db.Create(c)
|
q := db.Create(c)
|
||||||
utils.Log.Infof("API Key created: %s", c.ApiSecret)
|
utils.Log.Infof("API Key created: %s", c.ApiSecret)
|
||||||
return q.Error()
|
return q.Error()
|
||||||
|
|
|
@ -41,7 +41,7 @@ func Example(online bool) Service {
|
||||||
Checkpoint: time.Time{},
|
Checkpoint: time.Time{},
|
||||||
SleepDuration: 5 * time.Second,
|
SleepDuration: 5 * time.Second,
|
||||||
LastResponse: "The example service is hitting this page",
|
LastResponse: "The example service is hitting this page",
|
||||||
NotifyAfter: 2,
|
NotifyAfter: 0,
|
||||||
notifyAfterCount: 0,
|
notifyAfterCount: 0,
|
||||||
AllowNotifications: null.NewNullBool(true),
|
AllowNotifications: null.NewNullBool(true),
|
||||||
UpdateNotify: null.NewNullBool(true),
|
UpdateNotify: null.NewNullBool(true),
|
||||||
|
@ -54,7 +54,7 @@ func Example(online bool) Service {
|
||||||
LastCheck: utils.Now().Add(-37 * time.Second),
|
LastCheck: utils.Now().Add(-37 * time.Second),
|
||||||
LastOnline: utils.Now().Add(-37 * time.Second),
|
LastOnline: utils.Now().Add(-37 * time.Second),
|
||||||
LastOffline: utils.Now().Add(-75 * time.Second),
|
LastOffline: utils.Now().Add(-75 * time.Second),
|
||||||
prevOnline: true,
|
prevOnline: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ func TestServiceNotifications(t *testing.T) {
|
||||||
allNotifiers[notification.Method] = notification
|
allNotifiers[notification.Method] = notification
|
||||||
|
|
||||||
service := Example(true)
|
service := Example(true)
|
||||||
|
service.prevOnline = true // set online during startup
|
||||||
failure := failures.Example()
|
failure := failures.Example()
|
||||||
|
|
||||||
service.UpdateNotify = null.NewNullBool(true)
|
service.UpdateNotify = null.NewNullBool(true)
|
||||||
|
@ -70,6 +71,7 @@ func TestServiceNotifications(t *testing.T) {
|
||||||
allNotifiers[notification.Method] = notification
|
allNotifiers[notification.Method] = notification
|
||||||
|
|
||||||
service := Example(true)
|
service := Example(true)
|
||||||
|
service.prevOnline = true // set online during startup
|
||||||
failure := failures.Example()
|
failure := failures.Example()
|
||||||
notif := notification
|
notif := notification
|
||||||
|
|
||||||
|
@ -141,7 +143,7 @@ func TestServiceNotifications(t *testing.T) {
|
||||||
service := Example(false)
|
service := Example(false)
|
||||||
failure := failures.Example()
|
failure := failures.Example()
|
||||||
notif := notification
|
notif := notification
|
||||||
service.prevOnline = false
|
service.prevOnline = false // set offline
|
||||||
|
|
||||||
service.UpdateNotify = null.NewNullBool(false)
|
service.UpdateNotify = null.NewNullBool(false)
|
||||||
service.NotifyAfter = 2
|
service.NotifyAfter = 2
|
||||||
|
@ -208,6 +210,7 @@ func TestServiceNotifications(t *testing.T) {
|
||||||
t.Run("Strategy #4 - Disabled - [online, notifications are disabled", func(t *testing.T) {
|
t.Run("Strategy #4 - Disabled - [online, notifications are disabled", func(t *testing.T) {
|
||||||
allNotifiers[notification.Method] = notification
|
allNotifiers[notification.Method] = notification
|
||||||
service := Example(false)
|
service := Example(false)
|
||||||
|
service.prevOnline = true // set online during startup
|
||||||
service.AllowNotifications = null.NewNullBool(false)
|
service.AllowNotifications = null.NewNullBool(false)
|
||||||
failure := failures.Example()
|
failure := failures.Example()
|
||||||
notif := notification
|
notif := notification
|
||||||
|
|
Loading…
Reference in New Issue