diff --git a/frontend/src/components/dashboard/AddTagsMenu.tsx b/frontend/src/components/dashboard/AddTagsMenu.tsx index 1b0790079..b0f6b1a22 100644 --- a/frontend/src/components/dashboard/AddTagsMenu.tsx +++ b/frontend/src/components/dashboard/AddTagsMenu.tsx @@ -6,10 +6,12 @@ import { Menu, Transition } from '@headlessui/react'; import { Tag } from 'public/data/frequentInterfaces'; /** - * This is the menu that is used to download secrets as .env ad .yml files (in future we may have more options) + * This is the menu that is used to add more tags to a secret * @param {object} obj - * @param {SecretDataProps[]} obj.data - - * + * @param {Tag[]} obj.allTags - all available tags for a vertain project + * @param {Tag[]} obj.currentTags - currently selected tags for a certain secret + * @param {function} obj.modifyTags - modify tags for a certain secret + * @param {Tag[]} obj.position - currently selected tags for a certain secret */ const AddTagsMenu = ({ allTags, currentTags, modifyTags, position }: { allTags: Tag[]; currentTags: Tag[]; modifyTags: (value: Tag[], position: number) => void; position: number; }) => { const router = useRouter(); @@ -21,7 +23,7 @@ const AddTagsMenu = ({ allTags, currentTags, modifyTags, position }: { allTags: >
- {currentTags.length > 2 && {currentTags.length - 2}} + {currentTags?.length > 2 && {currentTags.length - 2}}
)})} diff --git a/frontend/src/components/dashboard/KeyPair.tsx b/frontend/src/components/dashboard/KeyPair.tsx index 03d22d39c..f5559046b 100644 --- a/frontend/src/components/dashboard/KeyPair.tsx +++ b/frontend/src/components/dashboard/KeyPair.tsx @@ -140,7 +140,7 @@ const KeyPair = ({
- {keyPair.tags.map((tag, index) => ( + {keyPair.tags?.map((tag, index) => ( index < 2 &&
tagDp._id === tag._id)[0]?.color} rounded-sm text-sm ${tagData.filter(tagDp => tagDp._id === tag._id)[0]?.colorText} flex items-center`}> {tag.name} modifyTags(keyPair.tags.filter(ttag => ttag._id !== tag._id), keyPair.pos)}/> diff --git a/frontend/src/pages/dashboard/[id].tsx b/frontend/src/pages/dashboard/[id].tsx index a4204a441..8951004ce 100644 --- a/frontend/src/pages/dashboard/[id].tsx +++ b/frontend/src/pages/dashboard/[id].tsx @@ -446,8 +446,8 @@ export default function Dashboard() { initDataPoint.key || newData!.filter((dataPoint) => dataPoint.id === initDataPoint.id)[0].comment !== initDataPoint.comment) || - newData!.filter((dataPoint) => dataPoint.id === initDataPoint.id)[0].tags !== - initDataPoint.tags + newData!.filter((dataPoint) => dataPoint.id === initDataPoint.id)[0]?.tags !== + initDataPoint?.tags ) .map((secret) => secret.id) .includes(newDataPoint.id) @@ -498,8 +498,7 @@ export default function Dashboard() { initDataPoint.key || newOverrides!.filter((dataPoint) => dataPoint.id === initDataPoint.id)[0] .comment !== initDataPoint.comment || - newOverrides!.filter((dataPoint) => dataPoint.id === initDataPoint.id)[0] - .tags !== initDataPoint.tags) + newOverrides!.filter((dataPoint) => dataPoint.id === initDataPoint.id)[0]?.tags !== initDataPoint?.tags) ) .map((secret) => secret.id) .includes(newDataPoint.id) @@ -877,7 +876,7 @@ export default function Dashboard() { .map((keyPair) => (