Highlight selected transaction in transactions log

Test: Visual
Change-Id: I7b6043220c1875aaf90c25451a7a1d2e084a46ff
This commit is contained in:
Pablo Gamito
2020-07-23 19:26:24 +01:00
parent 108b5eb44a
commit c4923eba86
2 changed files with 29 additions and 5 deletions

View File

@@ -1,5 +1,11 @@
<template> <template>
<div class="entry" :class="{inactive: source.timestamp > currentTimestamp}" @click="onClick(source)"> <div class="entry"
:class="{
inactive: source.timestamp > currentTimestamp,
selected: isSelected
}"
@click="onClick(source)"
>
<div class="time-column"> <div class="time-column">
<a @click="setTimelineTime(source.timestamp)" class="time-link"> <a @click="setTimelineTime(source.timestamp)" class="time-link">
{{source.time}} {{source.time}}
@@ -29,7 +35,7 @@ export default {
name: 'transaction-entry', name: 'transaction-entry',
props: { props: {
index: { index: {
type: Number type: Number,
}, },
source: { source: {
type: Object, type: Object,
@@ -40,11 +46,17 @@ export default {
onClick: { onClick: {
type: Function, type: Function,
}, },
selectedTransaction: {
type: Object,
}
}, },
computed: { computed: {
currentTimestamp() { currentTimestamp() {
return this.$store.state.currentTimestamp; return this.$store.state.currentTimestamp;
} },
isSelected() {
return this.source === this.selectedTransaction;
},
}, },
methods: { methods: {
setTimelineTime(timestamp) { setTimelineTime(timestamp) {
@@ -119,7 +131,16 @@ export default {
cursor: pointer; cursor: pointer;
} }
.entry:hover { .entry.selected {
background-color: #365179;
color: white;
}
.entry.selected a {
color: white;
}
.entry:not(.selected):hover {
background: #f1f1f1; background: #f1f1f1;
} }

View File

@@ -41,7 +41,7 @@
:data-key="'timestamp'" :data-key="'timestamp'"
:data-sources="filteredData" :data-sources="filteredData"
:data-component="transactionEntryComponent" :data-component="transactionEntryComponent"
:extra-props="{'onClick': transactionSelected}" :extra-props="{onClick: transactionSelected, selectedTransaction }"
ref="loglist" ref="loglist"
/> />
</flat-card> </flat-card>
@@ -102,6 +102,7 @@ export default {
selectedTree: null, selectedTree: null,
filters: [], filters: [],
selectedProperty: null, selectedProperty: null,
selectedTransaction: null,
transactionEntryComponent: TransactionEntry, transactionEntryComponent: TransactionEntry,
}; };
}, },
@@ -167,6 +168,8 @@ export default {
return changeObject; return changeObject;
}, },
transactionSelected(transaction) { transactionSelected(transaction) {
this.selectedTransaction = transaction;
let obj = this.removeNullFields(transaction.obj); let obj = this.removeNullFields(transaction.obj);
let name = transaction.type; let name = transaction.type;