From b3195bcd82d6a255c5f80993b9f583a9d5dbe07f Mon Sep 17 00:00:00 2001 From: inportb Date: Wed, 28 Sep 2022 02:03:21 -0400 Subject: [PATCH] Data row filtering --- htdocs/ViewData.vue | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/htdocs/ViewData.vue b/htdocs/ViewData.vue index 4895410..821e52f 100644 --- a/htdocs/ViewData.vue +++ b/htdocs/ViewData.vue @@ -6,16 +6,16 @@ @@ -37,16 +37,25 @@ table.table-sticky tbody tr { border-top: 1px dashed #dee2e6; } + table.table-sticky tbody tr:hover { + border: 1px solid #6c757d; + } td:nth-of-type(odd) { background-color: rgba(0, 0, 0, 0.05); } table.table-sticky tbody th, table.table-sticky th.name { + cursor: default; font-weight: bold; text-align: center; padding-left: 1rem; padding-right: 1rem; } + table.table-sticky th.filtered { + background-color: #6c757d; + color: #fff; + } table.table-sticky th.date { + cursor: default; font-size: 80%; font-weight: normal; text-align: center; @@ -147,11 +156,14 @@ } }, data() { - return {}; + return { + filter_name: null + }; }, computed: { resultset_all() { - return this.resultset_calculated.length > 0 ? this.resultset.concat(this.resultset_calculated) : this.resultset; + var res = this.resultset_calculated.length > 0 ? this.resultset.concat(this.resultset_calculated) : this.resultset; + return this.filter_name ? res.filter(x => x.name == this.filter_name) : res; }, resultset_calculated() { var self = this, snapshots = [], results = [], history, update, item; @@ -230,6 +242,9 @@ return res.join('\n'); } }, + toggle_filter_name(name) { + this.filter_name = this.filter_name != name ? name : null; + }, abnormal_ref(item) { return (item) && (item.flag); },