mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-27 20:01:10 +01:00
Click env var to edit AND improve input/editor ref handling
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
import type { Environment } from '@yaakapp-internal/models';
|
||||
import type { Environment, EnvironmentVariable } from '@yaakapp-internal/models';
|
||||
import { openFolderSettings } from '../commands/openFolderSettings';
|
||||
import { EnvironmentEditDialog } from '../components/EnvironmentEditDialog';
|
||||
import { toggleDialog } from './dialog';
|
||||
|
||||
export function editEnvironment(environment: Environment | null) {
|
||||
interface Options {
|
||||
addOrFocusVariable?: EnvironmentVariable;
|
||||
}
|
||||
|
||||
export function editEnvironment(environment: Environment | null, options: Options = {}) {
|
||||
if (environment?.parentModel === 'folder' && environment.parentId != null) {
|
||||
openFolderSettings(environment.parentId, 'variables');
|
||||
} else {
|
||||
@@ -12,7 +16,12 @@ export function editEnvironment(environment: Environment | null) {
|
||||
noPadding: true,
|
||||
size: 'lg',
|
||||
className: 'h-[80vh]',
|
||||
render: () => <EnvironmentEditDialog initialEnvironment={environment} />,
|
||||
render: () => (
|
||||
<EnvironmentEditDialog
|
||||
initialEnvironmentId={environment?.id ?? null}
|
||||
addOrFocusVariable={options.addOrFocusVariable}
|
||||
/>
|
||||
),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user