Преглед изворни кода

Implemented extra props for cron input

jnfrati пре 4 година
родитељ
комит
76a5f88a66

+ 8 - 11
dashboard/src/components/porter-form/field-components/CronInput.tsx

@@ -8,23 +8,20 @@ import CronParser from "cronstrue";
 import styled from "styled-components";
 
 const CronInput: React.FC<CronField> = (props) => {
-  const { id, variable } = props;
+  const { id, variable, label, placeholder } = props;
 
-  const { state, variables, setVars, setValidation, validation } = useFormField(
-    id,
-    {
-      initValidation: {
-        validated: hasSetValue(props),
-      },
-    }
-  );
-
-  console.log(validation[id]);
+  const { variables, setVars, setValidation, validation } = useFormField(id, {
+    initValidation: {
+      validated: hasSetValue(props),
+    },
+  });
 
   return (
     <>
       <InputRow
         type="text"
+        label={label}
+        placeholder={placeholder}
         value={variables[variable]}
         setValue={(x: string) => {
           setVars((vars) => {

+ 5 - 0
dashboard/src/components/porter-form/types.ts

@@ -121,6 +121,11 @@ export interface VariableField extends GenericInputField {
 
 export interface CronField extends GenericInputField {
   type: "cron";
+  label: string;
+  placeholder: string;
+  settings: {
+    default: string;
+  };
 }
 
 export type FormField =