Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

clean up and extra fields

gingervitisf19dba31da4f
diff --git a/web/pages/components/config/form-textfield.tsx b/web/pages/components/config/form-textfield.tsx
index 50ba29c121..096ac370a5 100644
--- a/web/pages/components/config/form-textfield.tsx
+++ b/web/pages/components/config/form-textfield.tsx
@@ -1,21 +1,4 @@
-/*
-- auto saves ,ajax call (submit when blur or onEnter)
-- set default text
-- show error state/confirm states
-- show info
-- label
-- min/max length
-- populate with curren val (from local sstate)
-
-load page,
-get all config vals,
-save to local state/context.
-read vals from there.
-update vals to state, andthru api.
-
-
-*/
import React, { useState, useContext } from 'react';
import { Button, Form, Input, InputNumber } from 'antd';
import { FormItemProps } from 'antd/es/form';
@@ -51,6 +34,8 @@ export default function TextField(props: TextFieldProps) {
handleResetValue,
initialValues = {},
onSubmit,
+ onBlur,
+ onChange,
type,
} = props;
@@ -92,6 +77,10 @@ export default function TextField(props: TextFieldProps) {
setHasChanged(true);
setFieldValueForSubmit(val);
}
+ // if an extra onChange handler was sent in as a prop, let's run that too.
+ if (onChange) {
+ onChange();
+ }
};
// if you blur a required field with an empty value, restore its original value
@@ -100,12 +89,16 @@ export default function TextField(props: TextFieldProps) {
if (required && val === '') {
handleResetValue(fieldName);
}
+
+ // if an extra onBlur handler was sent in as a prop, let's run that too.
+ if (onBlur) {
+ onBlur();
+ }
};
// how to get current value of input
const handleSubmit = async () => {
if ((required && fieldValueForSubmit !== '') || fieldValueForSubmit !== initialValue) {
- // postUpdateToAPI(fieldValueForSubmit);
setSubmitStatus('validating');
await postConfigUpdateToAPI({
diff --git a/web/pages/config-server-details.tsx b/web/pages/config-server-details.tsx
index 9f9567fe9e..39f284f465 100644
--- a/web/pages/config-server-details.tsx
+++ b/web/pages/config-server-details.tsx
@@ -1,7 +1,7 @@
import React, { useContext, useEffect } from 'react';
import { Typography, Form } from 'antd';
-import TextField, { TEXTFIELD_TYPE_NUMBER, TEXTFIELD_TYPE_PASSWORD, TEXTFIELD_TYPE_TEXTAREA } from './components/config/form-textfield';
+import TextField, { TEXTFIELD_TYPE_NUMBER, TEXTFIELD_TYPE_PASSWORD } from './components/config/form-textfield';
import { ServerStatusContext } from '../utils/server-status-context';
import { TEXTFIELD_DEFAULTS } from './components/config/constants';
diff --git a/web/types/config-section.ts b/web/types/config-section.ts
index ce4159d32f..4e60b3eb47 100644
--- a/web/types/config-section.ts
+++ b/web/types/config-section.ts
@@ -1,7 +1,7 @@
// TS types for elements on the Config pages
export interface TextFieldProps {
- handleResetValue?: (fieldName) => void;
+ handleResetValue?: (fieldName: string) => void;
fieldName: string;
initialValues?: any;
type?: string;
@@ -27,8 +27,8 @@ export interface UpdateArgs {
export interface ApiPostArgs {
apiPath: string,
data: object,
- onSuccess?: (arg: any) => {},
- onError?: (arg: any) => {},
+ onSuccess?: (arg: any) => void,
+ onError?: (arg: any) => void,
}
export interface ConfigDirectoryFields {