diff --git a/server/model/monitor.js b/server/model/monitor.js index 17722f9fe..b784eed3c 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -1418,7 +1418,7 @@ class Monitor extends BeanModel { } /** - * + * Checks recursive if parent (ancestors) are active * @param {number} monitorID ID of the monitor to get * @returns {Promise} */ diff --git a/src/components/MonitorList.vue b/src/components/MonitorList.vue index f9ec1d4e3..c69169ccf 100644 --- a/src/components/MonitorList.vue +++ b/src/components/MonitorList.vue @@ -79,6 +79,7 @@ export default { result = result.filter(monitor => monitor.parent === null); } + // Filter result by active state, weight and alphabetical result.sort((m1, m2) => { if (m1.active !== m2.active) { diff --git a/src/components/MonitorListItem.vue b/src/components/MonitorListItem.vue index 58e3e78b5..64f8a8e74 100644 --- a/src/components/MonitorListItem.vue +++ b/src/components/MonitorListItem.vue @@ -53,10 +53,12 @@ export default { type: Object, default: null, }, + /** If the user is currently searching */ isSearch: { type: Boolean, default: false, }, + /** How many ancestors are above this monitor */ depth: { type: Number, default: 0, @@ -124,6 +126,7 @@ export default { return; } + // Set collapsed value based on local storage let storage = window.localStorage.getItem("monitorCollapsed"); if (storage === null) { return; @@ -137,9 +140,13 @@ export default { this.isCollapsed = storageObject[`monitor_${this.monitor.id}`]; }, methods: { + /** + * Changes the collapsed value of the current monitor and saves it to local storage + */ changeCollapsed() { this.isCollapsed = !this.isCollapsed; + // Save collapsed value into local storage let storage = window.localStorage.getItem("monitorCollapsed"); let storageObject = {}; if (storage !== null) { diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index ad554c4f5..8206215e5 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -755,15 +755,9 @@ message HealthCheckResponse { return null; }, + // Filter result by active state, weight and alphabetical + // Only return groups which arent't itself and one of its decendants sortedMonitorList() { - // return Object.values(this.$root.monitorList).filter(monitor => { - // // Only return monitors which aren't related to the current selected - // if (monitor.id === this.monitor.id || monitor.parent === this.monitor.id) { - // return false; - // } - // return true; - // }); - let result = Object.values(this.$root.monitorList); console.log(this.monitor.childrenIDs); result = result.filter(monitor => monitor.type === "group");