Commit a61976a0 authored by Robert's avatar Robert 👽
Browse files

ADD: Date range filtering for EVlog

parent cb290051
Pipeline #150211 passed with stages
in 6 minutes and 19 seconds
......@@ -2,16 +2,20 @@
<b-modal size="xl" ok-title="Schließen" :title="'Eventlog: ' + title" :ok-only="true" :id="modal_id"
@show="fetchData()">
<b-form @submit="fetchData">
<b-input-group prepend="# Transaktionen" class="shadow">
<b-input-group prepend="# Transaktionen laden" class="shadow">
<b-form-input type="number" v-model="top_n"/>
<b-input-group-append>
<b-button type="submit" variant="success" @click="fetchData">Aktualisieren</b-button>
</b-input-group-append>
</b-input-group>
<FilterInput v-model="filter"/>
<b-input-group prepend="Datum eingrenzen" class="mt-3 shadow">
<b-form-datepicker v-model="filter.from_date" label-no-date-selected="Kein Datum ausgewählt" label-help="Sie können auch mit den Pfeiltasten auswählen." locale="de" placeholder="Von" today-button reset-button label-today-button="Heute auswählen" label-reset-button="Grenze löschen"/>
<b-form-datepicker v-model="filter.to_date" label-no-date-selected="Kein Datum ausgewählt" label-help="Sie können auch mit den Pfeiltasten auswählen." locale="de" placeholder="Bis" today-button reset-button label-today-button="Heute auswählen" label-reset-button="Grenze löschen"/>
</b-input-group>
<FilterInput v-model="filter.text"/>
</b-form>
<Loading :data="[records]">
<b-table :responsive="true" striped :items="records" :fields="table_fields" :filter="filter">
<b-table :responsive="true" striped :items="records" :fields="table_fields" :filter="filter" :filter-function="filterRecords">
<template v-slot:cell(data)="data">
<span style="white-space: pre-wrap">{{ data.item.data }}</span>
</template>
......@@ -64,7 +68,7 @@ export default {
sortable: true
}
],
filter: ''
filter: {text: '', from_date: '', to_date: ''}
}
},
props: {
......@@ -96,13 +100,26 @@ export default {
window.console.log(this.records)
},
ta_color(value, key, item, type) {
return {title: 'Aktionen aus einer Transaktion erhalten die selbe Farbe.', style: 'background: ' + item.ta_timestamp.toHSL({lit: [30, 40]})}
return {
title: 'Aktionen aus einer Transaktion erhalten die selbe Farbe.',
style: 'background: ' + item.ta_timestamp.toHSL({lit: [30, 40]})
}
},
formatDate(value, key, item) {
if (value == null) {
return 'N/A'
}
return new Date(Date.parse(value)).toLocaleString('de-DE')
},
filterRecords(row, filter) {
window.console.log(filter)
if (row.data.includes(filter.text) || row.type.includes(filter.text) || row.ta_timestamp.includes(filter.text) || (row.mgr_login_name != null && row.mgr_login_name.includes(filter.text))) {
if (filter.from_date !== '' && (Date.parse(row.ta_timestamp) < Date.parse(filter.from_date))) { return false }
if (filter.to_date !== '' && (Date.parse(row.ta_timestamp) > Date.parse(filter.to_date))) { return false }
return true
} else {
return false
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment