summaryrefslogtreecommitdiffstats
path: root/webapp/src/components/LogModule.vue
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/src/components/LogModule.vue')
-rw-r--r--webapp/src/components/LogModule.vue70
1 files changed, 37 insertions, 33 deletions
diff --git a/webapp/src/components/LogModule.vue b/webapp/src/components/LogModule.vue
index 05e9a30..173b70e 100644
--- a/webapp/src/components/LogModule.vue
+++ b/webapp/src/components/LogModule.vue
@@ -12,10 +12,9 @@
"category": "Category",
"categories": "Categories",
"description": "Description",
- "group": "Group",
"groups": "Groups",
- "client": "Client",
"clients": "Clients",
+ "users": "Users",
"includeSubgroups": "Include Subgroups"
},
"de": {
@@ -30,10 +29,9 @@
"category": "Kategorie",
"categories": "Kategorien",
"description": "Beschreibung",
- "group": "Gruppe",
"groups": "Gruppen",
- "client": "Client",
"clients": "Clients",
+ "users": "Benutzer",
"includeSubgroups": "Inklusive Untergruppen"
}
}
@@ -58,7 +56,7 @@
<select-box
class="select-box"
v-model="categoryFilter"
- :items="categories"
+ :items="CATEGORIES"
:max-columns="selectBoxColumnCount"
prepend-icon="all_inbox"
:label="$t('categories')"
@@ -147,7 +145,7 @@
v-model="groupFilter"
:items="groupList"
:max-columns="selectBoxColumnCount"
- prepend-icon="device_hub"
+ prepend-icon="category"
:label="$t('groups')"
hide-details
></select-box>
@@ -171,7 +169,11 @@
</v-card>
<v-subheader>{{ $t('log') }}</v-subheader>
<v-card>
- <data-table :headers="headers" :items="log" min-width="1100px" no-select no-sort></data-table>
+ <data-table :headers="headers" :items="log" min-width="900px" no-select no-sort :row-count="-1">
+ <template #description="{ item }">
+ <log-module-entry :item="item"></log-module-entry>
+ </template>
+ </data-table>
</v-card>
</v-tab-item>
</v-tabs-items>
@@ -181,6 +183,7 @@
</template>
<script>
+import LogModuleEntry from '@/components/LogModuleEntry'
import SelectBox from '@/components/SelectBox'
import DataTable from '@/components/DataTable'
import { mapState, mapGetters } from 'vuex'
@@ -188,20 +191,22 @@ import { mapState, mapGetters } from 'vuex'
export default {
name: 'LogModule',
components: {
+ LogModuleEntry,
SelectBox,
DataTable
},
data () {
return {
+ CATEGORIES: [
+ { id: 1, name: 'CLIENT_REGISTRATION' },
+ { id: 2, name: 'BACKEND_ERROR' }
+ ],
tabs: 0,
- categories: [],
log: [],
headers: [
{ key: 'timestamp', text: this.$t('timestamp'), width: '160px' },
{ key: 'category', text: this.$t('category'), width: '160px' },
- { key: 'description', text: this.$t('description') },
- { key: 'group', text: this.$t('group'), width: '180px' },
- { key: 'client', text: this.$t('client'), width: '180px' }
+ { key: 'description', searchKey: 'searchString', text: this.$t('description') }
],
loading: false,
fromDate: null,
@@ -266,8 +271,26 @@ export default {
this.$http.get('/api/log').then(response => {
response.data.forEach(item => {
item.timestamp = new Date(item.timestamp * 1000).toISOString().split('.')[0].replace('T', ' ')
- if (item.group) item.group = item.group.name
- if (item.client) item.client = item.client.name
+ item.searchString = ''
+ // Only show first line of the description
+ if (item.description) {
+ item.searchString += item.description + '\n'
+ const desc = item.description.split('\n')
+ if (desc.length > 1) item.multilineDescription = item.description
+ item.description = desc[0]
+ }
+ // Add client/group/user info to the search string
+ if (item.client) for (let key in item.client) item.searchString += item.client[key] + '\n'
+ if (item.group) for (let key in item.group) item.searchString += item.group[key] + '\n'
+ if (item.user) for (let key in item.user) item.searchString += item.user[key] + '\n'
+ // Add snapshot info to the search string
+ if (item.clientSnapshot) for (let key in item.clientSnapshot) item.searchString += item.clientSnapshot[key] + '\n'
+ if (item.groupSnapshot) for (let key in item.groupSnapshot) item.searchString += item.groupSnapshot[key] + '\n'
+ if (item.userSnapshot) for (let key in item.userSnapshot) item.searchString += item.userSnapshot[key] + '\n'
+ // Add client/group/user object for deleted clients/groups/users
+ if (item.clientSnapshot && !item.client) item.client = { name: item.clientSnapshot.id, deleted: true }
+ if (item.groupSnapshot && !item.group) item.group = { name: item.groupSnapshot.id, deleted: true }
+ if (item.userSnapshot && !item.user) item.user = { name: item.userSnapshot.id, deleted: true }
})
this.log = response.data
this.loading = false
@@ -275,15 +298,12 @@ export default {
}
},
created () {
- this.$store.dispatch('groups/loadLists')
- this.$http.get('/api/log/categories').then(response => {
- this.categories = response.data.map((category, index) => ({ id: index, name: category }))
- })
const date = new Date()
date.setDate(date.getDate() - 7)
this.fromDate = this.formatDate(this.defaultStartDate, { time: false })
this.fromTime = this.formatDate(this.defaultStartDate, { date: false, seconds: false })
this.loadLog()
+ this.$store.dispatch('groups/loadLists')
}
}
</script>
@@ -309,20 +329,4 @@ export default {
min-width: 70px;
width: 70px;
}
-
-.search-wrapper {
- display: flex;
- align-items: center;
-}
-
-.search-box {
- flex: 1;
-}
-
-.toggle-button {
- min-width: 36px;
- text-transform: none;
- font-size: 14px;
- font-weight: 600;
-}
</style>