From 1a95161784eb52a693d712ae3b93fe33c08beaf7 Mon Sep 17 00:00:00 2001 From: Jan Pieper Date: Tue, 28 Jan 2025 09:53:58 +0100 Subject: [PATCH 1/3] fix: time in `enable_protection_timer` translation --- client/src/components/Dashboard/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/Dashboard/index.tsx b/client/src/components/Dashboard/index.tsx index 8dacfd6b..e7d39ae6 100644 --- a/client/src/components/Dashboard/index.tsx +++ b/client/src/components/Dashboard/index.tsx @@ -154,7 +154,7 @@ const Dashboard = ({ }} disabled={processingProtection}> {protectionDisabledDuration - ? `${t('enable_protection_timer')} ${getRemaningTimeText(protectionDisabledDuration)}` + ? `${t('enable_protection_timer', { time: getRemaningTimeText(protectionDisabledDuration) })}` : getProtectionBtnText(protectionEnabled)} From c7b65fa522b7f9d48e729ae76069a0c28937fb47 Mon Sep 17 00:00:00 2001 From: Eugene Burkov Date: Tue, 28 Jan 2025 21:10:48 +0300 Subject: [PATCH 2/3] Pull request 2335: Update changelog Merge in DNS/adguard-home from upd-chlog to master Squashed commit of the following: commit ea263dbf3e2d409ae9a982b89ee7976de96138b1 Author: Eugene Burkov Date: Tue Jan 28 20:53:44 2025 +0300 all: upd chlog --- CHANGELOG.md | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2503edd3..9c216f35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,15 +9,23 @@ The format is based on [*Keep a Changelog*](https://keepachangelog.com/en/1.0.0/ + + +## [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]. @@ -36,14 +44,11 @@ NOTE: Add new changes BELOW THIS COMMENT. - The formatting of large numbers on the dashboard ([#7329]). -[#7513]: https://github.com/AdguardTeam/AdGuardHome/issues/7513 [#7329]: https://github.com/AdguardTeam/AdGuardHome/issues/7329 +[#7513]: https://github.com/AdguardTeam/AdGuardHome/issues/7513 [go-1.23.5]: https://groups.google.com/g/golang-announce/c/sSaUhLA-2SI - - +[ms-v0.107.56]: https://github.com/AdguardTeam/AdGuardHome/milestone/91?closed=1 ## [v0.107.55] - 2024-12-11 @@ -2985,11 +2990,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.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 From cc2006f61600858acdd7ba3a079b3b9fd9fc3873 Mon Sep 17 00:00:00 2001 From: Ildar Kamalov Date: Wed, 29 Jan 2025 18:08:39 +0300 Subject: [PATCH 3/3] Pull request #2337: ADG-9565 Merge in DNS/adguard-home from ADG-9565 to master Squashed commit of the following: commit ef92c2e8918c76d3fec40dbc5b838cf73f84b5c1 Merge: a4364ff7e 91270d0b6 Author: Ildar Kamalov Date: Wed Jan 29 13:42:29 2025 +0300 Merge branch 'master' into ADG-9565 commit a4364ff7ed5ed7f6b0cadd85e52d1005451f2b1b Author: Ildar Kamalov Date: Wed Jan 29 13:39:14 2025 +0300 ADG-9565 format large numbers in the upstream table and query log --- CHANGELOG.md | 6 +++++ .../components/Dashboard/UpstreamAvgTime.tsx | 3 ++- client/src/helpers/helpers.tsx | 22 +++++++++++-------- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c216f35..f68e4872 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,12 @@ See also the [v0.107.57 GitHub milestone][ms-v0.107.57]. 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 + diff --git a/client/src/components/Dashboard/UpstreamAvgTime.tsx b/client/src/components/Dashboard/UpstreamAvgTime.tsx index 48ed9e6a..8f5b4cab 100644 --- a/client/src/components/Dashboard/UpstreamAvgTime.tsx +++ b/client/src/components/Dashboard/UpstreamAvgTime.tsx @@ -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 (
diff --git a/client/src/helpers/helpers.tsx b/client/src/helpers/helpers.tsx index d04676c4..60851b36 100644 --- a/client/src/helpers/helpers.tsx +++ b/client/src/helpers/helpers.tsx @@ -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, - K extends keyof NestedObject ->( +export const getObjectKeysSorted = , 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))