Commit Graph

171 Commits

Author SHA1 Message Date
DL6ER
aeba7c958d Only show query types for which the count is larger than zero.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-06-28 21:41:39 +02:00
DL6ER
4bf018b52c Add missing radix information in parseInt().
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-06-04 16:57:55 +02:00
DL6ER
80873e83e8 Modify how we add data to the stacked bar charts on the dashboard.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-06-04 13:24:34 +02:00
XhmikosR
a70eb512c0 Remove unneeded chart.update() calls.
Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2020-06-03 17:38:38 +03:00
XhmikosR
3b22d681ff Specify animation: false for the bar graphs
Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2020-06-03 17:38:35 +03:00
Adam Warner
02a4e83d87 create utils.getGraphType() function.
also apply setting to long term graphs
flip logic - only return "line" if the setting is explicitly set to "false"

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2020-06-01 21:10:14 +01:00
XhmikosR
cecb5aa88c Use $(fn)
This is the recommended way in jQuery 3.x.

Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2020-05-30 10:24:55 +03:00
XhmikosR
7caabf7d2a index.js: assorted simplifications
Signed-off-by: XhmikosR <xhmikosr@gmail.com>

* rename `colors` variable to avoid shadowing and be more clear
* remove function used only once
* simplify a couple of for loops
2020-05-29 11:11:34 +03:00
XhmikosR
61c29cafc4 Move padNumber() to utils.
Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2020-05-29 11:11:34 +03:00
XhmikosR
7f71f1d5fe Move objectToArray() to utils.
Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2020-05-29 11:11:32 +03:00
XhmikosR
eab6485edb Move escapeHtml to utils.
Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2020-05-29 07:41:05 +03:00
XhmikosR
9b3d8b81e7 Replace $.each with native methods.
Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2020-05-26 06:34:27 +03:00
DL6ER
c86515e028 Merge pull request #1372 from pi-hole/indexOf
Always use `!== -1` to check for a string's existence
2020-05-25 20:42:02 +02:00
DL6ER
b6ad648842 Merge pull request #1329 from pi-hole/new/somepeoplelikecurves
Add checkbox (save state in localstorage) to toggle between bar and smooth
2020-05-25 20:08:42 +02:00
XhmikosR
4356bd5f04 Always use !== -1 to check for a string's existence
`String.indexOf()` returns -1 if the string isn't found so this is consistent with the rest of the codebase.

Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2020-05-25 09:38:47 +03:00
Adam Warner
c4091a7b3b Add checkbox (save state in localstorage) to toggle between bar and smooth charts
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2020-05-18 20:56:21 +01:00
XhmikosR
623087346a Enable no-zero-fractions rule
Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2020-05-17 15:03:52 +03:00
Adam Warner
dcf3c42924 flip null check on elName. === null was not working
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2020-05-17 11:46:50 +01:00
Adam Warner
b351f45cb2 Change the names of the info elements without changing the property names of the API
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2020-05-15 09:25:01 +01:00
DL6ER
b7d74ff772 Reinstall loading overlay on long-term graphs page (shown only if data has been requested).
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-12 22:50:29 +02:00
DL6ER
a08a85994e Initial (incomplete) support for themes. Currently, the default is the new Pi-hole dark theme.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-12 22:44:52 +02:00
DL6ER
2314a60d5b Get an endless array of colors without altering the colors array itself.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-12 17:16:55 +02:00
XhmikosR
7001a1b3a1 Update index.js 2020-05-12 17:58:34 +03:00
Adam Warner
d10f1905cc fix prettier complaints
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2020-05-12 13:21:30 +01:00
Adam Warner
3e94ff0f43 Update adminLTE to 2.4.
- Change a few references per upgrade guide
 - define colors[] at the top of index.js as AdminLTE.options does not appear to exist. (there may be a better way of doing this)

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2020-05-12 12:58:45 +01:00
XhmikosR
e02df5467a Fix lint errors.
Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2020-05-11 09:20:32 +03:00
DL6ER
73ee91a024 Merge branch 'master' into master-to-development-v5.0
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-10 22:00:07 +02:00
DL6ER
b86ff763c0 Address xo complaints.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-07 07:52:18 +02:00
Adam Warner
68ce56fc56 show a clickable "." when there is a blank domain in the top domain lists
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2020-05-06 23:19:50 +01:00
DL6ER
79539bdd6c Merge pull request #1121 from pi-hole/fix/queries_over_time
Fix tooltip percentage computation and more...
2020-04-28 04:36:02 +02:00
Th3M3
fadc6073db tweak chartjs customtooltips...
...and disable 'maintainAspectRatio' for the clients chart to avoid a squeezed display on small screens.

