@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
@@ -54,7 +54,7 @@ import { CovalentTextEditorModule } from '@covalent/text-editor';
54
54
  import en$1 from '@angular/common/locales/en';
55
55
  import sk$1 from '@angular/common/locales/sk';
56
56
  import de$1 from '@angular/common/locales/de';
57
- import { __assign, __extends, __spread, __values, __read } from 'tslib';
57
+ import { __assign, __extends, __values, __read, __spread } from 'tslib';
58
58
  import { of, BehaviorSubject, throwError, ReplaySubject, Subject, Observable, forkJoin, combineLatest, timer, from } from 'rxjs';
59
59
  import { HttpHeaders, HttpErrorResponse, HttpClient, HttpParams, HttpEventType, HTTP_INTERCEPTORS, HttpClientModule, HttpResponse } from '@angular/common/http';
60
60
  import { AngularResizedEventModule } from 'angular-resize-event';
@@ -378,18 +378,28 @@ var ConfigurationService = /** @class */ (function () {
378
378
  * @return requested configuration if it exists. `undefined` otherwise.
379
379
  */
380
380
  ConfigurationService.prototype.getViewByUrl = function (url) {
381
- var config = this.createConfigurationCopy();
382
- var views = config.views;
381
+ var e_1, _a;
382
+ var views = this.getViewsCopy();
383
383
  if (!views) {
384
384
  return undefined;
385
385
  }
386
386
  var map = new Map();
387
387
  map = this.getChildren(views, map, '');
388
388
  if (map.get(url) === undefined) {
389
- map.forEach(function (value, key) {
390
- if (key.includes('/**') && url.includes(key.split('/**')[0]))
391
- return value;
392
- });
389
+ try {
390
+ for (var map_1 = __values(map), map_1_1 = map_1.next(); !map_1_1.done; map_1_1 = map_1.next()) {
391
+ var _b = __read(map_1_1.value, 2), key = _b[0], value = _b[1];
392
+ if (key.includes('/**') && url.includes(key.split('/**')[0]))
393
+ return value;
394
+ }
395
+ }
396
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
397
+ finally {
398
+ try {
399
+ if (map_1_1 && !map_1_1.done && (_a = map_1.return)) _a.call(map_1);
400
+ }
401
+ finally { if (e_1) throw e_1.error; }
402
+ }
393
403
  }
394
404
  return map.get(url);
395
405
  };
@@ -436,7 +446,7 @@ var ConfigurationService = /** @class */ (function () {
436
446
  * Calling this method with an empty array as argument is equivalent to calling the [get()]{@link ConfigurationService#get} method.
437
447
  */
438
448
  ConfigurationService.prototype.getConfigurationSubtree = function (pathSegments) {
439
- var e_1, _a;
449
+ var e_2, _a;
440
450
  var root = this.configuration;
441
451
  try {
442
452
  for (var pathSegments_1 = __values(pathSegments), pathSegments_1_1 = pathSegments_1.next(); !pathSegments_1_1.done; pathSegments_1_1 = pathSegments_1.next()) {
@@ -447,12 +457,12 @@ var ConfigurationService = /** @class */ (function () {
447
457
  root = root[segment];
448
458
  }
449
459
  }
450
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
460
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
451
461
  finally {
452
462
  try {
453
463
  if (pathSegments_1_1 && !pathSegments_1_1.done && (_a = pathSegments_1.return)) _a.call(pathSegments_1);
454
464
  }
455
- finally { if (e_1) throw e_1.error; }
465
+ finally { if (e_2) throw e_2.error; }
456
466
  }
457
467
  return this.deepCopy(root);
458
468
  };
@@ -540,6 +550,9 @@ var ConfigurationService = /** @class */ (function () {
540
550
  ConfigurationService.prototype.createConfigurationCopy = function () {
541
551
  return this.deepCopy(this.configuration);
542
552
  };
553
+ ConfigurationService.prototype.getViewsCopy = function () {
554
+ return this.getConfigurationSubtree(['views']);
555
+ };
543
556
  ConfigurationService.prototype.deepCopy = function (obj) {
544
557
  return JSON.parse(JSON.stringify(obj));
545
558
  };
@@ -6701,8 +6714,11 @@ var AbstractFileFieldComponent = /** @class */ (function (_super) {
6701
6714
  this.state.uploading = true;
6702
6715
  var fileFormData = new FormData();
6703
6716
  var fileToUpload = this.fileUploadEl.nativeElement.files.item(0);
6717
+ var data = {};
6718
+ data[this.resolveParentTaskId()] = this.dataField.stringId;
6704
6719
  fileFormData.append('file', fileToUpload);
6705
- this._taskResourceService.uploadFile(this.resolveParentTaskId(), this.dataField.stringId, fileFormData, false)
6720
+ fileFormData.append('data', new Blob([JSON.stringify(data)], { type: 'application/json' }));
6721
+ this._taskResourceService.uploadFile(this.taskId, this.dataField.stringId, fileFormData, false)
6706
6722
  .subscribe(function (response) {
6707
6723
  if (response.type && response.type === ProgressType.UPLOAD) {
6708
6724
  _this.state.progress = response.progress;
@@ -6803,7 +6819,7 @@ var AbstractFileFieldComponent = /** @class */ (function (_super) {
6803
6819
  this._log.error('File cannot be deleted. No task is set to the field.');
6804
6820
  return;
6805
6821
  }
6806
- this._taskResourceService.deleteFile(this.resolveParentTaskId(), this.dataField.stringId).pipe(take(1)).subscribe(function (response) {
6822
+ this._taskResourceService.deleteFile(this.taskId, this.dataField.stringId).pipe(take(1)).subscribe(function (response) {
6807
6823
  if (response.success) {
6808
6824
  var filename = _this.dataField.value.name;
6809
6825
  _this.dataField.value = {};
@@ -7091,7 +7107,10 @@ var AbstractFileListFieldComponent = /** @class */ (function (_super) {
7091
7107
  filesToUpload.forEach(function (fileToUpload) {
7092
7108
  fileFormData.append('files', fileToUpload);
7093
7109
  });
7094
- this._taskResourceService.uploadFile(this.resolveParentTaskId(), this.dataField.stringId, fileFormData, true)
7110
+ var data = {};
7111
+ data[this.resolveParentTaskId()] = this.dataField.stringId;
7112
+ fileFormData.append('data', new Blob([JSON.stringify(data)], { type: 'application/json' }));
7113
+ this._taskResourceService.uploadFile(this.taskId, this.dataField.stringId, fileFormData, true)
7095
7114
  .subscribe(function (response) {
7096
7115
  if (response.type && response.type === ProgressType.UPLOAD) {
7097
7116
  _this.state.progress = response.progress;
@@ -7179,7 +7198,7 @@ var AbstractFileListFieldComponent = /** @class */ (function (_super) {
7179
7198
  this._log.error('File cannot be deleted. No task is set to the field.');
7180
7199
  return;
7181
7200
  }
7182
- this._taskResourceService.deleteFile(this.resolveParentTaskId(), this.dataField.stringId, fileName).pipe(take(1)).subscribe(function (response) {
7201
+ this._taskResourceService.deleteFile(this.taskId, this.dataField.stringId, fileName).pipe(take(1)).subscribe(function (response) {
7183
7202
  if (response.success) {
7184
7203
  _this.uploadedFiles = _this.uploadedFiles.filter(function (uploadedFile) { return uploadedFile !== fileName; });
7185
7204
  if (_this.dataField.value.namesPaths) {
@@ -12740,6 +12759,7 @@ var ProcessService = /** @class */ (function () {
12740
12759
  function ProcessService(_petriNetResource, _log) {
12741
12760
  this._petriNetResource = _petriNetResource;
12742
12761
  this._log = _log;
12762
+ this.LATEST = 'latest';
12743
12763
  this._nets = {};
12744
12764
  this._netsSubject = new Subject();
12745
12765
  this._netUpdate = new Subject();
@@ -12970,7 +12990,7 @@ var ProcessService = /** @class */ (function () {
12970
12990
  ProcessService.prototype.loadNetReference = function (id) {
12971
12991
  var _this = this;
12972
12992
  var returnReference = new ReplaySubject(1);
12973
- this._petriNetResource.getOne(id, '^').subscribe(function (reference) {
12993
+ this._petriNetResource.getOne(id, this.LATEST).subscribe(function (reference) {
12974
12994
  returnReference.next(!reference.stringId ? null : reference);
12975
12995
  returnReference.complete();
12976
12996
  return;
@@ -14219,7 +14239,7 @@ var AbstractAuthenticationOverlay = /** @class */ (function () {
14219
14239
  this._spinnerOverlay.spin$.next(true);
14220
14240
  this.subSession = this._session.verifying.subscribe(function (active) {
14221
14241
  _this.userService.user$.subscribe(function (user) {
14222
- if (!!user.id && user.id.length > 0) {
14242
+ if (!!user && !!user.id && user.id.length > 0) {
14223
14243
  _this.redirect(!active);
14224
14244
  }
14225
14245
  });
@@ -29738,7 +29758,7 @@ var NextGroupService = /** @class */ (function () {
29738
29758
  this._ownerGroups$ = new BehaviorSubject([]);
29739
29759
  this._memberGroups$ = new BehaviorSubject([]);
29740
29760
  this._userSub = this._userService.user$.pipe(switchMap(function (user) {
29741
- if (user.id === '') {
29761
+ if (!user || user.id === '') {
29742
29762
  return of([]);
29743
29763
  }
29744
29764
  var params = new HttpParams();