-
Notifications
You must be signed in to change notification settings - Fork 199
[Dashboard] Add admin stats #10533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
skarya22
wants to merge
7
commits into
aces:29.0-release
Choose a base branch
from
skarya22:2026_06_10_Dashboard_Admin_stats
base: 29.0-release
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[Dashboard] Add admin stats #10533
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
fab44a7
[Dashboard] Add admin stats
skarya22 1da67dc
Fix hindi
skarya22 499956b
Fix spacing
skarya22 c88eea8
Add new line
skarya22 94974d4
Merge remote-tracking branch 'aces/29.0-release' into 2026_06_10_Dash…
skarya22 29870aa
Finish adding translations to all fields in dashboard
skarya22 b4868f7
Add missing translations accross all languages
skarya22 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,147 @@ | ||
| import React, {useEffect, useState} from 'react'; | ||
| import PropTypes from 'prop-types'; | ||
| import i18n from 'I18nSetup'; | ||
| import Loader from 'Loader'; | ||
| import Panel from 'Panel'; | ||
| import {setupCharts} from './helpers/chartBuilder'; | ||
| import {useTranslation} from 'react-i18next'; | ||
| import jaStrings from '../../locale/ja/LC_MESSAGES/statistics.json'; | ||
| import hiStrings from '../../locale/hi/LC_MESSAGES/statistics.json'; | ||
| import zhStrings from '../../locale/zh/LC_MESSAGES/statistics.json'; | ||
| import frStrings from '../../locale/fr/LC_MESSAGES/statistics.json'; | ||
|
|
||
| /** | ||
| * AdminStats - a widget containing admin account statistics. | ||
| * | ||
| * @param {object} props | ||
| * @return {JSX.Element} | ||
| */ | ||
| const AdminStats = (props) => { | ||
| const {t} = useTranslation(); | ||
| const [loading, setLoading] = useState(true); | ||
| let json = props.data; | ||
|
|
||
| const [chartDetails, setChartDetails] = useState({ | ||
| 'adminStats': { | ||
| 'userregistrations_bydate': { | ||
| sizing: 11, | ||
| title: t('User Registrations', {ns: 'statistics'}), | ||
| filters: '', | ||
| chartType: 'line', | ||
| dataType: 'line', | ||
| label: t('Registrations', {ns: 'statistics'}), | ||
| legend: '', | ||
| options: {line: 'line'}, | ||
| chartObject: null, | ||
| includeTotal: false, | ||
| titlePrefix: 'Month', | ||
| dateFormat: '%m-%Y', | ||
| }, | ||
| 'uniquelogins_bymonth': { | ||
| sizing: 11, | ||
| title: t('Unique Monthly Logins', {ns: 'statistics'}), | ||
| filters: '', | ||
| chartType: 'line', | ||
| dataType: 'line', | ||
| label: t('Unique Logins', {ns: 'statistics'}), | ||
| legend: '', | ||
| options: {line: 'line'}, | ||
| chartObject: null, | ||
| includeTotal: false, | ||
| titlePrefix: 'Month', | ||
|
skarya22 marked this conversation as resolved.
Outdated
|
||
| dateFormat: '%m-%Y', | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| useEffect(() => { | ||
| i18n.addResourceBundle('ja', 'statistics', jaStrings); | ||
| i18n.addResourceBundle('zh', 'statistics', zhStrings); | ||
| i18n.addResourceBundle('hi', 'statistics', hiStrings); | ||
| i18n.addResourceBundle('fr', 'statistics', frStrings); | ||
|
|
||
| let newdetails = {...chartDetails}; | ||
| newdetails['adminStats']['userregistrations_bydate']['title'] | ||
| = t('User Registrations', {ns: 'statistics'}); | ||
| newdetails['adminStats']['userregistrations_bydate']['label'] | ||
| = t('Registrations', {ns: 'statistics'}); | ||
|
|
||
|
skarya22 marked this conversation as resolved.
Outdated
|
||
| newdetails['adminStats']['uniquelogins_bymonth']['title'] | ||
| = t('Unique Monthly Logins', {ns: 'statistics'}); | ||
| newdetails['adminStats']['uniquelogins_bymonth']['label'] | ||
| = t('Unique Logins', {ns: 'statistics'}); | ||
| setChartDetails(newdetails); | ||
|
skarya22 marked this conversation as resolved.
|
||
| }, []); | ||
|
|
||
| const showChart = (section, chartID) => { | ||
| return props.showChart(section, chartID, chartDetails, setChartDetails); | ||
| }; | ||
|
|
||
| useEffect(() => { | ||
| if (json && Object.keys(json).length !== 0) { | ||
| const newChartDetails = { | ||
| 'adminStats': { | ||
| ...chartDetails.adminStats, | ||
| 'userregistrations_bydate': { | ||
| ...chartDetails.adminStats.userregistrations_bydate, | ||
| data: json['adminstats']?.['User Registrations'], | ||
| }, | ||
| 'uniquelogins_bymonth': { | ||
| ...chartDetails.adminStats.uniquelogins_bymonth, | ||
| data: json['adminstats']?.['Unique Monthly Logins'], | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| setLoading(false); | ||
| setTimeout(() => { | ||
| setupCharts( | ||
| t, | ||
| false, | ||
| newChartDetails, | ||
| t('Total', {ns: 'loris'}) | ||
| ).then((data) => { | ||
| setChartDetails(data); | ||
| }); | ||
| }, 0); | ||
| json = props.data; | ||
| } | ||
| }, [props.data]); | ||
|
|
||
| const title = (subtitle) => t('Admin stats', {ns: 'statistics'}) | ||
| + ' — ' + t(subtitle, {ns: 'statistics'}); | ||
|
|
||
| return loading ? <Panel title='Admin stats'><Loader/></Panel> : ( | ||
| <Panel | ||
| title={t('Admin stats', {ns: 'statistics'})} | ||
| id='statistics_adminstats' | ||
| onChangeView={() => { | ||
| setupCharts(t, false, chartDetails, t('Total', {ns: 'loris'})); | ||
| }} | ||
| views={[ | ||
| { | ||
| content: | ||
| showChart('adminStats', 'userregistrations_bydate'), | ||
| title: title('User Registrations'), | ||
| }, | ||
| { | ||
| content: | ||
| showChart('adminStats', 'uniquelogins_bymonth'), | ||
| title: title('Unique Monthly Logins'), | ||
| }, | ||
| ]} | ||
| /> | ||
| ); | ||
| }; | ||
|
|
||
| AdminStats.propTypes = { | ||
| data: PropTypes.object, | ||
| baseURL: PropTypes.string, | ||
| showChart: PropTypes.func, | ||
| }; | ||
|
|
||
| AdminStats.defaultProps = { | ||
| data: {}, | ||
| }; | ||
|
|
||
| export default AdminStats; | ||
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.