Skip to content

Commit

Permalink
enhacement: Refactor EventTab component
Browse files Browse the repository at this point in the history
  • Loading branch information
sital committed Dec 27, 2024
1 parent ec2f921 commit d981cc0
Show file tree
Hide file tree
Showing 13 changed files with 431 additions and 864 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const FunctionForm = ({
updateFunctionState({
cronValue,
selectedCronOption: defaultSelected,
congifuredCronSettings: configuredSettings
configuredCronSettings: configuredSettings
});
};

Expand Down Expand Up @@ -120,8 +120,8 @@ export const FunctionForm = ({
};

const handleOptionChange = (optionValue: any) => {
const updatedFuctionState = { ...functionState, optionValue: optionValue };
updateFunctionState(updatedFuctionState);
const updatedFunctionState = { ...functionState, optionValue: optionValue };
updateFunctionState(updatedFunctionState);
};

const handleOnSave = () => {
Expand Down Expand Up @@ -225,8 +225,8 @@ export const FunctionForm = ({
<div className="flex w-full justify-end">
{functionState && functionState.canBeEvent && (
<CustomCombobox
defaultValue={functionState.type || 'CRON'}
itemsList={['CRON', 'EVENT']}
defaultValue={{id:functionState.type || 'CRON',label:functionState.type || 'CRON'}}
itemsList={[{id:'CRON',label:'CRON'}, {id:'EVENT',label:'EVENT'}]}
onSelect={(triggerType: any) =>
handleTypeChange(triggerType as TriggerType)
}
Expand All @@ -250,7 +250,7 @@ export const FunctionForm = ({
defaultCron={cronExpression}
onChange={handleCronChange}
previousConfiguredSettings={
functionState?.congifuredCronSettings
functionState?.configuredCronSettings
}
previousSelectedOption={functionState?.selectedCronOption}
defaultToCustomTab={editMode}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,23 @@ export default function CustomEditor({
onValueChange
}: {
defaultValue: IEventTrigger | null;
onValueChange: (data: IEventTrigger) => void;
onValueChange: (data: string) => void;
}) {
return (
<>
<Editor
height={'100%'}
width={'100%'}
defaultLanguage="json"
className="rounded-xl"
className="bg-brand-vscode !rounded-xl !py-4"
// defaultValue={JSON.stringify(defaultValue, null, 2) || ''}
theme="vs-dark"
value={JSON.stringify(defaultValue, null, 2) || '{}'}
onChange={(data) => data && onValueChange(JSON.parse(data))}
value={
defaultValue
? JSON.stringify(defaultValue, null, 2)
: '{"Welcome to Autonomous Agent Testing.": "Try Disabling Pro mode and use graph for initial state"}'
}
onChange={(data) => data && onValueChange(data)}
></Editor>
</>
);
Expand Down
Loading

0 comments on commit d981cc0

Please sign in to comment.