@netgrif/components-core 6.0.2 → 6.0.3-rc.1

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.
Files changed (27) hide show
  1. package/bundles/netgrif-components-core.umd.js +36 -16
  2. package/bundles/netgrif-components-core.umd.js.map +1 -1
  3. package/bundles/netgrif-components-core.umd.min.js +1 -1
  4. package/bundles/netgrif-components-core.umd.min.js.map +1 -1
  5. package/esm2015/lib/authentication/components/abstract-authentication-overlay.js +2 -2
  6. package/esm2015/lib/configuration/configuration.service.js +7 -5
  7. package/esm2015/lib/data-fields/file-field/abstract-file-field.component.js +6 -3
  8. package/esm2015/lib/data-fields/file-list-field/abstract-file-list-field.component.js +6 -3
  9. package/esm2015/lib/data-fields/models/file-field-id-body.js +2 -0
  10. package/esm2015/lib/groups/services/next-group.service.js +2 -2
  11. package/esm2015/lib/process/process.service.js +3 -2
  12. package/esm5/lib/authentication/components/abstract-authentication-overlay.js +2 -2
  13. package/esm5/lib/configuration/configuration.service.js +23 -10
  14. package/esm5/lib/data-fields/file-field/abstract-file-field.component.js +6 -3
  15. package/esm5/lib/data-fields/file-list-field/abstract-file-list-field.component.js +6 -3
  16. package/esm5/lib/data-fields/models/file-field-id-body.js +2 -0
  17. package/esm5/lib/groups/services/next-group.service.js +2 -2
  18. package/esm5/lib/process/process.service.js +3 -2
  19. package/fesm2015/netgrif-components-core.js +20 -11
  20. package/fesm2015/netgrif-components-core.js.map +1 -1
  21. package/fesm5/netgrif-components-core.js +37 -17
  22. package/fesm5/netgrif-components-core.js.map +1 -1
  23. package/lib/configuration/configuration.service.d.ts +1 -0
  24. package/lib/data-fields/models/file-field-id-body.d.ts +3 -0
  25. package/lib/process/process.service.d.ts +1 -0
  26. package/netgrif-components-core.metadata.json +1 -1
  27. package/package.json +1 -1
@@ -527,18 +527,28 @@
527
527
  * @return requested configuration if it exists. `undefined` otherwise.
528
528
  */
529
529
  ConfigurationService.prototype.getViewByUrl = function (url) {
530
- var config = this.createConfigurationCopy();
531
- var views = config.views;
530
+ var e_1, _a;
531
+ var views = this.getViewsCopy();
532
532
  if (!views) {
533
533
  return undefined;
534
534
  }
535
535
  var map = new Map();
536
536
  map = this.getChildren(views, map, '');
537
537
  if (map.get(url) === undefined) {
538
- map.forEach(function (value, key) {
539
- if (key.includes('/**') && url.includes(key.split('/**')[0]))
540
- return value;
541
- });
538
+ try {
539
+ for (var map_1 = __values(map), map_1_1 = map_1.next(); !map_1_1.done; map_1_1 = map_1.next()) {
540
+ var _b = __read(map_1_1.value, 2), key = _b[0], value = _b[1];
541
+ if (key.includes('/**') && url.includes(key.split('/**')[0]))
542
+ return value;
543
+ }
544
+ }
545
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
546
+ finally {
547
+ try {
548
+ if (map_1_1 && !map_1_1.done && (_a = map_1.return)) _a.call(map_1);
549
+ }
550
+ finally { if (e_1) throw e_1.error; }
551
+ }
542
552
  }
543
553
  return map.get(url);
544
554
  };
