diff --git a/frontend/components/dashboard/DashboardInputField.tsx b/frontend/components/dashboard/DashboardInputField.tsx index 43b001bbe..cb75dcf8c 100644 --- a/frontend/components/dashboard/DashboardInputField.tsx +++ b/frontend/components/dashboard/DashboardInputField.tsx @@ -7,8 +7,8 @@ import guidGenerator from '../utilities/randomId'; 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'; blurred: boolean; @@ -18,7 +18,7 @@ interface DashboardInputFieldProps { /** * This component renders the input fields on the dashboard * @param {object} obj - the order number of a keyPair - * @param {number} obj.index - the order number of a keyPair + * @param {number} obj.pos - the order number of a keyPair * @param {function} obj.onChangeHandler - what happens when the input is modified * @param {string} obj.type - whether the input field is for a Key Name or for a Key Value * @param {string} obj.value - value of the InputField @@ -28,7 +28,7 @@ interface DashboardInputFieldProps { */ const DashboardInputField = ({ - index, + position, onChangeHandler, type, value, @@ -57,7 +57,7 @@ const DashboardInputField = ({ > - onChangeHandler(e.target.value.toUpperCase(), index) + onChangeHandler(e.target.value.toUpperCase(), position) } type={type} value={value} @@ -87,7 +87,7 @@ const DashboardInputField = ({ > onChangeHandler(e.target.value, index)} + onChange={(e) => onChangeHandler(e.target.value, position)} onScroll={syncScroll} className={`${ blurred diff --git a/frontend/components/utilities/secrets/getSecretsForProject.ts b/frontend/components/utilities/secrets/getSecretsForProject.ts index 284b8bee1..0bbcdd0d2 100644 --- a/frontend/components/utilities/secrets/getSecretsForProject.ts +++ b/frontend/components/utilities/secrets/getSecretsForProject.ts @@ -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'] + } + }) ); + return tempFileState.map((line, index) => [ guidGenerator(), index, diff --git a/frontend/pages/dashboard/[id].js b/frontend/pages/dashboard/[id].js index 95919749c..3d3a46c3d 100644 --- a/frontend/pages/dashboard/[id].js +++ b/frontend/pages/dashboard/[id].js @@ -45,7 +45,7 @@ import getWorkspaces from '../api/workspace/getWorkspaces'; /** * This component represent a single row for an environemnt variable on the dashboard * @param {object} obj - * @param {String[]} obj.keyPair - data related to the environment variable (index, key, value, public/private) + * @param {String[]} obj.keyPair - data related to the environment variable (id, pos, key, value, public/private) * @param {function} obj.deleteRow - a function to delete a certain keyPair * @param {function} obj.modifyKey - modify the key of a certain environment variable * @param {function} obj.modifyValue - modify the value of a certain environment variable @@ -73,8 +73,8 @@ const KeyPair = ({ @@ -84,8 +84,8 @@ const KeyPair = ({ @@ -114,18 +114,18 @@ const KeyPair = ({
modifyVisibility( - keyPair[4] == 'personal' ? 'shared' : 'personal', - keyPair[1] + keyPair.type == 'personal' ? 'shared' : 'personal', + keyPair.pos ) } className="relative flex justify-start items-center cursor-pointer select-none py-2 px-2 rounded-md text-gray-400 hover:bg-white/10 duration-200 hover:text-gray-200 w-full" >
- {keyPair[4] == 'personal' ? 'Make Shared' : 'Make Personal'} + {keyPair.type == 'personal' ? 'Make Shared' : 'Make Personal'}
Math.floor(Math.random() * 16).toString(16)) .join(''), - keyPair[1] + keyPair.pos ); } }} @@ -147,7 +147,7 @@ const KeyPair = ({ >

Generate Random Hex

@@ -190,7 +190,7 @@ const KeyPair = ({