From fffe3a7f8bdf96c4ce9e93adf5fb4a694af1346e Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Mon, 2 Aug 2021 10:23:58 -0600 Subject: [PATCH] ui(admin): fix node settings button --- .../Api/Application/Nodes/NodeController.php | 2 +- .../Application/Nodes/StoreNodeRequest.php | 14 +- .../admin/nodes/NodeLimitContainer.tsx | 76 +++--- .../admin/nodes/NodeListenContainer.tsx | 76 +++--- .../admin/nodes/NodeSettingsContainer.tsx | 223 +++++++++--------- .../components/admin/servers/OwnerSelect.tsx | 10 +- 6 files changed, 202 insertions(+), 199 deletions(-) diff --git a/app/Http/Controllers/Api/Application/Nodes/NodeController.php b/app/Http/Controllers/Api/Application/Nodes/NodeController.php index f2e5e5476..fdf86ccc6 100644 --- a/app/Http/Controllers/Api/Application/Nodes/NodeController.php +++ b/app/Http/Controllers/Api/Application/Nodes/NodeController.php @@ -108,7 +108,7 @@ class NodeController extends ApplicationApiController $node = $this->updateService->handle( $node, $request->validated(), - $request->input('reset_secret'), + false, ); return $this->fractal->item($node) diff --git a/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php b/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php index 5a737d941..9ce8b37de 100644 --- a/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php +++ b/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php @@ -17,20 +17,24 @@ class StoreNodeRequest extends ApplicationApiRequest public function rules(array $rules = null): array { return collect($rules ?? Node::getRules())->only([ - 'public', 'name', 'location_id', + 'database_host_id', 'fqdn', - 'listen_port_http', - 'listen_port_sftp', - 'public_port_http', - 'public_port_sftp', 'scheme', 'behind_proxy', + 'public', + + 'listen_port_http', + 'public_port_http', + 'listen_port_sftp', + 'public_port_sftp', + 'memory', 'memory_overallocate', 'disk', 'disk_overallocate', + 'upload_size', 'daemon_base', ])->mapWithKeys(function ($value, $key) { diff --git a/resources/scripts/components/admin/nodes/NodeLimitContainer.tsx b/resources/scripts/components/admin/nodes/NodeLimitContainer.tsx index 8fbd9d429..93fc0c3bf 100644 --- a/resources/scripts/components/admin/nodes/NodeLimitContainer.tsx +++ b/resources/scripts/components/admin/nodes/NodeLimitContainer.tsx @@ -3,7 +3,7 @@ import AdminBox from '@/components/admin/AdminBox'; import tw from 'twin.macro'; import Field from '@/components/elements/Field'; import SpinnerOverlay from '@/components/elements/SpinnerOverlay'; -import { Form, useFormikContext } from 'formik'; +import { useFormikContext } from 'formik'; export default () => { const { isSubmitting } = useFormikContext(); @@ -12,47 +12,45 @@ export default () => { -
-
-
- -
- -
- -
+
+
+
-
-
- -
- -
- -
+
+
- +
+ +
+
+ +
+ +
+ +
+
); }; diff --git a/resources/scripts/components/admin/nodes/NodeListenContainer.tsx b/resources/scripts/components/admin/nodes/NodeListenContainer.tsx index 3145f6b13..69870d962 100644 --- a/resources/scripts/components/admin/nodes/NodeListenContainer.tsx +++ b/resources/scripts/components/admin/nodes/NodeListenContainer.tsx @@ -3,7 +3,7 @@ import AdminBox from '@/components/admin/AdminBox'; import tw from 'twin.macro'; import Field from '@/components/elements/Field'; import SpinnerOverlay from '@/components/elements/SpinnerOverlay'; -import { Form, useFormikContext } from 'formik'; +import { useFormikContext } from 'formik'; export default () => { const { isSubmitting } = useFormikContext(); @@ -12,47 +12,45 @@ export default () => { -
-
-
- -
- -
- -
+
+
+
-
-
- -
- -
- -
+
+
- +
+ +
+
+ +
+ +
+ +
+
); }; diff --git a/resources/scripts/components/admin/nodes/NodeSettingsContainer.tsx b/resources/scripts/components/admin/nodes/NodeSettingsContainer.tsx index f99a672e4..f94b0cf73 100644 --- a/resources/scripts/components/admin/nodes/NodeSettingsContainer.tsx +++ b/resources/scripts/components/admin/nodes/NodeSettingsContainer.tsx @@ -51,105 +51,103 @@ const NodeSettingsContainer = () => { -
-
- +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ + +
+ + +
+
-
- +
+ + +
+ + +
+
-
- +
+ + +
+ + +
- -
- -
- -
- - -
- - - -
-
- -
- - -
- - - -
-
- -
- - -
- - - -
-
- +
); }; @@ -167,6 +165,7 @@ export default () => { } const submit = (values: Values, { setSubmitting }: FormikHelpers) => { + console.log('submit!'); clearFlashes('node'); updateNode(node.id, values) @@ -216,29 +215,31 @@ export default () => { > { ({ isSubmitting, isValid }) => ( -
-
- -
- -
-
- +
+
+
+
-
- -
+
+
+ +
-
-
- +
+ +
+ +
+
+ +
-
+ ) } diff --git a/resources/scripts/components/admin/servers/OwnerSelect.tsx b/resources/scripts/components/admin/servers/OwnerSelect.tsx index f04fdcfcd..c5c89a1ea 100644 --- a/resources/scripts/components/admin/servers/OwnerSelect.tsx +++ b/resources/scripts/components/admin/servers/OwnerSelect.tsx @@ -12,10 +12,12 @@ export default ({ selected }: { selected: User | null }) => { const onSearch = (query: string): Promise => { return new Promise((resolve, reject) => { - searchUsers({ username: query, email: query }).then((users) => { - setUsers(users); - return resolve(); - }).catch(reject); + searchUsers({ username: query, email: query }) + .then((users) => { + setUsers(users); + return resolve(); + }) + .catch(reject); }); };