Redux Saga provides a clean and testable way to run side effects while
integrating with Redux. It is used now to fetch the preferences data and
store it in the Redux store, and will later be used for more side
effects (like updating the preferences in the API).
The Redux store React provider component is moved to the top level. The
other middleware used in development mode comes from the default
middleware. We are not using `getDefaultMiddleware` because it includes
Redux Thunk, which we do not need (we use Saga instead).
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
Added libraries and their usage:
- `redux`: Base Redux capabilities
- `redux-starter-kit`: Cut down on the boilerplate of using Redux
- `react-redux`: Easily connect React components to the Redux store
The preferences in the Redux store are currently only loaded from cache
or the default. Redux Saga will be added in upcoming commits to handle
fetching the preferences from the API.
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
- Convert from `withNamespaces` to `withTranslation`
- Fix react-i18next initialization
- Use Suspense to avoid missing translation warnings, due to the `wait`
option being removed. See #248 for the next steps for Suspense.
- Replaced usages of `Subtract` (provided by v9 of react-i18next) with
`Omit` which is provided by TypeScript as of 3.5
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
As part of this change, updating the language with i18n was moved from
`PreferenceSettings` into a new `LanguageApplier` component. Also, the
alert message translation process in `PreferenceSettings` was
refactored. A new dev dependency, `jest-localstorage-mock`, was added to
help test the preferences cache implementation.
See #155
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
The boxed layout button in the top right has been removed. The layout
is now controlled by the same option used in the PHP web interface. It
is retrieved when the web interface starts, and can be changed in the
Preferences page.
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
It seems an update to the formatter caused the license headers to get
reformatted, so that is the bulk of the changes. The other large change
is that the translate HOC function was renamed to withNamespaces.
With the license headers all getting updated, I updated the year to
2019.
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
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>
This fixes a bug where the settings endpoints were able to be accessed
without authentication (the API still requires auth, so no data would
have been shown).
A slight change was made to the wording of the login page redirect.
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
For example, dashboard components go into the dashboard folder,
settings components go into the settings folder, and components
used in multiple places go into the common folder.
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
Dropdown routes require a URL prefix so that we can determine if the
dropdown should be active. Example: "/blacklist/exact" triggers the
blacklist dropdown because it has the "/blacklist" prefix.
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
Information 1 & 2 renamed to "Versions" and "Networking", contents adjusted
Faker : "vDev" for git tags, first word of multi-word returns used for domain, hostname etc.
Signed-off-by: Rob Gill <rrobgill@protonmail.com>
All changes from conflicted/mangled pull request.
Network Information
Pi-Hole component versions, branches
DNS Upstream & Settings information
DHCP settings information
FTLdb size information
Displayed in two pages, available in drop down from
settings in the sidebar.
Signed-off-by: Rob Gill <rrobgill@protonmail.com>
Breadcrumb was basically unused since we don't take advantage of making
breadcrumbs.
Also moved the nav items to `route.js`.
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
- Added `placeholder` as a parameter for `DomainInput` (and therefore
`ListPage`
- Added a few new strings to support the new list
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
This prevents people from just going directly to the protected pages.
They will get redirected to the login page.
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
Major refactor of the list page. Abstracted list management logic into
the ListPage component. The Wildlist page will soon be put under the
blacklist category with the exact blocking page (the current Blacklist)
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>