mirror of
https://github.com/bastienwirtz/homer.git
synced 2025-03-13 06:49:32 +01:00
Linting update
This commit is contained in:
parent
ecf664d19b
commit
de4b7e6124
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "homer",
|
"name": "homer",
|
||||||
"version": "23.09.1",
|
"version": "23.10.1",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"mock": "http-server dummy-data/ --cors",
|
"mock": "http-server dummy-data/ --cors",
|
||||||
|
@ -208,7 +208,7 @@ export default {
|
|||||||
|
|
||||||
if (this.currentPage !== "default") {
|
if (this.currentPage !== "default") {
|
||||||
let pageConfig = await this.getConfig(
|
let pageConfig = await this.getConfig(
|
||||||
`assets/${this.currentPage}.yml`
|
`assets/${this.currentPage}.yml`,
|
||||||
);
|
);
|
||||||
config = Object.assign(config, pageConfig);
|
config = Object.assign(config, pageConfig);
|
||||||
}
|
}
|
||||||
@ -245,7 +245,7 @@ export default {
|
|||||||
return response
|
return response
|
||||||
.text()
|
.text()
|
||||||
.then((body) => {
|
.then((body) => {
|
||||||
return parse(body, {merge: true});
|
return parse(body, { merge: true });
|
||||||
})
|
})
|
||||||
.then(function (config) {
|
.then(function (config) {
|
||||||
if (config.externalConfig) {
|
if (config.externalConfig) {
|
||||||
|
@ -30,21 +30,21 @@ export default {
|
|||||||
that.checkOffline();
|
that.checkOffline();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
false
|
false,
|
||||||
);
|
);
|
||||||
window.addEventListener(
|
window.addEventListener(
|
||||||
"online",
|
"online",
|
||||||
function () {
|
function () {
|
||||||
that.checkOffline();
|
that.checkOffline();
|
||||||
},
|
},
|
||||||
false
|
false,
|
||||||
);
|
);
|
||||||
window.addEventListener(
|
window.addEventListener(
|
||||||
"offline",
|
"offline",
|
||||||
function () {
|
function () {
|
||||||
this.offline = true;
|
this.offline = true;
|
||||||
},
|
},
|
||||||
false
|
false,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -57,7 +57,9 @@ export default {
|
|||||||
// extra check to make sure we're not offline
|
// extra check to make sure we're not offline
|
||||||
let that = this;
|
let that = this;
|
||||||
const urlPath = window.location.pathname.replace(/\/+$/, "");
|
const urlPath = window.location.pathname.replace(/\/+$/, "");
|
||||||
const aliveCheckUrl = `${window.location.origin}${urlPath}/index.html?t=${new Date().valueOf()}`;
|
const aliveCheckUrl = `${
|
||||||
|
window.location.origin
|
||||||
|
}${urlPath}/index.html?t=${new Date().valueOf()}`;
|
||||||
return fetch(aliveCheckUrl, {
|
return fetch(aliveCheckUrl, {
|
||||||
method: "HEAD",
|
method: "HEAD",
|
||||||
cache: "no-store",
|
cache: "no-store",
|
||||||
|
@ -84,10 +84,13 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
watchIsDark: function () {
|
watchIsDark: function () {
|
||||||
matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
|
matchMedia("(prefers-color-scheme: dark)").addEventListener(
|
||||||
this.isDark = this.getIsDark();
|
"change",
|
||||||
this.$emit("updated", this.isDark);
|
() => {
|
||||||
});
|
this.isDark = this.getIsDark();
|
||||||
|
this.$emit("updated", this.isDark);
|
||||||
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -63,12 +63,12 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
fetchStatus: async function () {
|
fetchStatus: async function () {
|
||||||
this.status = await this.fetch("/control/status").catch((e) =>
|
this.status = await this.fetch("/control/status").catch((e) =>
|
||||||
console.log(e)
|
console.log(e),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
fetchStats: async function () {
|
fetchStats: async function () {
|
||||||
this.stats = await this.fetch("/control/stats").catch((e) =>
|
this.stats = await this.fetch("/control/stats").catch((e) =>
|
||||||
console.log(e)
|
console.log(e),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -66,7 +66,7 @@ export default {
|
|||||||
const apikey = this.item.apikey;
|
const apikey = this.item.apikey;
|
||||||
if (!apikey) {
|
if (!apikey) {
|
||||||
console.error(
|
console.error(
|
||||||
"apikey is not present in config.yml for the Healthchecks entry!"
|
"apikey is not present in config.yml for the Healthchecks entry!",
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -56,18 +56,20 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
humanizeSize: function () {
|
humanizeSize: function () {
|
||||||
let bytes = this.usage;
|
let bytes = this.usage;
|
||||||
if (Math.abs(bytes) < 1024)
|
if (Math.abs(bytes) < 1024) return bytes + " B";
|
||||||
return bytes + ' B';
|
|
||||||
|
|
||||||
const units = ['KiB', 'MiB', 'GiB', 'TiB'];
|
const units = ["KiB", "MiB", "GiB", "TiB"];
|
||||||
let u = -1;
|
let u = -1;
|
||||||
do {
|
do {
|
||||||
bytes /= 1024;
|
bytes /= 1024;
|
||||||
++u;
|
++u;
|
||||||
} while (Math.round(Math.abs(bytes) * 100) / 100 >= 1024 && u < units.length - 1);
|
} while (
|
||||||
|
Math.round(Math.abs(bytes) * 100) / 100 >= 1024 &&
|
||||||
|
u < units.length - 1
|
||||||
|
);
|
||||||
|
|
||||||
return bytes.toFixed(2) + ' ' + units[u];
|
return bytes.toFixed(2) + " " + units[u];
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -45,7 +45,7 @@ export default {
|
|||||||
if (this.item.subtitle != null) return;
|
if (this.item.subtitle != null) return;
|
||||||
|
|
||||||
this.meal = await this.fetch("/api/meal-plans/today/", { headers }).catch(
|
this.meal = await this.fetch("/api/meal-plans/today/", { headers }).catch(
|
||||||
(e) => console.log(e)
|
(e) => console.log(e),
|
||||||
);
|
);
|
||||||
this.stats = await this.fetch("/api/debug/statistics/", {
|
this.stats = await this.fetch("/api/debug/statistics/", {
|
||||||
headers,
|
headers,
|
||||||
|
@ -6,7 +6,9 @@
|
|||||||
<template v-if="item.subtitle && !state">
|
<template v-if="item.subtitle && !state">
|
||||||
{{ item.subtitle }}
|
{{ item.subtitle }}
|
||||||
</template>
|
</template>
|
||||||
<template v-if="!error && display == 'text' && statusClass == 'in-progress'">
|
<template
|
||||||
|
v-if="!error && display == 'text' && statusClass == 'in-progress'"
|
||||||
|
>
|
||||||
<i class="fa-solid fa-gear mr-1"></i>
|
<i class="fa-solid fa-gear mr-1"></i>
|
||||||
<b v-if="completion">{{ completion.toFixed() }}%</b>
|
<b v-if="completion">{{ completion.toFixed() }}%</b>
|
||||||
<span class="separator mx-1"> | </span>
|
<span class="separator mx-1"> | </span>
|
||||||
@ -17,9 +19,13 @@
|
|||||||
</template>
|
</template>
|
||||||
<template v-if="!error && display == 'text' && statusClass == 'ready'">
|
<template v-if="!error && display == 'text' && statusClass == 'ready'">
|
||||||
<i class="fa-solid fa-temperature-half mr-1"></i>
|
<i class="fa-solid fa-temperature-half mr-1"></i>
|
||||||
<b v-if="printer.temperature.bed">{{ printer.temperature.bed.actual.toFixed() }} C</b>
|
<b v-if="printer.temperature.bed"
|
||||||
|
>{{ printer.temperature.bed.actual.toFixed() }} C</b
|
||||||
|
>
|
||||||
<span class="separator mx-1"> | </span>
|
<span class="separator mx-1"> | </span>
|
||||||
<b v-if="printer.temperature.tool0">{{ printer.temperature.tool0.actual.toFixed() }} C</b>
|
<b v-if="printer.temperature.tool0"
|
||||||
|
>{{ printer.temperature.tool0.actual.toFixed() }} C</b
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="!error && display == 'bar'">
|
<template v-if="!error && display == 'bar'">
|
||||||
<progress
|
<progress
|
||||||
@ -28,7 +34,7 @@
|
|||||||
:value="completion"
|
:value="completion"
|
||||||
max="100"
|
max="100"
|
||||||
:title="`${state} - ${completion.toFixed()}%, ${toTime(
|
:title="`${state} - ${completion.toFixed()}%, ${toTime(
|
||||||
printTimeLeft
|
printTimeLeft,
|
||||||
)} left`"
|
)} left`"
|
||||||
>
|
>
|
||||||
{{ completion }}%
|
{{ completion }}%
|
||||||
@ -99,7 +105,9 @@ export default {
|
|||||||
},
|
},
|
||||||
fetchPrinterStatus: async function () {
|
fetchPrinterStatus: async function () {
|
||||||
try {
|
try {
|
||||||
const response = await this.fetch(`api/printer?apikey=${this.item.apikey}`);
|
const response = await this.fetch(
|
||||||
|
`api/printer?apikey=${this.item.apikey}`,
|
||||||
|
);
|
||||||
this.printer = response;
|
this.printer = response;
|
||||||
this.error = response.error;
|
this.error = response.error;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -40,7 +40,7 @@ export default {
|
|||||||
const apikey = this.item.apikey;
|
const apikey = this.item.apikey;
|
||||||
if (!apikey) {
|
if (!apikey) {
|
||||||
console.error(
|
console.error(
|
||||||
"apikey is not present in config.yml for the paperless entry!"
|
"apikey is not present in config.yml for the paperless entry!",
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,28 @@
|
|||||||
<template>
|
<template>
|
||||||
<Generic :item="item">
|
<Generic :item="item">
|
||||||
<template #indicator>
|
<template #indicator>
|
||||||
<div class="notifs">
|
<div class="notifs">
|
||||||
<strong class="notif total" title="Total Devices">
|
<strong class="notif total" title="Total Devices">
|
||||||
{{ total }}
|
{{ total }}
|
||||||
</strong>
|
</strong>
|
||||||
<strong class="notif connected" title="Connected Devices">
|
<strong class="notif connected" title="Connected Devices">
|
||||||
{{ connected }}
|
{{ connected }}
|
||||||
</strong>
|
</strong>
|
||||||
<strong class="notif newdevices" title="New Devices">
|
<strong class="notif newdevices" title="New Devices">
|
||||||
{{ newdevices }}
|
{{ newdevices }}
|
||||||
</strong>
|
</strong>
|
||||||
<strong class="notif alert" title="Down Alerts">
|
<strong class="notif alert" title="Down Alerts">
|
||||||
{{ downalert }}
|
{{ downalert }}
|
||||||
</strong>
|
</strong>
|
||||||
<strong v-if="serverError" class="notif alert"
|
<strong
|
||||||
title="Connection error to PiAlert server, check the url in config.yml">?</strong>
|
v-if="serverError"
|
||||||
</div>
|
class="notif alert"
|
||||||
</template>
|
title="Connection error to PiAlert server, check the url in config.yml"
|
||||||
</Generic>
|
>?</strong
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</Generic>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -26,79 +30,79 @@ import service from "@/mixins/service.js";
|
|||||||
import Generic from "./Generic.vue";
|
import Generic from "./Generic.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "PiAlert",
|
name: "PiAlert",
|
||||||
mixins: [service],
|
mixins: [service],
|
||||||
props: {
|
props: {
|
||||||
item: Object,
|
item: Object,
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
Generic,
|
Generic,
|
||||||
},
|
},
|
||||||
data: () => {
|
data: () => {
|
||||||
return {
|
return {
|
||||||
total: 0,
|
total: 0,
|
||||||
connected: 0,
|
connected: 0,
|
||||||
newdevices: 0,
|
newdevices: 0,
|
||||||
downalert: 0,
|
downalert: 0,
|
||||||
serverError: false,
|
serverError: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
const updateInterval = parseInt(this.item.updateInterval, 10) || 0;
|
const updateInterval = parseInt(this.item.updateInterval, 10) || 0;
|
||||||
if (updateInterval > 0) {
|
if (updateInterval > 0) {
|
||||||
setInterval(() => this.fetchStatus(), updateInterval);
|
setInterval(() => this.fetchStatus(), updateInterval);
|
||||||
}
|
}
|
||||||
this.fetchStatus();
|
this.fetchStatus();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fetchStatus: async function () {
|
fetchStatus: async function () {
|
||||||
this.fetch("/php/server/devices.php?action=getDevicesTotals")
|
this.fetch("/php/server/devices.php?action=getDevicesTotals")
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
this.total = response[0];
|
this.total = response[0];
|
||||||
this.connected = response[1];
|
this.connected = response[1];
|
||||||
this.newdevices = response[3];
|
this.newdevices = response[3];
|
||||||
this.downalert = response[4];
|
this.downalert = response[4];
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
this.serverError = true;
|
this.serverError = true;
|
||||||
});
|
});
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.notifs {
|
.notifs {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
color: white;
|
color: white;
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
top: 0.3em;
|
top: 0.3em;
|
||||||
right: 0.5em;
|
right: 0.5em;
|
||||||
|
|
||||||
.notif {
|
.notif {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 0.2em 0.35em;
|
padding: 0.2em 0.35em;
|
||||||
border-radius: 0.25em;
|
border-radius: 0.25em;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-left: 0.3em;
|
margin-left: 0.3em;
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
|
|
||||||
&.total {
|
&.total {
|
||||||
background-color: #4fb5d6;
|
background-color: #4fb5d6;
|
||||||
}
|
|
||||||
|
|
||||||
&.connected {
|
|
||||||
background-color: #4fd671;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.newdevices {
|
|
||||||
background-color: #d08d2e;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.alert {
|
|
||||||
background-color: #e51111;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.connected {
|
||||||
|
background-color: #4fd671;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.newdevices {
|
||||||
|
background-color: #d08d2e;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.alert {
|
||||||
|
background-color: #e51111;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -52,8 +52,9 @@ export default {
|
|||||||
const authQueryParams = this.item.apikey
|
const authQueryParams = this.item.apikey
|
||||||
? `?summaryRaw&auth=${this.item.apikey}`
|
? `?summaryRaw&auth=${this.item.apikey}`
|
||||||
: "";
|
: "";
|
||||||
const result = await this.fetch(`/api.php${authQueryParams}`)
|
const result = await this.fetch(`/api.php${authQueryParams}`).catch((e) =>
|
||||||
.catch((e) => console.log(e));
|
console.log(e),
|
||||||
|
);
|
||||||
|
|
||||||
this.status = result.status;
|
this.status = result.status;
|
||||||
this.ads_percentage_today = result.ads_percentage_today;
|
this.ads_percentage_today = result.ads_percentage_today;
|
||||||
|
@ -78,7 +78,7 @@ export default {
|
|||||||
this.endpoints = await this.fetch("/api/endpoints", { headers }).catch(
|
this.endpoints = await this.fetch("/api/endpoints", { headers }).catch(
|
||||||
(e) => {
|
(e) => {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
let containers = [];
|
let containers = [];
|
||||||
@ -93,7 +93,7 @@ export default {
|
|||||||
const endpointContainers = await this.fetch(uri, { headers }).catch(
|
const endpointContainers = await this.fetch(uri, { headers }).catch(
|
||||||
(e) => {
|
(e) => {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (endpointContainers) {
|
if (endpointContainers) {
|
||||||
|
@ -72,7 +72,7 @@ export default {
|
|||||||
countFiring: function () {
|
countFiring: function () {
|
||||||
if (this.api) {
|
if (this.api) {
|
||||||
return this.api.data?.alerts?.filter(
|
return this.api.data?.alerts?.filter(
|
||||||
(alert) => alert.state === AlertsStatus.firing
|
(alert) => alert.state === AlertsStatus.firing,
|
||||||
).length;
|
).length;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -80,7 +80,7 @@ export default {
|
|||||||
countPending: function () {
|
countPending: function () {
|
||||||
if (this.api) {
|
if (this.api) {
|
||||||
return this.api.data?.alerts?.filter(
|
return this.api.data?.alerts?.filter(
|
||||||
(alert) => alert.state === AlertsStatus.pending
|
(alert) => alert.state === AlertsStatus.pending,
|
||||||
).length;
|
).length;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -88,7 +88,7 @@ export default {
|
|||||||
countInactive: function () {
|
countInactive: function () {
|
||||||
if (this.api) {
|
if (this.api) {
|
||||||
return this.api.data?.alerts?.filter(
|
return this.api.data?.alerts?.filter(
|
||||||
(alert) => alert.state === AlertsStatus.pending
|
(alert) => alert.state === AlertsStatus.pending,
|
||||||
).length;
|
).length;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -122,7 +122,7 @@ export default {
|
|||||||
};
|
};
|
||||||
const status = await this.fetch(
|
const status = await this.fetch(
|
||||||
`/api2/json/nodes/${this.item.node}/status`,
|
`/api2/json/nodes/${this.item.node}/status`,
|
||||||
options
|
options,
|
||||||
);
|
);
|
||||||
// main metrics:
|
// main metrics:
|
||||||
const decimalsToShow = this.item.hide_decimals ? 0 : 1;
|
const decimalsToShow = this.item.hide_decimals ? 0 : 1;
|
||||||
@ -139,7 +139,7 @@ export default {
|
|||||||
if (this.isValueShown("vms")) {
|
if (this.isValueShown("vms")) {
|
||||||
const vms = await this.fetch(
|
const vms = await this.fetch(
|
||||||
`/api2/json/nodes/${this.item.node}/qemu`,
|
`/api2/json/nodes/${this.item.node}/qemu`,
|
||||||
options
|
options,
|
||||||
);
|
);
|
||||||
this.parseVMsAndLXCs(vms, this.vms);
|
this.parseVMsAndLXCs(vms, this.vms);
|
||||||
}
|
}
|
||||||
@ -147,7 +147,7 @@ export default {
|
|||||||
if (this.isValueShown("lxcs")) {
|
if (this.isValueShown("lxcs")) {
|
||||||
const lxcs = await this.fetch(
|
const lxcs = await this.fetch(
|
||||||
`/api2/json/nodes/${this.item.node}/lxc`,
|
`/api2/json/nodes/${this.item.node}/lxc`,
|
||||||
options
|
options,
|
||||||
);
|
);
|
||||||
this.parseVMsAndLXCs(lxcs, this.lxcs);
|
this.parseVMsAndLXCs(lxcs, this.lxcs);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ const displayRate = (rate) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
Intl.NumberFormat(undefined, { maximumFractionDigits: 2 }).format(
|
Intl.NumberFormat(undefined, { maximumFractionDigits: 2 }).format(
|
||||||
rate || 0
|
rate || 0,
|
||||||
) + ` ${units[i]}/s`
|
) + ` ${units[i]}/s`
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -105,8 +105,8 @@ export default {
|
|||||||
return this.getXml(methodName).then((xml) =>
|
return this.getXml(methodName).then((xml) =>
|
||||||
parseInt(
|
parseInt(
|
||||||
xml.getElementsByTagName("value")[0].firstChild.textContent,
|
xml.getElementsByTagName("value")[0].firstChild.textContent,
|
||||||
10
|
10,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
// Fetch the numer of torrents by requesting the download list
|
// Fetch the numer of torrents by requesting the download list
|
||||||
@ -143,7 +143,7 @@ export default {
|
|||||||
return response.text();
|
return response.text();
|
||||||
})
|
})
|
||||||
.then((text) =>
|
.then((text) =>
|
||||||
Promise.resolve(new DOMParser().parseFromString(text, "text/xml"))
|
Promise.resolve(new DOMParser().parseFromString(text, "text/xml")),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -56,7 +56,7 @@ export default {
|
|||||||
fetchStatus: async function () {
|
fetchStatus: async function () {
|
||||||
try {
|
try {
|
||||||
const response = await this.fetch(
|
const response = await this.fetch(
|
||||||
`/api?output=json&apikey=${this.item.apikey}&mode=queue`
|
`/api?output=json&apikey=${this.item.apikey}&mode=queue`,
|
||||||
);
|
);
|
||||||
this.error = false;
|
this.error = false;
|
||||||
this.stats = response.queue;
|
this.stats = response.queue;
|
||||||
|
@ -51,7 +51,7 @@ export default {
|
|||||||
fetchStatus: async function () {
|
fetchStatus: async function () {
|
||||||
try {
|
try {
|
||||||
const response = await this.fetch(
|
const response = await this.fetch(
|
||||||
`/api/v2?apikey=${this.item.apikey}&cmd=get_activity`
|
`/api/v2?apikey=${this.item.apikey}&cmd=get_activity`,
|
||||||
);
|
);
|
||||||
this.error = false;
|
this.error = false;
|
||||||
this.stats = response.response.data;
|
this.stats = response.response.data;
|
||||||
|
@ -72,14 +72,20 @@ export default {
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"Accept": "application/json",
|
Accept: "application/json",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({"headers":{"content-Type":"application/json"},"data":{"collection":"StatisticsJSONDB","mode":"getById","docID":"statistics","obj":{}},"timeout":1000}),
|
body: JSON.stringify({
|
||||||
|
headers: { "content-Type": "application/json" },
|
||||||
|
data: {
|
||||||
|
collection: "StatisticsJSONDB",
|
||||||
|
mode: "getById",
|
||||||
|
docID: "statistics",
|
||||||
|
obj: {},
|
||||||
|
},
|
||||||
|
timeout: 1000,
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
const response = await this.fetch(
|
const response = await this.fetch(`/api/v2/cruddb`, options);
|
||||||
`/api/v2/cruddb`,
|
|
||||||
options
|
|
||||||
);
|
|
||||||
this.error = false;
|
this.error = false;
|
||||||
this.stats = response;
|
this.stats = response;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -43,7 +43,7 @@ const displayRate = (rate) => {
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
Intl.NumberFormat(undefined, { maximumFractionDigits: 2 }).format(
|
Intl.NumberFormat(undefined, { maximumFractionDigits: 2 }).format(
|
||||||
rate || 0
|
rate || 0,
|
||||||
) + ` ${units[i]}/s`
|
) + ` ${units[i]}/s`
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user