diff --git a/frontend/src/views/SecretOverviewPage/SecretOverviewPage.tsx b/frontend/src/views/SecretOverviewPage/SecretOverviewPage.tsx index 1fba46266..487d75f82 100644 --- a/frontend/src/views/SecretOverviewPage/SecretOverviewPage.tsx +++ b/frontend/src/views/SecretOverviewPage/SecretOverviewPage.tsx @@ -2,15 +2,15 @@ import { useEffect, useRef, useState } from "react"; import { useTranslation } from "react-i18next"; import Link from "next/link"; import { useRouter } from "next/router"; -import { faCheckCircle } from "@fortawesome/free-regular-svg-icons"; import { subject } from "@casl/ability"; +import { faCheckCircle, faCircle } from "@fortawesome/free-regular-svg-icons"; import { faAngleDown, faArrowDown, faArrowUp, faFolderBlank, - faList, faFolderPlus, + faList, faMagnifyingGlass, faPlus } from "@fortawesome/free-solid-svg-icons"; @@ -18,7 +18,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider"; import NavHeader from "@app/components/navigation/NavHeader"; -import { PermissionDeniedBanner, ProjectPermissionCan } from "@app/components/permissions"; +import { ProjectPermissionCan } from "@app/components/permissions"; import { Button, DropdownMenu, @@ -207,10 +207,10 @@ export const SecretOverviewPage = () => { }; const handleEnvSelect = (envId: string) => { - if (visibleEnvs.map(env => env.id).includes(envId)) { - setVisisbleEnvs(visibleEnvs.filter(env => env.id !== envId)) + if (visibleEnvs.map((env) => env.id).includes(envId)) { + setVisisbleEnvs(visibleEnvs.filter((env) => env.id !== envId)); } else { - setVisisbleEnvs(visibleEnvs.concat(userAvailableEnvs.filter(env => env.id === envId))) + setVisisbleEnvs(visibleEnvs.concat(userAvailableEnvs.filter((env) => env.id === envId))); } }; @@ -390,39 +390,44 @@ export const SecretOverviewPage = () => {
- - - - - - - - - - Choose visible environments - {userAvailableEnvs.map((avaiableEnv) => { - const { id: envId, name } = avaiableEnv; + {userAvailableEnvs.length > 0 && ( + + + + + + + + + + Choose visible environments + {userAvailableEnvs.map((avaiableEnv) => { + const { id: envId, name } = avaiableEnv; - const isEnvSelected = visibleEnvs.map(env => env.id).includes(envId); - return ( - handleEnvSelect(envId)} - key={envId} - icon={isEnvSelected && } - iconPos="left" - > -
- {name} -
-
- ); - })} - {/* + const isEnvSelected = visibleEnvs.map((env) => env.id).includes(envId); + return ( + handleEnvSelect(envId)} + key={envId} + icon={ + isEnvSelected ? ( + + ) : ( + + ) + } + iconPos="left" + > +
{name}
+
+ ); + })} + {/* */} -
-
+
+
+ )}
{ leftIcon={} />
-
- - {(isAllowed) => ( - - )} - - handlePopUpToggle("misc", isOpen)} - > - - - - - - -
- 0 && ( +
+ + {(isAllowed) => ( + - )} - -
- - -
+ Add Secret + + )} + + handlePopUpToggle("misc", isOpen)} + > + + + + + + +
+ + {(isAllowed) => ( + + )} + +
+
+
+
+ )}
@@ -563,14 +571,25 @@ export const SecretOverviewPage = () => { className="bg-mineshaft-700" /> )} - {isTableEmpty && !isTableLoading && ( + {userAvailableEnvs.length > 0 && visibleEnvs.length === 0 && ( - + + + + )} + {userAvailableEnvs.length === 0 && ( + + + )} + {isTableEmpty && !isTableLoading && visibleEnvs.length > 0 && ( + + + + + + + + )} {!isTableLoading && filteredFolderNames.map((folderName, index) => ( { /> ))} {!isTableLoading && - (visibleEnvs?.length > 0 ? ( - filteredSecretNames.map((key, index) => ( - - )) - ) : ( - + visibleEnvs?.length > 0 && + filteredSecretNames.map((key, index) => ( + ))} diff --git a/frontend/src/views/SecretOverviewPage/components/CreateSecretForm/CreateSecretForm.tsx b/frontend/src/views/SecretOverviewPage/components/CreateSecretForm/CreateSecretForm.tsx index 403564274..36f8cfb27 100644 --- a/frontend/src/views/SecretOverviewPage/components/CreateSecretForm/CreateSecretForm.tsx +++ b/frontend/src/views/SecretOverviewPage/components/CreateSecretForm/CreateSecretForm.tsx @@ -171,7 +171,7 @@ export const CreateSecretForm = ({ )} /> -
+
{environments.map((env) => { return ( - {env.name} - {getSecretByKey(env.slug, newSecretKey) && ( - - - - )} + + + {env.name} + + + {getSecretByKey(env.slug, newSecretKey) && ( + + + + )} + + )} /> diff --git a/frontend/src/views/Settings/ProjectSettingsPage/components/EnvironmentSection/EnvironmentSection.tsx b/frontend/src/views/Settings/ProjectSettingsPage/components/EnvironmentSection/EnvironmentSection.tsx index 20f163f45..92ba623a2 100644 --- a/frontend/src/views/Settings/ProjectSettingsPage/components/EnvironmentSection/EnvironmentSection.tsx +++ b/frontend/src/views/Settings/ProjectSettingsPage/components/EnvironmentSection/EnvironmentSection.tsx @@ -63,7 +63,10 @@ export const EnvironmentSection = () => { }; return ( -
+

Environments