mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-14 01:50:39 +09:00
Copy inherited config as default when unchecking inherit checkbox
When unchecking the "Inherit project workspace runtime config" checkbox, if the runtime config field is empty, automatically populate it with the inherited config value so the user has a starting point to edit from. Existing values are preserved and never overwritten. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
612bab1eb6
commit
aff56c2297
1 changed files with 11 additions and 3 deletions
|
|
@ -547,9 +547,17 @@ export function ExecutionWorkspaceDetail() {
|
|||
id="inherit-runtime-config"
|
||||
type="checkbox"
|
||||
checked={form.inheritRuntime}
|
||||
onChange={(event) =>
|
||||
setForm((current) => current ? { ...current, inheritRuntime: event.target.checked } : current)
|
||||
}
|
||||
onChange={(event) => {
|
||||
const checked = event.target.checked;
|
||||
setForm((current) => {
|
||||
if (!current) return current;
|
||||
// When unchecking "inherit" and the field is empty, copy inherited config as a starting point
|
||||
if (!checked && !current.workspaceRuntime.trim() && inheritedRuntimeConfig) {
|
||||
return { ...current, inheritRuntime: checked, workspaceRuntime: formatJson(inheritedRuntimeConfig) };
|
||||
}
|
||||
return { ...current, inheritRuntime: checked };
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<label htmlFor="inherit-runtime-config">Inherit project workspace runtime config</label>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue