@rs-pk/asset-management 1.0.30 → 1.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1649,6 +1649,7 @@
1649
1649
  this._api = _api;
1650
1650
  this.files = [];
1651
1651
  this.fileNames = [];
1652
+ this.uploadErrors = new Map();
1652
1653
  this.supportedSize = 10 * 1024 * 1024; // 10MB
1653
1654
  // 10MB
1654
1655
  this.documentExtension = ['.pdf', '.csv'];
@@ -1751,9 +1752,25 @@
1751
1752
  * @return {?}
1752
1753
  */
1753
1754
  function (index) {
1755
+ this.uploadErrors.delete(this.files[index]);
1754
1756
  this.files.splice(index, 1);
1755
1757
  this.fileNames.splice(index, 1);
1756
1758
  };
1759
+ /**
1760
+ * @param {?} index
1761
+ * @return {?}
1762
+ */
1763
+ UploadAssetsService.prototype.getUploadName = /**
1764
+ * @param {?} index
1765
+ * @return {?}
1766
+ */
1767
+ function (index) {
1768
+ /** @type {?} */
1769
+ var nameSplit = this.files[index].name.split('.');
1770
+ /** @type {?} */
1771
+ var ext = "." + nameSplit.splice(nameSplit.length - 1, 1)[0];
1772
+ return "" + this.fileNames[index].name + ext;
1773
+ };
1757
1774
  /**
1758
1775
  * @param {?} parentAssetId
1759
1776
  * @return {?}
@@ -1765,21 +1782,11 @@
1765
1782
  function (parentAssetId) {
1766
1783
  var files = this.files;
1767
1784
  /** @type {?} */
1768
- var fileNames = this.fileNames.map((/**
1769
- * @param {?} file
1770
- * @return {?}
1771
- */
1772
- function (file) { return file.name; }));
1773
- /** @type {?} */
1774
1785
  var formData = new FormData();
1775
1786
  formData.append('parentAssetId', parentAssetId);
1776
1787
  formData.append('companyId', '732DA8D2-04EC-4BE0-A168-63EE0DCF50D8');
1777
1788
  for (var i = 0; i < files.length; i++) {
1778
- /** @type {?} */
1779
- var nameSplit = files[i].name.split('.');
1780
- /** @type {?} */
1781
- var ext = "." + nameSplit.splice(nameSplit.length - 1, 1)[0];
1782
- formData.append('files', files[i], "" + fileNames[i] + ext);
1789
+ formData.append('files', files[i], this.getUploadName(i));
1783
1790
  }
1784
1791
  return this._api.post(this.baseUrl + "/File/Upload", formData);
1785
1792
  };
@@ -1803,6 +1810,8 @@
1803
1810
  /** @type {?} */
1804
1811
  UploadAssetsService.prototype.fileNames;
1805
1812
  /** @type {?} */
1813
+ UploadAssetsService.prototype.uploadErrors;
1814
+ /** @type {?} */
1806
1815
  UploadAssetsService.prototype.supportedSize;
1807
1816
  /** @type {?} */
1808
1817
  UploadAssetsService.prototype.documentExtension;
@@ -2608,6 +2617,16 @@
2608
2617
  function () {
2609
2618
  this.initDataFile();
2610
2619
  };
