array[any] readonly

pull/21369/head
JzoNg 11 months ago
parent 0f73f6b20c
commit 44f51994c1

@ -7,6 +7,7 @@ type SchemaEditorProps = {
onUpdate: (schema: string) => void
hideTopMenu?: boolean
className?: string
readonly?: boolean
}
const SchemaEditor: FC<SchemaEditorProps> = ({
@ -14,9 +15,11 @@ const SchemaEditor: FC<SchemaEditorProps> = ({
onUpdate,
hideTopMenu,
className,
readonly = false,
}) => {
return (
<CodeEditor
readOnly={readonly}
className={cn('rounded-xl', className)}
editorWrapperClassName='grow'
value={schema}

@ -261,6 +261,7 @@ export enum VarType {
arrayObject = 'array[object]',
arrayFile = 'array[file]',
any = 'any',
arrayAny = 'array[any]',
}
export enum ValueType {

@ -36,9 +36,10 @@ const ValueContent = ({
const [editorHeight, setEditorHeight] = useState(0)
const showTextEditor = currentVar.value_type === 'secret' || currentVar.value_type === 'string' || currentVar.value_type === 'number'
const isSysFiles = currentVar.type === VarInInspectType.system && currentVar.name === 'files'
const showJSONEditor = !isSysFiles && (currentVar.value_type === 'object' || currentVar.value_type === 'array[string]' || currentVar.value_type === 'array[number]' || currentVar.value_type === 'array[object]')
const showJSONEditor = !isSysFiles && (currentVar.value_type === 'object' || currentVar.value_type === 'array[string]' || currentVar.value_type === 'array[number]' || currentVar.value_type === 'array[object]' || currentVar.value_type === 'array[any]')
const showFileEditor = isSysFiles || currentVar.value_type === 'file' || currentVar.value_type === 'array[file]'
const textEditorDisabled = currentVar.type === VarInInspectType.environment || (currentVar.type === VarInInspectType.system && currentVar.name !== 'query' && currentVar.name !== 'files')
const JSONEditorDisabled = currentVar.value_type === 'array[any]'
const [value, setValue] = useState<any>()
const [json, setJson] = useState('')
@ -185,6 +186,7 @@ const ValueContent = ({
)}
{showJSONEditor && (
<SchemaEditor
readonly={JSONEditorDisabled}
className='overflow-y-auto'
hideTopMenu
schema={json}

Loading…
Cancel
Save