mirror of https://github.com/statping/statping
custom notifier JSON/text, codemirror custom designs for variables, JWT updates
parent
01fea69edc
commit
f2ebe6de9f
|
@ -31,8 +31,8 @@
|
|||
</td>
|
||||
<td>{{$store.getters.servicesInGroup(group.id).length}}</td>
|
||||
<td>
|
||||
<span v-if="group.public" class="badge badge-primary">PUBLIC</span>
|
||||
<span v-if="!group.public" class="badge badge-secondary">PRIVATE</span>
|
||||
<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>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div v-if="$store.state.admin" class="btn-group">
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Username</th>
|
||||
<th scope="col">Type</th>
|
||||
<th scope="col" class="d-none d-md-table-cell">Last Login</th>
|
||||
<th scope="col">{{$t('username')}}</th>
|
||||
<th scope="col">{{$t('type')}}</th>
|
||||
<th scope="col" class="d-none d-md-table-cell">{{ $t('last_login') }}</th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -17,15 +17,15 @@
|
|||
<tr v-for="(user, index) in users" v-bind:key="user.id" >
|
||||
<td>{{user.username}}</td>
|
||||
<td>
|
||||
<span class="badge" :class="{'badge-danger': user.admin, 'badge-primary': !user.admin}">
|
||||
{{user.admin ? 'ADMIN' : 'USER'}}
|
||||
<span class="badge text-uppercase" :class="{'badge-danger': user.admin, 'badge-primary': !user.admin}">
|
||||
{{user.admin ? $t('admin') : $t('user')}}
|
||||
</span>
|
||||
</td>
|
||||
<td class="d-none d-md-table-cell">{{niceDate(user.updated_at)}}</td>
|
||||
<td class="text-right">
|
||||
<div class="btn-group">
|
||||
<a @click.prevent="editUser(user, edit)" href="#" class="btn btn-outline-secondary edit-user">
|
||||
<font-awesome-icon icon="user" /> Edit
|
||||
<font-awesome-icon icon="user" /> {{$t('edit') }}
|
||||
</a>
|
||||
<a @click.prevent="deleteUser(user)" v-if="index !== 0" href="#" class="btn btn-danger delete-user">
|
||||
<font-awesome-icon icon="times" />
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<tr>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col" class="d-none d-md-table-cell">Visibility</th>
|
||||
<th scope="col" class="d-none d-md-table-cell">Group</th>
|
||||
<th scope="col" class="d-none d-md-table-cell">{{ $t('group') }}</th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -17,7 +17,7 @@
|
|||
</td>
|
||||
<td class="d-none d-md-table-cell">
|
||||
<span class="badge" :class="{'badge-primary': service.public, 'badge-secondary': !service.public}">
|
||||
{{service.public ? "PUBLIC" : "PRIVATE"}}
|
||||
{{service.public ? $t('public') : $t('private')}}
|
||||
</span>
|
||||
</td>
|
||||
<td class="d-none d-md-table-cell">
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
</li>
|
||||
</ul>
|
||||
<span class="navbar-text">
|
||||
<a href="#" class="nav-link" @click.prevent="logout">Logout</a>
|
||||
<a href="#" class="nav-link" @click.prevent="logout">{{ $t('top_nav.logout') }}</a>
|
||||
</span>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
|
@ -47,7 +47,9 @@
|
|||
{{intervalpick.text}}
|
||||
</button>
|
||||
<div class="service-tm-menu" :class="{'d-none': !intervalMenu}">
|
||||
<a v-for="(interval, i) in intervals" @click.prevent="changeInterval(interval)" class="dropdown-item" href="#" :class="{'active': intervalpick === interval, 'disabled': disabled_interval(interval)}">{{interval.text}}</a>
|
||||
<a v-for="(interval, i) in intervals" @click.prevent="changeInterval(interval)" class="dropdown-item" href="#" :class="{'active': intervalpick === interval, 'disabled': disabled_interval(interval)}">
|
||||
{{interval.text}}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<span class="d-none float-left d-md-inline">
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
<div class="form-group">
|
||||
<label>{{ $t('setup.language') }}</label>
|
||||
<select v-model="core.language" class="form-control">
|
||||
<select v-model="core.language" v-bind:value="core.language" class="form-control">
|
||||
<option value="en">English</option>
|
||||
<option value="es">Spanish</option>
|
||||
<option value="fr">French</option>
|
||||
|
|
|
@ -6,6 +6,7 @@ const english = {
|
|||
announcements: "Announcements",
|
||||
settings: "Settings",
|
||||
logs: "Logs",
|
||||
logout: 'Logout',
|
||||
},
|
||||
setup: {
|
||||
language: "Language",
|
||||
|
@ -49,15 +50,22 @@ const english = {
|
|||
services: 'Services',
|
||||
domain: 'Domain',
|
||||
online: 'online',
|
||||
public: 'Public',
|
||||
private: 'Private',
|
||||
admin: 'Admin',
|
||||
user: 'User',
|
||||
offline: 'offline',
|
||||
incident: 'incident',
|
||||
group: 'Group',
|
||||
message: 'message',
|
||||
logout: 'logout',
|
||||
edit: 'Edit',
|
||||
type: 'Type',
|
||||
sample_data: 'Sample Data',
|
||||
today: 'Today',
|
||||
last_login: 'Last Login',
|
||||
day: 'day',
|
||||
hour: 'hour',
|
||||
uptime: '{0} Uptime',
|
||||
}
|
||||
|
||||
export default english
|
||||
|
|
|
@ -8,9 +8,7 @@
|
|||
<a 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>
|
||||
|
||||
<GroupServiceFailures :service="service"/>
|
||||
|
||||
<IncidentsBlock :service="service"/>
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<h6 class="mt-4 text-muted">Notifiers</h6>
|
||||
|
||||
<div id="notifiers_tabs">
|
||||
<a v-for="(notifier, index) in notifiers" v-bind:key="`${notifier.method}_${index}`" @click.prevent="changeTab" class="nav-link text-capitalize" v-bind:class="{active: liClass(`v-pills-${notifier.method.toLowerCase()}-tab`)}" v-bind:id="`v-pills-${notifier.method.toLowerCase()}-tab`" data-toggle="pill" v-bind:href="`#v-pills-${notifier.method.toLowerCase()}`" role="tab" v-bind:aria-controls="`v-pills-${notifier.method.toLowerCase()}`" aria-selected="false">
|
||||
<a v-for="(notifier, index) in notifiers" v-bind:key="`${notifier.method}`" @click.prevent="changeTab" class="nav-link text-capitalize" v-bind:class="{active: liClass(`v-pills-${notifier.method.toLowerCase()}-tab`)}" v-bind:id="`v-pills-${notifier.method.toLowerCase()}-tab`" data-toggle="pill" v-bind:href="`#v-pills-${notifier.method.toLowerCase()}`" role="tab" v-bind:aria-controls="`v-pills-${notifier.method.toLowerCase()}`" aria-selected="false">
|
||||
<font-awesome-icon :icon="iconName(notifier.icon)" class="mr-2"/> {{notifier.title}}
|
||||
<span v-if="notifier.enabled" class="badge badge-pill float-right mt-1" :class="{'badge-success': !liClass(`v-pills-${notifier.method.toLowerCase()}-tab`), 'badge-light': liClass(`v-pills-${notifier.method.toLowerCase()}-tab`), 'text-dark': liClass(`v-pills-${notifier.method.toLowerCase()}-tab`)}">ON</span>
|
||||
</a>
|
||||
|
|
|
@ -19,11 +19,6 @@ type discord struct {
|
|||
*notifications.Notification
|
||||
}
|
||||
|
||||
var (
|
||||
successData = `{"content": "Your service '{{.Service.Name}}' is currently online!"}`
|
||||
failureData = `{"content": "Your service '{{.Service.Name}}' is currently failing! Reason: {{.Failure.Issue}}"}`
|
||||
)
|
||||
|
||||
var Discorder = &discord{¬ifications.Notification{
|
||||
Method: "discord",
|
||||
Title: "discord",
|
||||
|
@ -33,8 +28,8 @@ var Discorder = &discord{¬ifications.Notification{
|
|||
Delay: time.Duration(5 * time.Second),
|
||||
Host: "https://discordapp.com/api/webhooks/****/*****",
|
||||
Icon: "fab fa-discord",
|
||||
SuccessData: successData,
|
||||
FailureData: failureData,
|
||||
SuccessData: `{"content": "Your service '{{.Service.Name}}' is currently online!"}`,
|
||||
FailureData: `{"content": "Your service '{{.Service.Name}}' is currently failing! Reason: {{.Failure.Issue}}"}`,
|
||||
DataType: "json",
|
||||
Limits: 60,
|
||||
Form: []notifications.NotificationForm{{
|
||||
|
|
|
@ -21,6 +21,7 @@ func Samples() error {
|
|||
UseCdn: null.NewNullBool(false),
|
||||
Footer: null.NewNullString(""),
|
||||
MigrationId: utils.Now().Unix(),
|
||||
Language: utils.Params.GetString("LANGUAGE"),
|
||||
}
|
||||
|
||||
return core.Create()
|
||||
|
|
|
@ -30,13 +30,16 @@ func (n *Notification) Create() error {
|
|||
if err := db.Create(n).Error(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if p.FailureData == "" || p.SuccessData == "" {
|
||||
p.SuccessData = n.SuccessData
|
||||
if p.FailureData == "" {
|
||||
p.FailureData = n.FailureData
|
||||
if err := p.Update(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if p.SuccessData == "" {
|
||||
p.SuccessData = n.SuccessData
|
||||
}
|
||||
if err := p.Update(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue