Rename upload result 'uploads' to 'finished'

pull/4783/head
Alex Dik 8 years ago
parent 6c1d64a42d
commit a81f17c9f6
  1. 2
      frontend/app/components/api/api-v3/hal-resources/work-package-resource.service.test.ts
  2. 4
      frontend/app/components/api/api-v3/hal-resources/work-package-resource.service.ts
  3. 2
      frontend/app/components/api/op-file-upload/op-file-upload.service.test.ts
  4. 6
      frontend/app/components/api/op-file-upload/op-file-upload.service.ts

@ -243,7 +243,7 @@ describe('WorkPackageResource service', () => {
uploadFilesDeferred = $q.defer(); uploadFilesDeferred = $q.defer();
const uploadResult = { const uploadResult = {
uploads: [uploadFilesDeferred.promise], uploads: [uploadFilesDeferred.promise],
upload: uploadFilesDeferred.promise finished: uploadFilesDeferred.promise
}; };
attachmentsUploadStub = sinon.stub(workPackage.attachments, 'upload').returns(uploadResult); attachmentsUploadStub = sinon.stub(workPackage.attachments, 'upload').returns(uploadResult);
uploadNotificationStub = sinon.stub(NotificationsService, 'addWorkPackageUpload'); uploadNotificationStub = sinon.stub(NotificationsService, 'addWorkPackageUpload');

@ -193,11 +193,11 @@ export class WorkPackageResource extends HalResource {
* Return an updated AttachmentCollectionResource. * Return an updated AttachmentCollectionResource.
*/ */
public uploadAttachments(files: UploadFile[]): IPromise<any> { public uploadAttachments(files: UploadFile[]): IPromise<any> {
const {uploads, upload} = this.attachments.upload(files); const {uploads, finished} = this.attachments.upload(files);
const message = I18n.t('js.label_upload_notification', this); const message = I18n.t('js.label_upload_notification', this);
const notification = NotificationsService.addWorkPackageUpload(message, uploads); const notification = NotificationsService.addWorkPackageUpload(message, uploads);
return upload return finished
.then(() => { .then(() => {
$timeout(() => { $timeout(() => {
NotificationsService.remove(notification); NotificationsService.remove(notification);

@ -85,7 +85,7 @@ describe('opFileUpload service', () => {
}); });
it('should return a resolved promise that is the summary of the uploads', () => { it('should return a resolved promise that is the summary of the uploads', () => {
expect(result.upload).to.eventually.be.fulfilled; expect(result.finished).to.eventually.be.fulfilled;
}); });
}); });
}); });

@ -36,7 +36,7 @@ export interface UploadFile extends File {
export interface UploadResult { export interface UploadResult {
uploads: IPromise<any>[]; uploads: IPromise<any>[];
upload: IPromise<any>; finished: IPromise<any>;
} }
export class OpenProjectFileUploadService { export class OpenProjectFileUploadService {
@ -57,9 +57,9 @@ export class OpenProjectFileUploadService {
} }
} }
})); }));
const upload = this.$q.all(uploads); const finished = this.$q.all(uploads);
return {uploads, upload}; return {uploads, finished};
} }
} }

Loading…
Cancel
Save