mirror of https://github.com/statping/statping
parent
1c57f5af53
commit
eb9792d184
|
@ -74,7 +74,7 @@ const webpackConfig = merge(commonConfig, {
|
||||||
threshold: 10240,
|
threshold: 10240,
|
||||||
minRatio: 0.8
|
minRatio: 0.8
|
||||||
}),
|
}),
|
||||||
new webpack.HashedModuleIdsPlugin(),
|
// new webpack.HashedModuleIdsPlugin(),
|
||||||
new HtmlPlugin({
|
new HtmlPlugin({
|
||||||
template: 'public/base.gohtml',
|
template: 'public/base.gohtml',
|
||||||
filename: 'base.gohtml',
|
filename: 'base.gohtml',
|
||||||
|
|
|
@ -14,6 +14,34 @@ A:HOVER {
|
||||||
color: lighten($text-color, 12%) !important;
|
color: lighten($text-color, 12%) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modal-backdrop {
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
position: absolute;
|
||||||
|
display: block;
|
||||||
|
z-index: 10000;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: #00000073;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal {
|
||||||
|
z-index: 999999 !important;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-dialog {
|
||||||
|
top: 20%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header {
|
||||||
|
padding: 0.5rem 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-footer {
|
||||||
|
padding: 0.5rem 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
.text-muted {
|
.text-muted {
|
||||||
color: lighten($text-color, 30%) !important;
|
color: lighten($text-color, 30%) !important;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,13 +81,21 @@
|
||||||
serviceName (service) {
|
serviceName (service) {
|
||||||
return service.name || "Global Message"
|
return service.name || "Global Message"
|
||||||
},
|
},
|
||||||
|
async delete(m) {
|
||||||
|
await Api.message_delete(m.id)
|
||||||
|
const messages = await Api.messages()
|
||||||
|
this.$store.commit('setMessages', messages)
|
||||||
|
},
|
||||||
async deleteMessage(m) {
|
async deleteMessage(m) {
|
||||||
let c = confirm(`Are you sure you want to delete message '${m.title}'?`)
|
const modal = {
|
||||||
if (c) {
|
visible: true,
|
||||||
await Api.message_delete(m.id)
|
title: "Delete Announcement",
|
||||||
const messages = await Api.messages()
|
body: `Are you sure you want to delete Announcement ${m.title}?`,
|
||||||
this.$store.commit('setMessages', messages)
|
btnColor: "btn-danger",
|
||||||
|
btnText: "Delete Announcement",
|
||||||
|
func: () => this.delete(m),
|
||||||
}
|
}
|
||||||
|
this.$store.commit("setModal", modal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
|
|
||||||
<div class="card contain-card mb-4">
|
<div class="card contain-card mb-4">
|
||||||
<div class="card-header">{{ $t('top_nav.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-success float-right">
|
<router-link v-if="$store.state.admin" to="/dashboard/create_service" class="btn btn-sm btn-success float-right">
|
||||||
|
@ -67,6 +68,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
const Modal = () => import(/* webpackChunkName: "dashboard" */ "@/components/Elements/Modal")
|
||||||
const FormGroup = () => import(/* webpackChunkName: "dashboard" */ '@/forms/Group')
|
const FormGroup = () => import(/* webpackChunkName: "dashboard" */ '@/forms/Group')
|
||||||
const ToggleSwitch = () => import(/* webpackChunkName: "dashboard" */ '@/forms/ToggleSwitch')
|
const ToggleSwitch = () => import(/* webpackChunkName: "dashboard" */ '@/forms/ToggleSwitch')
|
||||||
const ServicesList = () => import(/* webpackChunkName: "dashboard" */ '@/components/Dashboard/ServicesList')
|
const ServicesList = () => import(/* webpackChunkName: "dashboard" */ '@/components/Dashboard/ServicesList')
|
||||||
|
@ -76,6 +78,7 @@
|
||||||
export default {
|
export default {
|
||||||
name: 'DashboardServices',
|
name: 'DashboardServices',
|
||||||
components: {
|
components: {
|
||||||
|
Modal,
|
||||||
ServicesList,
|
ServicesList,
|
||||||
ToggleSwitch,
|
ToggleSwitch,
|
||||||
FormGroup,
|
FormGroup,
|
||||||
|
@ -112,13 +115,24 @@
|
||||||
this.group = g
|
this.group = g
|
||||||
this.edit = !mode
|
this.edit = !mode
|
||||||
},
|
},
|
||||||
|
confirm_delete(service) {
|
||||||
|
|
||||||
|
},
|
||||||
|
async delete(g) {
|
||||||
|
await Api.group_delete(g.id)
|
||||||
|
const groups = await Api.groups()
|
||||||
|
this.$store.commit('setGroups', groups)
|
||||||
|
},
|
||||||
async deleteGroup(g) {
|
async deleteGroup(g) {
|
||||||
let c = confirm(`Are you sure you want to delete '${g.name}'?`)
|
const modal = {
|
||||||
if (c) {
|
visible: true,
|
||||||
await Api.group_delete(g.id)
|
title: "Delete Group",
|
||||||
const groups = await Api.groups()
|
body: `Are you sure you want to delete group ${g.name}? All services attached will be removed from this group.`,
|
||||||
this.$store.commit('setGroups', groups)
|
btnColor: "btn-danger",
|
||||||
}
|
btnText: "Delete Group",
|
||||||
|
func: () => this.delete(g),
|
||||||
|
}
|
||||||
|
this.$store.commit("setModal", modal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,13 +74,21 @@
|
||||||
this.user = u
|
this.user = u
|
||||||
this.edit = !mode
|
this.edit = !mode
|
||||||
},
|
},
|
||||||
|
async delete(u) {
|
||||||
|
await Api.user_delete(u.id)
|
||||||
|
const users = await Api.users()
|
||||||
|
this.$store.commit('setUsers', users)
|
||||||
|
},
|
||||||
async deleteUser(u) {
|
async deleteUser(u) {
|
||||||
let c = confirm(`Are you sure you want to delete user '${u.username}'?`)
|
const modal = {
|
||||||
if (c) {
|
visible: true,
|
||||||
await Api.user_delete(u.id)
|
title: "Delete User",
|
||||||
const users = await Api.users()
|
body: `Are you sure you want to delete user ${u.username}?`,
|
||||||
this.$store.commit('setUsers', users)
|
btnColor: "btn-danger",
|
||||||
|
btnText: "Delete User",
|
||||||
|
func: () => this.delete(u),
|
||||||
}
|
}
|
||||||
|
this.$store.commit("setModal", modal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,14 +151,22 @@ export default {
|
||||||
await this.gotoPage(1)
|
await this.gotoPage(1)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
async delete() {
|
||||||
|
await Api.service_failures_delete(this.service)
|
||||||
|
this.service = await Api.service(this.service.id)
|
||||||
|
this.total = 0
|
||||||
|
await this.load()
|
||||||
|
},
|
||||||
async deleteFailures() {
|
async deleteFailures() {
|
||||||
const c = confirm('Are you sure you want to delete all failures?')
|
const modal = {
|
||||||
if (c) {
|
visible: true,
|
||||||
await Api.service_failures_delete(this.service)
|
title: "Delete All Failures",
|
||||||
this.service = await Api.service(this.service.id)
|
body: `Are you sure you want to delete all Failures for service ${this.service.title}?`,
|
||||||
this.total = 0
|
btnColor: "btn-danger",
|
||||||
await this.load()
|
btnText: "Delete Failures",
|
||||||
|
func: () => this.delete(),
|
||||||
}
|
}
|
||||||
|
this.$store.commit("setModal", modal)
|
||||||
},
|
},
|
||||||
async gotoPage(page) {
|
async gotoPage(page) {
|
||||||
this.page = page;
|
this.page = page;
|
||||||
|
|
|
@ -80,15 +80,23 @@ const FormIncidentUpdates = () => import(/* webpackChunkName: "dashboard" */ '@/
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
|
async delete(i) {
|
||||||
|
this.res = await Api.incident_delete(i)
|
||||||
|
if (this.res.status === "success") {
|
||||||
|
this.incidents = this.incidents.filter(obj => obj.id !== i.id);
|
||||||
|
//await this.loadIncidents()
|
||||||
|
}
|
||||||
|
},
|
||||||
async deleteIncident(incident) {
|
async deleteIncident(incident) {
|
||||||
let c = confirm(`Are you sure you want to delete '${incident.title}'?`)
|
const modal = {
|
||||||
if (c) {
|
visible: true,
|
||||||
this.res = await Api.incident_delete(incident)
|
title: "Delete Incident",
|
||||||
if (this.res.status === "success") {
|
body: `Are you sure you want to delete Incident ${incident.title}?`,
|
||||||
this.incidents = this.incidents.filter(obj => obj.id !== incident.id); // this is better in terms of not having to querry the db to get a fresh copy of all updates
|
btnColor: "btn-danger",
|
||||||
//await this.loadIncidents()
|
btnText: "Delete Incident",
|
||||||
} // TODO: further error checking here... maybe alert user it failed with modal or so
|
func: () => this.delete(incident),
|
||||||
}
|
}
|
||||||
|
this.$store.commit("setModal", modal)
|
||||||
},
|
},
|
||||||
|
|
||||||
async createIncident() {
|
async createIncident() {
|
||||||
|
|
|
@ -72,12 +72,14 @@
|
||||||
<script>
|
<script>
|
||||||
import Api from "../../API";
|
import Api from "../../API";
|
||||||
import ServiceSparkList from "@/components/Service/ServiceSparkList";
|
import ServiceSparkList from "@/components/Service/ServiceSparkList";
|
||||||
|
import Modal from "@/components/Elements/Modal";
|
||||||
const draggable = () => import(/* webpackChunkName: "dashboard" */ 'vuedraggable')
|
const draggable = () => import(/* webpackChunkName: "dashboard" */ 'vuedraggable')
|
||||||
const ToggleSwitch = () => import(/* webpackChunkName: "dashboard" */ '../../forms/ToggleSwitch');
|
const ToggleSwitch = () => import(/* webpackChunkName: "dashboard" */ '../../forms/ToggleSwitch');
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ServicesList',
|
name: 'ServicesList',
|
||||||
components: {
|
components: {
|
||||||
|
Modal,
|
||||||
ServiceSparkList,
|
ServiceSparkList,
|
||||||
ToggleSwitch,
|
ToggleSwitch,
|
||||||
draggable
|
draggable
|
||||||
|
@ -159,14 +161,25 @@ export default {
|
||||||
await Api.services_reorder(data)
|
await Api.services_reorder(data)
|
||||||
await this.update()
|
await this.update()
|
||||||
},
|
},
|
||||||
|
tester(s) {
|
||||||
|
console.log(s)
|
||||||
|
},
|
||||||
|
async delete(s) {
|
||||||
|
this.loading = true
|
||||||
|
await Api.service_delete(s.id)
|
||||||
|
await this.update()
|
||||||
|
this.loading = false
|
||||||
|
},
|
||||||
async deleteService(s) {
|
async deleteService(s) {
|
||||||
let c = confirm(`Are you sure you want to delete '${s.name}'?`)
|
const modal = {
|
||||||
if (c) {
|
visible: true,
|
||||||
this.loading = true
|
title: "Delete Service",
|
||||||
await Api.service_delete(s.id)
|
body: `Are you sure you want to delete service ${s.name}? This will also delete all failures, checkins, and incidents for this service.`,
|
||||||
await this.update()
|
btnColor: "btn-danger",
|
||||||
this.loading = false
|
btnText: "Delete Service",
|
||||||
}
|
func: () => this.delete(s),
|
||||||
|
}
|
||||||
|
this.$store.commit("setModal", modal)
|
||||||
},
|
},
|
||||||
serviceGroup(s) {
|
serviceGroup(s) {
|
||||||
let group = this.$store.getters.groupById(s.group_id)
|
let group = this.$store.getters.groupById(s.group_id)
|
||||||
|
|
|
@ -144,14 +144,22 @@ import('codemirror/mode/css/css.js')
|
||||||
this.pending = false
|
this.pending = false
|
||||||
await this.fetchTheme()
|
await this.fetchTheme()
|
||||||
},
|
},
|
||||||
|
async delete() {
|
||||||
|
this.pending = true
|
||||||
|
const resp = await Api.theme_generate(false)
|
||||||
|
await this.fetchTheme()
|
||||||
|
this.pending = false
|
||||||
|
},
|
||||||
async deleteAssets() {
|
async deleteAssets() {
|
||||||
this.pending = true
|
const modal = {
|
||||||
let c = confirm('Are you sure you want to delete all local assets?')
|
visible: true,
|
||||||
if (c) {
|
title: "Delete Local Assets",
|
||||||
const resp = await Api.theme_generate(false)
|
body: `Are you sure you want to delete all local assets?`,
|
||||||
await this.fetchTheme()
|
btnColor: "btn-danger",
|
||||||
}
|
btnText: "Delete",
|
||||||
this.pending = false
|
func: () => this.delete(),
|
||||||
|
}
|
||||||
|
this.$store.commit("setModal", modal)
|
||||||
},
|
},
|
||||||
async saveAssets() {
|
async saveAssets() {
|
||||||
this.pending = true
|
this.pending = true
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
<template>
|
||||||
|
<div v-if="modal.visible" class="modal d-block" tabindex="-1">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title">{{modal.title}}</h5>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p>{{modal.body}}</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button @click.prevent="close" type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||||
|
<button @click.prevent="runFunc" type="button" :class="`btn ${modal.btnColor}`">{{modal.btnText}}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "Modal",
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
modal() {
|
||||||
|
return this.$store.getters.modal
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
runFunc() {
|
||||||
|
this.$store.getters.modal.func()
|
||||||
|
this.close()
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.$store.commit("setModal", {visible: false})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
|
@ -149,11 +149,11 @@
|
||||||
|
|
||||||
<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.reverse()" 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 '{{$store.getters.serviceById(log.service).name}}'
|
Service {{log.service}}
|
||||||
{{log.success ? "Success Triggered" : "Failure Triggered"}}
|
{{log.success ? "Success Triggered" : "Failure Triggered"}}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<div class="bg-white p-3 small mt-2">
|
<div v-if="log.message !== ''" class="bg-white p-3 small mt-2">
|
||||||
<code>{{log.message}}</code>
|
<code>{{log.message}}</code>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,20 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="container col-md-7 col-sm-12 mt-md-5">
|
<div class="container col-md-7 col-sm-12 mt-md-5">
|
||||||
|
<div v-if="modal" class="modal-backdrop"></div>
|
||||||
|
<Modal/>
|
||||||
<TopNav :admin="admin"/>
|
<TopNav :admin="admin"/>
|
||||||
<router-view :admin="admin"/>
|
<router-view :admin="admin"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import Modal from "@/components/Elements/Modal";
|
||||||
const TopNav = () => import(/* webpackChunkName: "dashboard" */ '@/components/Dashboard/TopNav')
|
const TopNav = () => import(/* webpackChunkName: "dashboard" */ '@/components/Dashboard/TopNav')
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Dashboard',
|
name: 'Dashboard',
|
||||||
components: {
|
components: {
|
||||||
|
Modal,
|
||||||
TopNav,
|
TopNav,
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
|
@ -20,6 +24,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
modal() {
|
||||||
|
return this.$store.getters.modal.visible
|
||||||
|
},
|
||||||
admin() {
|
admin() {
|
||||||
return this.$store.getters.admin
|
return this.$store.getters.admin
|
||||||
},
|
},
|
||||||
|
|
|
@ -189,15 +189,23 @@
|
||||||
liClass(id) {
|
liClass(id) {
|
||||||
return this.tab === id
|
return this.tab === id
|
||||||
},
|
},
|
||||||
|
async renew() {
|
||||||
|
await Api.renewApiKeys()
|
||||||
|
const core = await Api.core()
|
||||||
|
this.$store.commit('setCore', core)
|
||||||
|
this.core = core
|
||||||
|
await this.logout()
|
||||||
|
},
|
||||||
async renewApiKeys() {
|
async renewApiKeys() {
|
||||||
let r = confirm("Are you sure you want to reset the API keys? You will be logged out.");
|
const modal = {
|
||||||
if (r === true) {
|
visible: true,
|
||||||
await Api.renewApiKeys()
|
title: "Reset API Key",
|
||||||
const core = await Api.core()
|
body: `Are you sure you want to reset the API keys? You will be logged out.`,
|
||||||
this.$store.commit('setCore', core)
|
btnColor: "btn-danger",
|
||||||
this.core = core
|
btnText: "Reset",
|
||||||
await this.logout()
|
func: () => this.renew(),
|
||||||
}
|
}
|
||||||
|
this.$store.commit("setModal", modal)
|
||||||
},
|
},
|
||||||
async logout () {
|
async logout () {
|
||||||
await Api.logout()
|
await Api.logout()
|
||||||
|
|
|
@ -31,7 +31,15 @@ export default new Vuex.Store({
|
||||||
checkins: [],
|
checkins: [],
|
||||||
admin: false,
|
admin: false,
|
||||||
user: false,
|
user: false,
|
||||||
loggedIn: false
|
loggedIn: false,
|
||||||
|
modal: {
|
||||||
|
visible: false,
|
||||||
|
title: "Modal Header",
|
||||||
|
body: "This is the content for the modal body",
|
||||||
|
btnText: "Save Changes",
|
||||||
|
btnColor: "btn-primary",
|
||||||
|
func: null,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
hasAllData: state => state.hasAllData,
|
hasAllData: state => state.hasAllData,
|
||||||
|
@ -49,6 +57,7 @@ export default new Vuex.Store({
|
||||||
notifiers: state => state.notifiers,
|
notifiers: state => state.notifiers,
|
||||||
checkins: state => state.checkins,
|
checkins: state => state.checkins,
|
||||||
loggedIn: state => state.loggedIn,
|
loggedIn: state => state.loggedIn,
|
||||||
|
modal: state => state.modal,
|
||||||
|
|
||||||
isAdmin: state => state.admin,
|
isAdmin: state => state.admin,
|
||||||
isUser: state => state.user,
|
isUser: state => state.user,
|
||||||
|
@ -140,6 +149,9 @@ export default new Vuex.Store({
|
||||||
setOAuth(state, oauth) {
|
setOAuth(state, oauth) {
|
||||||
state.oauth = oauth
|
state.oauth = oauth
|
||||||
},
|
},
|
||||||
|
setModal(state, modal) {
|
||||||
|
state.modal = modal
|
||||||
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
async getAllServices(context) {
|
async getAllServices(context) {
|
||||||
|
|
Loading…
Reference in New Issue