[ARVADOS-WORKBENCH2] created: 1.3.0-78-g6eaf888
Git user
git at public.curoverse.com
Mon Dec 10 04:28:06 EST 2018
at 6eaf8881f39c83f9073921277f81274425921054 (commit)
commit 6eaf8881f39c83f9073921277f81274425921054
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date: Mon Dec 10 10:27:57 2018 +0100
Delete unused import
Feature #14553
Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
diff --git a/src/services/ancestors-service/ancestors-service.ts b/src/services/ancestors-service/ancestors-service.ts
index d635145..23e7729 100644
--- a/src/services/ancestors-service/ancestors-service.ts
+++ b/src/services/ancestors-service/ancestors-service.ts
@@ -6,7 +6,7 @@ import { GroupsService } from "~/services/groups-service/groups-service";
import { UserService } from '../user-service/user-service';
import { GroupResource } from '~/models/group';
import { UserResource } from '~/models/user';
-import { extractUuidObjectType, ResourceObjectType, TrashableResource } from "~/models/resource";
+import { extractUuidObjectType, ResourceObjectType } from "~/models/resource";
export class AncestorService {
constructor(
commit 4e3cefd4fa42762aac756f3163dfff9047f2e516
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date: Mon Dec 10 10:26:55 2018 +0100
Refactor AncestorService to hide recursion implementation and give more meaningful names to arguments
Feature #14553
Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
diff --git a/src/services/ancestors-service/ancestors-service.ts b/src/services/ancestors-service/ancestors-service.ts
index 697cd8f..d635145 100644
--- a/src/services/ancestors-service/ancestors-service.ts
+++ b/src/services/ancestors-service/ancestors-service.ts
@@ -14,21 +14,25 @@ export class AncestorService {
private userService: UserService
) { }
- async ancestors(uuid: string, rootUuid: string, previousUuid = ''): Promise<Array<UserResource | GroupResource>> {
+ async ancestors(startUuid: string, endUuid: string): Promise<Array<UserResource | GroupResource>> {
+ return this._ancestors(startUuid, endUuid);
+ }
+
+ private async _ancestors(startUuid: string, endUuid: string, previousUuid = ''): Promise<Array<UserResource | GroupResource>> {
- if (uuid === previousUuid) {
+ if (startUuid === previousUuid) {
return [];
}
- const service = this.getService(extractUuidObjectType(uuid));
+ const service = this.getService(extractUuidObjectType(startUuid));
if (service) {
try {
- const resource = await service.get(uuid);
- if (uuid === rootUuid) {
+ const resource = await service.get(startUuid);
+ if (startUuid === endUuid) {
return [resource];
} else {
return [
- ...await this.ancestors(resource.ownerUuid, rootUuid, uuid),
+ ...await this._ancestors(resource.ownerUuid, endUuid, startUuid),
resource
];
}
commit c0b8c031bf6327c8ed22fb05ec40f3045b5aa1f1
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date: Mon Dec 10 10:19:27 2018 +0100
Add conditional that stops ancestors service from calling the same ownerUuid in infinite loop
Feature #14553
Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
diff --git a/src/services/ancestors-service/ancestors-service.ts b/src/services/ancestors-service/ancestors-service.ts
index 44e4eef..697cd8f 100644
--- a/src/services/ancestors-service/ancestors-service.ts
+++ b/src/services/ancestors-service/ancestors-service.ts
@@ -14,7 +14,12 @@ export class AncestorService {
private userService: UserService
) { }
- async ancestors(uuid: string, rootUuid: string): Promise<Array<UserResource | GroupResource>> {
+ async ancestors(uuid: string, rootUuid: string, previousUuid = ''): Promise<Array<UserResource | GroupResource>> {
+
+ if (uuid === previousUuid) {
+ return [];
+ }
+
const service = this.getService(extractUuidObjectType(uuid));
if (service) {
try {
@@ -23,7 +28,7 @@ export class AncestorService {
return [resource];
} else {
return [
- ...await this.ancestors(resource.ownerUuid, rootUuid),
+ ...await this.ancestors(resource.ownerUuid, rootUuid, uuid),
resource
];
}
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list