From a60a2327f82b1d63ba400f4a74a7e19ee8db8256 Mon Sep 17 00:00:00 2001 From: dblythy Date: Thu, 29 Jun 2023 18:10:54 +1000 Subject: [PATCH 1/5] feat: add security checks page --- src/components/Field/Field.react.js | 2 +- src/components/Field/Field.scss | 14 +-- src/components/Label/Label.react.js | 2 +- src/dashboard/Dashboard.js | 2 + src/dashboard/DashboardView.react.js | 3 + .../Settings/Security/Security.react.js | 108 ++++++++++++++++++ src/dashboard/Settings/Security/Security.scss | 15 +++ 7 files changed, 134 insertions(+), 12 deletions(-) create mode 100644 src/dashboard/Settings/Security/Security.react.js create mode 100644 src/dashboard/Settings/Security/Security.scss diff --git a/src/components/Field/Field.react.js b/src/components/Field/Field.react.js index 53706bd2b9..d4faf6d5eb 100644 --- a/src/components/Field/Field.react.js +++ b/src/components/Field/Field.react.js @@ -26,7 +26,7 @@ let Field = ({label, input, labelWidth = 50, labelPadding, height, className}) =
{label}
-
+
{input}
diff --git a/src/components/Field/Field.scss b/src/components/Field/Field.scss index 116a490828..2978470710 100644 --- a/src/components/Field/Field.scss +++ b/src/components/Field/Field.scss @@ -14,6 +14,7 @@ border-width: 1px 1px 0 1px; min-height: 80px; background: white; + display: flex; &:last-of-type { border-bottom-width: 1px; @@ -25,16 +26,8 @@ } .left { - position: absolute; - left: 0; - height: 100%; -} - -.centered { - @include transform(translateY(-50%)); - position: absolute; - width: 100%; - top: 50%; + display: flex; + align-items: center; } .right { @@ -46,6 +39,7 @@ display: flex; justify-content: center; align-items: center; + flex: 1 } diff --git a/src/components/Label/Label.react.js b/src/components/Label/Label.react.js index efc32129f2..88b2aeb204 100644 --- a/src/components/Label/Label.react.js +++ b/src/components/Label/Label.react.js @@ -15,7 +15,7 @@ let Label = (props) => { return (
+ style={{ padding: '0 ' + padding, ...props.style }}>
{props.text}
{props.description ?
{props.description}
: null}
diff --git a/src/dashboard/Dashboard.js b/src/dashboard/Dashboard.js index 516133dead..f74461c0bd 100644 --- a/src/dashboard/Dashboard.js +++ b/src/dashboard/Dashboard.js @@ -52,6 +52,7 @@ import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'; import { Helmet } from 'react-helmet'; import Playground from './Data/Playground/Playground.react'; import DashboardSettings from './Settings/DashboardSettings/DashboardSettings.react'; +import Security from './Settings/Security/Security.react'; const ShowSchemaOverview = false; //In progress features. Change false to true to work on this feature. @@ -201,6 +202,7 @@ export default class Dashboard extends React.Component { const SettingsRoute = ( }> } /> + } /> } /> } /> } /> diff --git a/src/dashboard/DashboardView.react.js b/src/dashboard/DashboardView.react.js index b224ac6778..6ded0c57f4 100644 --- a/src/dashboard/DashboardView.react.js +++ b/src/dashboard/DashboardView.react.js @@ -201,6 +201,9 @@ export default class DashboardView extends React.Component { const settingsSections = [{ name: 'Dashboard', link: '/settings/dashboard' + }, { + name: 'Security', + link: '/settings/security', }]; // Settings - nothing remotely like this in parse-server yet. Maybe it will arrive soon. diff --git a/src/dashboard/Settings/Security/Security.react.js b/src/dashboard/Settings/Security/Security.react.js new file mode 100644 index 0000000000..0becd09246 --- /dev/null +++ b/src/dashboard/Settings/Security/Security.react.js @@ -0,0 +1,108 @@ +import DashboardView from 'dashboard/DashboardView.react'; +import Button from 'components/Button/Button.react'; +import EmptyState from 'components/EmptyState/EmptyState.react'; +import Label from 'components/Label/Label.react'; +import React from 'react'; +import Toolbar from 'components/Toolbar/Toolbar.react'; +import LoaderContainer from 'components/LoaderContainer/LoaderContainer.react'; +import styles from './Security.scss'; +import Field from 'components/Field/Field.react'; +import Fieldset from 'components/Fieldset/Fieldset.react'; +import Parse from 'parse'; + +export default class Security extends DashboardView { + constructor() { + super(); + this.section = 'App Settings'; + this.subsection = 'Security'; + this.state = { + loading: false, + data: {}, + error: '', + }; + } + + componentWillMount() { + this.reload(); + } + + componentWillReceiveProps(nextProps, nextContext) { + if (this.context !== nextContext) { + this.reload(); + } + } + + renderToolbar() { + return ( + +