ui(admin): fix node settings button
This commit is contained in:
parent
0313bdb1cb
commit
fffe3a7f8b
|
@ -108,7 +108,7 @@ class NodeController extends ApplicationApiController
|
||||||
$node = $this->updateService->handle(
|
$node = $this->updateService->handle(
|
||||||
$node,
|
$node,
|
||||||
$request->validated(),
|
$request->validated(),
|
||||||
$request->input('reset_secret'),
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->fractal->item($node)
|
return $this->fractal->item($node)
|
||||||
|
|
|
@ -17,20 +17,24 @@ class StoreNodeRequest extends ApplicationApiRequest
|
||||||
public function rules(array $rules = null): array
|
public function rules(array $rules = null): array
|
||||||
{
|
{
|
||||||
return collect($rules ?? Node::getRules())->only([
|
return collect($rules ?? Node::getRules())->only([
|
||||||
'public',
|
|
||||||
'name',
|
'name',
|
||||||
'location_id',
|
'location_id',
|
||||||
|
'database_host_id',
|
||||||
'fqdn',
|
'fqdn',
|
||||||
'listen_port_http',
|
|
||||||
'listen_port_sftp',
|
|
||||||
'public_port_http',
|
|
||||||
'public_port_sftp',
|
|
||||||
'scheme',
|
'scheme',
|
||||||
'behind_proxy',
|
'behind_proxy',
|
||||||
|
'public',
|
||||||
|
|
||||||
|
'listen_port_http',
|
||||||
|
'public_port_http',
|
||||||
|
'listen_port_sftp',
|
||||||
|
'public_port_sftp',
|
||||||
|
|
||||||
'memory',
|
'memory',
|
||||||
'memory_overallocate',
|
'memory_overallocate',
|
||||||
'disk',
|
'disk',
|
||||||
'disk_overallocate',
|
'disk_overallocate',
|
||||||
|
|
||||||
'upload_size',
|
'upload_size',
|
||||||
'daemon_base',
|
'daemon_base',
|
||||||
])->mapWithKeys(function ($value, $key) {
|
])->mapWithKeys(function ($value, $key) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ import AdminBox from '@/components/admin/AdminBox';
|
||||||
import tw from 'twin.macro';
|
import tw from 'twin.macro';
|
||||||
import Field from '@/components/elements/Field';
|
import Field from '@/components/elements/Field';
|
||||||
import SpinnerOverlay from '@/components/elements/SpinnerOverlay';
|
import SpinnerOverlay from '@/components/elements/SpinnerOverlay';
|
||||||
import { Form, useFormikContext } from 'formik';
|
import { useFormikContext } from 'formik';
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const { isSubmitting } = useFormikContext();
|
const { isSubmitting } = useFormikContext();
|
||||||
|
@ -12,7 +12,6 @@ export default () => {
|
||||||
<AdminBox title={'Limits'} css={tw`w-full relative`}>
|
<AdminBox title={'Limits'} css={tw`w-full relative`}>
|
||||||
<SpinnerOverlay visible={isSubmitting}/>
|
<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-row mb-6`}>
|
||||||
<div css={tw`md:w-full md:flex md:flex-col md:mr-4 mb-6 md:mb-0`}>
|
<div css={tw`md:w-full md:flex md:flex-col md:mr-4 mb-6 md:mb-0`}>
|
||||||
<Field
|
<Field
|
||||||
|
@ -52,7 +51,6 @@ export default () => {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
|
||||||
</AdminBox>
|
</AdminBox>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@ import AdminBox from '@/components/admin/AdminBox';
|
||||||
import tw from 'twin.macro';
|
import tw from 'twin.macro';
|
||||||
import Field from '@/components/elements/Field';
|
import Field from '@/components/elements/Field';
|
||||||
import SpinnerOverlay from '@/components/elements/SpinnerOverlay';
|
import SpinnerOverlay from '@/components/elements/SpinnerOverlay';
|
||||||
import { Form, useFormikContext } from 'formik';
|
import { useFormikContext } from 'formik';
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const { isSubmitting } = useFormikContext();
|
const { isSubmitting } = useFormikContext();
|
||||||
|
@ -12,7 +12,6 @@ export default () => {
|
||||||
<AdminBox title={'Listen'} css={tw`w-full relative`}>
|
<AdminBox title={'Listen'} css={tw`w-full relative`}>
|
||||||
<SpinnerOverlay visible={isSubmitting}/>
|
<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-row`}>
|
||||||
<div css={tw`mb-6 md:w-full md:flex md:flex-col md:mr-4 md:mb-0`}>
|
<div css={tw`mb-6 md:w-full md:flex md:flex-col md:mr-4 md:mb-0`}>
|
||||||
<Field
|
<Field
|
||||||
|
@ -52,7 +51,6 @@ export default () => {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
|
||||||
</AdminBox>
|
</AdminBox>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -51,7 +51,6 @@ const NodeSettingsContainer = () => {
|
||||||
<AdminBox title={'Settings'} css={tw`w-full relative`}>
|
<AdminBox title={'Settings'} css={tw`w-full relative`}>
|
||||||
<SpinnerOverlay visible={isSubmitting}/>
|
<SpinnerOverlay visible={isSubmitting}/>
|
||||||
|
|
||||||
<Form css={tw`mb-0`}>
|
|
||||||
<div css={tw`mb-6`}>
|
<div css={tw`mb-6`}>
|
||||||
<Field
|
<Field
|
||||||
id={'name'}
|
id={'name'}
|
||||||
|
@ -149,7 +148,6 @@ const NodeSettingsContainer = () => {
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
|
||||||
</AdminBox>
|
</AdminBox>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -167,6 +165,7 @@ export default () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const submit = (values: Values, { setSubmitting }: FormikHelpers<Values>) => {
|
const submit = (values: Values, { setSubmitting }: FormikHelpers<Values>) => {
|
||||||
|
console.log('submit!');
|
||||||
clearFlashes('node');
|
clearFlashes('node');
|
||||||
|
|
||||||
updateNode(node.id, values)
|
updateNode(node.id, values)
|
||||||
|
@ -216,6 +215,7 @@ export default () => {
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
({ isSubmitting, isValid }) => (
|
({ isSubmitting, isValid }) => (
|
||||||
|
<Form>
|
||||||
<div css={tw`flex flex-col lg:flex-row`}>
|
<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`}>
|
<div css={tw`w-full lg:w-1/2 flex flex-col mr-0 lg:mr-2`}>
|
||||||
<NodeSettingsContainer/>
|
<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`rounded shadow-md bg-neutral-700 mt-4 py-2 pr-6`}>
|
||||||
<div css={tw`flex flex-row`}>
|
<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
|
Save Changes
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</Form>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
</Formik>
|
</Formik>
|
||||||
|
|
|
@ -12,10 +12,12 @@ export default ({ selected }: { selected: User | null }) => {
|
||||||
|
|
||||||
const onSearch = (query: string): Promise<void> => {
|
const onSearch = (query: string): Promise<void> => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
searchUsers({ username: query, email: query }).then((users) => {
|
searchUsers({ username: query, email: query })
|
||||||
|
.then((users) => {
|
||||||
setUsers(users);
|
setUsers(users);
|
||||||
return resolve();
|
return resolve();
|
||||||
}).catch(reject);
|
})
|
||||||
|
.catch(reject);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue