Commit Graph
547 Commits
Author SHA1 Message Date
Mark Drobnak fc8ceb2d25 Merge branch 'development' into fix/doughnut-chart-bugs 2018-12-16 11:46:35 -05:00
Mark Drobnak 88c44dfabd Merge pull request #117 from pi-hole/feature/shm-API-update
Update dashboard components to use new shared memory API data
2018-12-16 11:45:59 -05:00
Mcat12 b2f9fbe085 Fix doughnut charts acting weird when resized
The charts would start displaying data from other charts, and would have
graphical glitches. The glitches are fixed by giving the chart its own
copy of the dataset.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-12-16 00:08:21 -05:00
Mcat12 7bc9704587 Update dashboard components to use new shared memory API data
make-fake-data.js was put through the formatter.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-12-15 23:46:33 -05:00
Mark Drobnak 76e3910075 Merge pull request #114 from pi-hole/tweak/remove-proxy
Remove the proxy option from package.json
2018-12-12 15:19:09 -05:00
Mark Drobnak d6a7c2b12d Merge branch 'development' into tweak/remove-proxy 2018-12-12 15:17:05 -05:00
Mcat12 77548d1181 Remove the proxy option from package.json
It should only be added when testing against a real API instance. Most
of the time, development is done against the fake API, or there is no
real API running to test with.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-12-12 15:14:43 -05:00
Mark Drobnak 9f08cb0725 Merge pull request #112 from pi-hole/tweak/simplify-domainlist
Simplify DomainList
2018-12-10 16:51:18 -05:00
Mcat12 29394ceff9 Fix custom style not applying
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-29 23:24:45 -05:00
Mcat12 237bce2cb2 Simplify DomainList from a class to a function
It should be easier to read now.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-29 18:36:24 -05:00
Mark Drobnak 872eb67ad1 Merge pull request #110 from pi-hole/fix/dhcp-save-unmount
Cancel DHCP update if component unmounts
2018-11-11 14:54:52 -05:00
Mark Drobnak f82effc1e0 Merge branch 'development' into fix/dhcp-save-unmount 2018-11-11 14:53:23 -05:00
Mark Drobnak f1c6bb9a26 Merge pull request #109 from pi-hole/tweak/simplify-list-page
Simplify ListPage and DomainList
2018-11-11 10:09:54 -05:00
Mcat12 2a265d7342 Merge branch 'development' into tweak/simplify-list-page
# Conflicts:
#	src/components/list/DomainList.js
2018-11-11 10:03:26 -05:00
Mark Drobnak 293e537c40 Merge pull request #108 from pi-hole/feature/with-api-component
Abstract Retrieving Data From API
2018-11-11 10:02:18 -05:00
Mcat12 8e77dfb05f Cancel DHCP update if component unmounts
This was done for loading settings, but was forgotten for saving them.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-10 21:48:19 -05:00
Mcat12 7eeb6cc386 Fix invalid use of error props in summary stats tests
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-10 21:30:56 -05:00
Mcat12 cfc3b57c98 Move the API tests closer to the API file
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-10 21:30:16 -05:00
Mcat12 5dfb837b2c Convert VersionInfo to use WithAPIData
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-10 21:25:52 -05:00
Mcat12 b8ff1adfd1 Convert FTLInfo to use WithAPIData
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-10 21:16:44 -05:00
Mcat12 d639cfe3d4 Change initialData from a function to object
It was just returning a static object.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-10 21:16:12 -05:00
Mcat12 3586546580 Convert NetworkInfo to use WithAPIData
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-10 21:04:17 -05:00
Mcat12 e32e10fccc Fix wrong name in default props for WithAPIData
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-10 21:03:52 -05:00
Mcat12 f815f5ba55 Simplify ListPage and DomainList
The removal of domains happens in ListPage now instead of DomainList.
The three alerts in ListPage are condensed into one.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-10 20:44:40 -05:00
Mcat12 efdf602711 Convert StatusBadge to use WithAPIData
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-10 15:31:49 -05:00
Mcat12 f6cd2d3c57 Convert "TopX" components to use WithAPIData
Also improved the testability of the components.
Fixed an issue in WithAPIData where the component would get undefined
data if the promise was canceled.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-10 15:23:47 -05:00
Mcat12 a52efd0c3d Convert QueriesGraph to use WithAPIData
Also fix ClientsGraph's options, because they required the translate
function and couldn't be static.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-10 14:12:00 -05:00
Mcat12 de99025f49 Convert GenericDoughnutChart to use WithAPIData
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-10 11:33:58 -05:00
Mcat12 15813e2124 Rename ClientsGraph loadingState to loadingProps
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-10 11:23:02 -05:00
Mcat12 f070ffe208 Merge branch 'development' into feature/with-api-component 2018-11-10 11:15:35 -05:00
Mcat12 a87ed892cd Convert ClientsGraph to use WithAPIData
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-10 11:10:42 -05:00
Mcat12 131a418cb7 Add test for summary API data transformation function
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-10 10:53:38 -05:00
Mark Drobnak 10eb316898 Merge pull request #106 from pi-hole/feature/update-dhcp
Save DHCP Settings
2018-11-10 10:12:37 -05:00
Mcat12 2b8feb0808 Remove fetchMock from SummaryStats tests
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-09 23:58:34 -05:00
Mcat12 309bcabf9b Add WithAPIData component
This component acts as a provider of API data to decouple the view
from the data source. Previously the components would handle getting
the API data themselves, which hurt testing.

