Merge branch 'master' into AGDNS-2627-query-statistics

This commit is contained in:
Stanislav Chzhen 2025-01-30 14:01:46 +03:00
commit 4a9d79a259
4 changed files with 38 additions and 21 deletions

View File

@ -9,15 +9,29 @@ The format is based on [*Keep a Changelog*](https://keepachangelog.com/en/1.0.0/
<!--
## [v0.108.0] TBA
## [v0.107.56] - 2025-01-10 (APPROX.)
## [v0.107.57] - 2025-02-10 (APPROX.)
See also the [v0.107.56 GitHub milestone][ms-v0.107.56].
See also the [v0.107.57 GitHub milestone][ms-v0.107.57].
[ms-v0.107.56]: https://github.com/AdguardTeam/AdGuardHome/milestone/91?closed=1
[ms-v0.107.57]: https://github.com/AdguardTeam/AdGuardHome/milestone/92?closed=1
NOTE: Add new changes BELOW THIS COMMENT.
-->
### Fixed
- The formatting of large numbers in the upstream table and query log ([#7590]).
[#7590]: https://github.com/AdguardTeam/AdGuardHome/issues/7590
<!--
NOTE: Add new changes ABOVE THIS COMMENT.
-->
## [v0.107.56] - 2025-01-23
See also the [v0.107.56 GitHub milestone][ms-v0.107.56].
### Security
- Go version has been updated to prevent the possibility of exploiting the Go vulnerabilities fixed in [1.23.5][go-1.23.5].
@ -44,10 +58,7 @@ NOTE: Add new changes BELOW THIS COMMENT.
[#7513]: https://github.com/AdguardTeam/AdGuardHome/issues/7513
[go-1.23.5]: https://groups.google.com/g/golang-announce/c/sSaUhLA-2SI
<!--
NOTE: Add new changes ABOVE THIS COMMENT.
-->
[ms-v0.107.56]: https://github.com/AdguardTeam/AdGuardHome/milestone/91?closed=1
## [v0.107.55] - 2024-12-11
@ -2989,11 +3000,12 @@ See also the [v0.104.2 GitHub milestone][ms-v0.104.2].
[ms-v0.104.2]: https://github.com/AdguardTeam/AdGuardHome/milestone/28?closed=1
<!--
[Unreleased]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.107.56...HEAD
[v0.107.55]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.107.55...v0.107.56
[Unreleased]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.107.57...HEAD
[v0.107.57]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.107.56...v0.107.57
-->
[Unreleased]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.107.55...HEAD
[Unreleased]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.107.56...HEAD
[v0.107.56]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.107.55...v0.107.56
[v0.107.55]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.107.54...v0.107.55
[v0.107.54]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.107.53...v0.107.54
[v0.107.53]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.107.52...v0.107.53

View File

@ -10,6 +10,7 @@ import Card from '../ui/Card';
import DomainCell from './DomainCell';
import { DASHBOARD_TABLES_DEFAULT_PAGE_SIZE, TABLES_MIN_ROWS } from '../../helpers/constants';
import { formatNumber } from '../../helpers/helpers';
interface TimeCellProps {
value?: string | number;
@ -20,7 +21,7 @@ const TimeCell = ({ value }: TimeCellProps) => {
return '';
}
const valueInMilliseconds = round(Number(value) * 1000);
const valueInMilliseconds = formatNumber(round(Number(value) * 1000));
return (
<div className="logs__row o-hidden">

View File

@ -154,7 +154,7 @@ const Dashboard = ({
}}
disabled={processingProtection}>
{protectionDisabledDuration
? `${t('enable_protection_timer')} ${getRemaningTimeText(protectionDisabledDuration)}`
? `${t('enable_protection_timer', { time: getRemaningTimeText(protectionDisabledDuration) })}`
: getProtectionBtnText(protectionEnabled)}
</button>

View File

@ -453,7 +453,7 @@ export const getParamsForClientsSearch = (data: any, param: any, additionalParam
});
return {
clients: Array.from(clients).map(id => ({ id })),
clients: Array.from(clients).map((id) => ({ id })),
};
};
@ -670,9 +670,16 @@ export const countClientsStatistics = (ids: any, autoClients: any) => {
* @param {function} t translate
* @returns {string}
*/
export const formatElapsedMs = (elapsedMs: any, t: any) => {
const formattedElapsedMs = parseInt(elapsedMs, 10) || parseFloat(elapsedMs).toFixed(2);
return `${formattedElapsedMs} ${t('milliseconds_abbreviation')}`;
export const formatElapsedMs = (elapsedMs: string, t: (key: string) => string) => {
const parsedElapsedMs = parseInt(elapsedMs, 10);
if (Number.isNaN(parsedElapsedMs)) {
return elapsedMs;
}
const formattedMs = formatNumber(parsedElapsedMs);
return `${formattedMs} ${t('milliseconds_abbreviation')}`;
};
/**
@ -754,12 +761,9 @@ type NestedObject = {
order: number;
};
export const getObjectKeysSorted = <
T extends Record<string, NestedObject>,
K extends keyof NestedObject
>(
export const getObjectKeysSorted = <T extends Record<string, NestedObject>, K extends keyof NestedObject>(
object: T,
sortKey: K
sortKey: K,
): string[] => {
return Object.entries(object)
.sort(([, a], [, b]) => (a[sortKey] as number) - (b[sortKey] as number))