2620
+ Object.defineProperty(FileItemComponent.prototype, "uploadErrors", {
2621
+ get: /**
2622
+ * @return {?}
2623
+ */
2624
+ function () {
2625
+ return this.uploadAssetService.uploadErrors.get(this.file);
2626
+ },
2627
+ enumerable: true,
2628
+ configurable: true
2629
+ });
2611
2630
  /**
2612
2631
  * @private
2613
2632
  * @return {?}
@@ -2730,8 +2749,8 @@
2730
2749
  FileItemComponent.decorators = [
2731
2750
  { type: core.Component, args: [{
2732
2751
  selector: 'lib-file-item',
2733
- template: "<div class=\"file-item__img\">\n <ng-container\n *ngIf=\"\n file.type.indexOf('image') > -1 || documentExts.indexOf(dataFile.ext) > -1;\n else defaultFile\n \"\n >\n <img\n [class.image]=\"file.type.indexOf('image') > -1\"\n *ngIf=\"documentExts.indexOf(dataFile.ext) > -1 || dataFile.data\"\n [src]=\"documentExts.indexOf(dataFile.ext) > -1 ? base64PNG[dataFile.ext] : dataFile.data\"\n />\n </ng-container>\n <ng-template #defaultFile>\n <mat-icon>attach_file</mat-icon>\n </ng-template>\n</div>\n<div class=\"file-item__content\">\n <input\n class=\"file-item__content--name\"\n matInput\n placeholder=\"Enter file name\"\n [value]=\"dataFile.name\"\n required\n (input)=\"onChange($event)\"\n />\n <div class=\"file-item__content--info\">\n <div class=\"file-item__content--info__item\">\n Extension: <span>{{ dataFile.ext }}</span>\n </div>\n <div class=\"file-item__content--info__item\">\n Size: <span>{{ dataFile.size | fileSize }}</span>\n </div>\n </div>\n <div *ngIf=\"dataFile.errors.ext\" class=\"file-item__error\">\n {{ uploadAssetService.messageErrors['ext'] }}\n {{ uploadAssetService.supportedTypes.join(', ') }}\n </div>\n <div *ngIf=\"dataFile.errors.size\" class=\"file-item__error\">\n {{ uploadAssetService.messageErrors['size'] }}\n {{ uploadAssetService.supportedSize | fileSize: 0 }}\n </div>\n <div *ngIf=\"dataFile.errors.maxLength\" class=\"file-item__error\">\n {{ uploadAssetService.messageErrors['maxLength'] }}\n </div>\n</div>\n<div class=\"file-item__action\">\n <mat-icon (click)=\"onRemove()\">delete_outline</mat-icon>\n</div>\n",
2734
- styles: [":host::ng-deep{padding:10px 5%;display:flex;justify-content:space-between;align-items:center;background-color:#f9f9f9;border-radius:10px}:host::ng-deep .file-item__img{display:flex;justify-content:center;align-items:center;width:250px;height:150px;border-radius:10px}:host::ng-deep .file-item__img img{max-width:100%;max-height:100%;-o-object-fit:contain;object-fit:contain}:host::ng-deep .file-item__img img.image{background-image:url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEBLAEsAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAARCAAUABQDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD+/ivFPFOf+EjvxzjbBgdv+PeDp+OfxzSt4q18AkageASB9ntu3OM+Vn8c5rsdG0fT9d06DVdUgN1f3XmefP5ksO/ypXhj/dwvHGu2ONF+VF3bQSM0AeYUV7IPCWgjgWRA/wCvi4P85SaKAPGm5Vh7H+VeyeERjQLEDoPP/WeQ/wAzRRQB0tFFFAH/2Q==)}:host::ng-deep .file-item__img mat-icon{font-size:100px;width:auto;height:auto}:host::ng-deep .file-item__content{flex:1;padding-left:5%;padding-right:5%}:host::ng-deep .file-item__content--name{width:100%;padding:10px;border:1px solid #d8d8d8;border-radius:5px}:host::ng-deep .file-item__content--info{margin-top:10px;display:flex}:host::ng-deep .file-item__content--info__item:not(:last-child){margin-right:50px}:host::ng-deep .file-item__content--info__item span{color:#000;text-transform:uppercase}:host::ng-deep .file-item__error{margin-top:10px;color:#f44336}:host::ng-deep .file-item__action{color:#f44336;cursor:pointer}"]
2752
+ template: "<div class=\"file-item__img\">\n <ng-container\n *ngIf=\"\n file.type.indexOf('image') > -1 || documentExts.indexOf(dataFile.ext) > -1;\n else defaultFile\n \"\n >\n <img\n [class.image]=\"file.type.indexOf('image') > -1\"\n *ngIf=\"documentExts.indexOf(dataFile.ext) > -1 || dataFile.data\"\n [src]=\"documentExts.indexOf(dataFile.ext) > -1 ? base64PNG[dataFile.ext] : dataFile.data\"\n />\n </ng-container>\n <ng-template #defaultFile>\n <mat-icon>attach_file</mat-icon>\n </ng-template>\n</div>\n<div class=\"file-item__content\">\n <input\n class=\"file-item__content--name\"\n matInput\n placeholder=\"Enter file name\"\n [value]=\"dataFile.name\"\n required\n (input)=\"onChange($event)\"\n />\n <div class=\"file-item__content--info\">\n <div class=\"file-item__content--info__item\">\n Extension: <span>{{ dataFile.ext }}</span>\n </div>\n <div class=\"file-item__content--info__item\">\n Size: <span>{{ dataFile.size | fileSize }}</span>\n </div>\n </div>\n <div *ngIf=\"dataFile.errors.ext\" class=\"file-item__error\">\n <mat-icon class=\"file-item__error--icon\">error_outline</mat-icon>\n <span>\n {{ uploadAssetService.messageErrors['ext'] }}\n {{ uploadAssetService.supportedTypes.join(', ') }}\n </span>\n </div>\n <div *ngIf=\"dataFile.errors.size\" class=\"file-item__error\">\n <mat-icon class=\"file-item__error--icon\">error_outline</mat-icon>\n <span>\n {{ uploadAssetService.messageErrors['size'] }}\n {{ uploadAssetService.supportedSize | fileSize: 0 }}\n </span>\n </div>\n <div *ngIf=\"dataFile.errors.maxLength\" class=\"file-item__error\">\n <mat-icon class=\"file-item__error--icon\">error_outline</mat-icon>\n <span>{{ uploadAssetService.messageErrors['maxLength'] }}</span>\n </div>\n <div *ngFor=\"let message of uploadErrors\" class=\"file-item__error\" role=\"alert\">\n <mat-icon class=\"file-item__error--icon\">error_outline</mat-icon>\n <span>{{ message }}</span>\n </div>\n</div>\n<div class=\"file-item__action\">\n <mat-icon (click)=\"onRemove()\">delete_outline</mat-icon>\n</div>\n",
2753
+ styles: [":host::ng-deep{padding:10px 5%;display:flex;justify-content:space-between;align-items:center;background-color:#f9f9f9;border-radius:10px}:host::ng-deep .file-item__img{display:flex;justify-content:center;align-items:center;width:250px;height:150px;border-radius:10px}:host::ng-deep .file-item__img img{max-width:100%;max-height:100%;-o-object-fit:contain;object-fit:contain}:host::ng-deep .file-item__img img.image{background-image:url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEBLAEsAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAARCAAUABQDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD+/ivFPFOf+EjvxzjbBgdv+PeDp+OfxzSt4q18AkageASB9ntu3OM+Vn8c5rsdG0fT9d06DVdUgN1f3XmefP5ksO/ypXhj/dwvHGu2ONF+VF3bQSM0AeYUV7IPCWgjgWRA/wCvi4P85SaKAPGm5Vh7H+VeyeERjQLEDoPP/WeQ/wAzRRQB0tFFFAH/2Q==)}:host::ng-deep .file-item__img mat-icon{font-size:100px;width:auto;height:auto}:host::ng-deep .file-item__content{flex:1;padding-left:5%;padding-right:5%}:host::ng-deep .file-item__content--name{width:100%;padding:10px;border:1px solid #d8d8d8;border-radius:5px}:host::ng-deep .file-item__content--info{margin-top:10px;display:flex}:host::ng-deep .file-item__content--info__item:not(:last-child){margin-right:50px}:host::ng-deep .file-item__content--info__item span{color:#000;text-transform:uppercase}:host::ng-deep .file-item__error{display:flex;align-items:center;width:-moz-fit-content;width:fit-content;max-width:100%;margin-top:8px;padding:4px 10px;border-radius:6px;background-color:#fdecea;color:#d32f2f;font-size:13px;line-height:18px;word-break:break-word}:host::ng-deep .file-item__error--icon{flex-shrink:0;margin-right:6px;font-size:16px;width:16px;height:16px}:host::ng-deep .file-item__action{color:#f44336;cursor:pointer}"]
2735
2754
  }] }
2736
2755
  ];
2737
2756
  /** @nocollapse */
