docs: add comments

This commit is contained in:
Peace 2023-01-28 14:22:15 +01:00
parent faf3488b1e
commit 9a46b50989
No known key found for this signature in database
GPG key ID: 0EF6B46E172B739F
4 changed files with 11 additions and 9 deletions

View file

@ -1418,7 +1418,7 @@ class Monitor extends BeanModel {
} }
/** /**
* * Checks recursive if parent (ancestors) are active
* @param {number} monitorID ID of the monitor to get * @param {number} monitorID ID of the monitor to get
* @returns {Promise<Boolean>} * @returns {Promise<Boolean>}
*/ */

View file

@ -79,6 +79,7 @@ export default {
result = result.filter(monitor => monitor.parent === null); result = result.filter(monitor => monitor.parent === null);
} }
// Filter result by active state, weight and alphabetical
result.sort((m1, m2) => { result.sort((m1, m2) => {
if (m1.active !== m2.active) { if (m1.active !== m2.active) {

View file

@ -53,10 +53,12 @@ export default {
type: Object, type: Object,
default: null, default: null,
}, },
/** If the user is currently searching */
isSearch: { isSearch: {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
/** How many ancestors are above this monitor */
depth: { depth: {
type: Number, type: Number,
default: 0, default: 0,
@ -124,6 +126,7 @@ export default {
return; return;
} }
// Set collapsed value based on local storage
let storage = window.localStorage.getItem("monitorCollapsed"); let storage = window.localStorage.getItem("monitorCollapsed");
if (storage === null) { if (storage === null) {
return; return;
@ -137,9 +140,13 @@ export default {
this.isCollapsed = storageObject[`monitor_${this.monitor.id}`]; this.isCollapsed = storageObject[`monitor_${this.monitor.id}`];
}, },
methods: { methods: {
/**
* Changes the collapsed value of the current monitor and saves it to local storage
*/
changeCollapsed() { changeCollapsed() {
this.isCollapsed = !this.isCollapsed; this.isCollapsed = !this.isCollapsed;
// Save collapsed value into local storage
let storage = window.localStorage.getItem("monitorCollapsed"); let storage = window.localStorage.getItem("monitorCollapsed");
let storageObject = {}; let storageObject = {};
if (storage !== null) { if (storage !== null) {

View file

@ -755,15 +755,9 @@ message HealthCheckResponse {
return null; return null;
}, },
// Filter result by active state, weight and alphabetical
// Only return groups which arent't itself and one of its decendants
sortedMonitorList() { 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); let result = Object.values(this.$root.monitorList);
console.log(this.monitor.childrenIDs); console.log(this.monitor.childrenIDs);
result = result.filter(monitor => monitor.type === "group"); result = result.filter(monitor => monitor.type === "group");