Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Merge branch 'main' of github.com:LemmyMwaura/infisical into secrets-dash-jumping-bug-#51

lemmy mwaura117acce3f6aa
diff --cc frontend/components/dashboard/DashboardInputField.tsx
index 986ed3fba8,43b001bbe8..cb75dcf8c6
--- a/frontend/components/dashboard/DashboardInputField.tsx
+++ b/frontend/components/dashboard/DashboardInputField.tsx
@@@ -7,10 -7,10 +7,10 @@@ import guidGenerator from '../utilities
const REGEX = /([$]{.*?})/g;
interface DashboardInputFieldProps {
- index: number;
- onChangeHandler: (value: string, index: number) => void;
+ position: number;
+ onChangeHandler: (value: string, position: number) => void;
value: string;
- type: "varName" | "value";
+ type: 'varName' | 'value';
blurred: boolean;
duplicates: string[];
}
diff --cc frontend/components/utilities/secrets/getSecretsForProject.ts
index a4cce35e0b,284b8bee1d..0bbcdd0d25
--- a/frontend/components/utilities/secrets/getSecretsForProject.ts
+++ b/frontend/components/utilities/secrets/getSecretsForProject.ts
@@@ -68,17 -74,19 +74,17 @@@ const getSecretsForProject = async (
setFileState(tempFileState);
setData(
- tempFileState.map((line, index) => [
- guidGenerator(),
- index,
- line['key'],
- line['value'],
- line['type']
- ])
- // .sort((a, b) =>
- // sortMethod == "alphabetical"
- // ? a[2].localeCompare(b[2])
- // : b[2].localeCompare(a[2])
- // )
+ tempFileState.map((line, index) => {
+ return {
+ id: guidGenerator(),
+ pos: index,
- key: line["key"],
- value: line["value"],
- type: line["type"]
++ key: line['key'],
++ value: line['value'],
++ type: line['type']
+ }
+ })
);
+
return tempFileState.map((line, index) => [
guidGenerator(),
index,
diff --cc frontend/pages/dashboard/[id].js
index 187f0c3409,95919749cb..4c40258c01
--- a/frontend/pages/dashboard/[id].js
+++ b/frontend/pages/dashboard/[id].js
@@@ -450,28 -440,14 +450,28 @@@ export default function Dashboard()
setBlurred(!blurred);
};
+ const sortValuesHandler = () => {
+ const sortedData = data.sort((a, b) =>
- sortMethod == "alphabetical"
++ sortMethod == 'alphabetical'
+ ? a.key.localeCompare(b.key)
+ : b.key.localeCompare(a.key)
+ ).map((item, index) => {
+ return {
+ ...item, pos:index
+ }
+ })
+
+ setData(sortedData)
+ }
+
// This function downloads the secrets as a .env file
const download = () => {
- const file = data.map((item) => [item.key, item.value].join("=")).join("\n");
- const file = data.map((item) => [item[2], item[3]].join('=')).join('\n');
++ const file = data.map((item) => [item.key, item.value].join('=')).join('\n');
const blob = new Blob([file]);
const fileDownloadUrl = URL.createObjectURL(blob);
- let alink = document.createElement("a");
+ let alink = document.createElement('a');
alink.href = fileDownloadUrl;
- alink.download = envMapping[env] + ".env";
+ alink.download = envMapping[env] + '.env';
alink.click();
};
@@@ -672,13 -648,19 +672,13 @@@
{data
.filter(
(keyPair) =>
- keyPair[2]
+ keyPair.key
.toLowerCase()
.includes(searchKeys.toLowerCase()) &&
- keyPair.type == "personal"
- keyPair[4] == 'personal'
- )
- .sort((a, b) =>
- sortMethod == 'alphabetical'
- ? a[2].localeCompare(b[2])
- : b[2].localeCompare(a[2])
- )
- ?.map((keyPair, index) => (
++ keyPair.type == 'personal'
+ )?.map((keyPair) => (
<KeyPair
- key={keyPair[0]}
+ key={keyPair.id}
keyPair={keyPair}
deleteRow={deleteCertainRow}
modifyValue={listenChangeValue}
@@@ -720,13 -702,19 +720,13 @@@
{data
.filter(
(keyPair) =>
- keyPair[2]
+ keyPair.key
.toLowerCase()
.includes(searchKeys.toLowerCase()) &&
- keyPair.type == "shared"
- keyPair[4] == 'shared'
- )
- .sort((a, b) =>
- sortMethod == 'alphabetical'
- ? a[2].localeCompare(b[2])
- : b[2].localeCompare(a[2])
- )
- ?.map((keyPair, index) => (
++ keyPair.type == 'shared'
+ )?.map((keyPair) => (
<KeyPair
- key={keyPair[0]}
+ key={keyPair.id}
keyPair={keyPair}
deleteRow={deleteCertainRow}
modifyValue={listenChangeValue}