mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 22:28:15 +00:00
feat: re-arranged route paths
This commit is contained in:
@@ -4,7 +4,6 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|||||||
import { Link, useParams } from "@tanstack/react-router";
|
import { Link, useParams } from "@tanstack/react-router";
|
||||||
import { twMerge } from "tailwind-merge";
|
import { twMerge } from "tailwind-merge";
|
||||||
|
|
||||||
import { ROUTE_PATHS } from "@app/const/routes";
|
|
||||||
import { useOrganization, useWorkspace } from "@app/context";
|
import { useOrganization, useWorkspace } from "@app/context";
|
||||||
import { useToggle } from "@app/hooks";
|
import { useToggle } from "@app/hooks";
|
||||||
import { ProjectType } from "@app/hooks/api/workspace/types";
|
import { ProjectType } from "@app/hooks/api/workspace/types";
|
||||||
@@ -194,7 +193,7 @@ export default function NavHeader({
|
|||||||
to={`/${ProjectType.SecretManager}/$projectId/secrets/$envSlug` as const}
|
to={`/${ProjectType.SecretManager}/$projectId/secrets/$envSlug` as const}
|
||||||
params={{
|
params={{
|
||||||
projectId: currentWorkspace.id,
|
projectId: currentWorkspace.id,
|
||||||
envSlug: routerEnvSlug
|
envSlug: routerEnvSlug || ""
|
||||||
}}
|
}}
|
||||||
search={(query) => ({ ...query, secretPath: newSecretPath })}
|
search={(query) => ({ ...query, secretPath: newSecretPath })}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,13 +1,19 @@
|
|||||||
import { FileRouteTypes } from "@app/routeTree.gen";
|
import { FileRouteTypes } from "@app/routeTree.gen";
|
||||||
|
|
||||||
const setRoute = <TFull extends FileRouteTypes["fullPaths"], TId extends FileRouteTypes["id"]>(
|
const setRoute = <TFull extends FileRouteTypes["fullPaths"], TId extends FileRouteTypes["id"]>(
|
||||||
full: TFull,
|
path: TFull,
|
||||||
id: TId
|
id: TId
|
||||||
) => ({ full, id }) as const;
|
) => ({ path, id }) as const;
|
||||||
|
|
||||||
export const ROUTE_PATHS = Object.freeze({
|
export const ROUTE_PATHS = Object.freeze({
|
||||||
Auth: {
|
Auth: {
|
||||||
LoginSSO: setRoute("/login/sso", "/_restrict-login-signup/login/sso")
|
LoginSSO: setRoute("/login/sso", "/_restrict-login-signup/login/sso"),
|
||||||
|
ProviderSuccessPage: setRoute(
|
||||||
|
"/login/provider/success",
|
||||||
|
"/_restrict-login-signup/login/provider/success"
|
||||||
|
),
|
||||||
|
SignUpSsoPage: setRoute("/signup/sso", "/_restrict-login-signup/signup/sso"),
|
||||||
|
PasswordResetPage: setRoute("/password-reset", "/_restrict-login-signup/password-reset")
|
||||||
},
|
},
|
||||||
Organization: {
|
Organization: {
|
||||||
SecretScanning: setRoute(
|
SecretScanning: setRoute(
|
||||||
@@ -17,6 +23,26 @@ export const ROUTE_PATHS = Object.freeze({
|
|||||||
SettingsPage: setRoute(
|
SettingsPage: setRoute(
|
||||||
"/organization/settings",
|
"/organization/settings",
|
||||||
"/_authenticate/_inject-org-details/organization/_layout/settings"
|
"/_authenticate/_inject-org-details/organization/_layout/settings"
|
||||||
|
),
|
||||||
|
GroupDetailsByIDPage: setRoute(
|
||||||
|
"/organization/groups/$groupId",
|
||||||
|
"/_authenticate/_inject-org-details/organization/_layout/groups/$groupId"
|
||||||
|
),
|
||||||
|
IdentityDetailsByIDPage: setRoute(
|
||||||
|
"/organization/identities/$identityId",
|
||||||
|
"/_authenticate/_inject-org-details/organization/_layout/identities/$identityId"
|
||||||
|
),
|
||||||
|
UserDetailsByIDPage: setRoute(
|
||||||
|
"/organization/members/$membershipId",
|
||||||
|
"/_authenticate/_inject-org-details/organization/_layout/members/$membershipId"
|
||||||
|
),
|
||||||
|
AccessControlPage: setRoute(
|
||||||
|
"/organization/access-management",
|
||||||
|
"/_authenticate/_inject-org-details/organization/_layout/access-management"
|
||||||
|
),
|
||||||
|
RoleByIDPage: setRoute(
|
||||||
|
"/organization/roles/$roleId",
|
||||||
|
"/_authenticate/_inject-org-details/organization/_layout/roles/$roleId"
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
SecretManager: {
|
SecretManager: {
|
||||||
@@ -27,53 +53,27 @@ export const ROUTE_PATHS = Object.freeze({
|
|||||||
SecretDashboardPage: setRoute(
|
SecretDashboardPage: setRoute(
|
||||||
"/secret-manager/$projectId/secrets/$envSlug",
|
"/secret-manager/$projectId/secrets/$envSlug",
|
||||||
"/_authenticate/_inject-org-details/secret-manager/$projectId/_secret-manager-layout/secrets/$envSlug"
|
"/_authenticate/_inject-org-details/secret-manager/$projectId/_secret-manager-layout/secrets/$envSlug"
|
||||||
|
),
|
||||||
|
OverviewPage: setRoute(
|
||||||
|
"/secret-manager/$projectId/overview",
|
||||||
|
"/_authenticate/_inject-org-details/secret-manager/$projectId/_secret-manager-layout/overview"
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
ProviderSuccessPage: setRoute(
|
CertManager: {
|
||||||
"/login/provider/success",
|
CertAuthDetailsByIDPage: setRoute(
|
||||||
"/_restrict-login-signup/login/provider/success"
|
"/cert-manager/$projectId/ca/$caId",
|
||||||
),
|
"/_authenticate/_inject-org-details/cert-manager/$projectId/_cert-manager-layout/ca/$caId"
|
||||||
SignUpSsoPage: setRoute("/signup/sso", "/_restrict-login-signup/signup/sso"),
|
),
|
||||||
PasswordResetPage: setRoute("/password-reset", "/_restrict-login-signup/password-reset"),
|
OverviewPage: setRoute(
|
||||||
ViewSharedSecretByIDPage: setRoute("/shared/secret/$secretId", "/shared/secret/$secretId"),
|
"/cert-manager/$projectId/overview",
|
||||||
OrgGroupDetailsByIDPage: setRoute(
|
"/_authenticate/_inject-org-details/cert-manager/$projectId/_cert-manager-layout/overview"
|
||||||
"/organization/groups/$groupId",
|
),
|
||||||
"/_authenticate/_inject-org-details/organization/_layout/groups/$groupId"
|
PkiCollectionDetailsByIDPage: setRoute(
|
||||||
),
|
"/cert-manager/$projectId/pki-collections/$collectionId",
|
||||||
OrgIdentityDetailsByIDPage: setRoute(
|
"/_authenticate/_inject-org-details/cert-manager/$projectId/_cert-manager-layout/pki-collections/$collectionId"
|
||||||
"/organization/identities/$identityId",
|
)
|
||||||
"/_authenticate/_inject-org-details/organization/_layout/identities/$identityId"
|
},
|
||||||
),
|
Public: {
|
||||||
OrgUserDetailsByIDPage: setRoute(
|
ViewSharedSecretByIDPage: setRoute("/shared/secret/$secretId", "/shared/secret/$secretId")
|
||||||
"/organization/members/$membershipId",
|
}
|
||||||
"/_authenticate/_inject-org-details/organization/_layout/members/$membershipId"
|
|
||||||
),
|
|
||||||
OrgAccessControlPage: setRoute(
|
|
||||||
"/organization/access-management",
|
|
||||||
"/_authenticate/_inject-org-details/organization/_layout/access-management"
|
|
||||||
),
|
|
||||||
OrgRoleByIDPage: setRoute(
|
|
||||||
"/organization/roles/$roleId",
|
|
||||||
"/_authenticate/_inject-org-details/organization/_layout/roles/$roleId"
|
|
||||||
),
|
|
||||||
SecretOverviewPage: setRoute(
|
|
||||||
"/secret-manager/$projectId/overview",
|
|
||||||
"/_authenticate/_inject-org-details/secret-manager/$projectId/_secret-manager-layout/overview"
|
|
||||||
),
|
|
||||||
SecretDashboardPage: setRoute(
|
|
||||||
"/secret-manager/$projectId/secrets/$envSlug",
|
|
||||||
"/_authenticate/_inject-org-details/secret-manager/$projectId/_secret-manager-layout/secrets/$envSlug"
|
|
||||||
),
|
|
||||||
CertAuthDetailsByIDPage: setRoute(
|
|
||||||
"/cert-manager/$projectId/ca/$caId",
|
|
||||||
"/_authenticate/_inject-org-details/cert-manager/$projectId/_cert-manager-layout/ca/$caId"
|
|
||||||
),
|
|
||||||
CertCertificatesPage: setRoute(
|
|
||||||
"/cert-manager/$projectId/overview",
|
|
||||||
"/_authenticate/_inject-org-details/cert-manager/$projectId/_cert-manager-layout/overview"
|
|
||||||
),
|
|
||||||
CertPkiCollectionDetailsByIDPage: setRoute(
|
|
||||||
"/cert-manager/$projectId/pki-collections/$collectionId",
|
|
||||||
"/_authenticate/_inject-org-details/cert-manager/$projectId/_cert-manager-layout/pki-collections/$collectionId"
|
|
||||||
)
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export const PasswordResetPage = () => {
|
|||||||
const [passwordErrorBreached, setPasswordErrorBreached] = useState(false);
|
const [passwordErrorBreached, setPasswordErrorBreached] = useState(false);
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const search = useSearch({ from: ROUTE_PATHS.PasswordResetPage.id });
|
const search = useSearch({ from: ROUTE_PATHS.Auth.PasswordResetPage.id });
|
||||||
|
|
||||||
const {
|
const {
|
||||||
mutateAsync: verifyPasswordResetCodeMutateAsync,
|
mutateAsync: verifyPasswordResetCodeMutateAsync,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { ROUTE_PATHS } from "@app/const/routes";
|
|||||||
|
|
||||||
export const LoginProviderSuccessPage = () => {
|
export const LoginProviderSuccessPage = () => {
|
||||||
const search = useSearch({
|
const search = useSearch({
|
||||||
from: ROUTE_PATHS.ProviderSuccessPage.id
|
from: ROUTE_PATHS.Auth.ProviderSuccessPage.id
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { UserInfoSSOStep } from "./components/UserInfoSSOStep";
|
|||||||
|
|
||||||
export const SignupSsoPage = () => {
|
export const SignupSsoPage = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const search = useSearch({ from: ROUTE_PATHS.SignUpSsoPage.id });
|
const search = useSearch({ from: ROUTE_PATHS.Auth.SignUpSsoPage.id });
|
||||||
const token = search.token as string;
|
const token = search.token as string;
|
||||||
|
|
||||||
const [step, setStep] = useState(0);
|
const [step, setStep] = useState(0);
|
||||||
|
|||||||
+1
-1
@@ -34,7 +34,7 @@ import {
|
|||||||
const Page = () => {
|
const Page = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const params = useParams({
|
const params = useParams({
|
||||||
from: ROUTE_PATHS.CertAuthDetailsByIDPage.id
|
from: ROUTE_PATHS.CertManager.CertAuthDetailsByIDPage.id
|
||||||
});
|
});
|
||||||
const caId = params.caId as string;
|
const caId = params.caId as string;
|
||||||
const { data } = useGetCaById(caId);
|
const { data } = useGetCaById(caId);
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@ import { PkiCollectionDetailsSection, PkiCollectionItemsSection } from "./compon
|
|||||||
export const PkiCollectionPage = () => {
|
export const PkiCollectionPage = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const params = useParams({
|
const params = useParams({
|
||||||
from: ROUTE_PATHS.CertPkiCollectionDetailsByIDPage.id
|
from: ROUTE_PATHS.CertManager.PkiCollectionDetailsByIDPage.id
|
||||||
});
|
});
|
||||||
const collectionId = params.collectionId as string;
|
const collectionId = params.collectionId as string;
|
||||||
const { currentWorkspace } = useWorkspace();
|
const { currentWorkspace } = useWorkspace();
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ export const AccessManagementPage = () => {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { permission } = useOrgPermission();
|
const { permission } = useOrgPermission();
|
||||||
const navigate = useNavigate({
|
const navigate = useNavigate({
|
||||||
from: ROUTE_PATHS.OrgAccessControlPage.full
|
from: ROUTE_PATHS.Organization.AccessControlPage.path
|
||||||
});
|
});
|
||||||
const selectedTab = useSearch({
|
const selectedTab = useSearch({
|
||||||
from: ROUTE_PATHS.OrgAccessControlPage.id,
|
from: ROUTE_PATHS.Organization.AccessControlPage.id,
|
||||||
select: (el) => el.selectedTab,
|
select: (el) => el.selectedTab,
|
||||||
structuralSharing: true
|
structuralSharing: true
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export enum TabSections {
|
|||||||
const Page = () => {
|
const Page = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const params = useParams({
|
const params = useParams({
|
||||||
from: ROUTE_PATHS.OrgGroupDetailsByIDPage.id
|
from: ROUTE_PATHS.Organization.GroupDetailsByIDPage.id
|
||||||
});
|
});
|
||||||
const groupId = params.groupId as string;
|
const groupId = params.groupId as string;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -46,7 +46,7 @@ import {
|
|||||||
const Page = () => {
|
const Page = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const params = useParams({
|
const params = useParams({
|
||||||
from: ROUTE_PATHS.OrgIdentityDetailsByIDPage.id
|
from: ROUTE_PATHS.Organization.IdentityDetailsByIDPage.id
|
||||||
});
|
});
|
||||||
const identityId = params.identityId as string;
|
const identityId = params.identityId as string;
|
||||||
const { currentOrg } = useOrganization();
|
const { currentOrg } = useOrganization();
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import { RoleDetailsSection, RoleModal, RolePermissionsSection } from "./compone
|
|||||||
export const Page = () => {
|
export const Page = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const params = useParams({
|
const params = useParams({
|
||||||
from: ROUTE_PATHS.OrgRoleByIDPage.id
|
from: ROUTE_PATHS.Organization.RoleByIDPage.id
|
||||||
});
|
});
|
||||||
const roleId = params.roleId as string;
|
const roleId = params.roleId as string;
|
||||||
const { currentOrg } = useOrganization();
|
const { currentOrg } = useOrganization();
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ const Page = withPermission(
|
|||||||
() => {
|
() => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const search = useParams({
|
const search = useParams({
|
||||||
from: ROUTE_PATHS.OrgUserDetailsByIDPage.id
|
from: ROUTE_PATHS.Organization.UserDetailsByIDPage.id
|
||||||
});
|
});
|
||||||
const membershipId = search.membershipId as string;
|
const membershipId = search.membershipId as string;
|
||||||
const { user } = useUser();
|
const { user } = useUser();
|
||||||
|
|||||||
@@ -28,11 +28,11 @@ const extractDetailsFromUrl = (urlEncodedKey: string) => {
|
|||||||
|
|
||||||
export const ViewSharedSecretByIDPage = () => {
|
export const ViewSharedSecretByIDPage = () => {
|
||||||
const id = useParams({
|
const id = useParams({
|
||||||
from: ROUTE_PATHS.ViewSharedSecretByIDPage.id,
|
from: ROUTE_PATHS.Public.ViewSharedSecretByIDPage.id,
|
||||||
select: (el) => el.secretId
|
select: (el) => el.secretId
|
||||||
});
|
});
|
||||||
const urlEncodedKey = useSearch({
|
const urlEncodedKey = useSearch({
|
||||||
from: ROUTE_PATHS.ViewSharedSecretByIDPage.id,
|
from: ROUTE_PATHS.Public.ViewSharedSecretByIDPage.id,
|
||||||
select: (el) => el.key
|
select: (el) => el.key
|
||||||
});
|
});
|
||||||
const [password, setPassword] = useState<string>();
|
const [password, setPassword] = useState<string>();
|
||||||
|
|||||||
@@ -111,10 +111,10 @@ export const OverviewPage = () => {
|
|||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const navigate = useNavigate({
|
const navigate = useNavigate({
|
||||||
from: ROUTE_PATHS.SecretOverviewPage.full
|
from: ROUTE_PATHS.SecretManager.OverviewPage.path
|
||||||
});
|
});
|
||||||
const routerSearch = useSearch({
|
const routerSearch = useSearch({
|
||||||
from: ROUTE_PATHS.SecretOverviewPage.id,
|
from: ROUTE_PATHS.SecretManager.OverviewPage.id,
|
||||||
select: (el) => ({
|
select: (el) => ({
|
||||||
secretPath: el.secretPath,
|
secretPath: el.secretPath,
|
||||||
search: el.search
|
search: el.search
|
||||||
|
|||||||
@@ -68,13 +68,13 @@ const Page = () => {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { currentWorkspace } = useWorkspace();
|
const { currentWorkspace } = useWorkspace();
|
||||||
const navigate = useNavigate({
|
const navigate = useNavigate({
|
||||||
from: ROUTE_PATHS.SecretDashboardPage.full
|
from: ROUTE_PATHS.SecretManager.SecretDashboardPage.path
|
||||||
});
|
});
|
||||||
const routerQueryParams = useSearch({
|
const routerQueryParams = useSearch({
|
||||||
from: ROUTE_PATHS.SecretDashboardPage.id
|
from: ROUTE_PATHS.SecretManager.SecretDashboardPage.id
|
||||||
});
|
});
|
||||||
const environment = useParams({
|
const environment = useParams({
|
||||||
from: ROUTE_PATHS.SecretDashboardPage.id,
|
from: ROUTE_PATHS.SecretManager.SecretDashboardPage.id,
|
||||||
select: (el) => el.envSlug
|
select: (el) => el.envSlug
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@ export const FolderListView = ({
|
|||||||
"updateFolder",
|
"updateFolder",
|
||||||
"deleteFolder"
|
"deleteFolder"
|
||||||
] as const);
|
] as const);
|
||||||
const navigate = useNavigate({ from: ROUTE_PATHS.SecretManager.SecretDashboardPage.full });
|
const navigate = useNavigate({ from: ROUTE_PATHS.SecretManager.SecretDashboardPage.path });
|
||||||
const secretPathQueryparam = useSearch({
|
const secretPathQueryparam = useSearch({
|
||||||
from: ROUTE_PATHS.SecretManager.SecretDashboardPage.id,
|
from: ROUTE_PATHS.SecretManager.SecretDashboardPage.id,
|
||||||
select: (el) => el.secretPath
|
select: (el) => el.secretPath
|
||||||
|
|||||||
Reference in New Issue
Block a user