mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-29 21:15:06 +02:00
UBERF-6747 Expose collaborator statistics (#5483)
Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
@@ -49,15 +49,26 @@
|
||||
console.error(err)
|
||||
})
|
||||
}
|
||||
async function fetchCollabStats (): Promise<void> {
|
||||
const collaborator = getMetadata(presentation.metadata.CollaboratorApiUrl)
|
||||
await fetch(collaborator + `/api/v1/statistics?token=${token}`, {})
|
||||
.then(async (json) => {
|
||||
dataCollab = await json.json()
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
})
|
||||
}
|
||||
|
||||
let data: any
|
||||
let dataFront: any
|
||||
let dataCollab: any
|
||||
let admin = false
|
||||
onDestroy(
|
||||
ticker.subscribe(() => {
|
||||
void fetchStats()
|
||||
|
||||
void fetchUIStats()
|
||||
void fetchCollabStats()
|
||||
})
|
||||
)
|
||||
const tabs: TabItem[] = [
|
||||
@@ -73,6 +84,10 @@
|
||||
id: 'statistics-front',
|
||||
labelIntl: getEmbeddedLabel('Front')
|
||||
},
|
||||
{
|
||||
id: 'statistics-collab',
|
||||
labelIntl: getEmbeddedLabel('Collaborator')
|
||||
},
|
||||
{
|
||||
id: 'users',
|
||||
labelIntl: getEmbeddedLabel('Users')
|
||||
@@ -121,6 +136,8 @@
|
||||
|
||||
$: metricsDataFront = dataFront?.metrics as Metrics | undefined
|
||||
|
||||
$: metricsDataCollab = dataCollab?.metrics as Metrics | undefined
|
||||
|
||||
$: totalStats = Array.from(Object.entries(activeSessions).values()).reduce(
|
||||
(cur, it) => {
|
||||
const totalFind = it[1].sessions.reduce((it, itm) => itm.current.find + it, 0)
|
||||
@@ -330,6 +347,12 @@
|
||||
<MetricsInfo metrics={metricsDataFront} />
|
||||
{/if}
|
||||
</div>
|
||||
{:else if selectedTab === 'statistics-collab'}
|
||||
<div class="flex-column p-3 h-full" style:overflow="auto">
|
||||
{#if metricsDataCollab !== undefined}
|
||||
<MetricsInfo metrics={metricsDataCollab} />
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{:else}
|
||||
<Loading />
|
||||
|
||||
Reference in New Issue
Block a user