18559: Link from users panel to user profile page.
[arvados-workbench2.git] / src / routes / routes.ts
index d9da023411eb77d9c6ee83770edd0c85dc944def..205ae08fdd3c21978dddb1cc8316d3512d9e0ad8 100644 (file)
@@ -39,8 +39,8 @@ export const Routes = {
     MY_ACCOUNT: '/my-account',
     LINK_ACCOUNT: '/link_account',
     KEEP_SERVICES: `/keep-services`,
-    COMPUTE_NODES: `/nodes`,
     USERS: '/users',
+    USER_PROFILE: `/user/:id(${RESOURCE_UUID_PATTERN})`,
     API_CLIENT_AUTHORIZATIONS: `/api_client_authorizations`,
     GROUPS: '/groups',
     GROUP_DETAILS: `/group/:id(${RESOURCE_UUID_PATTERN})`,
@@ -69,7 +69,7 @@ export const getResourceUrl = (uuid: string) => {
 
 export const getNavUrl = (uuid: string, config: FederationConfig) => {
     const path = getResourceUrl(uuid) || "";
-    const cls = uuid.substr(0, 5);
+    const cls = uuid.substring(0, 5);
     if (cls === config.localCluster || extractUuidKind(uuid) === ResourceKind.USER || COLLECTION_PDH_REGEX.exec(uuid)) {
         return path;
     } else if (config.remoteHostsConfig[cls]) {
@@ -100,6 +100,8 @@ export const getProcessLogUrl = (uuid: string) => `/process-logs/${uuid}`;
 
 export const getGroupUrl = (uuid: string) => `/group/${uuid}`;
 
+export const getUserProfileUrl = (uuid: string) => `/user/${uuid}`;
+
 export interface ResourceRouteParams {
     id: string;
 }
@@ -176,8 +178,8 @@ export const matchFedTokenRoute = (route: string) =>
 export const matchUsersRoute = (route: string) =>
     matchPath(route, { path: Routes.USERS });
 
-export const matchComputeNodesRoute = (route: string) =>
-    matchPath(route, { path: Routes.COMPUTE_NODES });
+export const matchUserProfileRoute = (route: string) =>
+    matchPath<ResourceRouteParams>(route, { path: Routes.USER_PROFILE });
 
 export const matchApiClientAuthorizationsRoute = (route: string) =>
     matchPath(route, { path: Routes.API_CLIENT_AUTHORIZATIONS });