From 79b38e0e7bf7247da499e7f1266d3e674bfafd55 Mon Sep 17 00:00:00 2001 From: Nelson Chan Date: Mon, 26 Jun 2023 13:23:06 +0800 Subject: [PATCH] Feat: Improve monitorList filtering --- src/components/MonitorList.vue | 90 ++++-- src/components/MonitorListFilter.vue | 283 +++++++++++++++++++ src/components/MonitorListFilterDropdown.vue | 131 +++++++++ src/mixins/socket.js | 5 +- 4 files changed, 490 insertions(+), 19 deletions(-) create mode 100644 src/components/MonitorListFilter.vue create mode 100644 src/components/MonitorListFilterDropdown.vue diff --git a/src/components/MonitorList.vue b/src/components/MonitorList.vue index c69169cc..9ee46e24 100644 --- a/src/components/MonitorList.vue +++ b/src/components/MonitorList.vue @@ -1,17 +1,25 @@ @@ -159,8 +205,6 @@ export default { margin: -10px; margin-bottom: 10px; padding: 10px; - display: flex; - justify-content: space-between; .dark & { background-color: $dark-header-bg; @@ -168,6 +212,17 @@ export default { } } +.header-top { + display: flex; + justify-content: space-between; + align-items: center; +} + +.header-filter { + display: flex; + align-items: center; +} + @media (max-width: 770px) { .list-header { margin: -20px; @@ -216,5 +271,4 @@ export default { padding-left: 67px; margin-top: 5px; } - diff --git a/src/components/MonitorListFilter.vue b/src/components/MonitorListFilter.vue new file mode 100644 index 00000000..022f7d91 --- /dev/null +++ b/src/components/MonitorListFilter.vue @@ -0,0 +1,283 @@ + + + + + diff --git a/src/components/MonitorListFilterDropdown.vue b/src/components/MonitorListFilterDropdown.vue new file mode 100644 index 00000000..adf3d6b3 --- /dev/null +++ b/src/components/MonitorListFilterDropdown.vue @@ -0,0 +1,131 @@ + + + + + diff --git a/src/mixins/socket.js b/src/mixins/socket.js index e2834251..8e078b10 100644 --- a/src/mixins/socket.js +++ b/src/mixins/socket.js @@ -693,9 +693,11 @@ export default { stats() { let result = { + active: 0, up: 0, down: 0, maintenance: 0, + pending: 0, unknown: 0, pause: 0, }; @@ -707,12 +709,13 @@ export default { if (monitor && ! monitor.active) { result.pause++; } else if (beat) { + result.active++; if (beat.status === UP) { result.up++; } else if (beat.status === DOWN) { result.down++; } else if (beat.status === PENDING) { - result.up++; + result.pending++; } else if (beat.status === MAINTENANCE) { result.maintenance++; } else {