@@ -3452,6 +3471,9 @@
3452
3471
  this.uploadAssetsService = uploadAssetsService;
3453
3472
  this.isLoading = false;
3454
3473
  this.disabled = true;
3474
+ this.errorMessages = [];
3475
+ this.defaultErrorMessage = 'Something went wrong while uploading. Please try again.';
3476
+ this.isDestroyed = false;
3455
3477
  this.destroy$ = new rxjs.Subject();
3456
3478
  if (this.data.fileType) {
3457
3479
  this.uploadAssetsService.supportedTypes =
@@ -3479,6 +3501,7 @@
3479
3501
  */
3480
3502
  function (error) {
3481
3503
  _this.disabled = error;
3504
+ _this.clearErrors();
3482
3505
  _this.changeDetectorRef.detectChanges();
3483
3506
  }));
3484
3507
  };
@@ -3492,6 +3515,7 @@
3492
3515
  */
3493
3516
  function (hasError) {
3494
3517
  this.disabled = hasError;
3518
+ this.clearErrors();
3495
3519
  };
3496
3520
  /**
3497
3521
  * @return {?}
@@ -3502,6 +3526,8 @@
3502
3526
  function () {
3503
3527
  var _this = this;
3504
3528
  this.isLoading = true;
3529
+ this.clearErrors();
3530
+ this.dialogRef.disableClose = true;
3505
3531
  this.uploadAssetsService
3506
3532
  .uploadMultipleAssets(this.data.currentAssetId)
3507
3533
  .pipe(operators.takeUntil(this.destroy$))
@@ -3513,8 +3539,129 @@
3513
3539
  if (res) {
3514
3540
  _this.closeDialog(true);
3515
3541
  }
3542
+ }), (/**
3543
+ * @param {?} err
3544
+ * @return {?}
3545
+ */
3546
+ function (err) {
3547
+ _this.setUploadErrors(_this.getErrorMessages(err));
3548
+ _this.stopLoading();
3549
+ }), (
3550
+ // the request can complete without a truthy response (or be swallowed by an interceptor)
3551
+ // the request can complete without a truthy response (or be swallowed by an interceptor)
3552
+ /**
3553
+ * @return {?}
3554
+ */
3555
+ function () { return _this.stopLoading(); }));
3556
+ };
3557
+ /**
3558
+ * @private
3559
+ * @return {?}
3560
+ */
3561
+ UploadDialogComponent.prototype.stopLoading = /**
3562
+ * @private
3563
+ * @return {?}
3564
+ */
3565
+ function () {
3566
+ // takeUntil also completes the upload when the dialog is destroyed, its view can't be checked anymore
3567
+ if (this.isDestroyed) {
3568
+ return;
3569
+ }
3570
+ this.isLoading = false;
3571
+ this.dialogRef.disableClose = false;
3572
+ this.changeDetectorRef.detectChanges();
3573
+ };
3574
+ /**
3575
+ * @private
3576
+ * @return {?}
3577
+ */
3578
+ UploadDialogComponent.prototype.clearErrors = /**
3579
+ * @private
3580
+ * @return {?}
3581
+ */
3582
+ function () {
3583
+ this.errorMessages = [];
3584
+ this.uploadAssetsService.uploadErrors.clear();
3585
+ };
3586
+ // show each message on the file it mentions, the rest stay under the list
3587
+ // show each message on the file it mentions, the rest stay under the list
3588
+ /**
3589
+ * @private
3590
+ * @param {?} messages
3591
+ * @return {?}
3592
+ */
3593
+ UploadDialogComponent.prototype.setUploadErrors =
3594
+ // show each message on the file it mentions, the rest stay under the list
3595
+ /**
3596
+ * @private
3597
+ * @param {?} messages
3598
+ * @return {?}
3599
+ */
3600
+ function (messages) {
3601
+ var _this = this;
3602
+ var _a = this.uploadAssetsService, files = _a.getFiles, uploadErrors = _a.uploadErrors;
3603
+ /** @type {?} */
3604
+ var uploadNames = files.map((/**
3605
+ * @param {?} file
3606
+ * @param {?} index
3607
+ * @return {?}
3608
+ */
3609
+ function (file, index) { return _this.uploadAssetsService.getUploadName(index); }));
3610
+ this.errorMessages = messages.filter((/**
3611
+ * @param {?} message
3612
+ * @return {?}
3613
+ */
3614
+ function (message) {
3615
+ /** @type {?} */
3616
+ var index = uploadNames.findIndex((/**
3617
+ * @param {?} name
3618
+ * @return {?}
3619
+ */
3620
+ function (name) { return message.indexOf(name) > -1; }));
3621
+ if (index < 0 && files.length === 1) {
3622
+ index = 0;
3623
+ }
3624
+ if (index < 0) {
3625
+ return true;
3626
+ }
3627
+ uploadErrors.set(files[index], __spread((uploadErrors.get(files[index]) || []), [message]));
3628
+ return false;
3516
3629
  }));
3517
3630
  };
