-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ✨ Fetch and show analytics reports object
Fetched the /v1/statistics endpoint and showed its result object in a new component called AnalyticsReports
- Loading branch information
Showing
3 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
apps/meteor/client/views/admin/viewLogs/AnalyticsReports.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Box } from '@rocket.chat/fuselage'; | ||
import React from 'react'; | ||
|
||
import { useAnalyticsObject } from './hooks/useAnalyticsObject'; | ||
|
||
const AnalyticsReports = () => { | ||
const analytics = useAnalyticsObject(); | ||
|
||
return ( | ||
<Box display='flex' flexDirection='column' padding={8} flexGrow={1} color='default' bg='neutral' borderRadius='x4' overflow='scroll'> | ||
<pre>{JSON.stringify(analytics, null, '\t')}</pre> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default AnalyticsReports; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
apps/meteor/client/views/admin/viewLogs/hooks/useAnalyticsObject.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { useEndpoint } from '@rocket.chat/ui-contexts'; | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
export const useAnalyticsObject = () => { | ||
const getAnalytics = useEndpoint('GET', '/v1/statistics'); | ||
|
||
return useQuery(['analytics'], () => getAnalytics({})); | ||
}; |