@oat-sa/tao-core-ui 3.1.1 → 3.2.0

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.
@@ -449,19 +449,39 @@ define(['jquery', 'lodash', 'i18n', 'core/eventifier', 'core/polling', 'core/dat
449
449
  if (!config.url || !config.url.download) {
450
450
  throw new TypeError('config.url.download is not configured while download() is being called');
451
451
  }
452
- return new Promise(function (resolve, reject) {
453
- $.fileDownload(config.url.download, {
454
- httpMethod: 'POST',
455
- data: {
456
- taskId: taskId
457
- },
458
- successCallback: function (result) {
459
- resolve(result);
460
- },
461
- failCallback: function (err) {
462
- reject(err);
463
- }
464
- });
452
+ return this.getCached(taskId).then(function (taskData) {
453
+ let redirectUrl = (taskData || {}).redirectUrl;
454
+ if (redirectUrl) {
455
+ return new Promise(function (resolve) {
456
+ $.fileDownload(redirectUrl, {
457
+ httpMethod: 'GET',
458
+ data: {},
459
+ successCallback: function (result) {
460
+ resolve(result);
461
+ },
462
+ failCallback: function (err) {
463
+ resolve(err);
464
+ // Security issue : Failed to read a named property 'document' from 'Window':
465
+ // Blocked a frame with origin "https://[domain]" from accessing a cross-origin frame.
466
+ }
467
+ });
468
+ });
469
+ } else {
470
+ return new Promise(function (resolve, reject) {
471
+ $.fileDownload(config.url.download, {
472
+ httpMethod: 'POST',
473
+ data: {
474
+ taskId: taskId
475
+ },
476
+ successCallback: function (result) {
477
+ resolve(result);
478
+ },
479
+ failCallback: function (err) {
480
+ reject(err);
481
+ }
482
+ });
483
+ });
484
+ }
465
485
  });
466
486
  },
467
487
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oat-sa/tao-core-ui",
3
- "version": "3.1.1",
3
+ "version": "3.2.0",
4
4
  "displayName": "TAO Core UI",
5
5
  "description": "UI libraries of TAO",
6
6
  "scripts": {
@@ -496,17 +496,40 @@ export default function taskQueueModel(config) {
496
496
  throw new TypeError('config.url.download is not configured while download() is being called');
497
497
  }
498
498
 
499
- return new Promise(function(resolve, reject) {
500
- $.fileDownload(config.url.download, {
501
- httpMethod: 'POST',
502
- data: { taskId: taskId },
503
- successCallback: function(result) {
504
- resolve(result);
505
- },
506
- failCallback: function(err) {
507
- reject(err);
508
- }
509
- });
499
+ return this.getCached(taskId).then(function (taskData) {
500
+ let redirectUrl = (taskData || {}).redirectUrl;
501
+
502
+ if (redirectUrl) {
503
+ return new Promise(function (resolve) {
504
+ $.fileDownload(redirectUrl, {
505
+ httpMethod: 'GET',
506
+ data: {},
507
+ successCallback: function (result) {
508
+ resolve(result);
509
+ },
510
+ failCallback: function (err) {
511
+ resolve(err);
512
+ // Security issue : Failed to read a named property 'document' from 'Window':
513
+ // Blocked a frame with origin "https://[domain]" from accessing a cross-origin frame.
514
+ }
515
+ });
516
+ });
517
+ } else {
518
+ return new Promise(function (resolve, reject) {
519
+ $.fileDownload(config.url.download, {
520
+ httpMethod: 'POST',
521
+ data: {
522
+ taskId: taskId
523
+ },
524
+ successCallback: function (result) {
525
+ resolve(result);
526
+ },
527
+ failCallback: function (err) {
528
+ reject(err);
529
+ }
530
+ });
531
+ });
532
+ }
510
533
  });
511
534
  },
512
535