Prevent opening variables dialog for objects & groups if there is no object (#7132)

This commit is contained in:
Clément Pasteau
2024-11-06 14:49:16 +01:00
committed by GitHub
parent 5bc80537b7
commit 77d60b699b

View File

@@ -188,37 +188,43 @@ export default React.forwardRef<ParameterFieldProps, ParameterFieldInterface>(
}
onInstructionTypeChanged={onInstructionTypeChanged}
/>
{editorOpen && project && !objectGroup && (
<ObjectVariablesDialog
project={project}
projectScopedContainersAccessor={projectScopedContainersAccessor}
objectName={objectName}
variablesContainer={variablesContainers[0]}
open
onCancel={() => setEditorOpen(null)}
onApply={onVariableEditorApply}
preventRefactoringToDeleteInstructions
initiallySelectedVariableName={editorOpen.variableName}
shouldCreateInitiallySelectedVariable={editorOpen.shouldCreate}
onComputeAllVariableNames={onComputeAllVariableNames}
hotReloadPreviewButtonProps={null}
/>
)}
{editorOpen && project && objectGroup && (
<ObjectGroupVariablesDialog
project={project}
projectScopedContainersAccessor={projectScopedContainersAccessor}
globalObjectsContainer={globalObjectsContainer}
objectsContainer={objectsContainer}
objectGroup={objectGroup}
onCancel={() => setEditorOpen(null)}
onApply={onVariableEditorApply}
open
initiallySelectedVariableName={editorOpen.variableName}
shouldCreateInitiallySelectedVariable={editorOpen.shouldCreate}
onComputeAllVariableNames={onComputeAllVariableNames}
/>
)}
{editorOpen &&
project &&
!!variablesContainers.length &&
!objectGroup && (
<ObjectVariablesDialog
project={project}
projectScopedContainersAccessor={projectScopedContainersAccessor}
objectName={objectName}
variablesContainer={variablesContainers[0]}
open
onCancel={() => setEditorOpen(null)}
onApply={onVariableEditorApply}
preventRefactoringToDeleteInstructions
initiallySelectedVariableName={editorOpen.variableName}
shouldCreateInitiallySelectedVariable={editorOpen.shouldCreate}
onComputeAllVariableNames={onComputeAllVariableNames}
hotReloadPreviewButtonProps={null}
/>
)}
{editorOpen &&
project &&
objectGroup &&
!!variablesContainers.length && (
<ObjectGroupVariablesDialog
project={project}
projectScopedContainersAccessor={projectScopedContainersAccessor}
globalObjectsContainer={globalObjectsContainer}
objectsContainer={objectsContainer}
objectGroup={objectGroup}
onCancel={() => setEditorOpen(null)}
onApply={onVariableEditorApply}
open
initiallySelectedVariableName={editorOpen.variableName}
shouldCreateInitiallySelectedVariable={editorOpen.shouldCreate}
onComputeAllVariableNames={onComputeAllVariableNames}
/>
)}
</React.Fragment>
);
}