fix: added routes

This commit is contained in:
Piyush Gupta
2025-11-20 20:24:19 +05:30
parent 16df96ac60
commit e022f730ea
17 changed files with 494 additions and 378 deletions

View File

@@ -30,7 +30,7 @@ export const navigateUserToOrg = async (navigate: NavigateFn, organizationId?: s
} else {
// user is not part of any non-auth enforced orgs
localStorage.removeItem("orgData.id");
navigate({ to: "/organization/none" });
navigate({ to: "/organizations/none" });
}
};

View File

@@ -222,7 +222,7 @@ export const SelectOrganizationSection = () => {
// Case: User has no organizations.
// This can happen if the user was previously a member, but the organization was deleted or the user was removed.
if (organizations.data.length === 0) {
navigate({ to: "/organization/none" });
navigate({ to: "/organizations/none" });
} else if (organizations.data.length === 1) {
if (callbackPort) {
handleCliRedirect();

View File

@@ -44,7 +44,7 @@ export const Route = createFileRoute("/_authenticate")({
if (
!data.organizationId &&
location.pathname !== ROUTE_PATHS.Auth.PasswordSetupPage.path &&
location.pathname !== "/organization/none"
location.pathname !== "/organizations/none"
) {
throw redirect({ to: "/login/select-organization" });
}

View File

@@ -2,6 +2,6 @@ import { createFileRoute } from "@tanstack/react-router";
import { NoOrgPage } from "./NoOrgPage";
export const Route = createFileRoute("/_authenticate/organization/none")({
export const Route = createFileRoute("/_authenticate/organizations/none")({
component: NoOrgPage
});

View File

@@ -0,0 +1,22 @@
import { createFileRoute, redirect } from "@tanstack/react-router";
export const Route = createFileRoute("/_authenticate/_inject-org-details/organization/$")({
beforeLoad: ({ context, params, search }) => {
const orgId = context.organizationId;
if (!orgId) {
throw redirect({
to: "/login/select-organization"
});
}
// eslint-disable-next-line no-underscore-dangle
const remainingPath = params._splat || "";
throw redirect({
to: `/organizations/$orgId/${remainingPath}` as const,
params: { orgId },
search
});
}
});

View File

@@ -0,0 +1,32 @@
import { createFileRoute, redirect } from "@tanstack/react-router";
import { localStorageService } from "@app/helpers/localStorage";
export const Route = createFileRoute("/_authenticate/_inject-org-details/projects/$")({
beforeLoad: ({ context, params, search }) => {
const orgId = context.organizationId;
if (!orgId) {
throw redirect({
to: "/login/select-organization"
});
}
// eslint-disable-next-line no-underscore-dangle
const remainingPath = params._splat || "";
const projectId = localStorageService.getIintegrationProjectId();
if (!projectId) {
throw redirect({
to: "/organizations/$orgId/projects",
params: { orgId }
});
}
throw redirect({
to: `/organizations/$orgId/projects/${remainingPath}` as const,
params: { orgId, projectId },
search
});
}
});

View File

@@ -7,10 +7,11 @@ import { localStorageService } from "@app/helpers/localStorage";
import { AzureAppConfigurationOauthCallbackPageQueryParamsSchema } from "./AzureAppConfigurationOauthCallbackPage/route";
export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/integrations/azure-app-configuration/oauth2/callback"
"/_authenticate/_inject-org-details/_org-layout/integrations/azure-app-configuration/oauth2/callback"
)({
validateSearch: zodValidator(AzureAppConfigurationOauthCallbackPageQueryParamsSchema),
beforeLoad: ({ search, params }) => {
beforeLoad: ({ context, search }) => {
const orgId = context.organizationId;
const projectId = localStorageService.getIintegrationProjectId();
if (!projectId) {
createNotification({
@@ -20,12 +21,12 @@ export const Route = createFileRoute(
});
throw redirect({
to: "/organizations/$orgId/projects",
params: { orgId: params.orgId }
params: { orgId }
});
}
throw redirect({
to: "/organizations/$orgId/projects/secret-management/$projectId/integrations/azure-app-configuration/oauth2/callback",
params: { orgId: params.orgId, projectId },
params: { orgId, projectId },
search
});
}

View File

@@ -7,10 +7,11 @@ import { localStorageService } from "@app/helpers/localStorage";
import { AzureKeyVaultOauthCallbackQueryParamsSchema } from "./AzureKeyVaultOauthCallbackPage/route";
export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/integrations/azure-key-vault/oauth2/callback"
"/_authenticate/_inject-org-details/_org-layout/integrations/azure-key-vault/oauth2/callback"
)({
validateSearch: zodValidator(AzureKeyVaultOauthCallbackQueryParamsSchema),
beforeLoad: ({ search, params }) => {
beforeLoad: ({ context, search }) => {
const orgId = context.organizationId;
const projectId = localStorageService.getIintegrationProjectId();
if (!projectId) {
createNotification({
@@ -20,12 +21,12 @@ export const Route = createFileRoute(
});
throw redirect({
to: "/organizations/$orgId/projects",
params: { orgId: params.orgId }
params: { orgId }
});
}
throw redirect({
to: "/organizations/$orgId/projects/secret-management/$projectId/integrations/azure-key-vault/oauth2/callback",
params: { orgId: params.orgId, projectId },
params: { orgId, projectId },
search
});
}

View File

@@ -7,10 +7,11 @@ import { localStorageService } from "@app/helpers/localStorage";
import { BitbucketOauthCallbackQueryParamsSchema } from "./BitbucketOauthCallbackPage/route";
export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/integrations/bitbucket/oauth2/callback"
"/_authenticate/_inject-org-details/_org-layout/integrations/bitbucket/oauth2/callback"
)({
validateSearch: zodValidator(BitbucketOauthCallbackQueryParamsSchema),
beforeLoad: ({ search, params }) => {
beforeLoad: ({ context, search }) => {
const orgId = context.organizationId;
const projectId = localStorageService.getIintegrationProjectId();
if (!projectId) {
createNotification({
@@ -20,12 +21,12 @@ export const Route = createFileRoute(
});
throw redirect({
to: "/organizations/$orgId/projects",
params: { orgId: params.orgId }
params: { orgId }
});
}
throw redirect({
to: "/organizations/$orgId/projects/secret-management/$projectId/integrations/bitbucket/oauth2/callback",
params: { orgId: params.orgId, projectId },
params: { orgId, projectId },
search
});
}

View File

@@ -7,10 +7,11 @@ import { localStorageService } from "@app/helpers/localStorage";
import { GcpSecretManagerOAuthCallbackPageQueryParamsSchema } from "./GcpSecretManagerOauthCallbackPage/route";
export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/integrations/gcp-secret-manager/oauth2/callback"
"/_authenticate/_inject-org-details/_org-layout/integrations/gcp-secret-manager/oauth2/callback"
)({
validateSearch: zodValidator(GcpSecretManagerOAuthCallbackPageQueryParamsSchema),
beforeLoad: ({ search, params }) => {
beforeLoad: ({ context, search }) => {
const orgId = context.organizationId;
const projectId = localStorageService.getIintegrationProjectId();
if (!projectId) {
createNotification({
@@ -20,12 +21,12 @@ export const Route = createFileRoute(
});
throw redirect({
to: "/organizations/$orgId/projects",
params: { orgId: params.orgId }
params: { orgId }
});
}
throw redirect({
to: "/organizations/$orgId/projects/secret-management/$projectId/integrations/gcp-secret-manager/oauth2/callback",
params: { orgId: params.orgId, projectId },
params: { orgId, projectId },
search
});
}

View File

@@ -7,10 +7,11 @@ import { localStorageService } from "@app/helpers/localStorage";
import { GithubOAuthCallbackPageQueryParamsSchema } from "./GithubOauthCallbackPage/route";
export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/integrations/github/oauth2/callback"
"/_authenticate/_inject-org-details/_org-layout/integrations/github/oauth2/callback"
)({
validateSearch: zodValidator(GithubOAuthCallbackPageQueryParamsSchema),
beforeLoad: ({ search, params }) => {
beforeLoad: ({ context, search }) => {
const orgId = context.organizationId;
const projectId = localStorageService.getIintegrationProjectId();
if (!projectId) {
createNotification({
@@ -20,12 +21,12 @@ export const Route = createFileRoute(
});
throw redirect({
to: "/organizations/$orgId/projects",
params: { orgId: params.orgId }
params: { orgId }
});
}
throw redirect({
to: "/organizations/$orgId/projects/secret-management/$projectId/integrations/github/oauth2/callback",
params: { orgId: params.orgId, projectId },
params: { orgId, projectId },
search
});
}

View File

@@ -7,10 +7,11 @@ import { localStorageService } from "@app/helpers/localStorage";
import { GitlabOAuthCallbackPageQueryParamsSchema } from "./GitlabOauthCallbackPage/route";
export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/integrations/gitlab/oauth2/callback"
"/_authenticate/_inject-org-details/_org-layout/integrations/gitlab/oauth2/callback"
)({
validateSearch: zodValidator(GitlabOAuthCallbackPageQueryParamsSchema),
beforeLoad: ({ search, params }) => {
beforeLoad: ({ context, search }) => {
const orgId = context.organizationId;
const projectId = localStorageService.getIintegrationProjectId();
if (!projectId) {
createNotification({
@@ -20,12 +21,12 @@ export const Route = createFileRoute(
});
throw redirect({
to: "/organizations/$orgId/projects",
params: { orgId: params.orgId }
params: { orgId }
});
}
throw redirect({
to: "/organizations/$orgId/projects/secret-management/$projectId/integrations/gitlab/oauth2/callback",
params: { orgId: params.orgId, projectId },
params: { orgId, projectId },
search
});
}

View File

@@ -7,10 +7,11 @@ import { localStorageService } from "@app/helpers/localStorage";
import { HerokuOAuthCallbackPageQueryParamsSchema } from "./HerokuOauthCallbackPage/route";
export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/integrations/heroku/oauth2/callback"
"/_authenticate/_inject-org-details/_org-layout/integrations/heroku/oauth2/callback"
)({
validateSearch: zodValidator(HerokuOAuthCallbackPageQueryParamsSchema),
beforeLoad: ({ search, params }) => {
beforeLoad: ({ context, search }) => {
const orgId = context.organizationId;
const projectId = localStorageService.getIintegrationProjectId();
if (!projectId) {
createNotification({
@@ -20,12 +21,12 @@ export const Route = createFileRoute(
});
throw redirect({
to: "/organizations/$orgId/projects",
params: { orgId: params.orgId }
params: { orgId }
});
}
throw redirect({
to: "/organizations/$orgId/projects/secret-management/$projectId/integrations/heroku/oauth2/callback",
params: { orgId: params.orgId, projectId },
params: { orgId, projectId },
search
});
}

View File

@@ -7,10 +7,11 @@ import { localStorageService } from "@app/helpers/localStorage";
import { NetlifyOAuthCallbackPageQueryParamsSchema } from "./NetlifyOauthCallbackPage/route";
export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/integrations/netlify/oauth2/callback"
"/_authenticate/_inject-org-details/_org-layout/integrations/netlify/oauth2/callback"
)({
validateSearch: zodValidator(NetlifyOAuthCallbackPageQueryParamsSchema),
beforeLoad: ({ search, params }) => {
beforeLoad: ({ context, search }) => {
const orgId = context.organizationId;
const projectId = localStorageService.getIintegrationProjectId();
if (!projectId) {
createNotification({
@@ -20,12 +21,12 @@ export const Route = createFileRoute(
});
throw redirect({
to: "/organizations/$orgId/projects",
params: { orgId: params.orgId }
params: { orgId }
});
}
throw redirect({
to: "/organizations/$orgId/projects/secret-management/$projectId/integrations/netlify/oauth2/callback",
params: { orgId: params.orgId, projectId },
params: { orgId, projectId },
search
});
}

View File

@@ -7,10 +7,11 @@ import { localStorageService } from "@app/helpers/localStorage";
import { VercelOAuthCallbackPageQueryParamsSchema } from "./VercelOauthCallbackPage/route";
export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/integrations/vercel/oauth2/callback"
"/_authenticate/_inject-org-details/_org-layout/integrations/vercel/oauth2/callback"
)({
validateSearch: zodValidator(VercelOAuthCallbackPageQueryParamsSchema),
beforeLoad: ({ search, params }) => {
beforeLoad: ({ context, search }) => {
const orgId = context.organizationId;
const projectId = localStorageService.getIintegrationProjectId();
if (!projectId) {
createNotification({
@@ -20,12 +21,12 @@ export const Route = createFileRoute(
});
throw redirect({
to: "/organizations/$orgId/projects",
params: { orgId: params.orgId }
params: { orgId }
});
}
throw redirect({
to: "/organizations/$orgId/projects/secret-management/$projectId/integrations/vercel/oauth2/callback",
params: { orgId: params.orgId, projectId },
params: { orgId, projectId },
search
});
}

File diff suppressed because it is too large Load Diff

View File

@@ -248,7 +248,7 @@ const secretManagerRoutes = route("/organizations/$orgId/projects/secret-managem
])
]);
const secretManagerIntegrationsRedirect = route("/organizations/$orgId/integrations", [
const secretManagerIntegrationsRedirect = route("/integrations", [
route("/heroku/oauth2/callback", "secret-manager/integrations/route-heroku-oauth-redirect.tsx"),
route(
"/gcp-secret-manager/oauth2/callback",
@@ -425,8 +425,10 @@ export const routes = rootRoute("root.tsx", [
route("/personal-settings", [
layout("user/layout.tsx", [index("user/PersonalSettingsPage/route.tsx")])
]),
route("/organization/none", "organization/NoOrgPage/route.tsx"),
route("/organizations/none", "organization/NoOrgPage/route.tsx"),
middleware("inject-org-details.tsx", [
route("/organization/$", "redirects/organization-redirect.tsx"),
route("/projects/$", "redirects/project-redirect.tsx"),
adminRoute,
layout("org-layout", "organization/layout.tsx", [
organizationRoutes,