diff --git a/web/multinode/src/api/bandwidth.ts b/web/multinode/src/api/bandwidth.ts index 0a708f473..b0d2459fc 100644 --- a/web/multinode/src/api/bandwidth.ts +++ b/web/multinode/src/api/bandwidth.ts @@ -25,6 +25,10 @@ export class BandwidthClient extends APIClient { public async fetch(satelliteId: string | null, nodeId: string | null): Promise { let path = `${this.ROOT_PATH}`; + if (!satelliteId && !nodeId) { + path += '/'; + } + if (satelliteId) { path += `/satellites/${satelliteId}`; } @@ -40,9 +44,10 @@ export class BandwidthClient extends APIClient { } const traffic = await response.json(); + const daily = traffic.bandwidthDaily || []; return new BandwidthTraffic( - traffic.bandwidthDaily.map(daily => { + daily.map(daily => { return new BandwidthRollup( new Egress(daily.egress.repair, daily.egress.audit, daily.egress.usage), new Ingress(daily.ingress.repair, daily.ingress.usage), diff --git a/web/multinode/src/api/storage.ts b/web/multinode/src/api/storage.ts index 94970e178..19699f514 100644 --- a/web/multinode/src/api/storage.ts +++ b/web/multinode/src/api/storage.ts @@ -33,6 +33,13 @@ export class StorageClient extends APIClient { path += `/${nodeId}`; } + const now = new Date(); + const year = now.getUTCFullYear(); + const month = now.getUTCMonth() + 1; + const period = `${year}-${month > 9 ? month : `0${month}`}`; + + path += `?period=${period}`; + const response = await this.http.get(path); if (!response.ok) { diff --git a/web/multinode/src/app/components/bandwidth/BandwidthChart.vue b/web/multinode/src/app/components/bandwidth/BandwidthChart.vue index 91e754e13..58ce064f7 100644 --- a/web/multinode/src/app/components/bandwidth/BandwidthChart.vue +++ b/web/multinode/src/app/components/bandwidth/BandwidthChart.vue @@ -1,4 +1,4 @@ -// Copyright (C) 2019 Storj Labs, Inc. +// Copyright (C) 2021 Storj Labs, Inc. // See LICENSE for copying information.