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)
|
||||
- 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
|
||||
- Added additional testing for notifications
|
||||
-
|
||||
|
||||
# 0.90.61 (07-22-2020)
|
||||
- Modified sass layouts, organized and split up sections
|
||||
|
|
|
@ -21,13 +21,16 @@
|
|||
},
|
||||
admin: {
|
||||
required: true
|
||||
},
|
||||
onUpdate: {
|
||||
required: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async delete_update(update) {
|
||||
this.res = await Api.incident_update_delete(update)
|
||||
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>
|
||||
</h6>
|
||||
<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"/>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -18,7 +17,9 @@ import IncidentUpdate from "@/components/Elements/IncidentUpdate";
|
|||
|
||||
export default {
|
||||
name: 'IncidentsBlock',
|
||||
components: {IncidentUpdate},
|
||||
components: {
|
||||
IncidentUpdate
|
||||
},
|
||||
props: {
|
||||
service: {
|
||||
type: Object,
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
No updates found, create a new Incident Update below.
|
||||
</div>
|
||||
|
||||
<div v-for="update in updates" :key="update.id">
|
||||
<IncidentUpdate :update="update" :admin="true"/>
|
||||
</div>
|
||||
<transition-group name="fade" tag="div">
|
||||
<div v-for="update in updates.reverse()" :key="update.id">
|
||||
<IncidentUpdate :update="update" :onUpdate="loadUpdates" :admin="true"/>
|
||||
</div>
|
||||
</transition-group>
|
||||
|
||||
<form class="row" @submit.prevent="createIncidentUpdate">
|
||||
<div class="col-12 col-md-3 mb-3 mb-md-0">
|
||||
|
@ -19,7 +21,7 @@
|
|||
</select>
|
||||
</div>
|
||||
<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 class="col-12 col-md-2">
|
||||
|
@ -36,8 +38,6 @@
|
|||
|
||||
<script>
|
||||
import Api from "../API";
|
||||
import flatPickr from 'vue-flatpickr-component';
|
||||
import 'flatpickr/dist/flatpickr.css';
|
||||
import IncidentUpdate from "@/components/Elements/IncidentUpdate";
|
||||
|
||||
export default {
|
||||
|
|
|
@ -112,6 +112,9 @@ func TestSetupRoutes(t *testing.T) {
|
|||
if !core.App.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 {
|
||||
return errors.New("no services where found")
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ func (c *Core) AfterFind() {
|
|||
|
||||
func Select() (*Core, error) {
|
||||
var c Core
|
||||
// SelectCore will return the CoreApp global variable and the settings/configs for Statping
|
||||
if err := db.DB().Ping(); err != nil {
|
||||
return nil, errors.New("database has not been initiated yet.")
|
||||
}
|
||||
|
@ -47,6 +46,9 @@ func Select() (*Core, error) {
|
|||
}
|
||||
|
||||
func (c *Core) Create() error {
|
||||
if c.ApiSecret == "" {
|
||||
c.ApiSecret = utils.RandomString(16)
|
||||
}
|
||||
q := db.Create(c)
|
||||
utils.Log.Infof("API Key created: %s", c.ApiSecret)
|
||||
return q.Error()
|
||||
|
|
|
@ -41,7 +41,7 @@ func Example(online bool) Service {
|
|||
Checkpoint: time.Time{},
|
||||
SleepDuration: 5 * time.Second,
|
||||
LastResponse: "The example service is hitting this page",
|
||||
NotifyAfter: 2,
|
||||
NotifyAfter: 0,
|
||||
notifyAfterCount: 0,
|
||||
AllowNotifications: null.NewNullBool(true),
|
||||
UpdateNotify: null.NewNullBool(true),
|
||||
|
@ -54,7 +54,7 @@ func Example(online bool) Service {
|
|||
LastCheck: utils.Now().Add(-37 * time.Second),
|
||||
LastOnline: utils.Now().Add(-37 * 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
|
||||
|
||||
service := Example(true)
|
||||
service.prevOnline = true // set online during startup
|
||||
failure := failures.Example()
|
||||
|
||||
service.UpdateNotify = null.NewNullBool(true)
|
||||
|
@ -70,6 +71,7 @@ func TestServiceNotifications(t *testing.T) {
|
|||
allNotifiers[notification.Method] = notification
|
||||
|
||||
service := Example(true)
|
||||
service.prevOnline = true // set online during startup
|
||||
failure := failures.Example()
|
||||
notif := notification
|
||||
|
||||
|
@ -141,7 +143,7 @@ func TestServiceNotifications(t *testing.T) {
|
|||
service := Example(false)
|
||||
failure := failures.Example()
|
||||
notif := notification
|
||||
service.prevOnline = false
|
||||
service.prevOnline = false // set offline
|
||||
|
||||
service.UpdateNotify = null.NewNullBool(false)
|
||||
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) {
|
||||
allNotifiers[notification.Method] = notification
|
||||
service := Example(false)
|
||||
service.prevOnline = true // set online during startup
|
||||
service.AllowNotifications = null.NewNullBool(false)
|
||||
failure := failures.Example()
|
||||
notif := notification
|
||||
|
|
Loading…
Reference in New Issue