mirror of https://github.com/statping/statping
fix for https://github.com/statping/statping/issues/842, additional columns for language CSV, modified cache routine to 60 seconds
parent
bdbaf8cbca
commit
4c6b9e6a35
|
@ -2,6 +2,8 @@
|
||||||
- Merged PR #806 - Enhance GRPC Monitoring
|
- Merged PR #806 - Enhance GRPC Monitoring
|
||||||
- Merged PR #692 - When login fields are autofilled the sign in button should be enabled
|
- Merged PR #692 - When login fields are autofilled the sign in button should be enabled
|
||||||
- Modified multiple Vue forms to use number models for integer inputs
|
- Modified multiple Vue forms to use number models for integer inputs
|
||||||
|
- Fixed page freeze issue for incidents https://github.com/statping/statping/issues/842
|
||||||
|
- Modified cache routine from 5 seconds to 60 seconds
|
||||||
|
|
||||||
# 0.90.69 (09-18-2020)
|
# 0.90.69 (09-18-2020)
|
||||||
- Fixed issue with service view not loading. #808 #811 #800
|
- Fixed issue with service view not loading. #808 #811 #800
|
||||||
|
|
|
@ -146,7 +146,7 @@
|
||||||
<span class="badge badge-info float-right text-uppercase mt-1">{{notifier.logs.length}}</span>
|
<span class="badge badge-info float-right text-uppercase mt-1">{{notifier.logs.length}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body" :class="{'d-none': !expanded_logs}">
|
<div class="card-body" :class="{'d-none': !expanded_logs}">
|
||||||
<div v-for="(log, i) in notifier.logs.reverse()" class="alert" :class="{'alert-danger': log.error, 'alert-dark': !log.success && !log.error, 'alert-success': log.success && !log.error}">
|
<div v-for="(log, i) in notifier.logs" class="alert" :class="{'alert-danger': log.error, 'alert-dark': !log.success && !log.error, 'alert-success': log.success && !log.error}">
|
||||||
<span class="d-block">
|
<span class="d-block">
|
||||||
Service {{log.service}}
|
Service {{log.service}}
|
||||||
{{log.success ? "Success Triggered" : "Failure Triggered"}}
|
{{log.success ? "Success Triggered" : "Failure Triggered"}}
|
||||||
|
@ -187,49 +187,47 @@ import '../codemirror_json'
|
||||||
const beautify = require('js-beautify').js
|
const beautify = require('js-beautify').js
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Notifier',
|
name: 'Notifier',
|
||||||
components: {
|
components: {
|
||||||
codemirror
|
codemirror
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
notifier: {
|
notifier: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: false,
|
||||||
|
loadingTest: false,
|
||||||
|
error: null,
|
||||||
|
response: null,
|
||||||
|
request: null,
|
||||||
|
success: false,
|
||||||
|
saved: false,
|
||||||
|
expanded: false,
|
||||||
|
expanded_logs: false,
|
||||||
|
success_data: null,
|
||||||
|
failure_data: null,
|
||||||
|
form: {},
|
||||||
|
cmOptions: {
|
||||||
|
height: 700,
|
||||||
|
tabSize: 2,
|
||||||
|
lineNumbers: true,
|
||||||
|
line: true,
|
||||||
|
class: "json-field",
|
||||||
|
theme: 'neat',
|
||||||
|
mode: "mymode",
|
||||||
|
lineWrapping: true,
|
||||||
|
json: this.notifier.data_type === "json",
|
||||||
|
autoRefresh: true,
|
||||||
|
mime: this.notifier.data_type === "json" ? "application/json" : "text/plain"
|
||||||
|
},
|
||||||
|
beautifySettings: {indent_size: 2, space_in_empty_paren: true},
|
||||||
|
}
|
||||||
},
|
},
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
loading: false,
|
|
||||||
loadingTest: false,
|
|
||||||
error: null,
|
|
||||||
response: null,
|
|
||||||
request: null,
|
|
||||||
success: false,
|
|
||||||
saved: false,
|
|
||||||
expanded: false,
|
|
||||||
expanded_logs: false,
|
|
||||||
success_data: null,
|
|
||||||
failure_data: null,
|
|
||||||
form: {},
|
|
||||||
cmOptions: {
|
|
||||||
height: 700,
|
|
||||||
tabSize: 2,
|
|
||||||
lineNumbers: true,
|
|
||||||
line: true,
|
|
||||||
class: "json-field",
|
|
||||||
theme: 'neat',
|
|
||||||
mode: "mymode",
|
|
||||||
lineWrapping: true,
|
|
||||||
json: this.notifier.data_type === "json",
|
|
||||||
autoRefresh: true,
|
|
||||||
mime: this.notifier.data_type === "json" ? "application/json" : "text/plain"
|
|
||||||
},
|
|
||||||
beautifySettings: { indent_size: 2, space_in_empty_paren: true },
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
core() {
|
core() {
|
||||||
return this.$store.getters.core
|
return this.$store.getters.core
|
||||||
|
@ -239,92 +237,92 @@ export default {
|
||||||
return "https://chart.googleapis.com/chart?chs=500x500&cht=qr&chl=" + encodeURIComponent(u)
|
return "https://chart.googleapis.com/chart?chs=500x500&cht=qr&chl=" + encodeURIComponent(u)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
formVisible(want, form) {
|
formVisible(want, form) {
|
||||||
return !!want.includes(form.type);
|
return !!want.includes(form.type);
|
||||||
},
|
},
|
||||||
visible(isVisible, entry) {
|
visible(isVisible, entry) {
|
||||||
if (isVisible) {
|
if (isVisible) {
|
||||||
this.$refs.cmfailure.codemirror.refresh()
|
this.$refs.cmfailure.codemirror.refresh()
|
||||||
this.$refs.cmsuccess.codemirror.refresh()
|
this.$refs.cmsuccess.codemirror.refresh()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onCmSuccessReady(cm) {
|
onCmSuccessReady(cm) {
|
||||||
this.success_data = this.notifier.success_data
|
this.success_data = this.notifier.success_data
|
||||||
if (this.notifier.data_type === "json") {
|
if (this.notifier.data_type === "json") {
|
||||||
this.success_data = beautify(this.notifier.success_data, this.beautifySettings)
|
this.success_data = beautify(this.notifier.success_data, this.beautifySettings)
|
||||||
}
|
}
|
||||||
setTimeout(function() {
|
setTimeout(function () {
|
||||||
cm.refresh();
|
cm.refresh();
|
||||||
},1);
|
}, 1);
|
||||||
},
|
},
|
||||||
onCmFailureReady(cm) {
|
onCmFailureReady(cm) {
|
||||||
this.failure_data = this.notifier.failure_data
|
this.failure_data = this.notifier.failure_data
|
||||||
if (this.notifier.data_type === "json") {
|
if (this.notifier.data_type === "json") {
|
||||||
this.failure_data = beautify(this.notifier.failure_data, this.beautifySettings)
|
this.failure_data = beautify(this.notifier.failure_data, this.beautifySettings)
|
||||||
}
|
}
|
||||||
setTimeout(function() {
|
setTimeout(function () {
|
||||||
cm.refresh();
|
cm.refresh();
|
||||||
},1);
|
}, 1);
|
||||||
},
|
},
|
||||||
async enableToggle() {
|
async enableToggle() {
|
||||||
this.notifier.enabled = !!this.notifier.enabled
|
this.notifier.enabled = !!this.notifier.enabled
|
||||||
const form = {
|
const form = {
|
||||||
enabled: !this.notifier.enabled,
|
enabled: !this.notifier.enabled,
|
||||||
method: this.notifier.method,
|
method: this.notifier.method,
|
||||||
}
|
}
|
||||||
await Api.notifier_save(form)
|
await Api.notifier_save(form)
|
||||||
},
|
},
|
||||||
async saveNotifier() {
|
async saveNotifier() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
this.form.enabled = this.notifier.enabled
|
this.form.enabled = this.notifier.enabled
|
||||||
this.form.limits = parseInt(this.notifier.limits)
|
this.form.limits = parseInt(this.notifier.limits)
|
||||||
this.form.method = this.notifier.method
|
this.form.method = this.notifier.method
|
||||||
if (this.notifier.form) {
|
if (this.notifier.form) {
|
||||||
this.notifier.form.forEach((f) => {
|
this.notifier.form.forEach((f) => {
|
||||||
let field = f.field.toLowerCase()
|
let field = f.field.toLowerCase()
|
||||||
let val = this.notifier[field]
|
let val = this.notifier[field]
|
||||||
if (this.isNumeric(val)) {
|
if (this.isNumeric(val)) {
|
||||||
val = parseInt(val)
|
val = parseInt(val)
|
||||||
}
|
|
||||||
this.form[field] = val
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.form.success_data = this.success_data
|
|
||||||
this.form.failure_data = this.failure_data
|
|
||||||
await Api.notifier_save(this.form)
|
|
||||||
const notifiers = await Api.notifiers()
|
|
||||||
await this.$store.commit('setNotifiers', notifiers)
|
|
||||||
this.saved = true
|
|
||||||
this.loading = false
|
|
||||||
},
|
|
||||||
async testNotifier(method="success") {
|
|
||||||
this.success = false
|
|
||||||
this.loadingTest = true
|
|
||||||
this.form.method = this.notifier.method
|
|
||||||
if (this.notifier.form) {
|
|
||||||
this.notifier.form.forEach((f) => {
|
|
||||||
let field = f.field.toLowerCase()
|
|
||||||
let val = this.notifier[field]
|
|
||||||
if (this.isNumeric(val)) {
|
|
||||||
val = parseInt(val)
|
|
||||||
}
|
|
||||||
this.form[field] = val
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
let req = {
|
this.form[field] = val
|
||||||
notifier: this.form,
|
});
|
||||||
method: method,
|
}
|
||||||
}
|
this.form.success_data = this.success_data
|
||||||
const tested = await Api.notifier_test(req, this.notifier.method)
|
this.form.failure_data = this.failure_data
|
||||||
if (tested.success) {
|
await Api.notifier_save(this.form)
|
||||||
this.success = true
|
const notifiers = await Api.notifiers()
|
||||||
} else {
|
await this.$store.commit('setNotifiers', notifiers)
|
||||||
this.error = tested.error
|
this.saved = true
|
||||||
}
|
this.loading = false
|
||||||
this.response = tested.response
|
},
|
||||||
this.loadingTest = false
|
async testNotifier(method = "success") {
|
||||||
},
|
this.success = false
|
||||||
}
|
this.loadingTest = true
|
||||||
|
this.form.method = this.notifier.method
|
||||||
|
if (this.notifier.form) {
|
||||||
|
this.notifier.form.forEach((f) => {
|
||||||
|
let field = f.field.toLowerCase()
|
||||||
|
let val = this.notifier[field]
|
||||||
|
if (this.isNumeric(val)) {
|
||||||
|
val = parseInt(val)
|
||||||
|
}
|
||||||
|
this.form[field] = val
|
||||||
|
});
|
||||||
|
}
|
||||||
|
let req = {
|
||||||
|
notifier: this.form,
|
||||||
|
method: method,
|
||||||
|
}
|
||||||
|
const tested = await Api.notifier_test(req, this.notifier.method)
|
||||||
|
if (tested.success) {
|
||||||
|
this.success = true
|
||||||
|
} else {
|
||||||
|
this.error = tested.error
|
||||||
|
}
|
||||||
|
this.response = tested.response
|
||||||
|
this.loadingTest = false
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -27,7 +27,7 @@ type Item struct {
|
||||||
|
|
||||||
// cleanRoutine is a go routine to automatically remove expired caches that haven't been hit recently
|
// cleanRoutine is a go routine to automatically remove expired caches that haven't been hit recently
|
||||||
func cleanRoutine(s *Storage) {
|
func cleanRoutine(s *Storage) {
|
||||||
duration := 5 * time.Second
|
duration := 60 * time.Second
|
||||||
|
|
||||||
CacheRoutine:
|
CacheRoutine:
|
||||||
for {
|
for {
|
||||||
|
@ -40,7 +40,7 @@ CacheRoutine:
|
||||||
s.Delete(k)
|
s.Delete(k)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
duration = 5 * time.Second
|
duration = 60 * time.Second
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,6 +89,8 @@ func (s Storage) List() map[string]Item {
|
||||||
|
|
||||||
//Get a cached content by key
|
//Get a cached content by key
|
||||||
func (s Storage) Get(key string) []byte {
|
func (s Storage) Get(key string) []byte {
|
||||||
|
s.mu.Lock()
|
||||||
|
defer s.mu.Unlock()
|
||||||
item := s.items[key]
|
item := s.items[key]
|
||||||
if item.Expired() {
|
if item.Expired() {
|
||||||
CacheStorage.Delete(key)
|
CacheStorage.Delete(key)
|
||||||
|
|
Loading…
Reference in New Issue