diff --git a/frontend/src/views/SecretOverviewPage/SecretOverviewPage.tsx b/frontend/src/views/SecretOverviewPage/SecretOverviewPage.tsx index df88d8138..5f383ba98 100644 --- a/frontend/src/views/SecretOverviewPage/SecretOverviewPage.tsx +++ b/frontend/src/views/SecretOverviewPage/SecretOverviewPage.tsx @@ -4,7 +4,9 @@ import Link from "next/link"; import { useRouter } from "next/router"; import { faFolderBlank, faMagnifyingGlass } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { faArrowDown, faArrowUp } from "@fortawesome/free-solid-svg-icons"; +import { IconButton } from "@app/components/v2"; import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider"; import NavHeader from "@app/components/navigation/NavHeader"; import { @@ -46,6 +48,7 @@ export const SecretOverviewPage = () => { // coz when overflow the table goes to the right const parentTableRef = useRef(null); const [expandableTableWidth, setExpandableTableWidth] = useState(0); + const [sortDir, setSortDir] = useState<"asc" | "desc">("asc"); useEffect(() => { const handleParentTableWidthResize = () => { @@ -219,7 +222,7 @@ export const SecretOverviewPage = () => { const filteredSecretNames = secKeys?.filter((name) => name.toUpperCase().includes(searchFilter.toUpperCase()) - ); + ).sort((a, b) => sortDir === "asc" ? a.localeCompare(b || "") : b.localeCompare(a || "")); const filteredFolderNames = folderNames?.filter((name) => name.toLowerCase().includes(searchFilter.toLowerCase()) ); @@ -278,6 +281,9 @@ export const SecretOverviewPage = () => {
Name + setSortDir(prev => prev === "asc" ? "desc" : "asc")}> + +
{userAvailableEnvs?.map(({ name, slug }, index) => {