Commit Graph
539 Commits
Author SHA1 Message Date
Mcat12 b0a377f80c Implement DnsList components
These components will display an editable list of upstream DNS servers.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-30 17:36:45 -05:00
Mcat12 8f84a66dbc Add isValidIpv4OptionalPort validation function
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-29 17:13:53 -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
Mark Drobnak fe7284fa97 Merge branch 'development' into footer-dev 2018-11-05 13:07:44 -05:00
Mark Drobnak c8d3db377b Merge pull request #103 from pi-hole/feature/network-settings
DHCP Settings
2018-11-05 13:06:44 -05:00
Mcat12 7d64bb33f8 Make sure IPv4 addresses can not contain segments greater than 255
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-05 12:59:52 -05:00
Mcat12 1895b106ff Rename isStrictPositiveNumber to isPositiveNumber
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-05 12:39:19 -05:00
Mcat12 bc8e38cfce Add validation to DHCP settings
The button is not yet rigged to save the settings, but it is only
enabled if all of the settings are valid.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-05 12:01:22 -05:00
Mcat12 e51f210335 Don't use arbitrary strings for loading and error states in settings
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-05 11:59:59 -05:00
Mcat12 bc12f17e1e Add isValidIpv4
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-05 11:54:52 -05:00
Mcat12 cd53df4b96 Fix margins on checkboxes
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-05 11:47:17 -05:00