@@ -585,7 +595,7 @@
585
595
  * Calling this method with an empty array as argument is equivalent to calling the [get()]{@link ConfigurationService#get} method.
586
596
  */
587
597
  ConfigurationService.prototype.getConfigurationSubtree = function (pathSegments) {
588
- var e_1, _a;
598
+ var e_2, _a;
589
599
  var root = this.configuration;
590
600
  try {
591
601
  for (var pathSegments_1 = __values(pathSegments), pathSegments_1_1 = pathSegments_1.next(); !pathSegments_1_1.done; pathSegments_1_1 = pathSegments_1.next()) {
@@ -596,12 +606,12 @@
596
606
  root = root[segment];
597
607
  }
598
608
  }
599
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
609
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
600
610
  finally {
601
611
  try {
602
612
  if (pathSegments_1_1 && !pathSegments_1_1.done && (_a = pathSegments_1.return)) _a.call(pathSegments_1);
603
613
  }
604
- finally { if (e_1) throw e_1.error; }
614
+ finally { if (e_2) throw e_2.error; }
605
615
  }
606
616
  return this.deepCopy(root);
607
617
  };
@@ -689,6 +699,9 @@
689
699
  ConfigurationService.prototype.createConfigurationCopy = function () {
690
700
  return this.deepCopy(this.configuration);
691
701
  };
702
+ ConfigurationService.prototype.getViewsCopy = function () {
703
+ return this.getConfigurationSubtree(['views']);
704
+ };
692
705
  ConfigurationService.prototype.deepCopy = function (obj) {
693
706
  return JSON.parse(JSON.stringify(obj));
694
707
  };
@@ -6850,8 +6863,11 @@
6850
6863
  this.state.uploading = true;
6851
6864
  var fileFormData = new FormData();
6852
6865
  var fileToUpload = this.fileUploadEl.nativeElement.files.item(0);
6866
+ var data = {};
6867
+ data[this.resolveParentTaskId()] = this.dataField.stringId;
6853
6868
  fileFormData.append('file', fileToUpload);
6854
- this._taskResourceService.uploadFile(this.resolveParentTaskId(), this.dataField.stringId, fileFormData, false)
6869
+ fileFormData.append('data', new Blob([JSON.stringify(data)], { type: 'application/json' }));
6870
+ this._taskResourceService.uploadFile(this.taskId, this.dataField.stringId, fileFormData, false)
6855
6871
  .subscribe(function (response) {
6856
6872
  if (response.type && response.type === exports.ProgressType.UPLOAD) {
6857
6873
  _this.state.progress = response.progress;
@@ -6952,7 +6968,7 @@
6952
6968
  this._log.error('File cannot be deleted. No task is set to the field.');
6953
6969
  return;
6954
6970
  }
6955
- this._taskResourceService.deleteFile(this.resolveParentTaskId(), this.dataField.stringId).pipe(operators.take(1)).subscribe(function (response) {
6971
+ this._taskResourceService.deleteFile(this.taskId, this.dataField.stringId).pipe(operators.take(1)).subscribe(function (response) {
6956
6972
  if (response.success) {
6957
6973
  var filename = _this.dataField.value.name;
6958
6974
  _this.dataField.value = {};
@@ -7240,7 +7256,10 @@
7240
7256
  filesToUpload.forEach(function (fileToUpload) {
7241
7257
  fileFormData.append('files', fileToUpload);
7242
7258
  });
7243
- this._taskResourceService.uploadFile(this.resolveParentTaskId(), this.dataField.stringId, fileFormData, true)
7259
+ var data = {};
7260
+ data[this.resolveParentTaskId()] = this.dataField.stringId;
7261
+ fileFormData.append('data', new Blob([JSON.stringify(data)], { type: 'application/json' }));
7262
+ this._taskResourceService.uploadFile(this.taskId, this.dataField.stringId, fileFormData, true)
7244
7263
  .subscribe(function (response) {
7245
7264
  if (response.type && response.type === exports.ProgressType.UPLOAD) {
7246
7265
  _this.state.progress = response.progress;
@@ -7328,7 +7347,7 @@
7328
7347
  this._log.error('File cannot be deleted. No task is set to the field.');
7329
7348
  return;
7330
7349
  }
7331
- this._taskResourceService.deleteFile(this.resolveParentTaskId(), this.dataField.stringId, fileName).pipe(operators.take(1)).subscribe(function (response) {
7350
+ this._taskResourceService.deleteFile(this.taskId, this.dataField.stringId, fileName).pipe(operators.take(1)).subscribe(function (response) {
7332
7351
  if (response.success) {
7333
7352
  _this.uploadedFiles = _this.uploadedFiles.filter(function (uploadedFile) { return uploadedFile !== fileName; });
7334
7353
  if (_this.dataField.value.namesPaths) {
@@ -12889,6 +12908,7 @@
12889
12908
  function ProcessService(_petriNetResource, _log) {
12890
12909
  this._petriNetResource = _petriNetResource;
12891
12910
  this._log = _log;
12911
+ this.LATEST = 'latest';
12892
12912
  this._nets = {};
12893
12913
  this._netsSubject = new rxjs.Subject();
12894
12914
  this._netUpdate = new rxjs.Subject();
@@ -13119,7 +13139,7 @@
13119
13139
  ProcessService.prototype.loadNetReference = function (id) {
13120
13140
  var _this = this;
13121
13141
  var returnReference = new rxjs.ReplaySubject(1);
13122
- this._petriNetResource.getOne(id, '^').subscribe(function (reference) {
13142
+ this._petriNetResource.getOne(id, this.LATEST).subscribe(function (reference) {
13123
13143
  returnReference.next(!reference.stringId ? null : reference);
13124
13144
  returnReference.complete();
13125
13145
  return;
@@ -14368,7 +14388,7 @@
14368
14388
  this._spinnerOverlay.spin$.next(true);
14369
14389
  this.subSession = this._session.verifying.subscribe(function (active) {
14370
14390
  _this.userService.user$.subscribe(function (user) {
14371
- if (!!user.id && user.id.length > 0) {
14391
+ if (!!user && !!user.id && user.id.length > 0) {
14372
14392
  _this.redirect(!active);
14373
14393
  }
14374
14394
  });
@@ -29887,7 +29907,7 @@
29887
29907
  this._ownerGroups$ = new rxjs.BehaviorSubject([]);
29888
29908
  this._memberGroups$ = new rxjs.BehaviorSubject([]);
29889
29909
  this._userSub = this._userService.user$.pipe(operators.switchMap(function (user) {
29890
- if (user.id === '') {
29910
+ if (!user || user.id === '') {
29891
29911
  return rxjs.of([]);
29892
29912
  }
29893
29913
  var params = new http.HttpParams();