diff --git a/src-web/components/EnvironmentEditDialog.tsx b/src-web/components/EnvironmentEditDialog.tsx
index 9fc92fab..d9eb5e3e 100644
--- a/src-web/components/EnvironmentEditDialog.tsx
+++ b/src-web/components/EnvironmentEditDialog.tsx
@@ -13,6 +13,11 @@ import { HStack, VStack } from './core/Stacks';
import { IconButton } from './core/IconButton';
import { useDeleteEnvironment } from '../hooks/useDeleteEnvironment';
import type { GenericCompletionConfig } from './core/Editor/genericCompletion';
+import type { DropdownItem } from './core/Dropdown';
+import { Dropdown } from './core/Dropdown';
+import { Icon } from './core/Icon';
+import { usePrompt } from '../hooks/usePrompt';
+import { InlineCode } from './core/InlineCode';
export const EnvironmentEditDialog = function () {
const routes = useAppRoutes();
@@ -21,33 +26,35 @@ export const EnvironmentEditDialog = function () {
const activeEnvironment = useActiveEnvironment();
return (
-
-
- {environments.map((e) => (
-
- ))}
+
+
+
+ {environments.map((e) => (
+
+ ))}
+
-
+
{activeEnvironment != null &&
}
);
@@ -65,24 +72,54 @@ const EnvironmentEditor = function ({ environment }: { environment: Environment
);
const nameAutocomplete = useMemo(() => {
- const otherVariableNames = environments.flatMap((e) => e.variables.map((v) => v.name));
- const variableNames = otherVariableNames.filter(
- (name) => !environment.variables.some((v) => v.name === name),
+ const allVariableNames = environments.flatMap((e) => e.variables.map((v) => v.name));
+ // Filter out empty strings and variables that already exist in the active environment
+ const variableNames = allVariableNames.filter(
+ (name) => name != '' && !environment.variables.find((v) => v.name === name),
);
return { options: variableNames.map((name) => ({ label: name, type: 'constant' })) };
}, [environments, environment.variables]);
+ const prompt = usePrompt();
+ const items = useMemo(
+ () => [
+ {
+ key: 'rename',
+ label: 'Rename',
+ leftSlot: ,
+ onSelect: async () => {
+ const name = await prompt({
+ title: 'Rename Environment',
+ description: (
+ <>
+ Enter a new name for {environment.name}
+ >
+ ),
+ name: 'name',
+ label: 'Name',
+ defaultValue: environment.name,
+ });
+ updateEnvironment.mutate({ name });
+ },
+ },
+ {
+ key: 'delete',
+ variant: 'danger',
+ label: 'Delete',
+ leftSlot: ,
+ onSelect: () => deleteEnvironment.mutate(),
+ },
+ ],
+ [deleteEnvironment, updateEnvironment, environment.name, prompt],
+ );
+
return (
{environment.name}
- deleteEnvironment.mutate()}
- />
+
+
+
diff --git a/src-web/components/RequestPane.tsx b/src-web/components/RequestPane.tsx
index 4e20431a..024bc59e 100644
--- a/src-web/components/RequestPane.tsx
+++ b/src-web/components/RequestPane.tsx
@@ -204,6 +204,7 @@ export const RequestPane = memo(function RequestPane({ style, fullHeight, classN
, MenuPro