mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-31 06:23:08 +02:00
Add migrate for base environment to sync logic
This commit is contained in:
@@ -136,7 +136,7 @@ export function EnvironmentEditor({
|
||||
{
|
||||
label: 'Encrypt Variables',
|
||||
onClick: () => encryptEnvironment(environment),
|
||||
color: 'primary',
|
||||
color: 'success',
|
||||
},
|
||||
]}
|
||||
>
|
||||
|
||||
@@ -27,7 +27,6 @@ import {
|
||||
useMemo,
|
||||
useRef,
|
||||
} from 'react';
|
||||
import { activeEnvironmentIdAtom } from '../../../hooks/useActiveEnvironment';
|
||||
import type { WrappedEnvironmentVariable } from '../../../hooks/useEnvironmentVariables';
|
||||
import { useEnvironmentVariables } from '../../../hooks/useEnvironmentVariables';
|
||||
import { useRequestEditor } from '../../../hooks/useRequestEditor';
|
||||
@@ -138,9 +137,7 @@ export const Editor = forwardRef<EditorView | undefined, EditorProps>(function E
|
||||
) {
|
||||
const settings = useAtomValue(settingsAtom);
|
||||
|
||||
const activeEnvironmentId = useAtomValue(activeEnvironmentIdAtom);
|
||||
const environmentId = forcedEnvironmentId ?? activeEnvironmentId ?? null;
|
||||
const allEnvironmentVariables = useEnvironmentVariables(environmentId);
|
||||
const allEnvironmentVariables = useEnvironmentVariables(forcedEnvironmentId ?? null);
|
||||
const environmentVariables = autocompleteVariables ? allEnvironmentVariables : emptyVariables;
|
||||
const useTemplating = !!(autocompleteFunctions || autocompleteVariables || autocomplete);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ export function useEnvironmentVariables(targetEnvironmentId: string | null) {
|
||||
|
||||
// Folder environments also can auto-complete from the active environment
|
||||
const activeEnvironmentVariables =
|
||||
targetEnvironment != null && isFolderEnvironment(targetEnvironment)
|
||||
targetEnvironment == null || isFolderEnvironment(targetEnvironment)
|
||||
? wrapVariables(activeEnvironment)
|
||||
: [];
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ import { useMemo } from 'react';
|
||||
export function useEnvironmentsBreakdown() {
|
||||
const allEnvironments = useAtomValue(environmentsAtom);
|
||||
return useMemo(() => {
|
||||
const baseEnvironments = allEnvironments.filter((e) => e.parentId == null) ?? [];
|
||||
const baseEnvironments = allEnvironments.filter((e) => e.parentModel == 'workspace') ?? [];
|
||||
const subEnvironments =
|
||||
allEnvironments.filter((e) => e.parentModel === 'environment' && e.parentId != null) ?? [];
|
||||
allEnvironments.filter((e) => e.parentModel === 'environment') ?? [];
|
||||
const folderEnvironments =
|
||||
allEnvironments.filter((e) => e.parentModel === 'folder' && e.parentId != null) ?? [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user