Commit 4e3d2558 authored by gj4210's avatar gj4210 👽 Committed by janis.streib
Browse files

FIX: EVlog loading check

parent 84557bf8
......@@ -9,13 +9,20 @@
</b-input-group-append>
</b-input-group>
<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-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" :filter-function="filterRecords">
<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>
......@@ -36,7 +43,7 @@ import '@/util/colorutil'
export default {
name: 'EVLogViewer',
components: {Loading, FilterInput},
components: { Loading, FilterInput },
data() {
return {
records: null,
......@@ -68,7 +75,7 @@ export default {
sortable: true
}
],
filter: {text: '', from_date: '', to_date: ''}
filter: { text: '', from_date: '', to_date: '' }
}
},
props: {
......@@ -97,12 +104,11 @@ export default {
const res = await EVLogService.getByFK(this.$store.state.netdb_axios_config, this.ref_obj_fq, this.refobj_id_field, this.refobj_id_value, parseInt(this.top_n))
this.records = res.data[1]
this.record_types = apiutil.dict_by_value_of_array(res.data[2], 'short_name')
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]})
style: 'background: ' + item.ta_timestamp.toHSL({ lit: [30, 40] })
}
},
formatDate(value, key, item) {
......@@ -112,10 +118,14 @@ export default {
return new Date(Date.parse(value)).toLocaleString('de-DE')
},
filterRecords(row, filter) {
window.console.log(filter)
if (!row.data) return false
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 }
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