ui(admin): fix node behind proxy and automatic allocation settings

This commit is contained in:
Matthew Penner 2021-09-18 12:24:13 -06:00
parent ef47f21943
commit 32e8406c37
No known key found for this signature in database
GPG key ID: 030E4AB751DC756F

View file

@ -19,8 +19,8 @@ interface Values {
databaseHostId: number | null; databaseHostId: number | null;
fqdn: string; fqdn: string;
scheme: string; scheme: string;
behindProxy: boolean; behindProxy: string; // Yes, this is technically a boolean.
public: boolean; public: string; // Yes, this is technically a boolean.
daemonBase: string; // This value cannot be updated once a node has been created. daemonBase: string; // This value cannot be updated once a node has been created.
memory: number; memory: number;
@ -51,8 +51,10 @@ export default () => {
const submit = (values: Values, { setSubmitting }: FormikHelpers<Values>) => { const submit = (values: Values, { setSubmitting }: FormikHelpers<Values>) => {
clearFlashes('node'); clearFlashes('node');
updateNode(node.id, values) const v = { ...values, behindProxy: values.behindProxy === 'true', public: values.public === 'true' };
.then(() => setNode({ ...node, ...values }))
updateNode(node.id, v)
.then(() => setNode({ ...node, ...v }))
.catch(error => { .catch(error => {
console.error(error); console.error(error);
clearAndAddHttpError({ key: 'node', error }); clearAndAddHttpError({ key: 'node', error });
@ -69,8 +71,8 @@ export default () => {
databaseHostId: node.databaseHostId, databaseHostId: node.databaseHostId,
fqdn: node.fqdn, fqdn: node.fqdn,
scheme: node.scheme, scheme: node.scheme,
behindProxy: node.behindProxy, behindProxy: node.behindProxy ? 'true' : 'false',
public: node.public, public: node.public ? 'true' : 'false',
daemonBase: node.daemonBase, daemonBase: node.daemonBase,
listenPortHTTP: node.listenPortHTTP, listenPortHTTP: node.listenPortHTTP,