3631
+ /**
3632
+ * @private
3633
+ * @param {?} err
3634
+ * @return {?}
3635
+ */
3636
+ UploadDialogComponent.prototype.getErrorMessages = /**
3637
+ * @private
3638
+ * @param {?} err
3639
+ * @return {?}
3640
+ */
3641
+ function (err) {
3642
+ // HttpErrorResponse keeps the API body in `error`, an interceptor may already unwrap it
3643
+ /** @type {?} */
3644
+ var body = err && err.error && typeof err.error === 'object' ? err.error : err || {};
3645
+ /** @type {?} */
3646
+ var messages = (body.Messages || [])
3647
+ .map((/**
3648
+ * @param {?} message
3649
+ * @return {?}
3650
+ */
3651
+ function (message) { return (typeof message === 'string' ? message : message && message.Text); }))
3652
+ .filter(Boolean);
3653
+ if (!messages.length && body.ResponseMessage) {
3654
+ messages.push(body.ResponseMessage);
3655
+ }
3656
+ return messages.length
3657
+ ? messages.filter((/**
3658
+ * @param {?} message
3659
+ * @param {?} index
3660
+ * @return {?}
3661
+ */
3662
+ function (message, index) { return messages.indexOf(message) === index; }))
3663
+ : [this.defaultErrorMessage];
3664
+ };
3518
3665
  /**
3519
3666
  * @param {?=} res
3520
3667
  * @return {?}
@@ -3533,15 +3680,16 @@
3533
3680
  * @return {?}
3534
3681
  */
