diff --git a/frontend/src/components/project/ProjectOverviewChangeSection.tsx b/frontend/src/components/project/ProjectOverviewChangeSection.tsx index 0f88ec2e9..85a4ae46f 100644 --- a/frontend/src/components/project/ProjectOverviewChangeSection.tsx +++ b/frontend/src/components/project/ProjectOverviewChangeSection.tsx @@ -5,12 +5,14 @@ import { z } from "zod"; import { createNotification } from "@app/components/notifications"; import { ProjectPermissionCan } from "@app/components/permissions"; -import { Button, FormControl, Input, TextArea } from "@app/components/v2"; +import { Button, FormControl, Input, Select, SelectItem, TextArea } from "@app/components/v2"; import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context"; import { useUpdateProject } from "@app/hooks/api"; +import { ProjectType } from "@app/hooks/api/workspace/types"; const baseFormSchema = z.object({ name: z.string().min(1, "Required").max(64, "Too long, maximum length is 64 characters"), + defaultProduct: z.nativeEnum(ProjectType).default(ProjectType.SecretManager), description: z .string() .trim() @@ -50,6 +52,7 @@ export const ProjectOverviewChangeSection = ({ showSlugField = false }: Props) = reset({ name: currentWorkspace.name, description: currentWorkspace.description ?? "", + defaultProduct: currentWorkspace.defaultProduct, ...(showSlugField && { slug: currentWorkspace.slug }) }); } @@ -63,6 +66,7 @@ export const ProjectOverviewChangeSection = ({ showSlugField = false }: Props) = projectID: currentWorkspace.id, newProjectName: data.name, newProjectDescription: data.description, + defaultProduct: data.defaultProduct, ...(showSlugField && "slug" in data && { newSlug: data.slug !== currentWorkspace.slug ? data.slug : undefined @@ -212,6 +216,31 @@ export const ProjectOverviewChangeSection = ({ showSlugField = false }: Props) = + ( + + + + )} + />
{ createNotification({ text: "Project created", type: "success" }); reset(); onOpenChange(false); - navigate({ to: getProjectHomePage(project.defaultType), params: { projectId: project.id } }); + navigate({ + to: getProjectHomePage(project.defaultProduct), + params: { projectId: project.id } + }); } catch (err) { console.error(err); createNotification({ text: "Failed to create project", type: "error" }); diff --git a/frontend/src/components/v2/Breadcrumb/Breadcrumb.tsx b/frontend/src/components/v2/Breadcrumb/Breadcrumb.tsx index 5715aba32..0b97a58c4 100644 --- a/frontend/src/components/v2/Breadcrumb/Breadcrumb.tsx +++ b/frontend/src/components/v2/Breadcrumb/Breadcrumb.tsx @@ -1,6 +1,6 @@ /* eslint-disable react/prop-types */ import React from "react"; -import { faEllipsis, faSlash, faSort } from "@fortawesome/free-solid-svg-icons"; +import { faEllipsis, faSort } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { Link, ReactNode } from "@tanstack/react-router"; import { LinkComponentProps } from "node_modules/@tanstack/react-router/dist/esm/link"; @@ -40,7 +40,7 @@ const BreadcrumbItem = React.forwardRef (
  • ) @@ -79,9 +79,7 @@ BreadcrumbPage.displayName = "BreadcrumbPage"; const BreadcrumbSeparator = ({ children, className, ...props }: React.ComponentProps<"li">) => (
  • ); BreadcrumbSeparator.displayName = "BreadcrumbSeparator"; @@ -136,7 +134,7 @@ const BreadcrumbContainer = ({ breadcrumbs }: { breadcrumbs: TBreadcrumbFormat[] - + {el.label} diff --git a/frontend/src/hooks/api/identities/types.ts b/frontend/src/hooks/api/identities/types.ts index b233738d8..69cb26e6c 100644 --- a/frontend/src/hooks/api/identities/types.ts +++ b/frontend/src/hooks/api/identities/types.ts @@ -51,7 +51,7 @@ export type IdentityMembershipOrg = { export type IdentityMembership = { id: string; identity: Identity; - project: Pick; + project: Pick; roles: Array< { id: string; diff --git a/frontend/src/hooks/api/workspace/queries.tsx b/frontend/src/hooks/api/workspace/queries.tsx index ff2a170af..260b02145 100644 --- a/frontend/src/hooks/api/workspace/queries.tsx +++ b/frontend/src/hooks/api/workspace/queries.tsx @@ -280,7 +280,8 @@ export const useUpdateProject = () => { newProjectDescription, newSlug, secretSharing, - showSnapshotsLegacy + showSnapshotsLegacy, + defaultProduct }) => { const { data } = await apiRequest.patch<{ workspace: Workspace }>( `/api/v1/workspace/${projectID}`, @@ -288,6 +289,7 @@ export const useUpdateProject = () => { name: newProjectName, description: newProjectDescription, slug: newSlug, + defaultProduct, secretSharing, showSnapshotsLegacy } diff --git a/frontend/src/hooks/api/workspace/types.ts b/frontend/src/hooks/api/workspace/types.ts index d4f38fa66..5249f39ec 100644 --- a/frontend/src/hooks/api/workspace/types.ts +++ b/frontend/src/hooks/api/workspace/types.ts @@ -24,7 +24,7 @@ export type Workspace = { __v: number; id: string; name: string; - defaultType: ProjectType; + defaultProduct: ProjectType; description?: string; orgId: string; version: ProjectVersion; @@ -80,6 +80,7 @@ export type UpdateProjectDTO = { newSlug?: string; secretSharing?: boolean; showSnapshotsLegacy?: boolean; + defaultProduct?: ProjectType; }; export type UpdatePitVersionLimitDTO = { projectSlug: string; pitVersionLimit: number }; diff --git a/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx b/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx index 6cf2c0589..4e9184789 100644 --- a/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx +++ b/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx @@ -168,11 +168,10 @@ export const Navbar = () => {

    /

    -
    +
    -
    {currentOrg?.name}
    {getPlan(subscription)} diff --git a/frontend/src/layouts/ProjectLayout/components/ProjectSelect/ProjectSelect.tsx b/frontend/src/layouts/ProjectLayout/components/ProjectSelect/ProjectSelect.tsx index e67d415a9..dba71d238 100644 --- a/frontend/src/layouts/ProjectLayout/components/ProjectSelect/ProjectSelect.tsx +++ b/frontend/src/layouts/ProjectLayout/components/ProjectSelect/ProjectSelect.tsx @@ -102,13 +102,13 @@ export const ProjectSelect = () => { -
    +
    @@ -156,7 +156,7 @@ export const ProjectSelect = () => { // 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), + to: getProjectHomePage(workspace.defaultProduct), params: { projectId: workspace.id } diff --git a/frontend/src/pages/organization/AdminPage/components/OrgAdminProjects/OrgAdminProjects.tsx b/frontend/src/pages/organization/AdminPage/components/OrgAdminProjects/OrgAdminProjects.tsx index e1b50ce1d..674018f14 100644 --- a/frontend/src/pages/organization/AdminPage/components/OrgAdminProjects/OrgAdminProjects.tsx +++ b/frontend/src/pages/organization/AdminPage/components/OrgAdminProjects/OrgAdminProjects.tsx @@ -105,7 +105,7 @@ export const OrgAdminProjects = withPermission( {isProjectsLoading && } {!isProjectsLoading && - projects?.map(({ name, slug, createdAt, id, defaultType }) => ( + projects?.map(({ name, slug, createdAt, id, defaultProduct }) => ( {name} {slug} @@ -126,7 +126,7 @@ export const OrgAdminProjects = withPermission( onClick={(e) => { e.stopPropagation(); e.preventDefault(); - handleAccessProject(defaultType, id); + handleAccessProject(defaultProduct, id); }} icon={} disabled={ diff --git a/frontend/src/pages/organization/AuditLogsPage/components/LogsFilter.tsx b/frontend/src/pages/organization/AuditLogsPage/components/LogsFilter.tsx index 0ba187341..367cfefc0 100644 --- a/frontend/src/pages/organization/AuditLogsPage/components/LogsFilter.tsx +++ b/frontend/src/pages/organization/AuditLogsPage/components/LogsFilter.tsx @@ -418,10 +418,10 @@ export const LogsFilter = ({ onChange(e); }} placeholder="All projects" - options={workspacesInOrg.map(({ name, id, defaultType }) => ({ + options={workspacesInOrg.map(({ name, id, defaultProduct }) => ({ name, id, - type: defaultType + type: defaultProduct }))} getOptionValue={(option) => option.id} getOptionLabel={(option) => option.name} diff --git a/frontend/src/pages/organization/ProjectsPage/components/AllProjectView.tsx b/frontend/src/pages/organization/ProjectsPage/components/AllProjectView.tsx index 0a1bd7364..3789cf024 100644 --- a/frontend/src/pages/organization/ProjectsPage/components/AllProjectView.tsx +++ b/frontend/src/pages/organization/ProjectsPage/components/AllProjectView.tsx @@ -222,7 +222,7 @@ export const AllProjectView = ({ onKeyDown={(evt) => { if (evt.key === "Enter" && workspace.isMember) { navigate({ - to: getProjectHomePage(workspace.defaultType), + to: getProjectHomePage(workspace.defaultProduct), params: { projectId: workspace.id } @@ -232,7 +232,7 @@ export const AllProjectView = ({ onClick={() => { if (workspace.isMember) { navigate({ - to: getProjectHomePage(workspace.defaultType), + to: getProjectHomePage(workspace.defaultProduct), params: { projectId: workspace.id } diff --git a/frontend/src/pages/organization/ProjectsPage/components/MyProjectView.tsx b/frontend/src/pages/organization/ProjectsPage/components/MyProjectView.tsx index f315215e7..f9d2ed470 100644 --- a/frontend/src/pages/organization/ProjectsPage/components/MyProjectView.tsx +++ b/frontend/src/pages/organization/ProjectsPage/components/MyProjectView.tsx @@ -153,7 +153,7 @@ export const MyProjectView = ({
    { navigate({ - to: getProjectHomePage(workspace.defaultType), + to: getProjectHomePage(workspace.defaultProduct), params: { projectId: workspace.id } @@ -215,7 +215,7 @@ export const MyProjectView = ({
    { navigate({ - to: getProjectHomePage(workspace.defaultType), + to: getProjectHomePage(workspace.defaultProduct), params: { projectId: workspace.id }