fix(cli): cli behave as expected in forked workspaces

This commit is contained in:
Ruben Fiszel
2025-11-30 15:15:27 +00:00
parent c0200bfdae
commit b9ea46b78b
3 changed files with 134 additions and 89 deletions

View File

@@ -56,6 +56,8 @@
import GitRepoResourcePicker from './GitRepoResourcePicker.svelte'
import { updateDelegateToGitRepoConfig, insertAdditionalInventories } from '$lib/ansibleUtils'
import { copilotInfo } from '$lib/aiStore'
import JsonInputs from '$lib/components/JsonInputs.svelte'
import Toggle from './Toggle.svelte'
interface Props {
// Exported
@@ -124,6 +126,9 @@
}: Props = $props()
let initialArgs = structuredClone($state.snapshot(args))
let jsonEditor: JsonInputs | undefined = $state(undefined)
let jsonView = $state(false)
let schemaHeight = $state(0)
$effect.pre(() => {
if (schema == undefined) {
@@ -707,29 +712,51 @@
{/if}
</div>
{/if}
<div class="absolute top-2 right-2"
><Toggle size="2xs" bind:checked={jsonView} options={{ right: 'JSON' }} /></div
>
</div>
<Splitpanes horizontal class="!max-h-[calc(100%-43px)]">
<Pane size={33}>
<div class="px-4">
<div class="break-words relative font-sans">
{#key argsRender}
<SchemaForm
helperScript={{
source: 'inline',
code,
//@ts-ignore
lang
}}
compact
{schema}
bind:args
bind:isValid
noVariablePicker={customUi?.previewPanel?.disableVariablePicker === true}
showSchemaExplorer
/>
{/key}
{#if jsonView}
<div
class="py-2"
style="height: {!schemaHeight || schemaHeight < 600 ? 600 : schemaHeight}px"
data-schema-picker
>
<JsonInputs
bind:this={jsonEditor}
on:select={(e) => {
if (e.detail) {
args = e.detail
}
}}
updateOnBlur={false}
placeholder={`Write args as JSON.<br/><br/>Example:<br/><br/>{<br/>&nbsp;&nbsp;"foo": "12"<br/>}`}
/>
</div>
</div>
{:else}
<div class="px-4">
<div class="break-words relative font-sans" bind:clientHeight={schemaHeight}>
{#key argsRender}
<SchemaForm
helperScript={{
source: 'inline',
code,
//@ts-ignore
lang
}}
compact
{schema}
bind:args
bind:isValid
noVariablePicker={customUi?.previewPanel?.disableVariablePicker === true}
showSchemaExplorer
/>
{/key}
</div>
</div>
{/if}
</Pane>
<Pane size={67} class="relative">
<LogPanel