From fe0e164659cca012987c1170778907a79cb7110e Mon Sep 17 00:00:00 2001 From: 3thibaut1304 Date: Sat, 21 Jun 2025 21:28:07 +0200 Subject: [PATCH] add number of active connections and i renamed sftpgo_api_key to sftpgoApiKey to maintain naming consistency with the rest of the codebase --- src/components/services/Sftpgo.vue | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/components/services/Sftpgo.vue b/src/components/services/Sftpgo.vue index 73a7b6e..3b4e2f5 100644 --- a/src/components/services/Sftpgo.vue +++ b/src/components/services/Sftpgo.vue @@ -6,8 +6,11 @@ - @@ -23,7 +26,7 @@ import service from "@/mixins/service.js"; export default { - name: "Sftgo", + name: "SFTPGo", mixins: [service], props: { item: Object, @@ -31,6 +34,7 @@ export default { data: () => ({ fetchOk: null, versionstring: null, + activeConnections: null, }), computed: { status: function () { @@ -43,13 +47,17 @@ export default { methods: { fetchStatus: async function () { let headers = {}; - if (this.item.sftpgo_api_key) { - headers["X-SFTPGO-API-KEY"] = `${this.item.sftpgo_api_key}`; + if (this.item.sftpgoApiKey) { + headers["X-SFTPGO-API-KEY"] = `${this.item.sftpgoApiKey}`; } try { const response = await this.fetch("/api/v2/version", { headers }); - this.fetchOk = true; 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) { this.fetchOk = false; console.log(e);