Commit Graph

48 Commits

Author SHA1 Message Date
XhmikosR
31e9acb7a2 Use Bootstrap's classes when possible.
This reduces the custom CSS and style elements.

Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2019-11-27 16:32:15 +02:00
Mcat12
64380acd43 Convert LayoutApplier into a saga
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-07-06 14:16:04 -07:00
Mcat12
3cd50d21bd Convert LanguageApplier into a saga and add some tests
redux-saga-test-plan is added to help make testing sagas less brittle.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-06-30 20:45:14 -07:00
Mcat12
5b83f43e69 Add Redux Saga
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>
2019-06-30 18:59:57 -07:00
Mcat12
3a8f3ba5b2 Add Redux and convert LayoutApplier as a test
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>
2019-06-30 15:11:43 -07:00
Mcat12
f407853747 Migrate to v10 of react-i18next
- 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>
2019-05-31 21:33:05 -07:00
Mcat12
563ac8acc8 Cache the web interface preferences in local storage
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>
2019-03-01 21:18:10 -08:00
Mcat12
3134c8101d Convert dashboard components to TypeScript
Also fixed the format check to use TypeScript files.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-01-24 20:57:51 -08:00
Mcat12
5e7539bf83 Convert the rest of the common components to TypeScript
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-01-23 19:53:13 -08:00
Mcat12
64a0dd4f60 Convert the Full.js container component
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-01-21 17:50:47 -08:00
Mcat12
3512b49960 Convert route.js and some views
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-01-20 19:50:04 -08:00
Mcat12
2af97f830f Add preferences page with web interface layout preference
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>
2019-01-20 14:21:36 -08:00
Mcat12
4764723c36 Move context.js to components/common
It exports a component, and is only used by components.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-01-18 18:35:15 -08:00
Mcat12
848dc15a4a Add enable/disable buttons to the sidebar
The currently are read-only, they do not do anything when clicked.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-01-17 21:14:04 -08:00
Mcat12
b15326f7d4 Update packages to the latest versions
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>
2019-01-17 20:58:41 -08:00
Mcat12
97bd418ced Add support for custom components in the sidebar
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-01-16 22:16:48 -08: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
1dcdd23f02 Add Prettier and format code
Formatting is checked in CI

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-10-21 15:12:48 -04:00
Mcat12
e0c22465be Generate route data from the existing navigation data
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>
2018-08-18 15:56:39 -04:00
Mcat12
61cc62306e Organize components into folders based on where they are used
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>
2018-08-18 11:34:35 -04:00
Mcat12
097409e5a2 Improve sidebar active dropdown detection
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>
2018-07-07 18:50:18 -04:00
Mcat12
5797e5816c Fix incorrect Sidebar prop in Full
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-07-07 17:54:00 -04:00
Mcat12
7c0b0657b7 Merge branch 'development' into feature/tests
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-07-07 17:39:04 -04:00
Rob Gill
6cc22d89a6 Formatting, translation namespaces
Signed-off-by: Rob Gill <rrobgill@protonmail.com>
2018-07-04 15:24:49 -04:00
Rob Gill
8a611a627c Changed paths /settings
Signed-off-by: Rob Gill <rrobgill@protonmail.com>
2018-07-04 15:24:49 -04:00
Rob Gill
ad7ec23b17 Aligned with CoreUI update
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>
2018-07-04 15:24:49 -04:00
Rob Gill
0cfd9a28a0 Settings - Information pages
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>
2018-07-04 15:24:49 -04:00
Mcat12
a0129b7743 Add some Sidebar tests
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-07-01 15:47:08 -04:00
Mcat12
e68220f4e4 Remove Aside
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-06-28 21:42:34 -04:00
Mcat12
cceba15cf3 Merge branch 'development' into feature/regexlist 2018-06-03 22:29:14 -04:00
Mcat12
67b01d0b30 Internationalize the login page and remove Breadcrumb
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>
2018-06-03 22:05:25 -04:00
Mcat12
4c2527e512 Convert Wildlist into Regexlist
- 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>
2018-06-03 17:52:17 -04:00
Mcat12
2d70327887 Require authentication to certain routes through the Router
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>
2018-04-30 15:41:37 -04:00
Mcat12
d46755db2a Add Logout button
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-04-30 14:59:03 -04:00
Mcat12
7df5f34e22 Get login page looking decent
Still lots of work to do

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-09-24 18:17:07 -04:00
Mcat12
f80e6ed0d6 Change license and headers to reflect the real name of the repo 2017-09-24 15:59:14 -04:00
Mcat12
28f33a4e87 Remove extra space near license header 2017-09-24 15:38:38 -04:00
Mcat12
fb2b315d32 Close the sidebar on mobile if open and the page body is clicked
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-09-11 16:13:56 -04:00
Mcat12
9d47ae2ce0 Add license
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-09-10 13:22:53 -04:00
Mcat12
40227e8527 Move JS files out of separate folders
No need for all the extra package.json files, clears up the structure
a bit.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-09-10 12:59:23 -04:00
Mcat12
39a72367e9 Activate the Wildlist
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-09-04 18:03:00 -04:00
Mcat12
d812fa414d Add Blacklist page
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>
2017-09-04 16:13:23 -04:00
Mcat12
fb525c47a2 Simplify code by not using classes when they aren't needed
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-07-30 15:37:54 -04:00
Mcat12
d8fa185e69 Move export default into class headers
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-07-30 14:45:07 -04:00
Mcat12
c2edbae9cc Add empty Whitelist page
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-07-30 14:37:12 -04:00
Mcat12
a2aee0b8aa Move Query Log to components
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-07-30 14:20:56 -04:00
Mcat12
adf7e20bb5 Add first version of the Query Log
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-07-24 23:05:12 -04:00
Mcat12
476a64a468 Initial commit 2017-06-17 17:03:55 -04:00