Pull request 2164: 6712-hourly-graphs

Updates #6712.

Squashed commit of the following:

commit dd4c822dfea04cdedf2f3fd5ea7d492ef1c5f7d1
Merge: 73207860f 28a6b9f30
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Tue Mar 12 12:38:19 2024 +0300

    Merge branch 'master' into 6712-hourly-graphs

commit 73207860f6428ad2c7d3afe7e2d654cfeefcffdc
Merge: ca29ee8e4 5388ad55a
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Thu Mar 7 16:25:49 2024 +0300

    Merge branch 'master' into 6712-hourly-graphs

commit ca29ee8e41bf34b7fa4d261a2c9d2a809b97f874
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Thu Mar 7 14:41:45 2024 +0300

    all: upd chlog

commit 9d6154aef8f0c4db24c50bee6aaedc4b98e26b3c
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Thu Mar 7 14:10:32 2024 +0300

    all: hourly graphs
This commit is contained in:
Stanislav Chzhen 2024-03-12 13:13:59 +03:00
parent 28a6b9f303
commit 6409011510
3 changed files with 9 additions and 1 deletions

View File

@ -32,12 +32,14 @@ NOTE: Add new changes BELOW THIS COMMENT.
### Fixed ### Fixed
- Statistics for 7 days displayed by day on the dashboard graph ([#6712]).
- Missing "served from cache" label on long DNS server strings ([#6740]). - Missing "served from cache" label on long DNS server strings ([#6740]).
- Incorrect tracking of the system hosts file's changes ([#6711]). - Incorrect tracking of the system hosts file's changes ([#6711]).
[#5992]: https://github.com/AdguardTeam/AdGuardHome/issues/5992 [#5992]: https://github.com/AdguardTeam/AdGuardHome/issues/5992
[#6610]: https://github.com/AdguardTeam/AdGuardHome/issues/6610 [#6610]: https://github.com/AdguardTeam/AdGuardHome/issues/6610
[#6711]: https://github.com/AdguardTeam/AdGuardHome/issues/6711 [#6711]: https://github.com/AdguardTeam/AdGuardHome/issues/6711
[#6712]: https://github.com/AdguardTeam/AdGuardHome/issues/6712
[#6740]: https://github.com/AdguardTeam/AdGuardHome/issues/6740 [#6740]: https://github.com/AdguardTeam/AdGuardHome/issues/6740
<!-- <!--

View File

@ -55,6 +55,12 @@ const Dashboard = ({
return t('stats_disabled_short'); return t('stats_disabled_short');
} }
const msIn7Days = 604800000;
if (stats.timeUnits === TIME_UNITS.HOURS && stats.interval === msIn7Days) {
return t('for_last_days', { count: msToDays(stats.interval) });
}
return stats.timeUnits === TIME_UNITS.HOURS return stats.timeUnits === TIME_UNITS.HOURS
? t('for_last_hours', { count: msToHours(stats.interval) }) ? t('for_last_hours', { count: msToHours(stats.interval) })
: t('for_last_days', { count: msToDays(stats.interval) }); : t('for_last_days', { count: msToDays(stats.interval) });

View File

@ -484,7 +484,7 @@ func (s *StatsCtx) fillCollectedStats(data *StatsResp, units []*unitDB, curID ui
data.TimeUnits = timeUnitsHours data.TimeUnits = timeUnitsHours
daysCount := size / 24 daysCount := size / 24
if daysCount >= 7 { if daysCount > 7 {
size = daysCount size = daysCount
data.TimeUnits = timeUnitsDays data.TimeUnits = timeUnitsDays
} }