18484: Improves CollectionService.get() to support "select".
[arvados-workbench2.git] / src / services / collection-service / collection-service.ts
index 43041ccd91cc2e3103a54860ad0930e826a50e0b..b6272650debf07034f2c3f336880d94e2814a42a 100644 (file)
@@ -12,6 +12,7 @@ import { TrashableResourceService } from "services/common-service/trashable-reso
 import { ApiActions } from "services/api/api-actions";
 import { customEncodeURI } from "common/url";
 import { FilterBuilder } from "services/api/filter-builder";
+import { ListArguments } from "services/common-service/common-service";
 
 export type UploadProgress = (fileId: number, loaded: number, total: number, currentTime: number) => void;
 
@@ -29,11 +30,15 @@ export class CollectionService extends TrashableResourceService<CollectionResour
         ]);
     }
 
-    async get(uuid: string, showErrors?: boolean) {
+    async get(uuid: string, showErrors?: boolean, select?: string[]) {
         super.validateUuid(uuid);
         // We use a filtered list request to avoid getting the manifest text
         const filters = new FilterBuilder().addEqual('uuid', uuid).getFilters();
-        const lst = await super.list({filters}, showErrors);
+        const listArgs: ListArguments = {filters, includeOldVersions: true};
+        if (select) {
+            listArgs.select = select;
+        }
+        const lst = await super.list(listArgs, showErrors);
         return lst.items[0];
     }