mirror of https://github.com/statping/statping
commit
6b378039aa
|
@ -1,3 +1,7 @@
|
|||
# 0.90.54 (06-17-2020)
|
||||
- Fixed Slack Notifier's failure/success data saving issue
|
||||
- Added additional i18n Languages (help needed!)
|
||||
|
||||
# 0.90.53 (06-16-2020)
|
||||
- Modified most of the key's for prometheus metrics
|
||||
- Added Database Stats in prometheus metrics
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
<template>
|
||||
<div>
|
||||
<table class="table">
|
||||
<div class="card text-black-50 bg-white mb-5">
|
||||
<div class="card-header">Cache</div>
|
||||
<div class="card-body">
|
||||
<span v-if="!cache" class="text-muted">There are no cached pages yet!</span>
|
||||
<table v-if="cache" class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">URL</th>
|
||||
|
@ -18,7 +21,8 @@
|
|||
|
||||
</tbody>
|
||||
</table>
|
||||
<button @click.prevent="clearCache" class="btn btn-danger btn-block">Clear Cache</button>
|
||||
<button v-if="cache" @click.prevent="clearCache" class="btn btn-danger btn-block">Clear Cache</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<template>
|
||||
<div class="col-12">
|
||||
<div class="card contain-card text-black-50 bg-white mb-4">
|
||||
<div class="card-header">Announcements</div>
|
||||
<div class="card-header">{{ $t('top_nav.announcements') }}</div>
|
||||
<div class="card-body pt-0">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Title</th>
|
||||
<th scope="col" class="d-none d-md-table-cell">Service</th>
|
||||
<th scope="col" class="d-none d-md-table-cell">Begins</th>
|
||||
<th scope="col">{{ $t('dashboard.title') }}</th>
|
||||
<th scope="col" class="d-none d-md-table-cell">{{ $tc('dashboard.service', 1) }}</th>
|
||||
<th scope="col" class="d-none d-md-table-cell">{{ $t('dashboard.begins') }}</th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -21,8 +21,12 @@
|
|||
<td class="d-none d-md-table-cell">{{niceDate(message.start_on)}}</td>
|
||||
<td class="text-right">
|
||||
<div v-if="$store.state.admin" class="btn-group">
|
||||
<a @click.prevent="editMessage(message, edit)" href="#" class="btn btn-outline-secondary"><i class="fas fa-exclamation-triangle"></i> Edit</a>
|
||||
<a @click.prevent="deleteMessage(message)" href="#" class="btn btn-danger"><font-awesome-icon icon="times" /></a>
|
||||
<button @click.prevent="editMessage(message, edit)" href="#" class="btn btn-sm btn-outline-secondary">
|
||||
<font-awesome-icon icon="edit" />
|
||||
</button>
|
||||
<button @click.prevent="deleteMessage(message)" href="#" class="btn btn-sm btn-danger">
|
||||
<font-awesome-icon icon="times" />
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -48,6 +52,9 @@
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
goto(to) {
|
||||
this.$router.push(to)
|
||||
},
|
||||
editChange(v) {
|
||||
this.message = {}
|
||||
this.edit = v
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div class="col-12">
|
||||
<div class="card contain-card text-black-50 bg-white mb-4">
|
||||
<div class="card-header">Services
|
||||
<div class="card-header">{{ $t('top_nav.services') }}
|
||||
<router-link v-if="$store.state.admin" to="/dashboard/create_service" class="btn btn-sm btn-outline-success float-right">
|
||||
<font-awesome-icon icon="plus"/> Create
|
||||
</router-link>
|
||||
|
@ -12,14 +12,14 @@
|
|||
</div>
|
||||
|
||||
<div class="card contain-card text-black-50 bg-white mb-4">
|
||||
<div class="card-header">Groups</div>
|
||||
<div class="card-header">{{ $t('top_nav.groups') }}</div>
|
||||
<div class="card-body pt-0">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col">Services</th>
|
||||
<th scope="col">Visibility</th>
|
||||
<th scope="col">{{ $t('dashboard.name') }}</th>
|
||||
<th scope="col">{{ $tc('dashboard.service', 2) }}</th>
|
||||
<th scope="col">{{ $t('dashboard.visibility') }}</th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -31,8 +31,9 @@
|
|||
</td>
|
||||
<td>{{$store.getters.servicesInGroup(group.id).length}}</td>
|
||||
<td>
|
||||
<span v-if="group.public" class="badge badge-primary text-uppercase">{{ $t('public') }}</span>
|
||||
<span v-if="!group.public" class="badge badge-secondary text-uppercase">{{ $t('private') }}</span>
|
||||
<span class="badge text-uppercase" :class="{'badge-primary': group.public, 'badge-secondary': !group.public}">
|
||||
{{group.public ? $t('public') : $t('private')}}
|
||||
</span>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div v-if="$store.state.admin" class="btn-group">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div class="col-12">
|
||||
<div class="card contain-card text-black-50 bg-white mb-4">
|
||||
<div class="card-header">Users</div>
|
||||
<div class="card-header">{{ $t('top_nav.users') }}</div>
|
||||
<div class="card-body pt-0">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
</span> {{service.name}}
|
||||
</td>
|
||||
<td class="d-none d-md-table-cell">
|
||||
<span class="badge" :class="{'badge-primary': service.public, 'badge-secondary': !service.public}">
|
||||
<span class="badge text-uppercase" :class="{'badge-primary': service.public, 'badge-secondary': !service.public}">
|
||||
{{service.public ? $t('public') : $t('private')}}
|
||||
</span>
|
||||
</td>
|
||||
|
@ -27,15 +27,16 @@
|
|||
</td>
|
||||
<td class="text-right">
|
||||
<div class="btn-group">
|
||||
<router-link v-if="$store.state.admin" :to="{path: `/dashboard/edit_service/${service.id}`, params: {service: service} }" class="btn btn-outline-secondary">
|
||||
<i class="fas fa-chart-area"></i> Edit
|
||||
</router-link>
|
||||
<router-link :to="{path: serviceLink(service), params: {service: service} }" class="btn btn-outline-secondary">
|
||||
<i class="fas fa-chart-area"></i> View
|
||||
</router-link>
|
||||
<a v-if="$store.state.admin" @click.prevent="deleteService(service)" href="#" class="btn btn-danger">
|
||||
<font-awesome-icon icon="times" />
|
||||
</a>
|
||||
<button v-if="$store.state.admin" @click.prevent="goto({path: `/dashboard/edit_service/${service.id}`, params: {service: service} })" class="btn btn-sm btn-outline-secondary">
|
||||
<font-awesome-icon icon="edit" />
|
||||
</button>
|
||||
<button @click.prevent="goto({path: serviceLink(service), params: {service: service} })" class="btn btn-sm btn-outline-secondary">
|
||||
<font-awesome-icon icon="chart-area" />
|
||||
</button>
|
||||
<button v-if="$store.state.admin" @click.prevent="deleteService(service)" href="#" class="btn btn-sm btn-danger">
|
||||
<font-awesome-icon v-if="!loading" icon="times" />
|
||||
<font-awesome-icon v-if="loading" icon="circle-notch" spin/>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -54,6 +55,11 @@ export default {
|
|||
ToggleSwitch,
|
||||
draggable
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
servicesList: {
|
||||
get () {
|
||||
|
@ -65,6 +71,9 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
goto(to) {
|
||||
this.$router.push(to)
|
||||
},
|
||||
async updateOrder(value) {
|
||||
let data = [];
|
||||
value.forEach((s, k) => {
|
||||
|
@ -76,8 +85,10 @@ export default {
|
|||
async deleteService(s) {
|
||||
let c = confirm(`Are you sure you want to delete '${s.name}'?`)
|
||||
if (c) {
|
||||
this.loading = true
|
||||
await Api.service_delete(s.id)
|
||||
await this.update()
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
serviceGroup(s) {
|
||||
|
|
|
@ -1,13 +1,22 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="card text-black-50 bg-white mb-5">
|
||||
<div class="card-header">Theme Editor</div>
|
||||
<div class="card-body">
|
||||
<div v-if="error" class="alert alert-danger mt-3" style="white-space: pre-line;">
|
||||
{{error}}
|
||||
</div>
|
||||
|
||||
<div v-if="loaded && !directory" class="jumbotron jumbotron-fluid">
|
||||
<div class="text-center col-12">
|
||||
<h1 class="display-5">Enable Local Assets</h1>
|
||||
<span class="lead">Customize your status page design by enabling local assets. This will create a 'assets' directory containing all CSS.<p>
|
||||
<button id="enable_assets" @click.prevent="createAssets" :disabled="pending" href="#" class="btn btn-primary mt-3">Enable Local Assets</button>
|
||||
<button id="enable_assets" @click.prevent="createAssets" :disabled="pending" href="#" class="btn btn-primary mt-3">
|
||||
<font-awesome-icon v-if="pending" icon="circle-notch" class="mr-2" spin/>{{pending ? "Creating Assets" : "Enable Local Assets"}}
|
||||
</button>
|
||||
</p></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form v-observe-visibility="visible" v-if="loaded && directory" @submit.prevent="saveAssets" :disabled="pending">
|
||||
<h3>Variables</h3>
|
||||
<codemirror v-show="loaded" v-model="vars" ref="vars" :options="cmOptions" class="codemirrorInput"/>
|
||||
|
@ -18,8 +27,6 @@
|
|||
<h3 class="mt-3">Mobile Overwrites</h3>
|
||||
<codemirror v-show="loaded" v-model="mobile" ref="mobile" :options="cmOptions" class="codemirrorInput"/>
|
||||
|
||||
<div v-if="error" class="alert alert-danger mt-3" style="white-space: pre-line;">{{error}}</div>
|
||||
|
||||
<button id="save_assets" @submit.prevent="saveAssets" type="submit" class="btn btn-primary btn-block mt-2" :disabled="pending">{{pending ? "Saving..." : "Save Style"}}</button>
|
||||
<button id="delete_assets" v-if="directory" @click.prevent="deleteAssets" href="#" class="btn btn-danger btn-block confirm-btn" :disabled="pending">Delete Local Assets</button>
|
||||
|
||||
|
@ -28,6 +35,7 @@
|
|||
</h6>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -115,7 +123,12 @@
|
|||
async saveAssets() {
|
||||
this.pending = true
|
||||
const data = {base: this.base, variables: this.vars, mobile: this.mobile}
|
||||
const resp = await Api.theme_save(data)
|
||||
let resp
|
||||
try {
|
||||
resp = await Api.theme_save(data)
|
||||
} catch(e) {
|
||||
resp = {status: 'error', error: e.response.data.error}
|
||||
}
|
||||
if (resp.error) {
|
||||
this.error = resp.error
|
||||
this.pending = false
|
||||
|
|
|
@ -0,0 +1,138 @@
|
|||
<template>
|
||||
<div>
|
||||
<h2>Notifier Variables</h2>
|
||||
You can insert dynamic fields within the notifier payloads for some notifiers.
|
||||
|
||||
<p class="mt-2">
|
||||
Checkout the <a href="https://github.com/statping/statping/blob/master/types/services/struct.go">Service struct</a> and the <a href="https://github.com/statping/statping/blob/master/types/failures/struct.go">Failures struct</a> and create variables in golang template format.
|
||||
</p>
|
||||
|
||||
<p class="mt-2">
|
||||
For example, if you have <b>{{"\{\{.Service.Name\}\}"}}</b> it will return the service name.
|
||||
</p>
|
||||
|
||||
<h2 class="mt-3">Service Variables</h2>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Variable</th>
|
||||
<th scope="col">True Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Service.Id\}\}"}}</kbd></td>
|
||||
<td>1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Service.Name\}\}"}}</kbd></td>
|
||||
<td>Example Service</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Service.Domain\}\}"}}</kbd></td>
|
||||
<td>https://statping.com</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Service.Port\}\}"}}</kbd></td>
|
||||
<td>8080</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Service.DowntimeAgo\}\}"}}</kbd></td>
|
||||
<td>35 minutes ago</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Service.LastStatusCode\}\}"}}</kbd></td>
|
||||
<td>404</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Service.FailuresLast24Hours\}\}"}}</kbd></td>
|
||||
<td>38</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<small>Additional variables within the Service struct</small>
|
||||
</table>
|
||||
|
||||
<h2 class="mt-3">Failure Variables</h2>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Variable</th>
|
||||
<th scope="col">True Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Failure.Issue\}\}"}}</kbd></td>
|
||||
<td>Received 404 status code</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Failure.ErrorCode\}\}"}}</kbd></td>
|
||||
<td>404</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Failure.Service\}\}"}}</kbd></td>
|
||||
<td>1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Failure.PingTime\}\}"}}</kbd></td>
|
||||
<td>12482 (microseconds)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Failure.DowntimeAgo\}\}"}}</kbd></td>
|
||||
<td>35 minutes ago</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Failure.CreatedAt\}\}"}}</kbd></td>
|
||||
<td>2020-05-02 09:14:43.66381 +0000 UTC</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<small>Additional variables within the Failures struct</small>
|
||||
</table>
|
||||
|
||||
<h2 class="mt-3">Core Variables</h2>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Variable</th>
|
||||
<th scope="col">True Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Core.Domain\}\}"}}</kbd></td>
|
||||
<td>http://localhost:8080</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Core.Name\}\}"}}</kbd></td>
|
||||
<td>Statping Demo</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Core.Description\}\}"}}</kbd></td>
|
||||
<td>Statping will monitor your stuff!</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Core.Version\}\}"}}</kbd></td>
|
||||
<td>v0.90.34</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Core.Started\}\}"}}</kbd></td>
|
||||
<td>2020-05-02 09:14:43.66381 +0000 UTC</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<small>Additional variables within the Core struct</small>
|
||||
</table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'Variables',
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped>
|
||||
</style>
|
|
@ -2,9 +2,9 @@
|
|||
<footer>
|
||||
<div v-if="!core.footer" class="footer text-center mb-4 p-2">
|
||||
<a href="https://github.com/statping/statping" target="_blank">
|
||||
Statping {{core.version}} made with <font-awesome-icon icon="heart"/>
|
||||
Statping {{core.version}} made with <font-awesome-icon icon="heart" class="text-danger"/>
|
||||
</a> |
|
||||
<router-link :to="$store.state.admin ? '/dashboard' : '/login'">Dashboard</router-link>
|
||||
<router-link :to="$store.state.admin ? '/dashboard' : '/login'">{{$t('top_nav.dashboard')}}</router-link>
|
||||
</div>
|
||||
<div v-else class="footer text-center mb-4 p-2" v-html="core.footer"></div>
|
||||
</footer>
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
|
||||
<a v-for="(service, index) in $store.getters.servicesInGroup(group.id)" v-bind:key="index" class="service_li list-group-item list-group-item-action">
|
||||
<router-link class="no-decoration font-3" :to="serviceLink(service)">{{service.name}}</router-link>
|
||||
<span class="badge float-right" :class="{'bg-success': service.online, 'bg-danger': !service.online }">{{service.online ? "ONLINE" : "OFFLINE"}}</span>
|
||||
<span class="badge text-uppercase float-right" :class="{'bg-success': service.online, 'bg-danger': !service.online }">
|
||||
{{service.online ? $t('online') : $t('offline')}}
|
||||
</span>
|
||||
|
||||
<GroupServiceFailures :service="service"/>
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
|
||||
<div class="col-md-2 col-6 float-right">
|
||||
<button v-if="!expanded" @click="setService" class="btn btn-sm float-right dyn-dark text-white" :class="{'bg-success': service.online, 'bg-danger': !service.online}">
|
||||
View Service
|
||||
{{$t('service.view')}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
<div class="card-title px-4 pt-3">
|
||||
<h4 v-observe-visibility="setVisible">
|
||||
<router-link :to="serviceLink(service)">{{service.name}}</router-link>
|
||||
<span class="badge float-right" :class="{'badge-success': service.online, 'badge-danger': !service.online}">
|
||||
{{service.online ? "ONLINE" : "OFFLINE"}}
|
||||
</span>
|
||||
<span class="badge float-right text-uppercase" :class="{'badge-success': service.online, 'badge-danger': !service.online}">
|
||||
{{service.online ? $t('online') : $t('offline')}}
|
||||
</span>
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
|||
<div v-if="false" class="row mb-4 align-content-center">
|
||||
|
||||
<div v-if="!service.online" class="col-3 text-left">
|
||||
<span class="text-danger font-5 font-weight-bold">okko</span>
|
||||
<span class="text-danger font-5 font-weight-bold"></span>
|
||||
<span class="font-2 d-block">Current Downtime</span>
|
||||
</div>
|
||||
|
||||
|
@ -68,22 +68,24 @@
|
|||
<div class="row">
|
||||
|
||||
<div class="col-12 col-md-3 mb-2 mb-md-0">
|
||||
<router-link :to="{path: `/dashboard/service/${service.id}/incidents`, params: {id: service.id} }" class="btn btn-block btn-white incident">
|
||||
Incidents
|
||||
<router-link :to="{path: `/dashboard/service/${service.id}/incidents`, params: {id: service.id} }" class="btn btn-block btn-white text-capitalize incident">
|
||||
{{$tc('incident', 2)}}
|
||||
</router-link>
|
||||
</div>
|
||||
<div class="col-12 col-md-3 mb-2 mb-md-0">
|
||||
<router-link :to="{path: `/dashboard/service/${service.id}/checkins`, params: {id: service.id} }" class="btn btn-block btn-white checkins">
|
||||
Checkins
|
||||
<router-link :to="{path: `/dashboard/service/${service.id}/checkins`, params: {id: service.id} }" class="btn btn-block btn-white text-capitalize checkins">
|
||||
{{$tc('checkin', 2)}}
|
||||
</router-link>
|
||||
</div>
|
||||
<div class="col-12 col-md-3 mb-2 mb-md-0">
|
||||
<router-link :to="{path: `/dashboard/service/${service.id}/failures`, params: {id: service.id} }" class="btn btn-block btn-white failures">
|
||||
Failures <span class="badge badge-danger float-right mt-1">{{service.stats.failures}}</span>
|
||||
<router-link :to="{path: `/dashboard/service/${service.id}/failures`, params: {id: service.id} }" class="btn btn-block btn-white text-capitalize failures">
|
||||
{{$tc('failure', 2)}} <span class="badge badge-danger float-right mt-1">{{service.stats.failures}}</span>
|
||||
</router-link>
|
||||
</div>
|
||||
<div class="col-12 col-md-3 mb-2 mb-md-0 mt-0 mt-md-1">
|
||||
<span class="text-black-50 float-md-right">{{service.online_7_days}} % Uptime</span>
|
||||
<span class="text-black-50 float-md-right">
|
||||
{{$t('uptime', [service.online_7_days])}}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
<div class="row stats_area mt-5 mb-4">
|
||||
<div class="col-4">
|
||||
<span class="font-5 d-block font-weight-bold">{{humanTime(service.avg_response)}}</span>
|
||||
<span class="font-1 subtitle">Average Response</span>
|
||||
<span class="font-1 subtitle">{{$t('service.average')}}</span>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<span class="font-5 d-block font-weight-bold">{{service.online_24_hours}} %</span>
|
||||
<span class="font-1 subtitle">Uptime last 24 Hours</span>
|
||||
<span class="font-1 subtitle">{{$t('service.last_uptime', [24, $tc('hour', 24)])}}</span>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<span class="font-5 d-block font-weight-bold">{{service.online_7_days}} %</span>
|
||||
<span class="font-1 subtitle">Uptime last 7 Days</span>
|
||||
<span class="font-1 subtitle">{{$t('service.last_uptime', [7, $tc('day', 7)])}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
<div class="form-group">
|
||||
<label>{{ $t('setup.language') }}</label>
|
||||
<select v-model="core.language" v-bind:value="core.language" class="form-control">
|
||||
<select v-model="core.language" class="form-control">
|
||||
<option value="en">English</option>
|
||||
<option value="es">Spanish</option>
|
||||
<option value="fr">French</option>
|
||||
|
@ -84,7 +84,7 @@
|
|||
await Api.core_save(c)
|
||||
const core = await Api.core()
|
||||
this.$store.commit('setCore', core)
|
||||
setInterval(() => { this.loading = false }, 1500)
|
||||
this.loading = false
|
||||
},
|
||||
selectAll() {
|
||||
this.$refs.input.select();
|
||||
|
|
|
@ -2,19 +2,21 @@
|
|||
<div class="card contain-card text-black-50 bg-white mb-3">
|
||||
<div class="card-header">{{group.id ? `Update ${group.name}` : "Create Group"}}
|
||||
<transition name="slide-fade">
|
||||
<button @click="removeEdit" v-if="group.id" class="btn float-right btn-danger btn-sm">Close</button>
|
||||
<button @click="removeEdit" v-if="group.id" class="btn float-right btn-danger btn-sm">
|
||||
{{ $t('close') }}
|
||||
</button>
|
||||
</transition></div>
|
||||
<div class="card-body">
|
||||
|
||||
<form @submit.prevent="saveGroup">
|
||||
<div class="form-group row">
|
||||
<label for="title" class="col-sm-4 col-form-label">Group Name</label>
|
||||
<label for="title" class="col-sm-4 col-form-label">{{ $t('dashboard.group') }} {{ $t('dashboard.name') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input v-model="group.name" type="text" class="form-control" id="title" placeholder="Group Name" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="switch-group-public" class="col-sm-4 col-form-label">Public Group</label>
|
||||
<label for="switch-group-public" class="col-sm-4 col-form-label text-capitalize">{{ $t('public') }} {{ $t('dashboard.group') }}</label>
|
||||
<div class="col-md-8 col-xs-12 mt-1">
|
||||
<span @click="group.public = !!group.public" class="switch float-left">
|
||||
<input v-model="group.public" type="checkbox" class="switch" id="switch-group-public" :checked="group.public">
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
<div>
|
||||
<form @submit.prevent="login" autocomplete="on">
|
||||
<div class="form-group row">
|
||||
<label for="username" class="col-sm-2 col-form-label">Username</label>
|
||||
<label for="username" class="col-sm-2 col-form-label">{{$t('username')}}</label>
|
||||
<div class="col-sm-10">
|
||||
<input @keyup="checkForm" type="text" v-model="username" name="username" class="form-control" id="username" placeholder="Username" autocorrect="off" autocapitalize="none">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="password" class="col-sm-2 col-form-label">Password</label>
|
||||
<label for="password" class="col-sm-2 col-form-label">{{$t('password')}}</label>
|
||||
<div class="col-sm-10">
|
||||
<input @keyup="checkForm" type="password" v-model="password" name="password" class="form-control" id="password" placeholder="Password">
|
||||
</div>
|
||||
|
@ -16,10 +16,10 @@
|
|||
<div class="form-group row">
|
||||
<div class="col-sm-12">
|
||||
<div v-if="error" class="alert alert-danger" role="alert">
|
||||
Incorrect username or password
|
||||
{{$t('dashboard.wrong_login')}}
|
||||
</div>
|
||||
<button @click.prevent="login" type="submit" class="btn btn-block mb-3 btn-primary" :disabled="disabled || loading">
|
||||
{{loading ? "Loading" : "Sign in"}}
|
||||
{{loading ? $t('dashboard.loading') : $t('dashboard.sign_in')}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -3,13 +3,15 @@
|
|||
<div class="card contain-card text-black-50 bg-white mb-5">
|
||||
<div class="card-header">{{message.id ? `Update ${message.title}` : "Create Announcement"}}
|
||||
<transition name="slide-fade">
|
||||
<button @click="removeEdit" v-if="message.id" class="btn btn-sm float-right btn-danger btn-sm">Close</button>
|
||||
<button @click="removeEdit" v-if="message.id" class="btn btn-sm float-right btn-danger btn-sm">
|
||||
{{ $t('close') }}
|
||||
</button>
|
||||
</transition>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form @submit="saveMessage">
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-4 col-form-label">Title</label>
|
||||
<label class="col-sm-4 col-form-label">{{ $t('dashboard.title') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input v-model="message.title" type="text" name="title" class="form-control" id="title" placeholder="Announcement Title" required>
|
||||
</div>
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
<input @keyup="canSubmit" v-model="setup.db_password" id="db_password" type="password" class="form-control" placeholder="password123">
|
||||
</div>
|
||||
<div v-if="setup.db_connection !== 'sqlite'" class="form-group">
|
||||
<label for="db_database" class="text-capitalize">{{ $t('database') }}</label>
|
||||
<label for="db_database" class="text-capitalize">{{ $t('setup.database') }}</label>
|
||||
<input @keyup="canSubmit" v-model="setup.db_database" id="db_database" type="text" class="form-control" placeholder="Database name">
|
||||
</div>
|
||||
|
||||
|
@ -125,7 +125,7 @@
|
|||
</div>
|
||||
|
||||
<button @click.prevent="saveSetup" v-bind:disabled="disabled || loading" type="submit" class="btn btn-primary btn-block" :class="{'btn-primary': !loading, 'btn-default': loading}">
|
||||
{{loading ? "Loading..." : "Save Settings"}}
|
||||
<font-awesome-icon v-if="loading" icon="circle-notch" class="mr-2" spin/>{{loading ? "Loading..." : "Save Settings"}}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -176,6 +176,7 @@
|
|||
}
|
||||
},
|
||||
mounted() {
|
||||
this.changeLanguages()
|
||||
this.setup.domain = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":"+window.location.port : "")
|
||||
},
|
||||
methods: {
|
||||
|
@ -203,13 +204,12 @@
|
|||
},
|
||||
async saveSetup() {
|
||||
this.loading = true
|
||||
const s = this.setup
|
||||
if (s.password !== s.confirm_password) {
|
||||
alert('Passwords do not match!')
|
||||
this.loading = false
|
||||
return
|
||||
let resp
|
||||
try {
|
||||
resp = await Api.setup_save(this.setup)
|
||||
} catch(e) {
|
||||
resp = {status: 'error', error: e.response.data.error}
|
||||
}
|
||||
const resp = await Api.setup_save(s)
|
||||
if (resp.status === 'error') {
|
||||
this.error = resp.error
|
||||
this.loading = false
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-4 col-form-label">Confirm Password</label>
|
||||
<label class="col-sm-4 col-form-label">{{ $t('close') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input v-model="user.confirm_password" type="password" id="password_confirm" class="form-control" placeholder="Confirm Password" required>
|
||||
</div>
|
||||
|
|
|
@ -3,6 +3,7 @@ const english = {
|
|||
dashboard: "Dashboard",
|
||||
services: "Services",
|
||||
users: "Users",
|
||||
groups: "Groups",
|
||||
announcements: "Announcements",
|
||||
settings: "Settings",
|
||||
logs: "Logs",
|
||||
|
@ -27,6 +28,16 @@ const english = {
|
|||
total_services: "Total Services",
|
||||
failures_24_hours: "Failures last 24 Hours",
|
||||
online_services: "Online Services",
|
||||
service: 'Service | Services',
|
||||
group: 'Group',
|
||||
title: 'Title',
|
||||
begins: 'Begins',
|
||||
name: 'Name',
|
||||
loading: 'Loading',
|
||||
login: 'Login',
|
||||
sign_in: "Sign In",
|
||||
visibility: 'Visibility',
|
||||
wrong_login: 'Incorrect username or password'
|
||||
},
|
||||
settings: {
|
||||
name: "Project Name",
|
||||
|
@ -35,12 +46,23 @@ const english = {
|
|||
footer_notes: "HTML is allowed inside the footer",
|
||||
error_reporting: "Enable Error Reporting",
|
||||
error_reporting_notes: "Help the Statping project out by sending anonymous error logs back to our server.",
|
||||
save: "Save Settings"
|
||||
save: "Save Settings",
|
||||
main: "Main Settings",
|
||||
theme: "Theme Editor",
|
||||
cache: "Cache",
|
||||
oauth: "OAuth",
|
||||
beta: "BETA",
|
||||
changelog: "Changelog",
|
||||
repo: "Statping Github Repo",
|
||||
docs: "Documentation",
|
||||
},
|
||||
service: {
|
||||
name: "Service Name",
|
||||
type: "Service Type",
|
||||
info: "Service Information"
|
||||
info: "Service Information",
|
||||
view: "View Service",
|
||||
average: "Average Response",
|
||||
last_uptime: "Uptime last {0} {1}",
|
||||
},
|
||||
email: "Email Address",
|
||||
port: "Database Port",
|
||||
|
@ -53,9 +75,11 @@ const english = {
|
|||
public: 'Public',
|
||||
private: 'Private',
|
||||
admin: 'Admin',
|
||||
user: 'User',
|
||||
offline: 'offline',
|
||||
incident: 'incident',
|
||||
failure: 'failure | failures',
|
||||
incident: 'incident | incidents',
|
||||
checkin: 'checkin | checkins',
|
||||
user: 'User | Users',
|
||||
group: 'Group',
|
||||
message: 'message',
|
||||
edit: 'Edit',
|
||||
|
@ -63,9 +87,14 @@ const english = {
|
|||
sample_data: 'Sample Data',
|
||||
today: 'Today',
|
||||
last_login: 'Last Login',
|
||||
day: 'day',
|
||||
hour: 'hour',
|
||||
uptime: '{0} Uptime',
|
||||
uptime: '{0}% Uptime',
|
||||
close: 'Close',
|
||||
second: 'second | seconds',
|
||||
minute: 'minute | minutes',
|
||||
hour: 'hour | hours',
|
||||
day: 'day | days',
|
||||
week: 'week | weeks',
|
||||
month: 'month | months',
|
||||
}
|
||||
|
||||
export default english
|
||||
|
|
|
@ -1,19 +1,100 @@
|
|||
const french = {
|
||||
setup: {
|
||||
language: "Langue",
|
||||
database_connection: "Database Connection"
|
||||
top_nav: {
|
||||
dashboard: "Dashboard",
|
||||
services: "Services",
|
||||
users: "Users",
|
||||
groups: "Groups",
|
||||
announcements: "Announcements",
|
||||
settings: "Settings",
|
||||
logs: "Logs",
|
||||
logout: 'Logout',
|
||||
},
|
||||
service: 'service',
|
||||
setup: {
|
||||
language: "Language",
|
||||
connection: "Database Connection",
|
||||
host: "Host",
|
||||
database: "Database",
|
||||
project_name: "Project Name",
|
||||
project_description: "Project Description",
|
||||
domain: "Domain URL",
|
||||
username: "Admin Username",
|
||||
password: "Admin Password",
|
||||
password_confirm: "Confirm Admin Password",
|
||||
newsletter: "Newsletter",
|
||||
newsletter_note: "We will not share your email, emails are only for major updates.",
|
||||
send_reports: "Send Error Reports to Statping"
|
||||
},
|
||||
dashboard: {
|
||||
total_services: "Total Services",
|
||||
failures_24_hours: "Failures last 24 Hours",
|
||||
online_services: "Online Services",
|
||||
service: 'Service | Services',
|
||||
group: 'Group',
|
||||
title: 'Title',
|
||||
begins: 'Begins',
|
||||
name: 'Name',
|
||||
loading: 'Loading',
|
||||
login: 'Login',
|
||||
sign_in: "Sign In",
|
||||
visibility: 'Visibility',
|
||||
wrong_login: 'Incorrect username or password'
|
||||
},
|
||||
settings: {
|
||||
name: "Project Name",
|
||||
description: "Project Name",
|
||||
footer: "Custom Footer",
|
||||
footer_notes: "HTML is allowed inside the footer",
|
||||
error_reporting: "Enable Error Reporting",
|
||||
error_reporting_notes: "Help the Statping project out by sending anonymous error logs back to our server.",
|
||||
save: "Save Settings",
|
||||
main: "Main Settings",
|
||||
theme: "Theme Editor",
|
||||
cache: "Cache",
|
||||
oauth: "OAuth",
|
||||
beta: "BETA",
|
||||
changelog: "Changelog",
|
||||
repo: "Statping Github Repo",
|
||||
docs: "Documentation",
|
||||
},
|
||||
service: {
|
||||
name: "Service Name",
|
||||
type: "Service Type",
|
||||
info: "Service Information",
|
||||
view: "View Service",
|
||||
average: "Average Response",
|
||||
last_uptime: "Uptime last {0} {1}",
|
||||
},
|
||||
email: "Email Address",
|
||||
port: "Database Port",
|
||||
setting: "Settings",
|
||||
username: "Username",
|
||||
password: 'Password',
|
||||
services: 'Services',
|
||||
domain: 'Domain',
|
||||
online: 'online',
|
||||
public: 'Public',
|
||||
private: 'Private',
|
||||
admin: 'Admin',
|
||||
offline: 'offline',
|
||||
incident: 'incident',
|
||||
group: 'group',
|
||||
failure: 'failure | failures',
|
||||
incident: 'incident | incidents',
|
||||
checkin: 'checkin | checkins',
|
||||
user: 'User | Users',
|
||||
group: 'Group',
|
||||
message: 'message',
|
||||
logout: 'logout',
|
||||
edit: 'Edit',
|
||||
type: 'Type',
|
||||
sample_data: 'Sample Data',
|
||||
today: 'Today',
|
||||
day: 'day',
|
||||
hour: 'hour',
|
||||
last_login: 'Last Login',
|
||||
uptime: '{0}% Uptime',
|
||||
close: 'Close',
|
||||
second: 'second | seconds',
|
||||
minute: 'minute | minutes',
|
||||
hour: 'hour | hours',
|
||||
day: 'day | days',
|
||||
week: 'week | weeks',
|
||||
month: 'month | months',
|
||||
}
|
||||
|
||||
export default french
|
||||
|
|
|
@ -1,19 +1,100 @@
|
|||
const german = {
|
||||
setup: {
|
||||
language: "Sprache",
|
||||
database_connection: "Database Connection"
|
||||
top_nav: {
|
||||
dashboard: "Dashboard",
|
||||
services: "Services",
|
||||
users: "Users",
|
||||
groups: "Groups",
|
||||
announcements: "Announcements",
|
||||
settings: "Settings",
|
||||
logs: "Logs",
|
||||
logout: 'Logout',
|
||||
},
|
||||
service: 'service',
|
||||
setup: {
|
||||
language: "Language",
|
||||
connection: "Database Connection",
|
||||
host: "Host",
|
||||
database: "Database",
|
||||
project_name: "Project Name",
|
||||
project_description: "Project Description",
|
||||
domain: "Domain URL",
|
||||
username: "Admin Username",
|
||||
password: "Admin Password",
|
||||
password_confirm: "Confirm Admin Password",
|
||||
newsletter: "Newsletter",
|
||||
newsletter_note: "We will not share your email, emails are only for major updates.",
|
||||
send_reports: "Send Error Reports to Statping"
|
||||
},
|
||||
dashboard: {
|
||||
total_services: "Total Services",
|
||||
failures_24_hours: "Failures last 24 Hours",
|
||||
online_services: "Online Services",
|
||||
service: 'Service | Services',
|
||||
group: 'Group',
|
||||
title: 'Title',
|
||||
begins: 'Begins',
|
||||
name: 'Name',
|
||||
loading: 'Loading',
|
||||
login: 'Login',
|
||||
sign_in: "Sign In",
|
||||
visibility: 'Visibility',
|
||||
wrong_login: 'Incorrect username or password'
|
||||
},
|
||||
settings: {
|
||||
name: "Project Name",
|
||||
description: "Project Name",
|
||||
footer: "Custom Footer",
|
||||
footer_notes: "HTML is allowed inside the footer",
|
||||
error_reporting: "Enable Error Reporting",
|
||||
error_reporting_notes: "Help the Statping project out by sending anonymous error logs back to our server.",
|
||||
save: "Save Settings",
|
||||
main: "Main Settings",
|
||||
theme: "Theme Editor",
|
||||
cache: "Cache",
|
||||
oauth: "OAuth",
|
||||
beta: "BETA",
|
||||
changelog: "Changelog",
|
||||
repo: "Statping Github Repo",
|
||||
docs: "Documentation",
|
||||
},
|
||||
service: {
|
||||
name: "Service Name",
|
||||
type: "Service Type",
|
||||
info: "Service Information",
|
||||
view: "View Service",
|
||||
average: "Average Response",
|
||||
last_uptime: "Uptime last {0} {1}",
|
||||
},
|
||||
email: "Email Address",
|
||||
port: "Database Port",
|
||||
setting: "Settings",
|
||||
username: "Username",
|
||||
password: 'Password',
|
||||
services: 'Services',
|
||||
domain: 'Domain',
|
||||
online: 'online',
|
||||
public: 'Public',
|
||||
private: 'Private',
|
||||
admin: 'Admin',
|
||||
offline: 'offline',
|
||||
incident: 'incident',
|
||||
group: 'group',
|
||||
failure: 'failure | failures',
|
||||
incident: 'incident | incidents',
|
||||
checkin: 'checkin | checkins',
|
||||
user: 'User | Users',
|
||||
group: 'Group',
|
||||
message: 'message',
|
||||
logout: 'logout',
|
||||
edit: 'Edit',
|
||||
type: 'Type',
|
||||
sample_data: 'Sample Data',
|
||||
today: 'Today',
|
||||
day: 'day',
|
||||
hour: 'hour',
|
||||
last_login: 'Last Login',
|
||||
uptime: '{0}% Uptime',
|
||||
close: 'Close',
|
||||
second: 'second | seconds',
|
||||
minute: 'minute | minutes',
|
||||
hour: 'hour | hours',
|
||||
day: 'day | days',
|
||||
week: 'week | weeks',
|
||||
month: 'month | months',
|
||||
}
|
||||
|
||||
export default german
|
||||
|
|
|
@ -1,19 +1,100 @@
|
|||
const russian = {
|
||||
setup: {
|
||||
language: "язык",
|
||||
database_connection: "Database Connection"
|
||||
top_nav: {
|
||||
dashboard: "Dashboard",
|
||||
services: "Services",
|
||||
users: "Users",
|
||||
groups: "Groups",
|
||||
announcements: "Announcements",
|
||||
settings: "Settings",
|
||||
logs: "Logs",
|
||||
logout: 'Logout',
|
||||
},
|
||||
service: 'service',
|
||||
online: 'online',
|
||||
offline: 'offline',
|
||||
incident: 'incident',
|
||||
group: 'group',
|
||||
setup: {
|
||||
language: "Language",
|
||||
connection: "Database Connection",
|
||||
host: "Host",
|
||||
database: "Database",
|
||||
project_name: "Project Name",
|
||||
project_description: "Project Description",
|
||||
domain: "Domain URL",
|
||||
username: "Admin Username",
|
||||
password: "Admin Password",
|
||||
password_confirm: "Confirm Admin Password",
|
||||
newsletter: "Newsletter",
|
||||
newsletter_note: "We will not share your email, emails are only for major updates.",
|
||||
send_reports: "Send Error Reports to Statping"
|
||||
},
|
||||
dashboard: {
|
||||
total_services: "Total Services",
|
||||
failures_24_hours: "Failures last 24 Hours",
|
||||
online_services: "Online Services",
|
||||
service: 'Service | Services',
|
||||
group: 'Group',
|
||||
title: 'Title',
|
||||
begins: 'Begins',
|
||||
name: 'Name',
|
||||
loading: 'Loading',
|
||||
login: 'Login',
|
||||
sign_in: "Sign In",
|
||||
visibility: 'Visibility',
|
||||
wrong_login: 'Incorrect username or password'
|
||||
},
|
||||
settings: {
|
||||
name: "Project Name",
|
||||
description: "Project Name",
|
||||
footer: "Custom Footer",
|
||||
footer_notes: "HTML is allowed inside the footer",
|
||||
error_reporting: "Enable Error Reporting",
|
||||
error_reporting_notes: "Help the Statping project out by sending anonymous error logs back to our server.",
|
||||
save: "Save Settings",
|
||||
main: "Main Settings",
|
||||
theme: "Theme Editor",
|
||||
cache: "Cache",
|
||||
oauth: "OAuth",
|
||||
beta: "BETA",
|
||||
changelog: "Changelog",
|
||||
repo: "Statping Github Repo",
|
||||
docs: "Documentation",
|
||||
},
|
||||
service: {
|
||||
name: "Service Name",
|
||||
type: "Service Type",
|
||||
info: "Service Information",
|
||||
view: "View Service",
|
||||
average: "Average Response",
|
||||
last_uptime: "Uptime last {0} {1}",
|
||||
},
|
||||
email: "Email Address",
|
||||
port: "Database Port",
|
||||
setting: "Settings",
|
||||
username: "Username",
|
||||
password: 'Password',
|
||||
services: 'Services',
|
||||
domain: 'Domain',
|
||||
online: 'онлайн',
|
||||
public: 'Public',
|
||||
private: 'Private',
|
||||
admin: 'Admin',
|
||||
offline: 'не в сети',
|
||||
failure: 'failure | failures',
|
||||
incident: 'incident | incidents',
|
||||
checkin: 'checkin | checkins',
|
||||
user: 'User | Users',
|
||||
group: 'Group',
|
||||
message: 'message',
|
||||
logout: 'logout',
|
||||
edit: 'Edit',
|
||||
type: 'Type',
|
||||
sample_data: 'Sample Data',
|
||||
today: 'Today',
|
||||
day: 'day',
|
||||
hour: 'hour',
|
||||
last_login: 'Last Login',
|
||||
uptime: '{0}% Uptime',
|
||||
close: 'близко',
|
||||
second: 'второй | секунд',
|
||||
minute: 'минут | минут',
|
||||
hour: 'час | часов',
|
||||
day: 'день | дней',
|
||||
week: 'неделя | недель',
|
||||
month: 'месяц | месяцы',
|
||||
}
|
||||
|
||||
export default russian
|
||||
|
|
|
@ -1,19 +1,100 @@
|
|||
const spanish = {
|
||||
setup: {
|
||||
language: "Idioma",
|
||||
database_connection: "Database Connection"
|
||||
top_nav: {
|
||||
dashboard: "Dashboard",
|
||||
services: "Services",
|
||||
users: "Users",
|
||||
groups: "Groups",
|
||||
announcements: "Announcements",
|
||||
settings: "Settings",
|
||||
logs: "Logs",
|
||||
logout: 'Logout',
|
||||
},
|
||||
service: 'service',
|
||||
setup: {
|
||||
language: "Language",
|
||||
connection: "Database Connection",
|
||||
host: "Host",
|
||||
database: "Database",
|
||||
project_name: "Project Name",
|
||||
project_description: "Project Description",
|
||||
domain: "Domain URL",
|
||||
username: "Admin Username",
|
||||
password: "Admin Password",
|
||||
password_confirm: "Confirm Admin Password",
|
||||
newsletter: "Newsletter",
|
||||
newsletter_note: "We will not share your email, emails are only for major updates.",
|
||||
send_reports: "Send Error Reports to Statping"
|
||||
},
|
||||
dashboard: {
|
||||
total_services: "Total Services",
|
||||
failures_24_hours: "Failures last 24 Hours",
|
||||
online_services: "Online Services",
|
||||
service: 'Service | Services',
|
||||
group: 'Group',
|
||||
title: 'Title',
|
||||
begins: 'Begins',
|
||||
name: 'Name',
|
||||
loading: 'Loading',
|
||||
login: 'Login',
|
||||
sign_in: "Sign In",
|
||||
visibility: 'Visibility',
|
||||
wrong_login: 'Incorrect username or password'
|
||||
},
|
||||
settings: {
|
||||
name: "Project Name",
|
||||
description: "Project Name",
|
||||
footer: "Custom Footer",
|
||||
footer_notes: "HTML is allowed inside the footer",
|
||||
error_reporting: "Enable Error Reporting",
|
||||
error_reporting_notes: "Help the Statping project out by sending anonymous error logs back to our server.",
|
||||
save: "Save Settings",
|
||||
main: "Main Settings",
|
||||
theme: "Theme Editor",
|
||||
cache: "Cache",
|
||||
oauth: "OAuth",
|
||||
beta: "BETA",
|
||||
changelog: "Changelog",
|
||||
repo: "Statping Github Repo",
|
||||
docs: "Documentation",
|
||||
},
|
||||
service: {
|
||||
name: "Service Name",
|
||||
type: "Service Type",
|
||||
info: "Service Information",
|
||||
view: "View Service",
|
||||
average: "Average Response",
|
||||
last_uptime: "Uptime last {0} {1}",
|
||||
},
|
||||
email: "Email Address",
|
||||
port: "Database Port",
|
||||
setting: "Settings",
|
||||
username: "Username",
|
||||
password: 'Password',
|
||||
services: 'Services',
|
||||
domain: 'Domain',
|
||||
online: 'online',
|
||||
public: 'Public',
|
||||
private: 'Private',
|
||||
admin: 'Admin',
|
||||
offline: 'offline',
|
||||
incident: 'incident',
|
||||
group: 'group',
|
||||
failure: 'failure | failures',
|
||||
incident: 'incident | incidents',
|
||||
checkin: 'checkin | checkins',
|
||||
user: 'User | Users',
|
||||
group: 'Group',
|
||||
message: 'message',
|
||||
logout: 'logout',
|
||||
edit: 'Edit',
|
||||
type: 'Type',
|
||||
sample_data: 'Sample Data',
|
||||
today: 'Today',
|
||||
day: 'day',
|
||||
hour: 'hour',
|
||||
last_login: 'Last Login',
|
||||
uptime: '{0}% Uptime',
|
||||
close: 'Close',
|
||||
second: 'second | seconds',
|
||||
minute: 'minute | minutes',
|
||||
hour: 'hour | hours',
|
||||
day: 'day | days',
|
||||
week: 'week | weeks',
|
||||
month: 'month | months',
|
||||
}
|
||||
|
||||
export default spanish
|
||||
|
|
|
@ -20,7 +20,7 @@ export default Vue.mixin({
|
|||
return startOfToday()
|
||||
},
|
||||
secondsHumanize (val) {
|
||||
return `${val} seconds`
|
||||
return `${val} ${this.$t('second', val)}`
|
||||
},
|
||||
utc(val) {
|
||||
return new Date.UTC(val)
|
||||
|
@ -175,7 +175,7 @@ export default Vue.mixin({
|
|||
return startOfMonth(date)
|
||||
},
|
||||
lastDayOfMonth(month) {
|
||||
return lastDayOfMonth(date)
|
||||
return lastDayOfMonth(month)
|
||||
},
|
||||
addMonths(date, amount) {
|
||||
return addMonths(date, amount)
|
||||
|
|
|
@ -3,22 +3,20 @@
|
|||
|
||||
<div class="col-12 mb-4">
|
||||
|
||||
<span class="mt-3 mb-3 text-white d-md-none btn d-block d-md-none" :class="{'bg-success': service.online, 'bg-danger': !service.online}">
|
||||
{{service.online ? "ONLINE" : "OFFLINE"}}
|
||||
<span class="mt-3 mb-3 text-white d-md-none btn d-block d-md-none text-uppercase" :class="{'bg-success': service.online, 'bg-danger': !service.online}">
|
||||
{{service.online ? $t('online') : $t('offline')}}
|
||||
</span>
|
||||
|
||||
<h4 class="mt-2">
|
||||
<router-link to="/" class="text-black-50 text-decoration-none">{{core.name}}</router-link> - <span class="text-muted">{{service.name}}</span>
|
||||
<span class="badge float-right d-none d-md-block" :class="{'bg-success': service.online, 'bg-danger': !service.online}">
|
||||
{{service.online ? "ONLINE" : "OFFLINE"}}
|
||||
<span class="badge float-right d-none d-md-block text-uppercase" :class="{'bg-success': service.online, 'bg-danger': !service.online}">
|
||||
{{service.online ? $t('online') : $t('offline')}}
|
||||
</span>
|
||||
</h4>
|
||||
|
||||
<ServiceTopStats :service="service"/>
|
||||
|
||||
<div>
|
||||
<MessageBlock v-for="message in messagesInRange" v-bind:key="message.id" :message="message"/>
|
||||
</div>
|
||||
<MessageBlock v-for="message in messagesInRange" v-bind:key="message.id" :message="message"/>
|
||||
|
||||
<div class="row mt-5 mb-4">
|
||||
<div class="col-12 col-md-5 font-2 mb-3 mb-md-0">
|
||||
|
|
|
@ -3,19 +3,19 @@
|
|||
<div class="row">
|
||||
<div class="col-md-3 col-sm-12 mb-4 mb-md-0">
|
||||
<div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
|
||||
<h6 class="text-muted">Main Settings</h6>
|
||||
<h6 class="text-muted">{{ $t('settings.main') }}</h6>
|
||||
|
||||
<a @click.prevent="changeTab" class="nav-link" v-bind:class="{active: liClass('v-pills-home-tab')}" id="v-pills-home-tab" data-toggle="pill" href="#v-pills-home" role="tab" aria-controls="v-pills-home" aria-selected="true">
|
||||
<font-awesome-icon icon="cog" class="mr-2"/> Settings
|
||||
<font-awesome-icon icon="cog" class="mr-2"/> {{ $t('setting') }}
|
||||
</a>
|
||||
<a @click.prevent="changeTab" class="nav-link" v-bind:class="{active: liClass('v-pills-style-tab')}" id="v-pills-style-tab" data-toggle="pill" href="#v-pills-style" role="tab" aria-controls="v-pills-style" aria-selected="false">
|
||||
<font-awesome-icon icon="image" class="mr-2"/> Theme Editor
|
||||
<font-awesome-icon icon="image" class="mr-2"/> {{ $t('settings.theme') }}
|
||||
</a>
|
||||
<a @click.prevent="changeTab" class="nav-link" v-bind:class="{active: liClass('v-pills-cache-tab')}" id="v-pills-cache-tab" data-toggle="pill" href="#v-pills-cache" role="tab" aria-controls="v-pills-cache" aria-selected="false">
|
||||
<font-awesome-icon icon="paperclip" class="mr-2"/> Cache
|
||||
<font-awesome-icon icon="paperclip" class="mr-2"/> {{ $t('settings.cache') }}
|
||||
</a>
|
||||
<a @click.prevent="changeTab" class="nav-link" v-bind:class="{active: liClass('v-pills-oauth-tab')}" id="v-pills-oauth-tab" data-toggle="pill" href="#v-pills-oauth" role="tab" aria-controls="v-pills-oauth" aria-selected="false">
|
||||
<font-awesome-icon icon="key" class="mr-2"/> OAuth <span class="mt-1 float-right badge badge-light text-dark font-1">BETA</span>
|
||||
<font-awesome-icon icon="key" class="mr-2"/> {{ $t('settings.oauth') }} <span class="mt-1 float-right badge badge-light text-dark font-1">{{ $t('settings.beta') }}</span>
|
||||
</a>
|
||||
|
||||
<h6 class="mt-4 text-muted">Notifiers</h6>
|
||||
|
@ -33,19 +33,19 @@
|
|||
<h6 class="mt-4 mb-3 text-muted">Statping Links</h6>
|
||||
|
||||
<a href="https://github.com/statping/statping/wiki" class="mb-2 font-2 text-decoration-none text-muted">
|
||||
<font-awesome-icon icon="question" class="mr-3"/> Documentation
|
||||
<font-awesome-icon icon="question" class="mr-3"/> {{$t('settings.docs')}}
|
||||
</a>
|
||||
|
||||
<a href="https://github.com/statping/statping/wiki/API" class="mb-2 font-2 text-decoration-none text-muted">
|
||||
<font-awesome-icon icon="laptop" class="mr-2"/> API Documentation
|
||||
<font-awesome-icon icon="laptop" class="mr-2"/> API {{$t('settings.docs')}}
|
||||
</a>
|
||||
|
||||
<a href="https://raw.githubusercontent.com/statping/statping/master/CHANGELOG.md" class="mb-2 font-2 text-decoration-none text-muted">
|
||||
<font-awesome-icon icon="book" class="mr-3"/> Changelog
|
||||
<font-awesome-icon icon="book" class="mr-3"/> {{$t('settings.changelog')}}
|
||||
</a>
|
||||
|
||||
<a href="https://github.com/statping/statping" class="mb-2 font-2 text-decoration-none text-muted">
|
||||
<font-awesome-icon icon="code-branch" class="mr-3"/> Statping Github Repo
|
||||
<font-awesome-icon icon="code-branch" class="mr-3"/> {{$t('settings.repo')}}
|
||||
</a>
|
||||
|
||||
<div class="row justify-content-center mt-2">
|
||||
|
@ -89,30 +89,18 @@
|
|||
<div class="card text-black-50 bg-white mt-3">
|
||||
<div class="card-header">QR Code for Mobile App</div>
|
||||
<div class="card-body">
|
||||
|
||||
<img class="rounded" width="300" height="300" :src="qrcode">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" v-bind:class="{active: liClass('v-pills-style-tab'), show: liClass('v-pills-style-tab')}" id="v-pills-style" role="tabpanel" aria-labelledby="v-pills-style-tab">
|
||||
<div class="card text-black-50 bg-white mb-5">
|
||||
<div class="card-header">Theme Editor</div>
|
||||
<div class="card-body">
|
||||
<ThemeEditor/>
|
||||
</div>
|
||||
</div>
|
||||
<ThemeEditor/>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" v-bind:class="{active: liClass('v-pills-cache-tab'), show: liClass('v-pills-cache-tab')}" id="v-pills-cache" role="tabpanel" aria-labelledby="v-pills-cache-tab">
|
||||
<div class="card text-black-50 bg-white mb-5">
|
||||
<div class="card-header">Cache</div>
|
||||
<div class="card-body">
|
||||
<Cache/>
|
||||
</div>
|
||||
</div>
|
||||
<Cache/>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" v-bind:class="{active: liClass('v-pills-oauth-tab'), show: liClass('v-pills-oauth-tab')}" id="v-pills-oauth" role="tabpanel" aria-labelledby="v-pills-oauth-tab">
|
||||
|
@ -120,132 +108,7 @@
|
|||
</div>
|
||||
|
||||
<div class="tab-pane fade" v-bind:class="{active: liClass(`v-pills-notifier-docs-tab`), show: liClass(`v-pills-notifier-docs-tab`)}" v-bind:id="`v-pills-notifier-docs-tab`" role="tabpanel" v-bind:aria-labelledby="`v-pills-notifier-docs-tab`">
|
||||
<h2>Notifier Variables</h2>
|
||||
You can insert dynamic fields within the notifier payloads for some notifiers.
|
||||
|
||||
<p class="mt-2">
|
||||
Checkout the <a href="https://github.com/statping/statping/blob/master/types/services/struct.go">Service struct</a> and the <a href="https://github.com/statping/statping/blob/master/types/failures/struct.go">Failures struct</a> and create variables in golang template format.
|
||||
</p>
|
||||
|
||||
<p class="mt-2">
|
||||
For example, if you have <b>{{"\{\{.Service.Name\}\}"}}</b> it will return the service name.
|
||||
</p>
|
||||
|
||||
<h2 class="mt-3">Service Variables</h2>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Variable</th>
|
||||
<th scope="col">True Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Service.Id\}\}"}}</kbd></td>
|
||||
<td>1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Service.Name\}\}"}}</kbd></td>
|
||||
<td>Example Service</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Service.Domain\}\}"}}</kbd></td>
|
||||
<td>https://statping.com</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Service.Port\}\}"}}</kbd></td>
|
||||
<td>8080</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Service.DowntimeAgo\}\}"}}</kbd></td>
|
||||
<td>35 minutes ago</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Service.LastStatusCode\}\}"}}</kbd></td>
|
||||
<td>404</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Service.FailuresLast24Hours\}\}"}}</kbd></td>
|
||||
<td>38</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<small>Additional variables within the Service struct</small>
|
||||
</table>
|
||||
|
||||
<h2 class="mt-3">Failure Variables</h2>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Variable</th>
|
||||
<th scope="col">True Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Failure.Issue\}\}"}}</kbd></td>
|
||||
<td>Received 404 status code</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Failure.ErrorCode\}\}"}}</kbd></td>
|
||||
<td>404</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Failure.Service\}\}"}}</kbd></td>
|
||||
<td>1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Failure.PingTime\}\}"}}</kbd></td>
|
||||
<td>12482 (microseconds)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Failure.DowntimeAgo\}\}"}}</kbd></td>
|
||||
<td>35 minutes ago</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Failure.CreatedAt\}\}"}}</kbd></td>
|
||||
<td>2020-05-02 09:14:43.66381 +0000 UTC</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<small>Additional variables within the Failures struct</small>
|
||||
</table>
|
||||
|
||||
<h2 class="mt-3">Core Variables</h2>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Variable</th>
|
||||
<th scope="col">True Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Core.Domain\}\}"}}</kbd></td>
|
||||
<td>http://localhost:8080</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Core.Name\}\}"}}</kbd></td>
|
||||
<td>Statping Demo</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Core.Description\}\}"}}</kbd></td>
|
||||
<td>Statping will monitor your stuff!</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Core.Version\}\}"}}</kbd></td>
|
||||
<td>v0.90.34</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><kbd>{{"\{\{.Core.Started\}\}"}}</kbd></td>
|
||||
<td>2020-05-02 09:14:43.66381 +0000 UTC</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<small>Additional variables within the Core struct</small>
|
||||
</table>
|
||||
|
||||
|
||||
<Variables/>
|
||||
</div>
|
||||
|
||||
<div v-for="(notifier, index) in notifiers" v-bind:key="`${notifier.method}_${index}`" class="tab-pane fade" v-bind:class="{active: liClass(`v-pills-${notifier.method.toLowerCase()}-tab`), show: liClass(`v-pills-${notifier.method.toLowerCase()}-tab`)}" v-bind:id="`v-pills-${notifier.method.toLowerCase()}-tab`" role="tabpanel" v-bind:aria-labelledby="`v-pills-${notifier.method.toLowerCase()}-tab`">
|
||||
|
@ -262,6 +125,7 @@
|
|||
<script>
|
||||
import Api from '../API';
|
||||
import GithubButton from 'vue-github-button'
|
||||
import Variables from "@/components/Dashboard/Variables";
|
||||
|
||||
const CoreSettings = () => import('@/forms/CoreSettings')
|
||||
const FormIntegration = () => import('@/forms/Integration')
|
||||
|
@ -273,6 +137,7 @@
|
|||
export default {
|
||||
name: 'Settings',
|
||||
components: {
|
||||
Variables,
|
||||
GithubButton,
|
||||
OAuth,
|
||||
Cache,
|
||||
|
|
|
@ -167,11 +167,17 @@ export default new Vuex.Store({
|
|||
context.commit("setGroups", groups);
|
||||
const services = await Api.services()
|
||||
context.commit("setServices", services);
|
||||
const checkins = await Api.checkins()
|
||||
context.commit("setCheckins", checkins);
|
||||
const messages = await Api.messages()
|
||||
context.commit("setMessages", messages)
|
||||
context.commit("setHasPublicData", true)
|
||||
const messages = await Api.messages()
|
||||
context.commit("setMessages", messages)
|
||||
context.commit("setHasPublicData", true)
|
||||
try {
|
||||
const checkins = await Api.checkins()
|
||||
context.commit("setCheckins", checkins);
|
||||
} catch(e) {
|
||||
window.console.error(e)
|
||||
await Api.logout()
|
||||
return
|
||||
}
|
||||
const notifiers = await Api.notifiers()
|
||||
context.commit("setNotifiers", notifiers);
|
||||
const users = await Api.users()
|
||||
|
|
|
@ -64,7 +64,7 @@ func (c *commandLine) OnFailure(s *services.Service, f *failures.Failure) (strin
|
|||
|
||||
// OnTest for commandLine triggers when this notifier has been saved
|
||||
func (c *commandLine) OnTest() (string, error) {
|
||||
tmpl := ReplaceVars(c.Var1, services.Example(true), exampleFailure)
|
||||
tmpl := ReplaceVars(c.Var1, services.Example(true), failures.Example())
|
||||
in, out, err := runCommand(c.Host, tmpl)
|
||||
utils.Log.Infoln(in)
|
||||
utils.Log.Infoln(out)
|
||||
|
|
|
@ -2,8 +2,10 @@ package notifiers
|
|||
|
||||
import (
|
||||
"github.com/statping/statping/database"
|
||||
"github.com/statping/statping/types/failures"
|
||||
"github.com/statping/statping/types/notifications"
|
||||
"github.com/statping/statping/types/null"
|
||||
"github.com/statping/statping/types/services"
|
||||
"github.com/statping/statping/utils"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -39,12 +41,12 @@ func TestCommandNotifier(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("Command OnFailure", func(t *testing.T) {
|
||||
_, err := Command.OnFailure(exampleService, exampleFailure)
|
||||
_, err := Command.OnFailure(services.Example(false), failures.Example())
|
||||
assert.Nil(t, err)
|
||||
})
|
||||
|
||||
t.Run("Command OnSuccess", func(t *testing.T) {
|
||||
_, err := Command.OnSuccess(exampleService)
|
||||
_, err := Command.OnSuccess(services.Example(true))
|
||||
assert.Nil(t, err)
|
||||
})
|
||||
|
||||
|
|
|
@ -2,8 +2,10 @@ package notifiers
|
|||
|
||||
import (
|
||||
"github.com/statping/statping/database"
|
||||
"github.com/statping/statping/types/failures"
|
||||
"github.com/statping/statping/types/notifications"
|
||||
"github.com/statping/statping/types/null"
|
||||
"github.com/statping/statping/types/services"
|
||||
"github.com/statping/statping/utils"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -46,12 +48,12 @@ func TestDiscordNotifier(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("discord OnFailure", func(t *testing.T) {
|
||||
_, err := Discorder.OnFailure(exampleService, exampleFailure)
|
||||
_, err := Discorder.OnFailure(services.Example(false), failures.Example())
|
||||
assert.Nil(t, err)
|
||||
})
|
||||
|
||||
t.Run("discord OnSuccess", func(t *testing.T) {
|
||||
_, err := Discorder.OnSuccess(exampleService)
|
||||
_, err := Discorder.OnSuccess(services.Example(true))
|
||||
assert.Nil(t, err)
|
||||
})
|
||||
|
||||
|
|
|
@ -2,8 +2,10 @@ package notifiers
|
|||
|
||||
import (
|
||||
"github.com/statping/statping/database"
|
||||
"github.com/statping/statping/types/failures"
|
||||
"github.com/statping/statping/types/notifications"
|
||||
"github.com/statping/statping/types/null"
|
||||
"github.com/statping/statping/types/services"
|
||||
"github.com/statping/statping/utils"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -62,21 +64,21 @@ func TestEmailNotifier(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("email OnFailure", func(t *testing.T) {
|
||||
_, err := email.OnFailure(exampleService, exampleFailure)
|
||||
_, err := email.OnFailure(services.Example(false), failures.Example())
|
||||
assert.Nil(t, err)
|
||||
})
|
||||
|
||||
t.Run("email OnSuccess", func(t *testing.T) {
|
||||
_, err := email.OnSuccess(exampleService)
|
||||
_, err := email.OnSuccess(services.Example(false))
|
||||
assert.Nil(t, err)
|
||||
})
|
||||
|
||||
t.Run("email Check Back Online", func(t *testing.T) {
|
||||
assert.True(t, exampleService.Online)
|
||||
assert.True(t, services.Example(true).Online)
|
||||
})
|
||||
|
||||
t.Run("email OnSuccess Again", func(t *testing.T) {
|
||||
_, err := email.OnSuccess(exampleService)
|
||||
_, err := email.OnSuccess(services.Example(true))
|
||||
assert.Nil(t, err)
|
||||
})
|
||||
|
||||
|
|
|
@ -2,8 +2,10 @@ package notifiers
|
|||
|
||||
import (
|
||||
"github.com/statping/statping/database"
|
||||
"github.com/statping/statping/types/failures"
|
||||
"github.com/statping/statping/types/notifications"
|
||||
"github.com/statping/statping/types/null"
|
||||
"github.com/statping/statping/types/services"
|
||||
"github.com/statping/statping/utils"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -51,12 +53,12 @@ func TestMobileNotifier(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("Mobile OnFailure", func(t *testing.T) {
|
||||
_, err := Mobile.OnFailure(exampleService, exampleFailure)
|
||||
_, err := Mobile.OnFailure(services.Example(false), failures.Example())
|
||||
assert.Nil(t, err)
|
||||
})
|
||||
|
||||
t.Run("Mobile OnSuccess", func(t *testing.T) {
|
||||
_, err := Mobile.OnSuccess(exampleService)
|
||||
_, err := Mobile.OnSuccess(services.Example(true))
|
||||
assert.Nil(t, err)
|
||||
})
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"bytes"
|
||||
"github.com/statping/statping/types/core"
|
||||
"github.com/statping/statping/types/failures"
|
||||
"github.com/statping/statping/types/null"
|
||||
"github.com/statping/statping/types/services"
|
||||
"github.com/statping/statping/utils"
|
||||
"html/template"
|
||||
|
@ -12,7 +11,6 @@ import (
|
|||
)
|
||||
|
||||
var log = utils.Log.WithField("type", "notifier")
|
||||
var exampleService = services.Example(true)
|
||||
|
||||
type replacer struct {
|
||||
Core *core.Core
|
||||
|
@ -63,46 +61,6 @@ func ReplaceVars(input string, s *services.Service, f *failures.Failure) string
|
|||
return ReplaceTemplate(input, replacer{Service: s, Failure: f, Core: core.App})
|
||||
}
|
||||
|
||||
var ExampleService = &services.Service{
|
||||
Id: 1,
|
||||
Name: "Statping",
|
||||
Domain: "https://statping.com",
|
||||
Expected: null.NewNullString("a better response"),
|
||||
ExpectedStatus: 200,
|
||||
Interval: 60,
|
||||
Type: "http",
|
||||
Method: "get",
|
||||
Timeout: 10,
|
||||
Order: 2,
|
||||
VerifySSL: null.NewNullBool(true),
|
||||
Public: null.NewNullBool(true),
|
||||
GroupId: 0,
|
||||
Permalink: null.NewNullString("statping"),
|
||||
Online: true,
|
||||
Latency: 324399,
|
||||
PingTime: 18399,
|
||||
Online24Hours: 99.2,
|
||||
Online7Days: 99.8,
|
||||
AvgResponse: 300233,
|
||||
FailuresLast24Hours: 4,
|
||||
Checkpoint: utils.Now().Add(-10 * time.Minute),
|
||||
SleepDuration: 55,
|
||||
LastResponse: "returning from a response",
|
||||
AllowNotifications: null.NewNullBool(true),
|
||||
UserNotified: false,
|
||||
UpdateNotify: null.NewNullBool(true),
|
||||
SuccessNotified: false,
|
||||
LastStatusCode: 200,
|
||||
LastLookupTime: 5233,
|
||||
LastLatency: 270233,
|
||||
LastCheck: utils.Now().Add(-15 * time.Second),
|
||||
LastOnline: utils.Now().Add(-15 * time.Second),
|
||||
LastOffline: utils.Now().Add(-10 * time.Minute),
|
||||
SecondsOnline: 4500,
|
||||
SecondsOffline: 300,
|
||||
Redirect: null.NewNullBool(true),
|
||||
}
|
||||
|
||||
var exampleFailure = &failures.Failure{
|
||||
Id: 1,
|
||||
Issue: "HTTP returned a 500 status code",
|
||||
|
|
|
@ -2,8 +2,10 @@ package notifiers
|
|||
|
||||
import (
|
||||
"github.com/statping/statping/database"
|
||||
"github.com/statping/statping/types/failures"
|
||||
"github.com/statping/statping/types/notifications"
|
||||
"github.com/statping/statping/types/null"
|
||||
"github.com/statping/statping/types/services"
|
||||
"github.com/statping/statping/utils"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -49,12 +51,12 @@ func TestPushoverNotifier(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("Pushover OnFailure", func(t *testing.T) {
|
||||
_, err := Pushover.OnFailure(exampleService, exampleFailure)
|
||||
_, err := Pushover.OnFailure(services.Example(false), failures.Example())
|
||||
assert.Nil(t, err)
|
||||
})
|
||||
|
||||
t.Run("Pushover OnSuccess", func(t *testing.T) {
|
||||
_, err := Pushover.OnSuccess(exampleService)
|
||||
_, err := Pushover.OnSuccess(services.Example(true))
|
||||
assert.Nil(t, err)
|
||||
})
|
||||
|
||||
|
|
|
@ -18,11 +18,6 @@ const (
|
|||
slackMethod = "slack"
|
||||
)
|
||||
|
||||
var (
|
||||
failingTemplate = `{ "blocks": [ { "type": "section", "text": { "type": "mrkdwn", "text": ":warning: The service {{.Service.Name}} is currently offline! :warning:" } }, { "type": "divider" }, { "type": "section", "fields": [ { "type": "mrkdwn", "text": "*Service:*\n{{.Service.Name}}" }, { "type": "mrkdwn", "text": "*URL:*\n{{.Service.Domain}}" }, { "type": "mrkdwn", "text": "*Status Code:*\n{{.Service.LastStatusCode}}" }, { "type": "mrkdwn", "text": "*When:*\n{{.Failure.CreatedAt}}" }, { "type": "mrkdwn", "text": "*Downtime:*\n{{.Service.DowntimeAgo}}" }, { "type": "plain_text", "text": "*Error:*\n{{.Failure.Issue}}" } ] }, { "type": "divider" }, { "type": "actions", "elements": [ { "type": "button", "text": { "type": "plain_text", "text": "View Offline Service", "emoji": true }, "style": "danger", "url": "{{.Core.Domain}}/service/{{.Service.Id}}" }, { "type": "button", "text": { "type": "plain_text", "text": "Go to Statping", "emoji": true }, "url": "{{.Core.Domain}}" } ] } ] }`
|
||||
successTemplate = `{ "blocks": [ { "type": "section", "text": { "type": "mrkdwn", "text": "The service {{.Service.Name}} is back online." } }, { "type": "actions", "elements": [ { "type": "button", "text": { "type": "plain_text", "text": "View Service", "emoji": true }, "style": "primary", "url": "{{.Core.Domain}}/service/{{.Service.Id}}" }, { "type": "button", "text": { "type": "plain_text", "text": "Go to Statping", "emoji": true }, "url": "{{.Core.Domain}}" } ] } ] }`
|
||||
)
|
||||
|
||||
type slack struct {
|
||||
*notifications.Notification
|
||||
}
|
||||
|
@ -40,8 +35,8 @@ var slacker = &slack{¬ifications.Notification{
|
|||
Delay: time.Duration(10 * time.Second),
|
||||
Host: "https://webhooksurl.slack.com/***",
|
||||
Icon: "fab fa-slack",
|
||||
SuccessData: successTemplate,
|
||||
FailureData: failingTemplate,
|
||||
SuccessData: `{ "blocks": [ { "type": "section", "text": { "type": "mrkdwn", "text": "The service {{.Service.Name}} is back online." } }, { "type": "actions", "elements": [ { "type": "button", "text": { "type": "plain_text", "text": "View Service", "emoji": true }, "style": "primary", "url": "{{.Core.Domain}}/service/{{.Service.Id}}" }, { "type": "button", "text": { "type": "plain_text", "text": "Go to Statping", "emoji": true }, "url": "{{.Core.Domain}}" } ] } ] }`,
|
||||
FailureData: `{ "blocks": [ { "type": "section", "text": { "type": "mrkdwn", "text": ":warning: The service {{.Service.Name}} is currently offline! :warning:" } }, { "type": "divider" }, { "type": "section", "fields": [ { "type": "mrkdwn", "text": "*Service:*\n{{.Service.Name}}" }, { "type": "mrkdwn", "text": "*URL:*\n{{.Service.Domain}}" }, { "type": "mrkdwn", "text": "*Status Code:*\n{{.Service.LastStatusCode}}" }, { "type": "mrkdwn", "text": "*When:*\n{{.Failure.CreatedAt}}" }, { "type": "mrkdwn", "text": "*Downtime:*\n{{.Service.DowntimeAgo}}" }, { "type": "plain_text", "text": "*Error:*\n{{.Failure.Issue}}" } ] }, { "type": "divider" }, { "type": "actions", "elements": [ { "type": "button", "text": { "type": "plain_text", "text": "View Offline Service", "emoji": true }, "style": "danger", "url": "{{.Core.Domain}}/service/{{.Service.Id}}" }, { "type": "button", "text": { "type": "plain_text", "text": "Go to Statping", "emoji": true }, "url": "{{.Core.Domain}}" } ] } ] }`,
|
||||
DataType: "json",
|
||||
RequestInfo: "Slack allows you to customize your own messages with many complex components. Checkout the <a target=\"_blank\" href=\"https://api.slack.com/reference/surfaces/formatting\">Slack Message API</a> to learn how you can create your own.",
|
||||
Limits: 60,
|
||||
|
@ -66,7 +61,7 @@ func (s *slack) sendSlack(msg string) (string, error) {
|
|||
|
||||
func (s *slack) OnTest() (string, error) {
|
||||
example := services.Example(true)
|
||||
testMsg := ReplaceVars(failingTemplate, example, nil)
|
||||
testMsg := ReplaceVars(s.SuccessData, example, nil)
|
||||
contents, resp, err := utils.HttpRequest(s.Host, "POST", "application/json", nil, bytes.NewBuffer([]byte(testMsg)), time.Duration(10*time.Second), true, nil)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
@ -80,14 +75,14 @@ func (s *slack) OnTest() (string, error) {
|
|||
|
||||
// OnFailure will trigger failing service
|
||||
func (s *slack) OnFailure(srv *services.Service, f *failures.Failure) (string, error) {
|
||||
msg := ReplaceVars(failingTemplate, srv, f)
|
||||
msg := ReplaceVars(s.FailureData, srv, f)
|
||||
out, err := s.sendSlack(msg)
|
||||
return out, err
|
||||
}
|
||||
|
||||
// OnSuccess will trigger successful service
|
||||
func (s *slack) OnSuccess(srv *services.Service) (string, error) {
|
||||
msg := ReplaceVars(successTemplate, srv, nil)
|
||||
msg := ReplaceVars(s.SuccessData, srv, nil)
|
||||
out, err := s.sendSlack(msg)
|
||||
return out, err
|
||||
}
|
||||
|
|
|
@ -2,8 +2,10 @@ package notifiers
|
|||
|
||||
import (
|
||||
"github.com/statping/statping/database"
|
||||
"github.com/statping/statping/types/failures"
|
||||
"github.com/statping/statping/types/notifications"
|
||||
"github.com/statping/statping/types/null"
|
||||
"github.com/statping/statping/types/services"
|
||||
"github.com/statping/statping/utils"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -47,12 +49,12 @@ func TestSlackNotifier(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("slack OnFailure", func(t *testing.T) {
|
||||
_, err := slacker.OnFailure(exampleService, exampleFailure)
|
||||
_, err := slacker.OnFailure(services.Example(false), failures.Example())
|
||||
assert.Nil(t, err)
|
||||
})
|
||||
|
||||
t.Run("slack OnSuccess", func(t *testing.T) {
|
||||
_, err := slacker.OnSuccess(exampleService)
|
||||
_, err := slacker.OnSuccess(services.Example(true))
|
||||
assert.Nil(t, err)
|
||||
})
|
||||
|
||||
|
|
|
@ -2,8 +2,10 @@ package notifiers
|
|||
|
||||
import (
|
||||
"github.com/statping/statping/database"
|
||||
"github.com/statping/statping/types/failures"
|
||||
"github.com/statping/statping/types/notifications"
|
||||
"github.com/statping/statping/types/null"
|
||||
"github.com/statping/statping/types/services"
|
||||
"github.com/statping/statping/utils"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -53,12 +55,12 @@ func TestTelegramNotifier(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("Telegram OnFailure", func(t *testing.T) {
|
||||
_, err := Telegram.OnFailure(exampleService, exampleFailure)
|
||||
_, err := Telegram.OnFailure(services.Example(false), failures.Example())
|
||||
assert.Nil(t, err)
|
||||
})
|
||||
|
||||
t.Run("Telegram OnSuccess", func(t *testing.T) {
|
||||
_, err := Telegram.OnSuccess(exampleService)
|
||||
_, err := Telegram.OnSuccess(services.Example(true))
|
||||
assert.Nil(t, err)
|
||||
})
|
||||
|
||||
|
|
|
@ -2,8 +2,10 @@ package notifiers
|
|||
|
||||
import (
|
||||
"github.com/statping/statping/database"
|
||||
"github.com/statping/statping/types/failures"
|
||||
"github.com/statping/statping/types/notifications"
|
||||
"github.com/statping/statping/types/null"
|
||||
"github.com/statping/statping/types/services"
|
||||
"github.com/statping/statping/utils"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -53,12 +55,12 @@ func TestTwilioNotifier(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("Twilio OnFailure", func(t *testing.T) {
|
||||
_, err := Twilio.OnFailure(exampleService, exampleFailure)
|
||||
_, err := Twilio.OnFailure(services.Example(false), failures.Example())
|
||||
assert.Nil(t, err)
|
||||
})
|
||||
|
||||
t.Run("Twilio OnSuccess", func(t *testing.T) {
|
||||
_, err := Twilio.OnSuccess(exampleService)
|
||||
_, err := Twilio.OnSuccess(services.Example(true))
|
||||
assert.Nil(t, err)
|
||||
})
|
||||
|
||||
|
|
|
@ -2,8 +2,10 @@ package notifiers
|
|||
|
||||
import (
|
||||
"github.com/statping/statping/database"
|
||||
"github.com/statping/statping/types/failures"
|
||||
"github.com/statping/statping/types/notifications"
|
||||
"github.com/statping/statping/types/null"
|
||||
"github.com/statping/statping/types/services"
|
||||
"github.com/statping/statping/utils"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -45,12 +47,12 @@ func TestWebhookNotifier(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("webhooker OnFailure", func(t *testing.T) {
|
||||
_, err := Webhook.OnFailure(exampleService, exampleFailure)
|
||||
_, err := Webhook.OnFailure(services.Example(false), failures.Example())
|
||||
assert.Nil(t, err)
|
||||
})
|
||||
|
||||
t.Run("webhooker OnSuccess", func(t *testing.T) {
|
||||
_, err := Webhook.OnSuccess(exampleService)
|
||||
_, err := Webhook.OnSuccess(services.Example(true))
|
||||
assert.Nil(t, err)
|
||||
})
|
||||
|
||||
|
|
|
@ -40,6 +40,9 @@ func Select() (*Core, error) {
|
|||
if utils.Params.GetBool("ALLOW_REPORTS") {
|
||||
App.AllowReports = null.NewNullBool(true)
|
||||
}
|
||||
if utils.Params.GetString("LANGUAGE") != "" {
|
||||
App.Language = utils.Params.GetString("LANGUAGE")
|
||||
}
|
||||
return App, q.Error()
|
||||
}
|
||||
|
||||
|
|
|
@ -42,9 +42,10 @@ func SentryInit(v *string, allow bool) {
|
|||
allowReports := Params.GetBool("ALLOW_REPORTS")
|
||||
if allowReports || allow || goEnv == "test" {
|
||||
if err := sentry.Init(sentry.ClientOptions{
|
||||
Dsn: errorReporter,
|
||||
Environment: goEnv,
|
||||
Release: version,
|
||||
Dsn: errorReporter,
|
||||
Environment: goEnv,
|
||||
Release: version,
|
||||
AttachStacktrace: true,
|
||||
}); err != nil {
|
||||
Log.Errorln(err)
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
0.90.53
|
||||
0.90.54
|
||||
|
|
Loading…
Reference in New Issue