Skip to content

Commit

Permalink
Pull request 2164: 6712-hourly-graphs
Browse files Browse the repository at this point in the history
Updates #6712.

Squashed commit of the following:

commit dd4c822
Merge: 7320786 28a6b9f
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Tue Mar 12 12:38:19 2024 +0300

    Merge branch 'master' into 6712-hourly-graphs

commit 7320786
Merge: ca29ee8 5388ad5
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Thu Mar 7 16:25:49 2024 +0300

    Merge branch 'master' into 6712-hourly-graphs

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

    all: upd chlog

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

    all: hourly graphs
  • Loading branch information
schzhn committed Mar 12, 2024
1 parent 28a6b9f commit 6409011
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ NOTE: Add new changes BELOW THIS COMMENT.

### Fixed

- Statistics for 7 days displayed by day on the dashboard graph ([#6712]).
- Missing "served from cache" label on long DNS server strings ([#6740]).
- Incorrect tracking of the system hosts file's changes ([#6711]).

[#5992]: https://github.com/AdguardTeam/AdGuardHome/issues/5992
[#6610]: https://github.com/AdguardTeam/AdGuardHome/issues/6610
[#6711]: https://github.com/AdguardTeam/AdGuardHome/issues/6711
[#6712]: https://github.com/AdguardTeam/AdGuardHome/issues/6712
[#6740]: https://github.com/AdguardTeam/AdGuardHome/issues/6740

<!--
Expand Down
6 changes: 6 additions & 0 deletions client/src/components/Dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ const Dashboard = ({
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
? t('for_last_hours', { count: msToHours(stats.interval) })
: t('for_last_days', { count: msToDays(stats.interval) });
Expand Down
2 changes: 1 addition & 1 deletion internal/stats/unit.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ func (s *StatsCtx) fillCollectedStats(data *StatsResp, units []*unitDB, curID ui
data.TimeUnits = timeUnitsHours

daysCount := size / 24
if daysCount >= 7 {
if daysCount > 7 {
size = daysCount
data.TimeUnits = timeUnitsDays
}
Expand Down

0 comments on commit 6409011

Please sign in to comment.