UBERF-6042: Fix front service (#4991)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev
2024-03-15 21:30:50 +06:00
committed by GitHub
parent 7d1508b792
commit 487d753a9a
7 changed files with 515 additions and 532 deletions
@@ -18,8 +18,8 @@
import Expandable from '@hcengineering/ui/src/components/Expandable.svelte'
import { ObjectPresenter } from '@hcengineering/view-resources'
import { onDestroy } from 'svelte'
import MetricsInfo from './statistics/MetricsInfo.svelte'
import { workspacesStore } from '../utils'
import MetricsInfo from './statistics/MetricsInfo.svelte'
const _endpoint: string = fetchMetadataLocalStorage(login.metadata.LoginEndpoint) ?? ''
const token: string = getMetadata(presentation.metadata.Token) ?? ''
@@ -30,6 +30,7 @@
}
let data: any
let dataFront: any
let admin = false
onDestroy(
ticker.subscribe(() => {
@@ -41,6 +42,14 @@
.catch((err) => {
console.error(err)
})
void fetch(`/api/v1/statistics?token=${token}`, {})
.then(async (json) => {
dataFront = await json.json()
})
.catch((err) => {
console.error(err)
})
})
)
const tabs: TabItem[] = [
@@ -50,7 +59,11 @@
},
{
id: 'statistics',
labelIntl: getEmbeddedLabel('Statistics')
labelIntl: getEmbeddedLabel('Server')
},
{
id: 'statistics-front',
labelIntl: getEmbeddedLabel('Front')
},
{
id: 'users',
@@ -91,6 +104,8 @@
$: metricsData = data?.metrics as Metrics | undefined
$: metricsDataFront = dataFront?.metrics as Metrics | undefined
$: totalStats = Array.from(Object.entries(activeSessions).values()).reduce(
(cur, it) => {
const totalFind = it[1].reduce((it, itm) => itm.current.find + it, 0)
@@ -240,6 +255,12 @@
<MetricsInfo metrics={metricsData} />
{/if}
</div>
{:else if selectedTab === 'statistics-front'}
<div class="flex-column p-3 h-full" style:overflow="auto">
{#if metricsDataFront !== undefined}
<MetricsInfo metrics={metricsDataFront} />
{/if}
</div>
{/if}
{:else}
<Loading />