Chore: Run lint

This commit is contained in:
NihadBadalov 2024-02-17 18:36:29 +01:00
parent 5c46af6019
commit 4b0ce4857e
2 changed files with 40 additions and 40 deletions

View file

@ -100,16 +100,16 @@ export default {
down: 0, down: 0,
pending: 2, pending: 2,
maintenance: 3, maintenance: 3,
1: 'up', 1: "up",
0: 'down', 0: "down",
2: 'pending', 2: "pending",
3: 'maintenance', 3: "maintenance",
}, },
activeStates: { activeStates: {
running: true, running: true,
paused: false, paused: false,
true: 'running', true: "running",
false: 'paused', false: "paused",
}, },
}; };
}, },
@ -293,11 +293,11 @@ export default {
updateFilter(newFilter) { updateFilter(newFilter) {
const newQuery = { ...this.$router.currentRoute.value.query }; const newQuery = { ...this.$router.currentRoute.value.query };
for (const [key, value] of Object.entries(newFilter)) { for (const [ key, value ] of Object.entries(newFilter)) {
if (!value if (!value
|| (value instanceof Array && value.length === 0)) { || (value instanceof Array && value.length === 0)) {
delete newQuery[key]; delete newQuery[key];
continue continue;
} }
newQuery[key] = value instanceof Array newQuery[key] = value instanceof Array

View file

@ -14,10 +14,10 @@
<font-awesome-icon v-if="numFiltersActive > 0" icon="times" /> <font-awesome-icon v-if="numFiltersActive > 0" icon="times" />
</button> </button>
<MonitorListFilterDropdown <MonitorListFilterDropdown
:filterActive="this.$router.currentRoute.value.query?.status?.length > 0" :filterActive="$router.currentRoute.value.query?.status?.length > 0"
> >
<template #status> <template #status>
<Status v-if="this.$router.currentRoute.value.query?.status?.length === 1" :status="this.$router.currentRoute.value.query?.status[0]" /> <Status v-if="$router.currentRoute.value.query?.status?.length === 1" :status="$router.currentRoute.value.query?.status[0]" />
<span v-else> <span v-else>
{{ $t('Status') }} {{ $t('Status') }}
</span> </span>
@ -29,7 +29,7 @@
<Status :status="1" /> <Status :status="1" />
<span class="ps-3"> <span class="ps-3">
{{ $root.stats.up }} {{ $root.stats.up }}
<span v-if="this.$router.currentRoute.value.query?.status?.includes('up')" class="px-1 filter-active"> <span v-if="$router.currentRoute.value.query?.status?.includes('up')" class="px-1 filter-active">
<font-awesome-icon icon="check" /> <font-awesome-icon icon="check" />
</span> </span>
</span> </span>
@ -42,7 +42,7 @@
<Status :status="0" /> <Status :status="0" />
<span class="ps-3"> <span class="ps-3">
{{ $root.stats.down }} {{ $root.stats.down }}
<span v-if="this.$router.currentRoute.value.query?.status?.includes('down')" class="px-1 filter-active"> <span v-if="$router.currentRoute.value.query?.status?.includes('down')" class="px-1 filter-active">
<font-awesome-icon icon="check" /> <font-awesome-icon icon="check" />
</span> </span>
</span> </span>
@ -55,7 +55,7 @@
<Status :status="2" /> <Status :status="2" />
<span class="ps-3"> <span class="ps-3">
{{ $root.stats.pending }} {{ $root.stats.pending }}
<span v-if="this.$router.currentRoute.value.query?.status?.includes('pending')" class="px-1 filter-active"> <span v-if="$router.currentRoute.value.query?.status?.includes('pending')" class="px-1 filter-active">
<font-awesome-icon icon="check" /> <font-awesome-icon icon="check" />
</span> </span>
</span> </span>
@ -68,7 +68,7 @@
<Status :status="3" /> <Status :status="3" />
<span class="ps-3"> <span class="ps-3">
{{ $root.stats.maintenance }} {{ $root.stats.maintenance }}
<span v-if="this.$router.currentRoute.value.query?.status?.includes('maintenance')" class="px-1 filter-active"> <span v-if="$router.currentRoute.value.query?.status?.includes('maintenance')" class="px-1 filter-active">
<font-awesome-icon icon="check" /> <font-awesome-icon icon="check" />
</span> </span>
</span> </span>
@ -77,10 +77,10 @@
</li> </li>
</template> </template>
</MonitorListFilterDropdown> </MonitorListFilterDropdown>
<MonitorListFilterDropdown :filterActive="this.$router.currentRoute.value.query?.active?.length > 0"> <MonitorListFilterDropdown :filterActive="$router.currentRoute.value.query?.active?.length > 0">
<template #status> <template #status>
<span v-if="this.$router.currentRoute.value.query?.active?.length === 1"> <span v-if="$router.currentRoute.value.query?.active?.length === 1">
<span v-if="this.$router.currentRoute.value.query?.active[0]">{{ $t("Running") }}</span> <span v-if="$router.currentRoute.value.query?.active[0]">{{ $t("Running") }}</span>
<span v-else>{{ $t("filterActivePaused") }}</span> <span v-else>{{ $t("filterActivePaused") }}</span>
</span> </span>
<span v-else> <span v-else>
@ -94,7 +94,7 @@
<span>{{ $t("Running") }}</span> <span>{{ $t("Running") }}</span>
<span class="ps-3"> <span class="ps-3">
{{ $root.stats.active }} {{ $root.stats.active }}
<span v-if="this.$router.currentRoute.value.query?.active?.includes(true)" class="px-1 filter-active"> <span v-if="$router.currentRoute.value.query?.active?.includes(true)" class="px-1 filter-active">
<font-awesome-icon icon="check" /> <font-awesome-icon icon="check" />
</span> </span>
</span> </span>
@ -107,7 +107,7 @@
<span>{{ $t("filterActivePaused") }}</span> <span>{{ $t("filterActivePaused") }}</span>
<span class="ps-3"> <span class="ps-3">
{{ $root.stats.pause }} {{ $root.stats.pause }}
<span v-if="this.$router.currentRoute.value.query?.active?.includes(false)" class="px-1 filter-active"> <span v-if="$router.currentRoute.value.query?.active?.includes(false)" class="px-1 filter-active">
<font-awesome-icon icon="check" /> <font-awesome-icon icon="check" />
</span> </span>
</span> </span>
@ -116,11 +116,11 @@
</li> </li>
</template> </template>
</MonitorListFilterDropdown> </MonitorListFilterDropdown>
<MonitorListFilterDropdown :filterActive="this.$router.currentRoute.value.query?.tags?.length > 0"> <MonitorListFilterDropdown :filterActive="$router.currentRoute.value.query?.tags?.length > 0">
<template #status> <template #status>
<Tag <Tag
v-if="this.$router.currentRoute.value.query?.tags?.length === 1" v-if="$router.currentRoute.value.query?.tags?.length === 1"
:item="tagsList.find(tag => tag.id === this.$router.currentRoute.value.query?.tags[0])" :item="tagsList.find(tag => tag.id === $router.currentRoute.value.query?.tags[0])"
:size="'sm'" :size="'sm'"
/> />
<span v-else> <span v-else>
@ -134,7 +134,7 @@
<span><Tag :item="tag" :size="'sm'" /></span> <span><Tag :item="tag" :size="'sm'" /></span>
<span class="ps-3"> <span class="ps-3">
{{ getTaggedMonitorCount(tag) }} {{ getTaggedMonitorCount(tag) }}
<span v-if="this.$router.currentRoute.value.query?.tags?.split(',').includes(tag.name)" class="px-1 filter-active"> <span v-if="$router.currentRoute.value.query?.tags?.split(',').includes(tag.name)" class="px-1 filter-active">
<font-awesome-icon icon="check" /> <font-awesome-icon icon="check" />
</span> </span>
</span> </span>
@ -167,9 +167,9 @@ export default {
return { return {
tagsList: [], tagsList: [],
filterNames: [ filterNames: [
'status', "status",
'active', "active",
'tags', "tags",
], ],
}; };
}, },
@ -194,15 +194,15 @@ export default {
this.getExistingTags(); this.getExistingTags();
}, },
methods: { methods: {
getActiveFilters: function() { getActiveFilters: function () {
const filters = Object.fromEntries( const filters = Object.fromEntries(
Array.from(Object.entries(this.$router.currentRoute.value.query ?? {})) Array.from(Object.entries(this.$router.currentRoute.value.query ?? {}))
); );
return { return {
status: filters['status'] ? filters['status'].split(',') : [], status: filters["status"] ? filters["status"].split(",") : [],
active: filters['active'] ? filters['active'].split(',') : [], active: filters["active"] ? filters["active"].split(",") : [],
tags: filters['tags'] ? filters['tags'].split(',') : [], tags: filters["tags"] ? filters["tags"].split(",") : [],
}; };
}, },
toggleStatusFilter(status) { toggleStatusFilter(status) {
@ -211,16 +211,16 @@ export default {
}; };
const statusStates = { const statusStates = {
1: 'up', 1: "up",
0: 'down', 0: "down",
2: 'pending', 2: "pending",
3: 'maintenance', 3: "maintenance",
}; };
const finalStatus = statusStates[status]; const finalStatus = statusStates[status];
if (newFilter.status.includes(''+finalStatus)) { if (newFilter.status.includes("" + finalStatus)) {
newFilter.status = newFilter.status.filter(item => item !== ''+finalStatus); newFilter.status = newFilter.status.filter(item => item !== "" + finalStatus);
} else { } else {
newFilter.status.push(finalStatus); newFilter.status.push(finalStatus);
} }
@ -232,8 +232,8 @@ export default {
...this.getActiveFilters(), ...this.getActiveFilters(),
}; };
if (newFilter.active.includes(''+active)) { if (newFilter.active.includes("" + active)) {
newFilter.active = newFilter.active.filter(item => item !== ''+active); newFilter.active = newFilter.active.filter(item => item !== "" + active);
} else { } else {
newFilter.active.push(active); newFilter.active.push(active);
} }
@ -245,8 +245,8 @@ export default {
...this.getActiveFilters(), ...this.getActiveFilters(),
}; };
if (newFilter.tags.includes(''+tag.name)) { if (newFilter.tags.includes("" + tag.name)) {
newFilter.tags = newFilter.tags.filter(item => item !== ''+tag.name); newFilter.tags = newFilter.tags.filter(item => item !== "" + tag.name);
} else { } else {
newFilter.tags.push(tag.name); newFilter.tags.push(tag.name);
} }