diff --git a/server/model/monitor.js b/server/model/monitor.js index fb71f7546..26da3f34c 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -167,7 +167,7 @@ class Monitor extends BeanModel { async isActive() { const parentActive = await Monitor.isParentActive(this.id); - return this.active && parentActive; + return (this.active === 1) && parentActive; } /** diff --git a/src/components/MonitorList.vue b/src/components/MonitorList.vue index c69169ccf..9ee46e243 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 000000000..dbb1eb940 --- /dev/null +++ b/src/components/MonitorListFilter.vue @@ -0,0 +1,284 @@ + + + + + diff --git a/src/components/MonitorListFilterDropdown.vue b/src/components/MonitorListFilterDropdown.vue new file mode 100644 index 000000000..01b9678f9 --- /dev/null +++ b/src/components/MonitorListFilterDropdown.vue @@ -0,0 +1,131 @@ + + + + + diff --git a/src/lang/en.json b/src/lang/en.json index bc4f9ce33..ceafe06cd 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -155,6 +155,8 @@ "Disable 2FA": "Disable 2FA", "2FA Settings": "2FA Settings", "Two Factor Authentication": "Two Factor Authentication", + "filterActive": "Active", + "filterActivePaused": "Paused", "Active": "Active", "Inactive": "Inactive", "Token": "Token", diff --git a/src/lang/zh-HK.json b/src/lang/zh-HK.json index fd5d35e36..aa43caa53 100644 --- a/src/lang/zh-HK.json +++ b/src/lang/zh-HK.json @@ -139,6 +139,8 @@ "Disable 2FA": "關閉 2FA", "2FA Settings": "2FA 設定", "Two Factor Authentication": "雙重認證", + "filterActive": "執行狀態", + "filterActivePaused": "已暫停", "Active": "生效", "Inactive": "未生效", "Token": "Token", diff --git a/src/mixins/socket.js b/src/mixins/socket.js index e2834251a..8e078b100 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 {