diff --git a/backend/src/services/project/project-service.ts b/backend/src/services/project/project-service.ts index b05579c73..b6b4e183f 100644 --- a/backend/src/services/project/project-service.ts +++ b/backend/src/services/project/project-service.ts @@ -305,7 +305,6 @@ export const projectServiceFactory = ({ tx ); - // TODO(pta: check this again) await bootstrapSshProject({ projectId: project.id, sshCertificateAuthorityDAL, diff --git a/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx b/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx index 4bc31c0eb..394e97784 100644 --- a/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx +++ b/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx @@ -8,6 +8,7 @@ import { faCubes, faEnvelope, faInfo, + faInfoCircle, faSignOut, faSlash, faSort, @@ -19,6 +20,7 @@ import { useQueryClient } from "@tanstack/react-query"; import { Link, useNavigate, useRouter, useRouterState } from "@tanstack/react-router"; import { Mfa } from "@app/components/auth/Mfa"; +import { createNotification } from "@app/components/notifications"; import SecurityClient from "@app/components/utilities/SecurityClient"; import { BreadcrumbContainer, @@ -30,7 +32,8 @@ import { IconButton, Modal, ModalContent, - TBreadcrumbFormat + TBreadcrumbFormat, + Tooltip } from "@app/components/v2"; import { envConfig } from "@app/config/env"; import { useOrganization, useSubscription, useUser } from "@app/context"; @@ -39,6 +42,7 @@ import { useToggle } from "@app/hooks"; import { useGetOrganizations, useLogoutUser, workspaceKeys } from "@app/hooks/api"; import { authKeys, selectOrganization } from "@app/hooks/api/auth/queries"; import { MfaMethod } from "@app/hooks/api/auth/types"; +import { getAuthToken } from "@app/hooks/api/reactQuery"; import { SubscriptionPlan } from "@app/hooks/api/types"; import { AuthMethod } from "@app/hooks/api/users/types"; import { navigateUserToOrg } from "@app/pages/auth/LoginPage/Login.utils"; @@ -130,6 +134,19 @@ export const Navbar = () => { } }; + const handleCopyToken = async () => { + try { + await window.navigator.clipboard.writeText(getAuthToken()); + createNotification({ + type: "success", + text: "Copied current login session token to clipboard" + }); + } catch (error) { + console.log(error); + createNotification({ type: "error", text: "Failed to copy user token to clipboard" }); + } + }; + if (shouldShowMfa) { return (
@@ -365,6 +382,16 @@ export const Navbar = () => {
+ + Copy Token + + + + +
}> Log Out diff --git a/frontend/src/layouts/ProjectLayout/components/ProjectSelect/ProjectSelect.tsx b/frontend/src/layouts/ProjectLayout/components/ProjectSelect/ProjectSelect.tsx index d91418cec..e67d415a9 100644 --- a/frontend/src/layouts/ProjectLayout/components/ProjectSelect/ProjectSelect.tsx +++ b/frontend/src/layouts/ProjectLayout/components/ProjectSelect/ProjectSelect.tsx @@ -1,8 +1,9 @@ -import { useMemo } from "react"; +import { useMemo, useState } from "react"; import { faStar } from "@fortawesome/free-regular-svg-icons"; import { faCheck, faCube, + faMagnifyingGlass, faPlus, faSort, faStar as faSolidStar @@ -19,7 +20,8 @@ import { DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, - IconButton + IconButton, + Input } from "@app/components/v2"; import { OrgPermissionActions, @@ -37,6 +39,7 @@ import { ProjectType, Workspace } from "@app/hooks/api/workspace/types"; // TODO(pta): add search to project select export const ProjectSelect = () => { + const [searchProject, setSearchProject] = useState(""); const { currentWorkspace } = useWorkspace(); const { currentOrg } = useOrganization(); const { data: workspaces = [] } = useGetUserWorkspaces(); @@ -131,46 +134,62 @@ export const ProjectSelect = () => { style={{ minWidth: "220px" }} >
Projects
- {projects?.map((workspace) => { - return ( - { - // todo(akhi): this is not using react query because react query in overview is throwing error when envs are not exact same count - // to reproduce change this back to router.push and switch between two projects with different env count - // look into this on dashboard revamp - const url = linkOptions({ - to: getProjectHomePage(workspace.defaultType), - params: { - projectId: workspace.id - } - }); - window.location.assign(url.to.replaceAll("$projectId", workspace.id)); - }} - icon={ - currentWorkspace?.id === workspace.id && ( - - ) - } - > -
-
- {workspace.name} -
- { - e.stopPropagation(); - await ( - workspace.isFavorite ? removeProjectFromFavorites : addProjectToFavorites - )(workspace.id); +
+ setSearchProject(evt.target.value || "")} + leftIcon={} + size="xs" + variant="plain" + placeholder="Search projects" + /> +
+
+ {projects + ?.filter((el) => el.name?.toLowerCase().includes(searchProject.toLowerCase())) + ?.map((workspace) => { + return ( + { + // todo(akhi): this is not using react query because react query in overview is throwing error when envs are not exact same count + // to reproduce change this back to router.push and switch between two projects with different env count + // look into this on dashboard revamp + const url = linkOptions({ + to: getProjectHomePage(workspace.defaultType), + params: { + projectId: workspace.id + } + }); + window.location.assign(url.to.replaceAll("$projectId", workspace.id)); }} - /> -
- - ); - })} + icon={ + currentWorkspace?.id === workspace.id && ( + + ) + } + > +
+
+ {workspace.name} +
+ { + e.stopPropagation(); + await ( + workspace.isFavorite + ? removeProjectFromFavorites + : addProjectToFavorites + )(workspace.id); + }} + /> +
+ + ); + })} +
{(isAllowed) => (