3535
3682
  function () {
3683
+ this.isDestroyed = true;
3536
3684
  this.destroy$.next(true);
3537
3685
  this.destroy$.complete();
3538
3686
  };
3539
3687
  UploadDialogComponent.decorators = [
3540
3688
  { type: core.Component, args: [{
3541
3689
  selector: 'lib-upload-dialog',
3542
- template: "<lib-modal heading=\"Add new assets\">\n <ng-container content>\n <lib-upload-file\n *ngIf=\"!uploadAssetsService?.getFiles?.length\"\n (revalidate)=\"onValidate($event)\"\n ></lib-upload-file>\n <lib-file-list\n *ngIf=\"uploadAssetsService?.getFiles?.length\"\n (revalidate)=\"onValidate($event)\"\n ></lib-file-list>\n </ng-container>\n <ng-container actions>\n <button mat-raised-button mat-dialog-close>Cancel</button>\n <button\n class=\"upload__action\"\n [class.loading]=\"isLoading\"\n mat-raised-button\n color=\"primary\"\n (click)=\"uploadFiles()\"\n [disabled]=\"disabled || isLoading\"\n >\n <ng-container *ngIf=\"isLoading\">\n <mat-spinner [diameter]=\"20\"></mat-spinner>\n </ng-container>\n <span>Upload</span>\n </button>\n </ng-container>\n</lib-modal>\n",
3690
+ template: "<lib-modal heading=\"Add new assets\">\n <ng-container content>\n <lib-upload-file\n *ngIf=\"!uploadAssetsService?.getFiles?.length\"\n (revalidate)=\"onValidate($event)\"\n ></lib-upload-file>\n <lib-file-list\n *ngIf=\"uploadAssetsService?.getFiles?.length\"\n (revalidate)=\"onValidate($event)\"\n ></lib-file-list>\n <div *ngFor=\"let message of errorMessages\" class=\"upload__error\" role=\"alert\">\n <mat-icon class=\"upload__error--icon\">error_outline</mat-icon>\n <span>{{ message }}</span>\n </div>\n </ng-container>\n <ng-container actions>\n <button mat-raised-button mat-dialog-close [disabled]=\"isLoading\">Cancel</button>\n <button\n class=\"upload__action\"\n [class.loading]=\"isLoading\"\n mat-raised-button\n color=\"primary\"\n (click)=\"uploadFiles()\"\n [disabled]=\"disabled || isLoading\"\n >\n <ng-container *ngIf=\"isLoading\">\n <mat-spinner [diameter]=\"20\"></mat-spinner>\n </ng-container>\n <span>Upload</span>\n </button>\n </ng-container>\n</lib-modal>\n",
3543
3691
  providers: [UploadAssetsService],
3544
- styles: [":host::ng-deep{display:block;width:1200px;max-width:100%;font-size:14px;line-height:16px;color:#979797;letter-spacing:.15px}:host::ng-deep .mat-dialog-title{position:relative;margin-bottom:0;padding-bottom:24px;color:#000}:host::ng-deep .mat-dialog-actions{justify-content:flex-end;padding:24px 0 0}:host::ng-deep .upload__action{min-width:100px}:host::ng-deep .upload__action.loading{padding:0 5px}:host::ng-deep .upload__action.loading .mat-button-wrapper{display:flex;width:100%;justify-content:center;align-items:center}:host::ng-deep .upload__action.loading .mat-spinner{margin-right:10px}"]
3692
+ styles: [":host::ng-deep{display:block;width:1200px;max-width:100%;font-size:14px;line-height:16px;color:#979797;letter-spacing:.15px}:host::ng-deep .mat-dialog-title{position:relative;margin-bottom:0;padding-bottom:24px;color:#000}:host::ng-deep .mat-dialog-actions{justify-content:flex-end;padding:24px 0 0}:host::ng-deep .upload__error{display:flex;align-items:center;width:-moz-fit-content;width:fit-content;max-width:100%;margin-top:8px;padding:4px 10px;border-radius:6px;background-color:#fdecea;color:#d32f2f;font-size:13px;line-height:18px;word-break:break-word}:host::ng-deep .upload__error--icon{flex-shrink:0;margin-right:6px;font-size:16px;width:16px;height:16px}:host::ng-deep .upload__action{min-width:100px}:host::ng-deep .upload__action.loading{padding:0 5px}:host::ng-deep .upload__action.loading .mat-button-wrapper{display:flex;width:100%;justify-content:center;align-items:center}:host::ng-deep .upload__action.loading .mat-spinner{margin-right:10px}"]
3545
3693
  }] }
3546
3694
  ];
