aglinxinyuan commented on code in PR #9332:
URL: https://github.com/apache/texera/pull/9332#discussion_r4509645037
##########
frontend/src/app/dashboard/service/user/quota/user-quota.service.ts:
##########
@@ -38,19 +38,23 @@ export class UserQuotaService {
constructor(private http: HttpClient) {}
public getCreatedDatasets(uid: number):
Observable<ReadonlyArray<DatasetQuota>> {
- return
this.http.get<ReadonlyArray<DatasetQuota>>(`${USER_CREATED_DATASETS}`);
+ return this.getQuotaResource<DatasetQuota>(USER_CREATED_DATASETS);
}
public getCreatedWorkflows(uid: number): Observable<ReadonlyArray<Workflow>>
{
- return this.http.get<ReadonlyArray<Workflow>>(`${USER_CREATED_WORKFLOWS}`);
+ return this.getQuotaResource<Workflow>(USER_CREATED_WORKFLOWS);
}
public getAccessWorkflows(uid: number): Observable<ReadonlyArray<number>> {
- return this.http.get<ReadonlyArray<number>>(`${USER_ACCESS_WORKFLOWS}`);
+ return this.getQuotaResource<number>(USER_ACCESS_WORKFLOWS);
}
public getExecutionQuota(uid: number):
Observable<ReadonlyArray<ExecutionQuota>> {
- return this.http.get<ReadonlyArray<ExecutionQuota>>(`${USER_QUOTA_SIZE}`);
+ return this.getQuotaResource<ExecutionQuota>(USER_QUOTA_SIZE);
+ }
+
+ private getQuotaResource<T>(url: string): Observable<ReadonlyArray<T>> {
+ return this.http.get<ReadonlyArray<T>>(url);
}
Review Comment:
Agreed — restored the direct `http.get` calls in `UserQuotaService` and its
original spec in 51292cf6b7, so the PR now only extracts the admin
`getUserResource` helper.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]