Skip to content

Commit 407a91f

Browse files
gracecluvohiochenlicakunwp1bobbai00
authored
refactor(frontend): move shared computing unit types and services to frontend/src/app/common (#4358)
<!-- Thanks for sending a pull request (PR)! Here are some tips for you: 1. If this is your first time, please read our contributor guidelines: [Contributing to Texera](https://github.com/apache/texera/blob/main/CONTRIBUTING.md) 2. Ensure you have added or run the appropriate tests for your PR 3. If the PR is work in progress, mark it a draft on GitHub. 4. Please write your PR title to summarize what this PR proposes, we are following Conventional Commits style for PR titles as well. 5. Be sure to keep the PR description updated to reflect all changes. --> ### What changes were proposed in this PR? <!-- Please clarify what changes you are proposing. The purpose of this section is to outline the changes. Here are some tips for you: 1. If you propose a new API, clarify the use case for a new API. 2. If you fix a bug, you can clarify why it is a bug. 3. If it is a refactoring, clarify what has been changed. 3. It would be helpful to include a before-and-after comparison using screenshots or GIFs. 4. Please consider writing useful notes for better and faster reviews. --> (For readability, `...` refers to `frontend/src/app` in the codebase.) This PR moves shared computing unit types and services to `.../common` under `frontend/src/app`. Specifically: | Original location | New location | | ---------------- | ------------- | | `.../dashboard/service/user/computing-unit-actions` | `.../common/service/computing-unit/computing-unit-actions` | | `.../workspace/service/workflow-computing-unit` | `.../common/service/computing-unit/computing-unit-managing` | | `.../workspace/service/computing-unit-status` | `.../common/service/computing-unit/computing-unit-status` | | `.../workspace/types/computing-unit-connection.interface.ts` | `.../common/type/computing-unit-connection.interface.ts` | | `.../workspace/types/workflow-computing-unit.ts` | `.../common/type/workflow-computing-unit.ts` | ### Any related issues, documentation, discussions? <!-- Please use this section to link other resources if not mentioned already. 1. If this PR fixes an issue, please include `Fixes #1234`, `Resolves #1234` or `Closes #1234`. If it is only related, simply mention the issue number. 2. If there is design documentation, please add the link. 3. If there is a discussion in the mailing list, please add the link. --> Closes #4362 ### How was this PR tested? <!-- If tests were added, say they were added here. Or simply mention that if the PR is tested with existing test cases. Make sure to include/update test cases that check the changes thoroughly including negative and positive cases if possible. If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future. If tests were not added, please describe why they were not added and/or why it was difficult to add. --> Locally tested ### Was this PR authored or co-authored using generative AI tooling? <!-- If generative AI tooling has been used in the process of authoring this PR, please include the phrase: 'Generated-by: ' followed by the name of the tool and its version. If no, write 'No'. Please refer to the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) for details. --> No --------- Co-authored-by: Chen Li <chenli@gmail.com> Co-authored-by: Kunwoo (Chris) <143021053+kunwp1@users.noreply.github.com> Co-authored-by: Jiadong Bai <43344272+bobbai00@users.noreply.github.com>
1 parent 8560cca commit 407a91f

28 files changed

+65
-65
lines changed

frontend/src/app/dashboard/service/user/computing-unit-actions/computing-unit-actions.service.ts renamed to frontend/src/app/common/service/computing-unit/computing-unit-actions/computing-unit-actions.service.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,13 @@
2020
import { Injectable } from "@angular/core";
2121
import { Observable } from "rxjs";
2222
import { NzModalService } from "ng-zorro-antd/modal";
23-
import { ShareAccessComponent } from "../../../component/user/share-access/share-access.component";
24-
import { WorkflowComputingUnitManagingService } from "../../../../workspace/service/workflow-computing-unit/workflow-computing-unit-managing.service";
25-
import {
26-
DashboardWorkflowComputingUnit,
27-
WorkflowComputingUnitType,
28-
} from "../../../../workspace/types/workflow-computing-unit";
29-
import { NotificationService } from "../../../../common/service/notification/notification.service";
30-
import { unitTypeMessageTemplate } from "../../../../common/util/computing-unit.util";
31-
import { ComputingUnitStatusService } from "../../../../workspace/service/computing-unit-status/computing-unit-status.service";
32-
import { extractErrorMessage } from "../../../../common/util/error";
23+
import { ShareAccessComponent } from "../../../../dashboard/component/user/share-access/share-access.component";
24+
import { WorkflowComputingUnitManagingService } from "../workflow-computing-unit/workflow-computing-unit-managing.service";
25+
import { DashboardWorkflowComputingUnit, WorkflowComputingUnitType } from "../../../type/workflow-computing-unit";
26+
import { NotificationService } from "../../notification/notification.service";
27+
import { unitTypeMessageTemplate } from "../../../util/computing-unit.util";
28+
import { ComputingUnitStatusService } from "../computing-unit-status/computing-unit-status.service";
29+
import { extractErrorMessage } from "../../../util/error";
3330

3431
export interface StartComputingUnitRequest {
3532
type: WorkflowComputingUnitType;

frontend/src/app/workspace/service/computing-unit-status/computing-unit-status.service.ts renamed to frontend/src/app/common/service/computing-unit/computing-unit-status/computing-unit-status.service.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
import { Injectable, OnDestroy } from "@angular/core";
2121
import { BehaviorSubject, interval, Observable, of, Subject, Subscription } from "rxjs";
2222
import { catchError, distinctUntilChanged, filter, map, switchMap, take, tap } from "rxjs/operators";
23-
import { DashboardWorkflowComputingUnit } from "../../types/workflow-computing-unit";
23+
import { DashboardWorkflowComputingUnit } from "../../../type/workflow-computing-unit";
2424
import { WorkflowComputingUnitManagingService } from "../workflow-computing-unit/workflow-computing-unit-managing.service";
25-
import { WorkflowWebsocketService } from "../workflow-websocket/workflow-websocket.service";
25+
import { WorkflowWebsocketService } from "../../../../workspace/service/workflow-websocket/workflow-websocket.service";
2626
import { UntilDestroy, untilDestroyed } from "@ngneat/until-destroy";
27-
import { ComputingUnitState } from "../../types/computing-unit-connection.interface";
28-
import { isDefined } from "../../../common/util/predicate";
29-
import { WorkflowStatusService } from "../workflow-status/workflow-status.service";
30-
import { UserService } from "../../../common/service/user/user.service";
27+
import { ComputingUnitState } from "../../../type/computing-unit-connection.interface";
28+
import { isDefined } from "../../../util/predicate";
29+
import { WorkflowStatusService } from "../../../../workspace/service/workflow-status/workflow-status.service";
30+
import { UserService } from "../../user/user.service";
3131

3232
/**
3333
* Service that manages and provides access to computing unit status information

frontend/src/app/workspace/service/computing-unit-status/mock-computing-unit-status.service.ts renamed to frontend/src/app/common/service/computing-unit/computing-unit-status/mock-computing-unit-status.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
import { Injectable } from "@angular/core";
21-
import { DashboardWorkflowComputingUnit } from "../../types/workflow-computing-unit";
21+
import { DashboardWorkflowComputingUnit } from "../../../type/workflow-computing-unit";
2222
import { Observable, of } from "rxjs";
2323

2424
@Injectable()

frontend/src/app/workspace/service/workflow-computing-unit/workflow-computing-unit-managing.service.ts renamed to frontend/src/app/common/service/computing-unit/workflow-computing-unit/workflow-computing-unit-managing.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
import { Injectable } from "@angular/core";
2121
import { HttpClient } from "@angular/common/http";
2222
import { Observable } from "rxjs";
23-
import { AppSettings } from "../../../common/app-setting";
23+
import { AppSettings } from "../../../app-setting";
2424
import {
2525
DashboardWorkflowComputingUnit,
2626
WorkflowComputingUnit,
2727
WorkflowComputingUnitResourceLimit,
2828
WorkflowComputingUnitType,
29-
} from "../../types/workflow-computing-unit";
29+
} from "../../../type/workflow-computing-unit";
3030
import { map } from "rxjs/operators";
3131

3232
export const COMPUTING_UNIT_BASE_URL = "computing-unit";

frontend/src/app/workspace/types/computing-unit-connection.interface.ts renamed to frontend/src/app/common/type/computing-unit-connection.interface.ts

File renamed without changes.

frontend/src/app/workspace/types/workflow-computing-unit.ts renamed to frontend/src/app/common/type/workflow-computing-unit.ts

File renamed without changes.

frontend/src/app/common/util/computing-unit.util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import { Component, inject } from "@angular/core";
2121
import { NZ_MODAL_DATA } from "ng-zorro-antd/modal";
22-
import { DashboardWorkflowComputingUnit } from "../../workspace/types/workflow-computing-unit";
22+
import { DashboardWorkflowComputingUnit } from "../type/workflow-computing-unit";
2323

2424
@Component({
2525
template: `

frontend/src/app/dashboard/component/user/user-computing-unit/user-computing-unit-list-item/user-computing-unit-list-item.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ import {
2727
ViewChild,
2828
ElementRef,
2929
} from "@angular/core";
30-
import { ComputingUnitStatusService } from "../../../../../workspace/service/computing-unit-status/computing-unit-status.service";
30+
import { ComputingUnitStatusService } from "../../../../../common/service/computing-unit/computing-unit-status/computing-unit-status.service";
3131
import { extractErrorMessage } from "../../../../../common/util/error";
3232
import { NotificationService } from "../../../../../common/service/notification/notification.service";
3333
import { NzModalService } from "ng-zorro-antd/modal";
3434
import { UntilDestroy, untilDestroyed } from "@ngneat/until-destroy";
3535
import {
3636
DashboardWorkflowComputingUnit,
3737
WorkflowComputingUnit,
38-
} from "../../../../../workspace/types/workflow-computing-unit";
39-
import { WorkflowComputingUnitManagingService } from "../../../../../workspace/service/workflow-computing-unit/workflow-computing-unit-managing.service";
38+
} from "../../../../../common/type/workflow-computing-unit";
39+
import { WorkflowComputingUnitManagingService } from "../../../../../common/service/computing-unit/workflow-computing-unit/workflow-computing-unit-managing.service";
4040
import {
4141
ComputingUnitMetadataComponent,
4242
parseResourceUnit,
@@ -53,7 +53,7 @@ import {
5353
getComputingUnitCpuLimitUnit,
5454
} from "../../../../../common/util/computing-unit.util";
5555
import { GuiConfigService } from "../../../../../common/service/gui-config.service";
56-
import { ComputingUnitActionsService } from "../../../../service/user/computing-unit-actions/computing-unit-actions.service";
56+
import { ComputingUnitActionsService } from "../../../../../common/service/computing-unit/computing-unit-actions/computing-unit-actions.service";
5757

5858
@UntilDestroy()
5959
@Component({

frontend/src/app/dashboard/component/user/user-computing-unit/user-computing-unit.component.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ import { HttpClient } from "@angular/common/http";
2525
import { UserService } from "../../../../common/service/user/user.service";
2626
import { StubUserService } from "../../../../common/service/user/stub-user.service";
2727
import { commonTestProviders } from "../../../../common/testing/test-utils";
28-
import { WorkflowComputingUnitManagingService } from "../../../../workspace/service/workflow-computing-unit/workflow-computing-unit-managing.service";
29-
import { ComputingUnitStatusService } from "../../../../workspace/service/computing-unit-status/computing-unit-status.service";
30-
import { MockComputingUnitStatusService } from "../../../../workspace/service/computing-unit-status/mock-computing-unit-status.service";
28+
import { WorkflowComputingUnitManagingService } from "../../../../common/service/computing-unit/workflow-computing-unit/workflow-computing-unit-managing.service";
29+
import { ComputingUnitStatusService } from "../../../../common/service/computing-unit/computing-unit-status/computing-unit-status.service";
30+
import { MockComputingUnitStatusService } from "../../../../common/service/computing-unit/computing-unit-status/mock-computing-unit-status.service";
3131

3232
describe("UserComputingUnitComponent", () => {
3333
let component: UserComputingUnitComponent;

frontend/src/app/dashboard/component/user/user-computing-unit/user-computing-unit.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@
1818
*/
1919

2020
import { Component, Input, OnInit } from "@angular/core";
21-
import { ComputingUnitStatusService } from "../../../../workspace/service/computing-unit-status/computing-unit-status.service";
21+
import { ComputingUnitStatusService } from "../../../../common/service/computing-unit/computing-unit-status/computing-unit-status.service";
2222
import { DashboardEntry } from "../../../type/dashboard-entry";
2323
import {
2424
DashboardWorkflowComputingUnit,
2525
WorkflowComputingUnitType,
26-
} from "../../../../workspace/types/workflow-computing-unit";
26+
} from "../../../../common/type/workflow-computing-unit";
2727
import { extractErrorMessage } from "../../../../common/util/error";
2828
import { NotificationService } from "../../../../common/service/notification/notification.service";
2929
import { NzModalService } from "ng-zorro-antd/modal";
3030
import { UntilDestroy, untilDestroyed } from "@ngneat/until-destroy";
3131
import { UserService } from "../../../../common/service/user/user.service";
32-
import { WorkflowComputingUnitManagingService } from "../../../../workspace/service/workflow-computing-unit/workflow-computing-unit-managing.service";
32+
import { WorkflowComputingUnitManagingService } from "../../../../common/service/computing-unit/workflow-computing-unit/workflow-computing-unit-managing.service";
3333
import {
3434
parseResourceUnit,
3535
parseResourceNumber,
@@ -38,7 +38,7 @@ import {
3838
isComputingUnitShmTooLarge,
3939
getJvmMemorySliderConfig,
4040
} from "../../../../common/util/computing-unit.util";
41-
import { ComputingUnitActionsService } from "../../../service/user/computing-unit-actions/computing-unit-actions.service";
41+
import { ComputingUnitActionsService } from "../../../../common/service/computing-unit/computing-unit-actions/computing-unit-actions.service";
4242

4343
@UntilDestroy()
4444
@Component({

0 commit comments

Comments
 (0)