ui(admin): fix node settings button
This commit is contained in:
parent
0313bdb1cb
commit
fffe3a7f8b
6 changed files with 202 additions and 199 deletions
|
@ -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)
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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,7 +12,6 @@ export default () => {
|
|||
<AdminBox title={'Limits'} css={tw`w-full relative`}>
|
||||
<SpinnerOverlay visible={isSubmitting}/>
|
||||
|
||||
<Form css={tw`mb-0`}>
|
||||
<div css={tw`md:w-full md:flex md:flex-row mb-6`}>
|
||||
<div css={tw`md:w-full md:flex md:flex-col md:mr-4 mb-6 md:mb-0`}>
|
||||
<Field
|
||||
|
@ -52,7 +51,6 @@ export default () => {
|
|||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Form>
|
||||
</AdminBox>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -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,7 +12,6 @@ export default () => {
|
|||
<AdminBox title={'Listen'} css={tw`w-full relative`}>
|
||||
<SpinnerOverlay visible={isSubmitting}/>
|
||||
|
||||
<Form css={tw`mb-0`}>
|
||||
<div css={tw`mb-6 md:w-full md:flex md:flex-row`}>
|
||||
<div css={tw`mb-6 md:w-full md:flex md:flex-col md:mr-4 md:mb-0`}>
|
||||
<Field
|
||||
|
@ -52,7 +51,6 @@ export default () => {
|
|||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Form>
|
||||
</AdminBox>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -51,7 +51,6 @@ const NodeSettingsContainer = () => {
|
|||
<AdminBox title={'Settings'} css={tw`w-full relative`}>
|
||||
<SpinnerOverlay visible={isSubmitting}/>
|
||||
|
||||
<Form css={tw`mb-0`}>
|
||||
<div css={tw`mb-6`}>
|
||||
<Field
|
||||
id={'name'}
|
||||
|
@ -149,7 +148,6 @@ const NodeSettingsContainer = () => {
|
|||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</Form>
|
||||
</AdminBox>
|
||||
);
|
||||
};
|
||||
|
@ -167,6 +165,7 @@ export default () => {
|
|||
}
|
||||
|
||||
const submit = (values: Values, { setSubmitting }: FormikHelpers<Values>) => {
|
||||
console.log('submit!');
|
||||
clearFlashes('node');
|
||||
|
||||
updateNode(node.id, values)
|
||||
|
@ -216,6 +215,7 @@ export default () => {
|
|||
>
|
||||
{
|
||||
({ isSubmitting, isValid }) => (
|
||||
<Form>
|
||||
<div css={tw`flex flex-col lg:flex-row`}>
|
||||
<div css={tw`w-full lg:w-1/2 flex flex-col mr-0 lg:mr-2`}>
|
||||
<NodeSettingsContainer/>
|
||||
|
@ -232,13 +232,14 @@ export default () => {
|
|||
|
||||
<div css={tw`rounded shadow-md bg-neutral-700 mt-4 py-2 pr-6`}>
|
||||
<div css={tw`flex flex-row`}>
|
||||
<Button type="submit" size="small" css={tw`ml-auto`} disabled={isSubmitting || !isValid}>
|
||||
<Button type={'submit'} css={tw`ml-auto`} disabled={isSubmitting || !isValid}>
|
||||
Save Changes
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Form>
|
||||
)
|
||||
}
|
||||
</Formik>
|
||||
|
|
|
@ -12,10 +12,12 @@ export default ({ selected }: { selected: User | null }) => {
|
|||
|
||||
const onSearch = (query: string): Promise<void> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
searchUsers({ username: query, email: query }).then((users) => {
|
||||
searchUsers({ username: query, email: query })
|
||||
.then((users) => {
|
||||
setUsers(users);
|
||||
return resolve();
|
||||
}).catch(reject);
|
||||
})
|
||||
.catch(reject);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue