mirror of https://github.com/bastienwirtz/homer
add number of active connections and i renamed sftpgo_api_key to sftpgoApiKey to maintain naming consistency with the rest of the codebase
parent
47bd7ec0a2
commit
fe0e164659
|
@ -6,8 +6,11 @@
|
||||||
<template v-if="item.subtitle">
|
<template v-if="item.subtitle">
|
||||||
{{ item.subtitle }}
|
{{ item.subtitle }}
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="versionstring">
|
<template v-else>
|
||||||
Version {{ versionstring }}
|
<span v-if="versionstring">Version {{ versionstring }}</span>
|
||||||
|
<span v-if="activeConnections !== null">
|
||||||
|
– Active connections: {{ activeConnections }}
|
||||||
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</p>
|
</p>
|
||||||
</template>
|
</template>
|
||||||
|
@ -23,7 +26,7 @@
|
||||||
import service from "@/mixins/service.js";
|
import service from "@/mixins/service.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Sftgo",
|
name: "SFTPGo",
|
||||||
mixins: [service],
|
mixins: [service],
|
||||||
props: {
|
props: {
|
||||||
item: Object,
|
item: Object,
|
||||||
|
@ -31,6 +34,7 @@ export default {
|
||||||
data: () => ({
|
data: () => ({
|
||||||
fetchOk: null,
|
fetchOk: null,
|
||||||
versionstring: null,
|
versionstring: null,
|
||||||
|
activeConnections: null,
|
||||||
}),
|
}),
|
||||||
computed: {
|
computed: {
|
||||||
status: function () {
|
status: function () {
|
||||||
|
@ -43,13 +47,17 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
fetchStatus: async function () {
|
fetchStatus: async function () {
|
||||||
let headers = {};
|
let headers = {};
|
||||||
if (this.item.sftpgo_api_key) {
|
if (this.item.sftpgoApiKey) {
|
||||||
headers["X-SFTPGO-API-KEY"] = `${this.item.sftpgo_api_key}`;
|
headers["X-SFTPGO-API-KEY"] = `${this.item.sftpgoApiKey}`;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const response = await this.fetch("/api/v2/version", { headers });
|
const response = await this.fetch("/api/v2/version", { headers });
|
||||||
this.fetchOk = true;
|
|
||||||
this.versionstring = response.version || "inconnue";
|
this.versionstring = response.version || "inconnue";
|
||||||
|
|
||||||
|
const connResponse = await this.fetch("/api/v2/connections", { headers });
|
||||||
|
this.activeConnections = Array.isArray(connResponse) ? connResponse.length : null;
|
||||||
|
|
||||||
|
this.fetchOk = true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.fetchOk = false;
|
this.fetchOk = false;
|
||||||
console.log(e);
|
console.log(e);
|
||||||
|
|
Loading…
Reference in New Issue