From 40faae74ad50ac55c03136fb385a1961b530e459 Mon Sep 17 00:00:00 2001 From: Daniel LaCosse <3759828+daniellacosse@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:52:57 -0500 Subject: [PATCH] fix --- server_manager/www/shadowbox_server.ts | 28 ++++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/server_manager/www/shadowbox_server.ts b/server_manager/www/shadowbox_server.ts index 8b8b3ca48c..f40c6eb2e8 100644 --- a/server_manager/www/shadowbox_server.ts +++ b/server_manager/www/shadowbox_server.ts @@ -67,18 +67,6 @@ export class ShadowboxServer implements server.Server { this.supportedEndpoints = { 'experimental/server/metrics': false, }; - - this.api - .request('experimental/server/metrics') - .then( - () => (this.supportedEndpoints['experimental/server/metrics'] = true) - ) - .catch(error => { - // endpoint is not defined, keep set to false - if (error.response.status === 404) return; - - this.supportedEndpoints['experimental/server/metrics'] = true; - }); } getId(): string { @@ -173,7 +161,7 @@ export class ShadowboxServer implements server.Server { async getServerMetrics(): Promise { if (this.supportedEndpoints['experimental/server/metrics']) { return this.api.request( - 'experimental/server/metrics' + 'experimental/server/metrics?since=30d' ); } @@ -298,6 +286,20 @@ export class ShadowboxServer implements server.Server { protected setManagementApi(api: PathApiClient): void { this.api = api; + + this.api + .request( + 'experimental/server/metrics?since=30d' + ) + .then( + () => (this.supportedEndpoints['experimental/server/metrics'] = true) + ) + .catch(error => { + // endpoint is not defined, keep set to false + if (error.response.status === 404) return; + + this.supportedEndpoints['experimental/server/metrics'] = true; + }); } getManagementApiUrl(): string {