3547
3695
  /** @nocollapse */
@@ -3558,6 +3706,18 @@
3558
3706
  UploadDialogComponent.prototype.isLoading;
3559
3707
  /** @type {?} */
3560
3708
  UploadDialogComponent.prototype.disabled;
3709
+ /** @type {?} */
3710
+ UploadDialogComponent.prototype.errorMessages;
3711
+ /**
3712
+ * @type {?}
3713
+ * @private
3714
+ */
3715
+ UploadDialogComponent.prototype.defaultErrorMessage;
3716
+ /**
3717
+ * @type {?}
3718
+ * @private
3719
+ */
3720
+ UploadDialogComponent.prototype.isDestroyed;
3561
3721
  /**
3562
3722
  * @type {?}
3563
3723
  * @private
@@ -3844,6 +4004,7 @@
3844
4004
  this.hasAccessPermission = true;
3845
4005
  this.hasArchivePermission = true;
3846
4006
  this.backgroundProcessingNum = BackgroudProcessingStatus;
4007
+ this.processingCheckDelay = 5000;
3847
4008
  this.unsubscribe$ = new rxjs.Subject();
3848
4009
  this.selectedAssets = [];
3849
4010
  }
@@ -3865,17 +4026,8 @@
3865
4026
  * @return {?}
3866
4027
  */
