import React from 'react'; import Button from '@/components/elements/Button'; import FormikSwitch from '@/components/elements/FormikSwitch'; import Input from '@/components/elements/Input'; import AdminBox from '@/components/admin/AdminBox'; import tw from 'twin.macro'; import { object } from 'yup'; import updateServer from '@/api/admin/servers/updateServer'; import Field from '@/components/elements/Field'; import SpinnerOverlay from '@/components/elements/SpinnerOverlay'; import { Form, Formik, FormikHelpers, useFormikContext } from 'formik'; import { Context } from '@/components/admin/servers/ServerRouter'; import { ApplicationStore } from '@/state'; import { Actions, useStoreActions } from 'easy-peasy'; import Label from '@/components/elements/Label'; // import { ServerEggVariable } from '@/api/server/types'; /* interface Props { variable: ServerEggVariable; } */ interface Values { startupCommand: string; nestId: number; eggId: number; } /* const VariableBox = ({ variable }: Props) => { const { isSubmitting } = useFormikContext(); const server = Context.useStoreState(state => state.server); if (server === undefined) { return ( <> ); } return (
); }; */ const ServerServiceContainer = () => { const { isSubmitting } = useFormikContext(); const server = Context.useStoreState(state => state.server); if (server === undefined) { return ( <> ); } return (

This is a destructive operation in many cases. This server will be stopped immediately in order for this action to proceed.

Changing any of the below values will result in the server processing a re-install command. The server will be stopped and will then proceed. If you would like the service scripts to not run, ensure the box is checked at the bottom.

Nest/Egg Selector HERE
); }; const ServerStartupContainer = () => { const { isSubmitting } = useFormikContext(); const server = Context.useStoreState(state => state.server); if (server === undefined) { return ( <> ); } return (
); }; export default () => { const { clearFlashes, clearAndAddHttpError } = useStoreActions((actions: Actions) => actions.flashes); const server = Context.useStoreState(state => state.server); const setServer = Context.useStoreActions(actions => actions.setServer); if (server === undefined) { return ( <> ); } const submit = (values: Values, { setSubmitting }: FormikHelpers) => { clearFlashes('server'); updateServer(server.id, values) .then(() => setServer({ ...server, ...values })) .catch(error => { console.error(error); clearAndAddHttpError({ key: 'server', error }); }) .then(() => setSubmitting(false)); }; return ( { ({ isSubmitting, isValid }) => (
Server Startup variables go here
) }
); };