diff --git a/amber/src/main/scala/org/apache/texera/web/service/WorkflowEmailNotifier.scala b/amber/src/main/scala/org/apache/texera/web/service/WorkflowEmailNotifier.scala
index af9a26286d4..c49f63e9394 100644
--- a/amber/src/main/scala/org/apache/texera/web/service/WorkflowEmailNotifier.scala
+++ b/amber/src/main/scala/org/apache/texera/web/service/WorkflowEmailNotifier.scala
@@ -107,7 +107,7 @@ class WorkflowEmailNotifier(
private def createDashboardUrl(): String = {
val host = sessionUri.getHost
val port = sessionUri.getPort
- val path = s"/dashboard/user/workspace/$workflowId"
+ val path = s"/user/workspace/$workflowId"
if (port == -1 || port == 80 || port == 443) {
s"http://$host$path"
} else {
diff --git a/frontend/src/app/app-routing.constant.ts b/frontend/src/app/app-routing.constant.ts
index 4181df8a954..6e06f725201 100644
--- a/frontend/src/app/app-routing.constant.ts
+++ b/frontend/src/app/app-routing.constant.ts
@@ -17,32 +17,31 @@
* under the License.
*/
-export const DASHBOARD = "/dashboard";
-export const DASHBOARD_HOME = `${DASHBOARD}/home`;
-export const DASHBOARD_ABOUT = `${DASHBOARD}/about`;
+export const HOME = "/home";
+export const ABOUT = "/about";
-export const DASHBOARD_HUB = `${DASHBOARD}/hub`;
-export const DASHBOARD_HUB_WORKFLOW = `${DASHBOARD_HUB}/workflow`;
-export const DASHBOARD_HUB_WORKFLOW_RESULT = `${DASHBOARD_HUB_WORKFLOW}/result`;
-export const DASHBOARD_HUB_WORKFLOW_RESULT_DETAIL = `${DASHBOARD_HUB_WORKFLOW_RESULT}/detail`;
-export const DASHBOARD_HUB_DATASET = `${DASHBOARD_HUB}/dataset`;
-export const DASHBOARD_HUB_DATASET_RESULT = `${DASHBOARD_HUB_DATASET}/result`;
-export const DASHBOARD_HUB_DATASET_RESULT_DETAIL = `${DASHBOARD_HUB_DATASET_RESULT}/detail`;
+export const HUB = "/hub";
+export const HUB_WORKFLOW = `${HUB}/workflow`;
+export const HUB_WORKFLOW_RESULT = `${HUB_WORKFLOW}/result`;
+export const HUB_WORKFLOW_RESULT_DETAIL = `${HUB_WORKFLOW_RESULT}/detail`;
+export const HUB_DATASET = `${HUB}/dataset`;
+export const HUB_DATASET_RESULT = `${HUB_DATASET}/result`;
+export const HUB_DATASET_RESULT_DETAIL = `${HUB_DATASET_RESULT}/detail`;
-export const DASHBOARD_USER = `${DASHBOARD}/user`;
-export const DASHBOARD_USER_PROJECT = `${DASHBOARD_USER}/project`;
-export const DASHBOARD_USER_WORKSPACE = `${DASHBOARD_USER}/workflow`;
-export const DASHBOARD_USER_WORKFLOW = `${DASHBOARD_USER}/workflow`;
-export const DASHBOARD_USER_DATASET = `${DASHBOARD_USER}/dataset`;
-export const DASHBOARD_USER_DATASET_CREATE = `${DASHBOARD_USER_DATASET}/create`;
-export const DASHBOARD_USER_COMPUTING_UNIT = `${DASHBOARD_USER}/compute`;
-export const DASHBOARD_USER_QUOTA = `${DASHBOARD_USER}/quota`;
-export const DASHBOARD_USER_DISCUSSION = `${DASHBOARD_USER}/discussion`;
+export const USER = "/user";
+export const USER_PROJECT = `${USER}/project`;
+export const USER_WORKSPACE = `${USER}/workflow`;
+export const USER_WORKFLOW = `${USER}/workflow`;
+export const USER_DATASET = `${USER}/dataset`;
+export const USER_DATASET_CREATE = `${USER_DATASET}/create`;
+export const USER_COMPUTING_UNIT = `${USER}/compute`;
+export const USER_QUOTA = `${USER}/quota`;
+export const USER_DISCUSSION = `${USER}/discussion`;
-export const DASHBOARD_ADMIN = `${DASHBOARD}/admin`;
-export const DASHBOARD_ADMIN_USER = `${DASHBOARD_ADMIN}/user`;
-export const DASHBOARD_ADMIN_GMAIL = `${DASHBOARD_ADMIN}/gmail`;
-export const DASHBOARD_ADMIN_EXECUTION = `${DASHBOARD_ADMIN}/execution`;
-export const DASHBOARD_ADMIN_SETTINGS = `${DASHBOARD_ADMIN}/settings`;
+export const ADMIN = "/admin";
+export const ADMIN_USER = `${ADMIN}/user`;
+export const ADMIN_GMAIL = `${ADMIN}/gmail`;
+export const ADMIN_EXECUTION = `${ADMIN}/execution`;
+export const ADMIN_SETTINGS = `${ADMIN}/settings`;
-export const DASHBOARD_SEARCH = `${DASHBOARD}/search`;
+export const SEARCH = "/search";
diff --git a/frontend/src/app/app-routing.module.ts b/frontend/src/app/app-routing.module.ts
index 179caf5c088..3a3e7dcdf8a 100644
--- a/frontend/src/app/app-routing.module.ts
+++ b/frontend/src/app/app-routing.module.ts
@@ -17,8 +17,8 @@
* under the License.
*/
-import { inject, NgModule } from "@angular/core";
-import { CanActivateFn, Router, RouterModule, Routes } from "@angular/router";
+import { NgModule } from "@angular/core";
+import { RouterModule, Routes } from "@angular/router";
import { DashboardComponent } from "./dashboard/component/dashboard.component";
import { UserWorkflowComponent } from "./dashboard/component/user/user-workflow/user-workflow.component";
import { UserQuotaComponent } from "./dashboard/component/user/user-quota/user-quota.component";
@@ -38,28 +38,21 @@ import { DatasetDetailComponent } from "./dashboard/component/user/user-dataset/
import { UserDatasetComponent } from "./dashboard/component/user/user-dataset/user-dataset.component";
import { HubWorkflowDetailComponent } from "./hub/component/workflow/detail/hub-workflow-detail.component";
import { LandingPageComponent } from "./hub/component/landing-page/landing-page.component";
-import { DASHBOARD_ABOUT, DASHBOARD_USER_WORKFLOW } from "./app-routing.constant";
+import { USER_WORKFLOW } from "./app-routing.constant";
import { HubSearchResultComponent } from "./hub/component/hub-search-result/hub-search-result.component";
import { AdminSettingsComponent } from "./dashboard/component/admin/settings/admin-settings.component";
-import { GuiConfigService } from "./common/service/gui-config.service";
-
-const rootRedirectGuard: CanActivateFn = () => {
- const config = inject(GuiConfigService);
- const router = inject(Router);
- try {
- return router.parseUrl(DASHBOARD_ABOUT);
- } catch {
- // config not loaded yet, swallow the error and let the app handle it
- }
- return true;
-};
const routes: Routes = [];
routes.push({
- path: "dashboard",
+ path: "",
component: DashboardComponent,
children: [
+ {
+ path: "",
+ redirectTo: "about",
+ pathMatch: "full",
+ },
{
path: "home",
component: LandingPageComponent,
@@ -185,7 +178,7 @@ routes.push({
// redirect all other paths to index.
routes.push({
path: "**",
- redirectTo: DASHBOARD_USER_WORKFLOW,
+ redirectTo: USER_WORKFLOW,
});
@NgModule({
diff --git a/frontend/src/app/common/service/user/auth-guard.service.ts b/frontend/src/app/common/service/user/auth-guard.service.ts
index 3e6e3158711..1a69ad0289f 100644
--- a/frontend/src/app/common/service/user/auth-guard.service.ts
+++ b/frontend/src/app/common/service/user/auth-guard.service.ts
@@ -21,7 +21,7 @@ import { Injectable } from "@angular/core";
import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from "@angular/router";
import { GuiConfigService } from "../gui-config.service";
import { UserService } from "./user.service";
-import { DASHBOARD_ABOUT } from "../../../app-routing.constant";
+import { ABOUT } from "../../../app-routing.constant";
/**
* AuthGuardService is a service can tell the router whether
@@ -38,7 +38,7 @@ export class AuthGuardService implements CanActivate {
if (this.userService.isLogin()) {
return true;
} else {
- this.router.navigate([DASHBOARD_ABOUT], { queryParams: { returnUrl: state.url === "/" ? null : state.url } });
+ this.router.navigate([ABOUT], { queryParams: { returnUrl: state.url === "/" ? null : state.url } });
return false;
}
}
diff --git a/frontend/src/app/dashboard/component/admin/execution/admin-execution.component.html b/frontend/src/app/dashboard/component/admin/execution/admin-execution.component.html
index 41a2ceb9656..907ffa8d727 100644
--- a/frontend/src/app/dashboard/component/admin/execution/admin-execution.component.html
+++ b/frontend/src/app/dashboard/component/admin/execution/admin-execution.component.html
@@ -100,7 +100,7 @@
|
diff --git a/frontend/src/app/dashboard/component/admin/execution/admin-execution.component.spec.ts b/frontend/src/app/dashboard/component/admin/execution/admin-execution.component.spec.ts
index 466d0a3db00..caaa71a2207 100644
--- a/frontend/src/app/dashboard/component/admin/execution/admin-execution.component.spec.ts
+++ b/frontend/src/app/dashboard/component/admin/execution/admin-execution.component.spec.ts
@@ -18,12 +18,14 @@
*/
import { ComponentFixture, inject, TestBed } from "@angular/core/testing";
+import { By } from "@angular/platform-browser";
import { AdminExecutionComponent } from "./admin-execution.component";
import { AdminExecutionService } from "../../../service/admin/execution/admin-execution.service";
import { HttpClientTestingModule, HttpTestingController } from "@angular/common/http/testing";
import { NzDropDownModule } from "ng-zorro-antd/dropdown";
import { NzModalModule } from "ng-zorro-antd/modal";
import { commonTestProviders } from "../../../../common/testing/test-utils";
+import { Execution } from "../../../../common/type/execution";
describe("AdminDashboardComponent", () => {
let component: AdminExecutionComponent;
@@ -45,4 +47,23 @@ describe("AdminDashboardComponent", () => {
it("should create", inject([HttpTestingController], () => {
expect(component).toBeTruthy();
}));
+
+ it("renders the workflow link to /user/workflow/ when the admin has access", () => {
+ component.listOfExecutions = [
+ {
+ access: true,
+ workflowId: 42,
+ workflowName: "demo workflow",
+ executionId: 1,
+ executionName: "exec",
+ userName: "alice",
+ executionStatus: "COMPLETED",
+ } as unknown as Execution,
+ ];
+ component.isLoading = false;
+ fixture.detectChanges();
+
+ const anchor = fixture.debugElement.query(By.css('a[href="/user/workflow/42"]'));
+ expect(anchor).toBeTruthy();
+ });
});
diff --git a/frontend/src/app/dashboard/component/dashboard.component.html b/frontend/src/app/dashboard/component/dashboard.component.html
index 9edea629159..ba3f74fa3a1 100644
--- a/frontend/src/app/dashboard/component/dashboard.component.html
+++ b/frontend/src/app/dashboard/component/dashboard.component.html
@@ -65,7 +65,7 @@
nz-tooltip="Look up the user projects"
nzMatchRouter="true"
nzTooltipPlacement="right"
- [routerLink]="DASHBOARD_USER_PROJECT">
+ [routerLink]="USER_PROJECT">
@@ -78,7 +78,7 @@
nz-tooltip="Open the saved workflows"
nzMatchRouter="true"
nzTooltipPlacement="right"
- [routerLink]="DASHBOARD_USER_WORKFLOW">
+ [routerLink]="USER_WORKFLOW">
@@ -91,7 +91,7 @@
nz-tooltip="Look up for datasets"
nzMatchRouter="true"
nzTooltipPlacement="right"
- [routerLink]="DASHBOARD_USER_DATASET">
+ [routerLink]="USER_DATASET">
@@ -103,7 +103,7 @@
nz-tooltip="Manage computing units"
nzMatchRouter="true"
nzTooltipPlacement="right"
- [routerLink]="DASHBOARD_USER_COMPUTING_UNIT">
+ [routerLink]="USER_COMPUTING_UNIT">
@@ -115,7 +115,7 @@
nz-tooltip="Quota information"
nzMatchRouter="true"
nzTooltipPlacement="right"
- [routerLink]="DASHBOARD_USER_QUOTA">
+ [routerLink]="USER_QUOTA">
@@ -127,7 +127,7 @@
nz-tooltip="Open the discussion forum"
nzMatchRouter="true"
nzTooltipPlacement="right"
- [routerLink]="DASHBOARD_USER_DISCUSSION">
+ [routerLink]="USER_DISCUSSION">
@@ -147,7 +147,7 @@
nz-tooltip="Look up the users"
nzMatchRouter="true"
nzTooltipPlacement="right"
- [routerLink]="DASHBOARD_ADMIN_USER">
+ [routerLink]="ADMIN_USER">
@@ -158,7 +158,7 @@
nz-tooltip="View statistics"
nzMatchRouter="true"
nzTooltipPlacement="right"
- [routerLink]="DASHBOARD_ADMIN_EXECUTION">
+ [routerLink]="ADMIN_EXECUTION">
@@ -169,7 +169,7 @@
nz-tooltip="Setup gmail"
nzMatchRouter="true"
nzTooltipPlacement="right"
- [routerLink]="DASHBOARD_ADMIN_GMAIL">
+ [routerLink]="ADMIN_GMAIL">
@@ -180,7 +180,7 @@
nz-tooltip="Settings"
nzMatchRouter="true"
nzTooltipPlacement="right"
- [routerLink]="DASHBOARD_ADMIN_SETTINGS">
+ [routerLink]="ADMIN_SETTINGS">
@@ -194,7 +194,7 @@
nz-menu-item
nz-tooltip
nzTooltipPlacement="right"
- [routerLink]="DASHBOARD_ABOUT">
+ [routerLink]="ABOUT">
diff --git a/frontend/src/app/dashboard/component/dashboard.component.spec.ts b/frontend/src/app/dashboard/component/dashboard.component.spec.ts
index 6f508ca136a..29ed8426fe2 100644
--- a/frontend/src/app/dashboard/component/dashboard.component.spec.ts
+++ b/frontend/src/app/dashboard/component/dashboard.component.spec.ts
@@ -35,12 +35,26 @@ import {
NavigationEnd,
Params,
Router,
+ RouterLink,
UrlSegment,
} from "@angular/router";
import type { Mock } from "vitest";
import { HttpClientTestingModule } from "@angular/common/http/testing";
import { commonTestProviders } from "../../common/testing/test-utils";
import { GuiConfigService } from "../../common/service/gui-config.service";
+import {
+ ABOUT,
+ ADMIN_EXECUTION,
+ ADMIN_GMAIL,
+ ADMIN_SETTINGS,
+ ADMIN_USER,
+ USER_COMPUTING_UNIT,
+ USER_DATASET,
+ USER_DISCUSSION,
+ USER_PROJECT,
+ USER_QUOTA,
+ USER_WORKFLOW,
+} from "../../app-routing.constant";
describe("DashboardComponent", () => {
let component: DashboardComponent;
@@ -77,11 +91,12 @@ describe("DashboardComponent", () => {
isAdmin: vi.fn().mockReturnValue(false),
isLogin: vi.fn().mockReturnValue(false),
userChanged: vi.fn().mockReturnValue(of(null)),
+ getCurrentUser: vi.fn().mockReturnValue(undefined),
};
routerMock = {
- events: of(new NavigationEnd(1, "/dashboard", "/dashboard")),
- url: "/dashboard",
+ events: of(new NavigationEnd(1, "/", "/")),
+ url: "/",
navigateByUrl: vi.fn(),
};
@@ -162,4 +177,48 @@ describe("DashboardComponent", () => {
expect(fixture.debugElement.query(By.css("#powered-by"))).toBeTruthy();
});
+
+ it("should hide the navbar on workflow workspace routes", () => {
+ expect(component.isNavbarEnabled("/user/workflow/42")).toBe(false);
+ expect(component.isNavbarEnabled("/user/workflow")).toBe(true);
+ expect(component.isNavbarEnabled("/user/project")).toBe(true);
+ });
+
+ it("exposes route constants without the legacy /dashboard prefix", () => {
+ expect(USER_PROJECT).toBe("/user/project");
+ expect(USER_WORKFLOW).toBe("/user/workflow");
+ expect(USER_DATASET).toBe("/user/dataset");
+ expect(USER_COMPUTING_UNIT).toBe("/user/compute");
+ expect(USER_QUOTA).toBe("/user/quota");
+ expect(USER_DISCUSSION).toBe("/user/discussion");
+ expect(ADMIN_USER).toBe("/admin/user");
+ expect(ADMIN_EXECUTION).toBe("/admin/execution");
+ expect(ADMIN_GMAIL).toBe("/admin/gmail");
+ expect(ADMIN_SETTINGS).toBe("/admin/settings");
+ expect(ABOUT).toBe("/about");
+ });
+
+ it("renders every sidebar tab's routerLink when fully enabled", () => {
+ (userServiceMock.isLogin as Mock).mockReturnValue(true);
+ component.isLogin = true;
+ component.isAdmin = true;
+ component.sidebarTabs = {
+ hub_enabled: false,
+ home_enabled: true,
+ workflow_enabled: true,
+ dataset_enabled: true,
+ your_work_enabled: true,
+ projects_enabled: true,
+ workflows_enabled: true,
+ datasets_enabled: true,
+ compute_enabled: true,
+ quota_enabled: true,
+ forum_enabled: true,
+ about_enabled: true,
+ };
+ fixture.detectChanges();
+
+ // 6 "Your Work" links + 4 admin links + 1 about link = 11
+ expect(fixture.debugElement.queryAll(By.directive(RouterLink)).length).toBe(11);
+ });
});
diff --git a/frontend/src/app/dashboard/component/dashboard.component.ts b/frontend/src/app/dashboard/component/dashboard.component.ts
index 57e6e8e284e..7cc12af36e9 100644
--- a/frontend/src/app/dashboard/component/dashboard.component.ts
+++ b/frontend/src/app/dashboard/component/dashboard.component.ts
@@ -29,17 +29,17 @@ import { AdminSettingsService } from "../service/admin/settings/admin-settings.s
import { GuiConfigService } from "../../common/service/gui-config.service";
import {
- DASHBOARD_ABOUT,
- DASHBOARD_ADMIN_EXECUTION,
- DASHBOARD_ADMIN_GMAIL,
- DASHBOARD_ADMIN_SETTINGS,
- DASHBOARD_ADMIN_USER,
- DASHBOARD_USER_COMPUTING_UNIT,
- DASHBOARD_USER_DATASET,
- DASHBOARD_USER_DISCUSSION,
- DASHBOARD_USER_PROJECT,
- DASHBOARD_USER_QUOTA,
- DASHBOARD_USER_WORKFLOW,
+ ABOUT,
+ ADMIN_EXECUTION,
+ ADMIN_GMAIL,
+ ADMIN_SETTINGS,
+ ADMIN_USER,
+ USER_COMPUTING_UNIT,
+ USER_DATASET,
+ USER_DISCUSSION,
+ USER_PROJECT,
+ USER_QUOTA,
+ USER_WORKFLOW,
} from "../../app-routing.constant";
import { Version } from "../../../environments/version";
import { SidebarTabs } from "../../common/type/gui-config";
@@ -105,16 +105,18 @@ export class DashboardComponent implements OnInit {
about_enabled: false,
};
- protected readonly DASHBOARD_USER_PROJECT = DASHBOARD_USER_PROJECT;
- protected readonly DASHBOARD_USER_WORKFLOW = DASHBOARD_USER_WORKFLOW;
- protected readonly DASHBOARD_USER_DATASET = DASHBOARD_USER_DATASET;
- protected readonly DASHBOARD_USER_COMPUTING_UNIT = DASHBOARD_USER_COMPUTING_UNIT;
- protected readonly DASHBOARD_USER_QUOTA = DASHBOARD_USER_QUOTA;
- protected readonly DASHBOARD_USER_DISCUSSION = DASHBOARD_USER_DISCUSSION;
- protected readonly DASHBOARD_ADMIN_USER = DASHBOARD_ADMIN_USER;
- protected readonly DASHBOARD_ADMIN_GMAIL = DASHBOARD_ADMIN_GMAIL;
- protected readonly DASHBOARD_ADMIN_EXECUTION = DASHBOARD_ADMIN_EXECUTION;
- protected readonly DASHBOARD_ADMIN_SETTINGS = DASHBOARD_ADMIN_SETTINGS;
+ protected readonly USER_PROJECT = USER_PROJECT;
+ protected readonly USER_WORKFLOW = USER_WORKFLOW;
+ protected readonly USER_DATASET = USER_DATASET;
+ protected readonly USER_COMPUTING_UNIT = USER_COMPUTING_UNIT;
+ protected readonly USER_QUOTA = USER_QUOTA;
+ protected readonly USER_DISCUSSION = USER_DISCUSSION;
+ protected readonly ADMIN_USER = ADMIN_USER;
+ protected readonly ADMIN_GMAIL = ADMIN_GMAIL;
+ protected readonly ADMIN_EXECUTION = ADMIN_EXECUTION;
+ protected readonly ADMIN_SETTINGS = ADMIN_SETTINGS;
+ protected readonly ABOUT = ABOUT;
+ protected readonly String = String;
constructor(
private userService: UserService,
@@ -158,7 +160,7 @@ export class DashboardComponent implements OnInit {
.pipe(untilDestroyed(this))
.subscribe(() => {
this.ngZone.run(() => {
- this.router.navigateByUrl(this.route.snapshot.queryParams["returnUrl"] || DASHBOARD_USER_WORKFLOW);
+ this.router.navigateByUrl(this.route.snapshot.queryParams["returnUrl"] || USER_WORKFLOW);
});
});
});
@@ -232,7 +234,7 @@ export class DashboardComponent implements OnInit {
isNavbarEnabled(currentRoute: string) {
// Hide navbar for workflow workspace pages (with numeric ID)
- if (currentRoute.match(/\/dashboard\/user\/workflow\/\d+/)) {
+ if (currentRoute.match(/\/user\/workflow\/\d+/)) {
return false;
}
return true;
@@ -249,6 +251,4 @@ export class DashboardComponent implements OnInit {
}
}
- protected readonly DASHBOARD_ABOUT = DASHBOARD_ABOUT;
- protected readonly String = String;
}
diff --git a/frontend/src/app/dashboard/component/user/list-item/list-item.component.spec.ts b/frontend/src/app/dashboard/component/user/list-item/list-item.component.spec.ts
index debcc5b99eb..93401267cb7 100644
--- a/frontend/src/app/dashboard/component/user/list-item/list-item.component.spec.ts
+++ b/frontend/src/app/dashboard/component/user/list-item/list-item.component.spec.ts
@@ -31,6 +31,14 @@ import { UserService } from "../../../../common/service/user/user.service";
import { commonTestProviders } from "../../../../common/testing/test-utils";
import type { Mocked } from "vitest";
import { DashboardEntry } from "src/app/dashboard/type/dashboard-entry";
+import {
+ HUB_DATASET_RESULT_DETAIL,
+ HUB_WORKFLOW_RESULT_DETAIL,
+ USER_DATASET,
+ USER_PROJECT,
+ USER_WORKSPACE,
+} from "../../../../app-routing.constant";
+
describe("ListItemComponent", () => {
let component: ListItemComponent;
let fixture: ComponentFixture;
@@ -104,4 +112,66 @@ describe("ListItemComponent", () => {
expect(component.entry.description).toBe("Old Description");
expect(component.editingDescription).toBe(false);
});
+
+ describe("initializeEntry routes", () => {
+ const baseStats = { likeCount: 0, viewCount: 0, isLiked: false };
+
+ it("routes owned workflows to the user workspace", () => {
+ component.currentUid = 1;
+ component.entry = {
+ id: 100,
+ type: "workflow",
+ workflow: { isOwner: true },
+ accessibleUserIds: [1],
+ ...baseStats,
+ } as unknown as DashboardEntry;
+ component.initializeEntry();
+ expect(component.entryLink).toEqual([USER_WORKSPACE, "100"]);
+ });
+
+ it("routes non-owned workflows to the hub workflow detail page", () => {
+ component.currentUid = 1;
+ component.entry = {
+ id: 101,
+ type: "workflow",
+ workflow: { isOwner: false },
+ accessibleUserIds: [2],
+ ...baseStats,
+ } as unknown as DashboardEntry;
+ component.initializeEntry();
+ expect(component.entryLink).toEqual([HUB_WORKFLOW_RESULT_DETAIL, "101"]);
+ });
+
+ it("routes projects to the user project page", () => {
+ component.entry = { id: 200, type: "project", ...baseStats } as unknown as DashboardEntry;
+ component.initializeEntry();
+ expect(component.entryLink).toEqual([USER_PROJECT, "200"]);
+ });
+
+ it("routes owned datasets to the user dataset page", () => {
+ component.currentUid = 1;
+ component.entry = {
+ id: 300,
+ type: "dataset",
+ dataset: { isOwner: true },
+ accessibleUserIds: [1],
+ ...baseStats,
+ } as unknown as DashboardEntry;
+ component.initializeEntry();
+ expect(component.entryLink).toEqual([USER_DATASET, "300"]);
+ });
+
+ it("routes non-owned datasets to the hub dataset detail page", () => {
+ component.currentUid = 1;
+ component.entry = {
+ id: 301,
+ type: "dataset",
+ dataset: { isOwner: false },
+ accessibleUserIds: [2],
+ ...baseStats,
+ } as unknown as DashboardEntry;
+ component.initializeEntry();
+ expect(component.entryLink).toEqual([HUB_DATASET_RESULT_DETAIL, "301"]);
+ });
+ });
});
diff --git a/frontend/src/app/dashboard/component/user/list-item/list-item.component.ts b/frontend/src/app/dashboard/component/user/list-item/list-item.component.ts
index 4cb8af764c7..c635a62108f 100644
--- a/frontend/src/app/dashboard/component/user/list-item/list-item.component.ts
+++ b/frontend/src/app/dashboard/component/user/list-item/list-item.component.ts
@@ -45,11 +45,11 @@ import { formatSize } from "src/app/common/util/size-formatter.util";
import { DatasetService, DEFAULT_DATASET_NAME } from "../../../service/user/dataset/dataset.service";
import { NotificationService } from "../../../../common/service/notification/notification.service";
import {
- DASHBOARD_HUB_DATASET_RESULT_DETAIL,
- DASHBOARD_HUB_WORKFLOW_RESULT_DETAIL,
- DASHBOARD_USER_DATASET,
- DASHBOARD_USER_PROJECT,
- DASHBOARD_USER_WORKSPACE,
+ HUB_DATASET_RESULT_DETAIL,
+ HUB_WORKFLOW_RESULT_DETAIL,
+ USER_DATASET,
+ USER_PROJECT,
+ USER_WORKSPACE,
} from "../../../../app-routing.constant";
import { isDefined } from "../../../../common/util/predicate";
import { NzCardComponent } from "ng-zorro-antd/card";
@@ -144,24 +144,24 @@ export class ListItemComponent implements OnChanges {
this.disableDelete = !this.entry.workflow.isOwner;
this.owners = this.entry.accessibleUserIds;
if (this.currentUid !== undefined && this.owners.includes(this.currentUid)) {
- this.entryLink = [DASHBOARD_USER_WORKSPACE, String(this.entry.id)];
+ this.entryLink = [USER_WORKSPACE, String(this.entry.id)];
} else {
- this.entryLink = [DASHBOARD_HUB_WORKFLOW_RESULT_DETAIL, String(this.entry.id)];
+ this.entryLink = [HUB_WORKFLOW_RESULT_DETAIL, String(this.entry.id)];
}
this.size = this.entry.size;
}
this.iconType = "project";
} else if (this.entry.type === "project") {
- this.entryLink = [DASHBOARD_USER_PROJECT, String(this.entry.id)];
+ this.entryLink = [USER_PROJECT, String(this.entry.id)];
this.iconType = "container";
} else if (this.entry.type === "dataset") {
if (typeof this.entry.id === "number") {
this.disableDelete = !this.entry.dataset.isOwner;
this.owners = this.entry.accessibleUserIds;
if (this.currentUid !== undefined && this.owners.includes(this.currentUid)) {
- this.entryLink = [DASHBOARD_USER_DATASET, String(this.entry.id)];
+ this.entryLink = [USER_DATASET, String(this.entry.id)];
} else {
- this.entryLink = [DASHBOARD_HUB_DATASET_RESULT_DETAIL, String(this.entry.id)];
+ this.entryLink = [HUB_DATASET_RESULT_DETAIL, String(this.entry.id)];
}
this.iconType = "database";
this.size = this.entry.size;
diff --git a/frontend/src/app/dashboard/component/user/search-bar/search-bar.component.ts b/frontend/src/app/dashboard/component/user/search-bar/search-bar.component.ts
index ae6a6c1df59..638a2f7e7b1 100644
--- a/frontend/src/app/dashboard/component/user/search-bar/search-bar.component.ts
+++ b/frontend/src/app/dashboard/component/user/search-bar/search-bar.component.ts
@@ -28,7 +28,7 @@ import { DashboardEntry } from "../../../type/dashboard-entry";
import { Observable, of, Subject } from "rxjs";
import { debounceTime, switchMap } from "rxjs/operators";
import { UserService } from "../../../../common/service/user/user.service";
-import { DASHBOARD_SEARCH } from "../../../../app-routing.constant";
+import { SEARCH } from "../../../../app-routing.constant";
import { ɵNzTransitionPatchDirective } from "ng-zorro-antd/core/transition-patch";
import { NzSpaceCompactItemDirective } from "ng-zorro-antd/space";
import { NzInputGroupComponent, NzInputDirective } from "ng-zorro-antd/input";
@@ -137,7 +137,7 @@ export class SearchBarComponent {
}
performSearch(keyword: string) {
- this.router.navigate([DASHBOARD_SEARCH], { queryParams: { q: keyword } });
+ this.router.navigate([SEARCH], { queryParams: { q: keyword } });
}
convertToName(resultItem: SearchResultItem): string {
diff --git a/frontend/src/app/dashboard/component/user/share-access/share-access.component.ts b/frontend/src/app/dashboard/component/user/share-access/share-access.component.ts
index b6b51b9709a..d6a6388a871 100644
--- a/frontend/src/app/dashboard/component/user/share-access/share-access.component.ts
+++ b/frontend/src/app/dashboard/component/user/share-access/share-access.component.ts
@@ -28,9 +28,9 @@ import { NZ_MODAL_DATA, NzModalRef, NzModalService } from "ng-zorro-antd/modal";
import { NotificationService } from "../../../../common/service/notification/notification.service";
import { HttpErrorResponse } from "@angular/common/http";
import {
- DASHBOARD_USER_DATASET,
- DASHBOARD_USER_PROJECT,
- DASHBOARD_USER_WORKFLOW,
+ USER_DATASET,
+ USER_PROJECT,
+ USER_WORKFLOW,
} from "../../../../app-routing.constant";
import { NzMessageService } from "ng-zorro-antd/message";
import { DatasetService } from "../../../service/user/dataset/dataset.service";
@@ -196,9 +196,9 @@ export class ShareAccessComponent implements OnInit, OnDestroy {
let message = `${this.userService.getCurrentUser()?.email} shared a ${this.type} with you`;
if (this.type !== "computing-unit") {
let routePath = "";
- if (this.type === "workflow") routePath = DASHBOARD_USER_WORKFLOW;
- if (this.type === "dataset") routePath = DASHBOARD_USER_DATASET;
- if (this.type === "project") routePath = DASHBOARD_USER_PROJECT;
+ if (this.type === "workflow") routePath = USER_WORKFLOW;
+ if (this.type === "dataset") routePath = USER_DATASET;
+ if (this.type === "project") routePath = USER_PROJECT;
message += `, access the ${this.type} at ${location.origin}${routePath}/${this.id}`;
}
this.accessService
diff --git a/frontend/src/app/dashboard/component/user/user-dataset/user-dataset-list-item/user-dataset-list-item.component.html b/frontend/src/app/dashboard/component/user/user-dataset/user-dataset-list-item/user-dataset-list-item.component.html
index 6fa0d48a789..1383680f8fb 100644
--- a/frontend/src/app/dashboard/component/user/user-dataset/user-dataset-list-item/user-dataset-list-item.component.html
+++ b/frontend/src/app/dashboard/component/user/user-dataset/user-dataset-list-item/user-dataset-list-item.component.html
@@ -33,7 +33,7 @@
|