{{ props.item.customer }}
+ {{ props.item.delayTime }} |
{{ props.item.name }} |
{{ props.item.environment }} |
{{ props.item.reactivateDate }} {{ props.item.reactivateTime }} |
@@ -747,12 +762,14 @@ export default {
data: vm => ({
status: ['true', 'false'],
days: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
+ intervals: ['second','minute', 'hour', 'days'],
search: '',
dialog: false,
active_dialog: false,
headers: [
{ text: i18n.t('Acitve'), value: 'active' },
{ text: i18n.t('Customer'), value: 'customer' },
+ { text: i18n.t('Delay'), value: 'delay' },
{ text: i18n.t('Name'), value: 'Name' },
{ text: i18n.t('Environment'), value: 'environment' },
{ text: i18n.t('Reactivate'), value: 'reactivate' },
@@ -780,6 +797,10 @@ export default {
customer: null,
name: null,
environment: null,
+ timeObj: {
+ time: null,
+ interval: null
+ },
receivers: [],
userIds: [],
groupIds: [],
@@ -811,6 +832,10 @@ export default {
customer: null,
name: null,
environment: null,
+ timeObj: {
+ time: null,
+ interval: null
+ },
receivers: [],
userIds: [],
groupIds: [],
@@ -867,11 +892,16 @@ export default {
).slice(-2)}`
}
let reactivate = b.reactivate ? moment(b.reactivate) : null
+
return Object.assign(
{ ...b },
{
period: period,
+ timeObj: {
+ time: b.delayTime,
+ interval: 'second'
+ },
text:
b.text === null
? ''
@@ -1135,6 +1165,7 @@ export default {
customer: this.editedItem.customer,
name: this.editedItem.name,
environment: this.editedItem.environment,
+ delayTime: this.editedItem.timeObj.time ? `${this.editedItem.timeObj.time} ${this.editedItem.timeObj.interval}` : null,
receivers: this.editedItem.receivers,
userIds: this.editedItem.userIds,
groupIds: this.editedItem.groupIds,
@@ -1167,6 +1198,7 @@ export default {
id: null,
startTime: sTimeStr,
endTime: eTimeStr,
+ delayTime: this.editedItem.timeObj.time ? `${this.editedItem.timeObj.time} ${this.editedItem.timeObj.interval}` : null,
text: this.editedItem.text.replace(/\{([\w\[\]\. ]*)\}/g, '%($1)s')
})
)
diff --git a/src/router.ts b/src/router.ts
index 1d6e480c..88ce2afe 100644
--- a/src/router.ts
+++ b/src/router.ts
@@ -79,6 +79,12 @@ export function createRouter(basePath): VueRouter {
component: () => import(/* webpackChunkName: 'user' */ './views/Blackouts.vue'),
meta: {title: 'Blackouts', requiresAuth: true}
},
+ {
+ path: '/notificationdelays',
+ name: 'notificationdelays',
+ component: () => import(/* webpackChunkName: 'user' */ './views/NotificationDelay.vue'),
+ meta: {title: 'NotificationDelays', requiresAuth: true}
+ },
{
path: '/notificationrules',
name: 'notificationrules',
diff --git a/src/services/api/notificationDelay.service.ts b/src/services/api/notificationDelay.service.ts
new file mode 100644
index 00000000..a2487b2e
--- /dev/null
+++ b/src/services/api/notificationDelay.service.ts
@@ -0,0 +1,13 @@
+import api from './index'
+
+export default {
+ getNotificationDelays(query: object) {
+ let config = {
+ params: {}
+ }
+ return api.get('/notificationdelay', config)
+ },
+ deleteNotificationDelay(id: string) {
+ return api.delete(`/notificationdelay/${id}`)
+ }
+}
diff --git a/src/store/index.ts b/src/store/index.ts
index 49631c88..62b820b2 100644
--- a/src/store/index.ts
+++ b/src/store/index.ts
@@ -6,6 +6,7 @@ import heartbeats from './modules/heartbeats.store'
import blackouts from './modules/blackouts.store'
import notificationRules from './modules/notificationRule.store'
import notificationHistory from './modules/notificationHistory.store'
+import notificationDelays from './modules/notificationDelay.store'
import escalationRules from './modules/escalationRule.store'
import notificationChannels from './modules/notificationChannel.store'
import onCalls from './modules/onCall.store'
@@ -51,6 +52,7 @@ export function createStore(): Store {
heartbeats,
blackouts,
notificationRules,
+ notificationDelays,
notificationHistory,
escalationRules,
notificationChannels,
diff --git a/src/store/modules/notificationDelay.store.ts b/src/store/modules/notificationDelay.store.ts
new file mode 100644
index 00000000..b84369ee
--- /dev/null
+++ b/src/store/modules/notificationDelay.store.ts
@@ -0,0 +1,77 @@
+import NotificationDelayApi from '@/services/api/notificationDelay.service'
+
+const namespaced = true
+
+const state = {
+ isLoading: false,
+
+ notification_delays: [],
+
+ pagination: {
+ page: 1,
+ rowsPerPage: 15,
+ sortBy: 'delay_time',
+ descending: true,
+ rowsPerPageItems: [10, 15, 30, 50, 100, 200]
+ }
+}
+
+const mutations = {
+ SET_LOADING(state) {
+ state.isLoading = true
+ },
+ SET_NOTIFICATION_DELAY(state, [notificationDelays, total, pageSize]) {
+ state.isLoading = false
+ state.notification_delays = notificationDelays
+ state.pagination.totalItems = total
+ state.pagination.rowsPerPage = pageSize
+ },
+ RESET_LOADING(state) {
+ state.isLoading = false
+ },
+ SET_PAGINATION(state, pagination) {
+ state.pagination = Object.assign({}, state.pagination, pagination)
+ }
+}
+
+const actions = {
+ getNotificationDelays({commit, state}) {
+ commit('SET_LOADING')
+ let params = new URLSearchParams()
+
+ // add server-side paging
+ params.append('page', state.pagination.page)
+ params.append('page-size', state.pagination.rowsPerPage)
+
+ // add server-side sort
+ params.append('sort-by', (state.pagination.descending ? '-' : '') + state.pagination.sortBy)
+
+ return NotificationDelayApi.getNotificationDelays(params)
+ .then(({notificationDelays, total, pageSize}) =>
+ commit('SET_NOTIFICATION_DELAY', [notificationDelays, total, pageSize])
+ )
+ .catch(() => commit('RESET_LOADING'))
+ },
+ deleteNotificationDelay({dispatch, commit}, notificationDelayId) {
+ return NotificationDelayApi.deleteNotificationDelay(notificationDelayId).then(response => {
+ dispatch('getNotificationDelays')
+ })
+ },
+ setPagination({commit}, pagination) {
+ commit('SET_PAGINATION', pagination)
+ }
+}
+
+const getters = {
+ pagination: state => {
+ return state.pagination
+ }
+}
+
+export default {
+ namespaced,
+ state,
+ mutations,
+ actions,
+ getters
+}
diff --git a/src/views/NotificationDelay.vue b/src/views/NotificationDelay.vue
new file mode 100644
index 00000000..23e67052
--- /dev/null
+++ b/src/views/NotificationDelay.vue
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+