Signed-off-by: Th3M3 <the_me@outlook.de>
2020-04-12 15:25:29 +02:00
XhmikosR
ae13014565 Adapt to the new rules.
Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2020-04-10 18:34:47 +00:00
DL6ER
1e22f3349f Merge branch 'release/v5.0' into fix/queries_over_time 2020-03-31 21:22:18 +00:00
DL6ER
280b73bf8d Fix computation of percentages in the over-time graph.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-02-04 22:40:11 +01:00
Dan Schaper
e319db238a Merge branch 'release/v5.0' into fix/queries_over_time 2020-01-25 17:50:43 -08:00
DL6ER
f2713a9b3d Always show date (but only once if the interval is on the same date), break long lines on small displays, and abbreviate gray color definition.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-01-03 14:56:13 +02:00
DL6ER
0ee3c06c77 Fix tooltip percentage computation. While we're at it, also put the blocked queries under permitted ones and show them in gray instead of blue.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-01-03 14:52:12 +02:00
XhmikosR
793a6ec49f Remove unused function isMobile()
Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2020-01-03 14:49:41 +02:00
XhmikosR
704c352277 Format JS code
Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2020-01-02 19:42:18 +02:00
Adam Warner
4fbec2a557 Merge pull request #1112 from pi-hole/scrollY
`window.scrollY` isn't supported on IE
2020-01-02 17:34:02 +00:00
Adam Warner
ab629c52a1 Replace padStart with a solution that works in older browsers
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2019-12-29 10:17:55 +02:00
XhmikosR
6e55b4f827 window.scrollY isn't supported on IE
Replace it with `window.pageYOffset`

Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2019-12-29 10:12:09 +02:00
DL6ER
1849e8a9c6 Remove unused variable.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-12-19 15:45:37 +00:00
DL6ER
aca6461468 Change over-time graphs from line to stacked bar representation. This is much more natural for this kind of data. Also, improve DB graphs to always generate a meaningful display (always generate about 200 bars). This graph was basically unusable when specifying a larger range than, say, one week.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-12-18 13:22:33 +00:00
DL6ER
f9496c5c6e Merge pull request #1087 from pi-hole/let
Use var instead of let.
2019-12-17 15:54:01 +01:00
XhmikosR
18cfd8dab1 Reuse variable and make code clearer
Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2019-12-17 12:19:43 +02:00
XhmikosR
ef396ede5b Use var instead of let.
Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2019-12-17 10:47:01 +02:00
XhmikosR
9c1846885a Clean up JS
* remove unused variables/functions
* use the dot notation
* use explicit coercion
* remove unneeded else
* use `textContent` instead of `innerHTML`
* cache a few `getElementById` calls
* fix a couple of undefined variables
* various assorted lint tweaks

Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2019-12-16 20:36:40 +02:00
XhmikosR
7031d19d25 Remove unneeded escape characters
Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2019-12-09 21:50:42 +02:00
XhmikosR
d65b5be5e2 A few CSS tweaks.
Add utilities classes and fix a few CSS issues.

Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2019-12-09 21:36:58 +02:00