util.js has been split out into three files in a new "util" directory.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-09 23:49:47 -05:00
Mcat12 8fd794a905 Add DHCPInfo tests
Also renamed `updateDHCPInfo` to `loadDHCPInfo` to note that it does not
save/update the DHCP info.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-09 18:14:03 -05:00
Mcat12 ec26ad763b Fix isCanceled test issue
When the convertJSON call was added as a catch to the api call
response promises, it didn't handle canceled requests correctly.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-08 23:21:13 -05:00
Mcat12 ef39aff53d Update translations for new settings strings
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-08 23:04:53 -05:00
Mcat12 eadde4ddc5 Show progress and result of saving DHCP settings
The submit button is disabled while the settings are being processed.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-08 22:53:59 -05:00
Mcat12 6177dcc9ae Add default argument for onClick in Alert
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-08 22:50:47 -05:00
Mcat12 87627a1d30 Add api-errors to the list of translation tags, and update translations
The threshold for downloading languages has been lowered to 70%.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-08 22:19:33 -05:00
Mcat12 042d468a04 Translate API errors
The API errors are translated based off of the error key. If the error
was a JavaScript error (Error type), then the message should already
be translated.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-08 16:37:53 -05:00
Mcat12 1c2d881ae1 Send a DHCP settings update request when DHCP settings are applied
If an error is returned, it is shown at the top of the form.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-08 15:53:00 -05:00
Mcat12 aadadca1b2 Add updateDHCPInfo to the api endpoints
Required adding a `put` method for making PUT requests

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-08 15:50:06 -05:00
Mcat12 07c37b2a8a Handle API errors better by handling rejected promises from fetch
Some statuses (such as 500) are returned as rejected promises by fetch.
These responses are now caught and handled as normal API responses
(checking for errors later). If fetch returns an Error, that is kept as
a rejected promise.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-08 15:48:54 -05:00
Mcat12 8c39914f46 Don't refresh DHCP settings after page load
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-08 12:10:44 -05:00
Mark Drobnak 256d747ae4 Merge pull request #104 from pi-hole/feature/allow-empty-dhcp-setting
Allow empty DHCP settings if DHCP is not enabled
2018-11-05 17:12:49 -05:00
Mcat12 a6874f202b Allow empty DHCP settings if DHCP is not enabled
Previously you could put any values in the DHCP settings if it was
disabled. Now you must have either valid settings or empty settings when
DHCP is disabled. This avoids sending arbitrary setting strings to the
API.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-05 16:49:23 -05:00
Mark Drobnak 4a414c50e1 Merge pull request #97 from miro1091/footer-dev
Dont Show Versions In Footer
2018-11-05 13:22:32 -05:00
Mcat12 aa669330cf Update Translations
This adds the "Update Available" text, among other updates.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-05 13:18:28 -05:00