3867
4028
  function (changes) {
3868
- var _this = this;
3869
4029
  if (changes.assets) {
3870
- // Check if asset is uploading
3871
- if (this.assets && this.assets.find((/**
3872
- * @param {?} x
3873
- * @return {?}
3874
- */
3875
- function (x) { return x.BackgroudProcessingStatus === _this.backgroundProcessingNum.InProcessing; }))) {
3876
- this._resetUploadingAssets();
3877
- }
3878
- ;
4030
+ this.checkProcessingAssets();
3879
4031
  this.paginator.pageIndex = this.assetService.pageIndex;
3880
4032
  this.paginator.pageSize = this.assetService.pageSize;
3881
4033
  this.paginator.length = this.assetService.fileTotal;
@@ -4028,15 +4180,8 @@
4028
4180
  * @param {?} res
4029
4181
  * @return {?}
4030
4182
  */
4031
- function (res) {
4032
- /** @type {?} */
4033
- var pagination = res && res.Meta || {};
4034
- /** @type {?} */
4035
- var assets = res && res.Data && res.Data.Children || [];
4036
- /** @type {?} */
4037
- var totalFile = res && res.Data && res.Data.TotalFile || 0;
4038
- _this.assetService.setAssetList(assets, pagination, totalFile);
4039
- })).add((/**
4183
+ function (res) { return _this.setAssetList(res); }))
4184
+ .add((/**
4040
4185
  * @return {?}
4041
4186
  */
4042
4187
  function () {
@@ -4048,29 +4193,92 @@
4048
4193
  };
4049
4194
  /**
4050
4195
  * @private
4196
+ * @param {?} res
4051
4197
  * @return {?}
4052
4198
  */
4053
- AssetListComponent.prototype._resetUploadingAssets = /**
4199
+ AssetListComponent.prototype.setAssetList = /**
4200
+ * @private
4201
+ * @param {?} res
4202
+ * @return {?}
4203
+ */
4204
+ function (res) {
4205
+ /** @type {?} */
4206
+ var pagination = res && res.Meta || {};
4207
+ /** @type {?} */
4208
+ var assets = res && res.Data && res.Data.Children || [];
4209
+ /** @type {?} */
4210
+ var totalFile = res && res.Data && res.Data.TotalFile || 0;
4211
+ this.assetService.setAssetList(assets, pagination, totalFile);
4212
+ };
4213
+ // Called on every new asset list: while some files are still processed in the background,
4214
+ // reload the list once after a delay. The reloaded list calls this again, until nothing is processing.
4215
+ // Called on every new asset list: while some files are still processed in the background,
4216
+ // reload the list once after a delay. The reloaded list calls this again, until nothing is processing.
4217
+ /**
4218
+ * @private
4219
+ * @return {?}
4220
+ */
4221
+ AssetListComponent.prototype.checkProcessingAssets =
4222
+ // Called on every new asset list: while some files are still processed in the background,
4223
+ // reload the list once after a delay. The reloaded list calls this again, until nothing is processing.
4224
+ /**
4054
4225
  * @private
4055
4226
  * @return {?}
4056
4227
  */
4057
4228
  function () {
4058
4229
  var _this = this;
4230
+ this.stopProcessingCheck();
4059
4231
  /** @type {?} */
4060
- var reload = setInterval((/**
4232
+ var hasProcessingAssets = this.assets && this.assets.some((/**
4233
+ * @param {?} asset
4061
4234
  * @return {?}
4062
4235
  */
4063
- function () {
4064
- _this.fetchChildrenAssets();
4065
- if (_this.assets.find((/**
4066
- * @param {?} x
4236
+ function (asset) { return asset.BackgroudProcessingStatus === _this.backgroundProcessingNum.InProcessing; }));
4237
+ if (hasProcessingAssets) {
4238
+ this.processingCheckTimer = setTimeout((/**
4067
4239
  * @return {?}
4068
4240
  */
4069
- function (x) { return x.BackgroudProcessingStatus === _this.backgroundProcessingNum.Processed; }))) {
4070
- clearInterval(reload);
4071
- }
4072
- console.log('Upload Successfully!'); // interval will be cleared after completing this whole block
4073
- }), 5000);
4241
+ function () { return _this.reloadProcessingAssets(); }), this.processingCheckDelay);
4242
+ }
4243
+ };
4244
+ // Silent reload, without the global loading bar
4245
+ // Silent reload, without the global loading bar
4246
+ /**
4247
+ * @private
4248
+ * @return {?}
4249
+ */
4250
+ AssetListComponent.prototype.reloadProcessingAssets =
4251
+ // Silent reload, without the global loading bar
4252
+ /**
4253
+ * @private
4254
+ * @return {?}
4255
+ */
4256
+ function () {
4257
+ var _this = this;
4258
+ if (!this.currentFolderId) {
4259
+ return;
4260
+ }
4261
+ this.processingCheckRequest = this.assetService
4262
+ .getChildrenAssets({ assetId: this.currentFolderId })
4263
+ .subscribe((/**
4264
+ * @param {?} res
4265
+ * @return {?}
4266
+ */
4267
+ function (res) { return _this.setAssetList(res); }));
4268
+ };
4269
+ /**
4270
+ * @private
4271
+ * @return {?}
4272
+ */
4273
+ AssetListComponent.prototype.stopProcessingCheck = /**
4274
+ * @private
4275
+ * @return {?}
4276
+ */
4277
+ function () {
4278
+ clearTimeout(this.processingCheckTimer);
4279
+ if (this.processingCheckRequest) {
4280
+ this.processingCheckRequest.unsubscribe();
4281
+ }
4074
4282
  };
4075
4283
  /**
4076
4284
  * @return {?}
@@ -4079,6 +4287,7 @@
4079
4287
  * @return {?}
4080
4288
  */
4081
4289
  function () {
4290
+ this.stopProcessingCheck();
4082
4291
  this.unsubscribe$.next();
4083
4292
  this.unsubscribe$.complete();
4084
4293
  };
@@ -4119,6 +4328,21 @@
4119
4328
  AssetListComponent.prototype.assets;
4120
4329
  /** @type {?} */
4121
4330
  AssetListComponent.prototype.backgroundProcessingNum;
4331
+ /**
4332
+ * @type {?}
4333
+ * @private
4334
+ */
4335
+ AssetListComponent.prototype.processingCheckDelay;
4336
+ /**
4337
+ * @type {?}
4338
+ * @private
4339
+ */
4340
+ AssetListComponent.prototype.processingCheckTimer;
4341
+ /**
4342
+ * @type {?}
4343
+ * @private
4344
+ */
4345
+ AssetListComponent.prototype.processingCheckRequest;
4122
4346
  /**
4123
4347
  * @type {?}
4124
4348
  * @private