Skip to content

Commit

Permalink
Small changes in the code editor buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
ancorgs committed Nov 22, 2024
1 parent 9603189 commit f1923c6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions web/src/components/core/ConfigEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,15 @@ const ConfigEditor = ({ sections }): React.ReactNode => {
};

const [configJson, setConfigJson] = useState(fetchConfigJson());
const [isEnabled, setIsEnabled] = useState(false);

const onChange = (code) => {
setConfigJson(code);
setIsEnabled(true);
};

const updateConfig = () => {
setIsEnabled(false);
setConfig.mutate(JSON.parse(configJson));
};

Expand All @@ -60,9 +63,9 @@ const ConfigEditor = ({ sections }): React.ReactNode => {
<CodeEditor height="65vh" isUploadEnabled onCodeChange={onChange} language={Language.json} code={configJson} />
<Split hasGutter>
<Button variant="secondary" onClick={closeEditor}>
{_("Cancel")}
{_("Back to human UI")}
</Button>
<Button onClick={updateConfig}>
<Button isDisabled={!isEnabled} onClick={updateConfig}>
{_("Save")}
</Button>
</Split>
Expand Down

0 comments on commit f1923c6

Please sign in to comment.