diff --git a/src/lib/components/variables/environmentVariables.svelte b/src/lib/components/variables/environmentVariables.svelte
index 98290c0412..595cc08ac5 100644
--- a/src/lib/components/variables/environmentVariables.svelte
+++ b/src/lib/components/variables/environmentVariables.svelte
@@ -2,27 +2,17 @@
import { Empty, Paginator } from '$lib/components';
import { Button } from '$lib/elements/forms';
import {
- ActionMenu,
Accordion,
Badge,
InteractiveText,
Icon,
Layout,
- Popover,
Skeleton,
Table,
- Tooltip,
- Button as PinkButton
+ Tooltip
} from '@appwrite.io/pink-svelte';
- import {
- IconDotsHorizontal,
- IconCode,
- IconUpload,
- IconPlus,
- IconTrash,
- IconEyeOff,
- IconPencil
- } from '@appwrite.io/pink-icons-svelte';
+ import { IconCode, IconUpload, IconPlus } from '@appwrite.io/pink-icons-svelte';
+ import VariableActionMenu from './variableActionMenu.svelte';
import type { Models } from '@appwrite.io/console';
import VariableEditorModal from './variableEditorModal.svelte';
import SecretVariableModal from './secretVariableModal.svelte';
@@ -66,14 +56,14 @@
const tableColumns = $derived(
$isSmallViewport
? [
- { id: 'key', width: { min: 420 } },
- { id: 'value', width: { min: 240 } },
+ { id: 'key', width: { min: 120, max: 300 } },
+ { id: 'value', width: { min: 100, max: 200 } },
{ id: 'actions', width: 40 }
]
: [
- { id: 'key', width: { min: 300 } },
- { id: 'value', width: { min: 280 } },
- { id: 'actions', width: 40 }
+ { id: 'key', width: { min: 280, max: 420 } },
+ { id: 'value', width: { min: 200, max: 400 } },
+ { id: 'actions', width: 50 }
]
);
@@ -111,13 +101,15 @@
{/if}
@@ -179,59 +171,20 @@
-
- {
- e.preventDefault();
- toggle(e);
- }}>
-
-
-
-
-
- {#if !variable?.secret}
- {
- toggle(e);
- currentVariable = variable;
- showUpdate = true;
- }}>
- Update
-
- {/if}
- {#if !variable?.secret}
- {
- toggle(e);
- currentVariable = variable;
- showSecretModal = true;
- }}>
- Secret
-
- {/if}
- {
- toggle(e);
- currentVariable = variable;
- showDelete = true;
- }}>
- Delete
-
-
-
-
+
{
+ currentVariable = variable;
+ showUpdate = true;
+ }}
+ onSecret={() => {
+ currentVariable = variable;
+ showSecretModal = true;
+ }}
+ onDelete={() => {
+ currentVariable = variable;
+ showDelete = true;
+ }} />
diff --git a/src/lib/components/variables/updateVariableModal.svelte b/src/lib/components/variables/updateVariableModal.svelte
index bf48d8b62f..7d02391fab 100644
--- a/src/lib/components/variables/updateVariableModal.svelte
+++ b/src/lib/components/variables/updateVariableModal.svelte
@@ -23,10 +23,10 @@
function handleVariable() {
if (selectedVar) {
variables = variables.map((variable) => {
- if (variable.$id === selectedVar.$id) {
- return pair;
- }
- return variable;
+ const match = selectedVar.$id
+ ? variable.$id === selectedVar.$id
+ : variable.key === selectedVar.key;
+ return match ? pair : variable;
});
} else {
variables = [...variables, pair];
diff --git a/src/lib/components/variables/variableActionMenu.svelte b/src/lib/components/variables/variableActionMenu.svelte
new file mode 100644
index 0000000000..1969f04a96
--- /dev/null
+++ b/src/lib/components/variables/variableActionMenu.svelte
@@ -0,0 +1,131 @@
+
+
+
+
+
+ {
+ e.preventDefault();
+ toggle();
+ }}>
+
+
+
+
+{#if open}
+
+
+ {#if !variable?.secret}
+ {
+ hide();
+ onUpdate();
+ }}>
+ Update
+
+ {/if}
+ {#if !variable?.secret}
+ {
+ hide();
+ onSecret();
+ }}>
+ Secret
+
+ {/if}
+ {
+ hide();
+ onDelete();
+ }}>
+ Delete
+
+
+
+{/if}