mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-12-03 12:14:12 +01:00
@@ -0,0 +1,9 @@
|
||||
import repository from './repository'
|
||||
|
||||
const resource = 'alarms'
|
||||
|
||||
export default {
|
||||
getAll () {
|
||||
return repository.get(`${resource}/`)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<template>
|
||||
<v-card class="mt-6">
|
||||
<v-toolbar flat>
|
||||
<v-menu offset-y>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-btn v-bind="attrs" v-on="on" small>
|
||||
Actions <v-icon right>mdi-chevron-down</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-list dense>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
<v-spacer></v-spacer>
|
||||
<v-text-field
|
||||
v-model="search"
|
||||
prepend-inner-icon="mdi-magnify"
|
||||
placeholder="Search"
|
||||
filled
|
||||
outlined
|
||||
dense
|
||||
hide-details
|
||||
></v-text-field>
|
||||
</v-toolbar>
|
||||
<v-data-table
|
||||
v-model="selected"
|
||||
:headers="headers"
|
||||
:items="alarms"
|
||||
:search="search"
|
||||
item-key="pk"
|
||||
class="elevation-1"
|
||||
show-select
|
||||
>
|
||||
<template v-slot:item.created="{ item }">
|
||||
{{ item.created|date }}
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import alarms from '@/api/alarms'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
alarms: [],
|
||||
headers: [
|
||||
{ text: this.$gettext('Date'), value: 'created' },
|
||||
{ text: this.$gettext('Domain'), value: 'domain.name' },
|
||||
{ text: this.$gettext('Mailbox'), value: 'mailbox.name' },
|
||||
{ text: this.$gettext('Message'), value: 'title' }
|
||||
],
|
||||
search: '',
|
||||
selected: []
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
alarms.getAll().then(resp => {
|
||||
this.alarms = resp.data
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -75,11 +75,22 @@
|
||||
<div class="text-right">
|
||||
<v-menu offset-y>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-btn icon v-bind="attrs" v-on="on">
|
||||
<v-badge
|
||||
v-if="item.opened_alarms_count"
|
||||
bordered
|
||||
color="error"
|
||||
icon="mdi-bell"
|
||||
overlap
|
||||
>
|
||||
<v-btn icon v-bind="attrs" v-on="on">
|
||||
<v-icon>mdi-dots-horizontal</v-icon>
|
||||
</v-btn>
|
||||
</v-badge>
|
||||
<v-btn v-else icon v-bind="attrs" v-on="on">
|
||||
<v-icon>mdi-dots-horizontal</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<menu-items :items="domainMenuItems" :object="item" />
|
||||
<menu-items :items="getDomainMenuItems(item)" :object="item" />
|
||||
</v-menu>
|
||||
</div>
|
||||
</td>
|
||||
@@ -151,11 +162,6 @@ export default {
|
||||
}),
|
||||
data () {
|
||||
return {
|
||||
domainMenuItems: [
|
||||
{ label: this.$gettext('Administrators'), icon: 'mdi-account-supervisor', onClick: this.openAdminList },
|
||||
{ label: this.$gettext('Edit'), icon: 'mdi-circle-edit-outline', onClick: this.editDomain },
|
||||
{ label: this.$gettext('Delete'), icon: 'mdi-delete-outline', onClick: this.deleteDomain, color: 'red' }
|
||||
],
|
||||
headers: [
|
||||
{ text: this.$gettext('Name'), value: 'name' },
|
||||
{ text: this.$gettext('Aliases'), value: 'domainalias_count' },
|
||||
@@ -243,6 +249,22 @@ export default {
|
||||
},
|
||||
showAliases (item) {
|
||||
this.expanded = [{ item }]
|
||||
},
|
||||
getDomainMenuItems (domain) {
|
||||
const result = [
|
||||
{ label: this.$gettext('Administrators'), icon: 'mdi-account-supervisor', onClick: this.openAdminList },
|
||||
{ label: this.$gettext('Edit'), icon: 'mdi-circle-edit-outline', onClick: this.editDomain },
|
||||
{ label: this.$gettext('Delete'), icon: 'mdi-delete-outline', onClick: this.deleteDomain, color: 'red' }
|
||||
]
|
||||
if (domain.opened_alarms_count) {
|
||||
result.push({
|
||||
label: this.$gettext('Alarms'),
|
||||
icon: 'mdi-bell',
|
||||
color: 'red',
|
||||
onClick: () => this.$router.push({ name: 'Alarms' })
|
||||
})
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,6 +174,11 @@ export default {
|
||||
icon: 'mdi-account',
|
||||
roles: ['DomainAdmins', 'Resellers', 'SuperAdmins']
|
||||
},
|
||||
{
|
||||
text: this.$gettext('Alarms'),
|
||||
to: { name: 'Alarms' },
|
||||
icon: 'mdi-bell'
|
||||
},
|
||||
{
|
||||
icon: 'mdi-history',
|
||||
text: this.$gettext('Logs'),
|
||||
|
||||
@@ -110,6 +110,14 @@ const routes = [
|
||||
allowedRoles: ['SuperAdmins']
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/alarms',
|
||||
name: 'Alarms',
|
||||
component: () => import('../views/alarms/Alarms.vue'),
|
||||
meta: {
|
||||
requiresAuth: true
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/logs/audit_trail',
|
||||
name: 'AuditTrail',
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-toolbar flat>
|
||||
<v-toolbar-title><translate>Opened alarms</translate></v-toolbar-title>
|
||||
</v-toolbar>
|
||||
<alarm-list />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AlarmList from '@/components/alarms/AlarmList'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
AlarmList
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.v-toolbar {
|
||||
background-color: #f7f8fa !important;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user