@seniorsistemas/exclusion-process-component 0.2.1-d6a79e93-16a1-4705-a52d-6a12a465c189 → 0.3.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.
@@ -377,18 +377,36 @@
377
377
  return LogicalDeleteService;
378
378
  }());
379
379
 
380
+ var EXCLUSION_PROCESS_STATUS_BADGE = [
381
+ {
382
+ enumValue: EnumExclusionProcessStatus.ERROR,
383
+ color: angularComponents.EnumBadgeColors.RED
384
+ },
385
+ {
386
+ enumValue: EnumExclusionProcessStatus.PENDING,
387
+ color: angularComponents.EnumBadgeColors.YELLOW
388
+ },
389
+ {
390
+ enumValue: EnumExclusionProcessStatus.PROCESSING,
391
+ color: angularComponents.EnumBadgeColors.BLUE
392
+ },
393
+ {
394
+ enumValue: EnumExclusionProcessStatus.SUCCESS,
395
+ color: angularComponents.EnumBadgeColors.GREEN
396
+ }
397
+ ];
380
398
  var ExclusionDetailsComponent = /** @class */ (function () {
381
- function ExclusionDetailsComponent(router, route, translate, logicalDeleteService, projectConfigs) {
382
- this.router = router;
399
+ function ExclusionDetailsComponent(route, translate, logicalDeleteService, projectConfigs) {
383
400
  this.route = route;
384
401
  this.translate = translate;
385
402
  this.logicalDeleteService = logicalDeleteService;
386
403
  this.projectConfigs = projectConfigs;
387
- this._entityName = "";
404
+ this.expandedRows = {};
388
405
  this._isVisible = false;
389
406
  this._isLoading = false;
390
- this._processSummaryData = [];
391
- this._processSummaryColumns = [];
407
+ this._processGroupData = [];
408
+ this._processGroupColumns = [];
409
+ this._processStepColumns = [];
392
410
  this.ngUnsubscribe = new rxjs.Subject();
393
411
  }
394
412
  Object.defineProperty(ExclusionDetailsComponent.prototype, "isVisible", {
@@ -405,16 +423,23 @@
405
423
  enumerable: true,
406
424
  configurable: true
407
425
  });
408
- Object.defineProperty(ExclusionDetailsComponent.prototype, "processSummaryData", {
426
+ Object.defineProperty(ExclusionDetailsComponent.prototype, "processGroupData", {
427
+ get: function () {
428
+ return this._processGroupData;
429
+ },
430
+ enumerable: true,
431
+ configurable: true
432
+ });
433
+ Object.defineProperty(ExclusionDetailsComponent.prototype, "processGroupColumns", {
409
434
  get: function () {
410
- return this._processSummaryData;
435
+ return this._processGroupColumns;
411
436
  },
412
437
  enumerable: true,
413
438
  configurable: true
414
439
  });
415
- Object.defineProperty(ExclusionDetailsComponent.prototype, "processSummaryColumns", {
440
+ Object.defineProperty(ExclusionDetailsComponent.prototype, "processStepColumns", {
416
441
  get: function () {
417
- return this._processSummaryColumns;
442
+ return this._processStepColumns;
418
443
  },
419
444
  enumerable: true,
420
445
  configurable: true
@@ -426,7 +451,8 @@
426
451
  .subscribe(function (data) {
427
452
  _this.locale = data.localeConfig;
428
453
  });
429
- this._processSummaryColumns = this.getSummaryColumns();
454
+ this._processGroupColumns = this.getGroupColumns();
455
+ this._processStepColumns = this.getStepColumns();
430
456
  };
431
457
  ExclusionDetailsComponent.prototype.ngOnDestroy = function () {
432
458
  this.ngUnsubscribe.next();
@@ -435,9 +461,8 @@
435
461
  };
436
462
  ExclusionDetailsComponent.prototype.showDetails = function (details) {
437
463
  this._exclusionDetails = details;
438
- this._entityName = details.entityName;
439
464
  this._isVisible = true;
440
- this._processSummaryData = [];
465
+ this._processGroupData = [];
441
466
  this.processDetails = null;
442
467
  this.entityDescription = details.entityDescription;
443
468
  this.loadProcessDetails(details);
@@ -449,18 +474,9 @@
449
474
  ExclusionDetailsComponent.prototype.closeDetails = function () {
450
475
  this._isVisible = false;
451
476
  this._exclusionDetails = null;
452
- this._processSummaryData = [];
477
+ this._processGroupData = [];
453
478
  this.disconnectWebSocket();
454
479
  };
455
- ExclusionDetailsComponent.prototype.openExclusions = function () {
456
- this.closeDetails();
457
- this.router.navigate([this._entityName, "exclusions-list"], {
458
- queryParams: {
459
- entityName: this._entityName,
460
- entityDescription: this.entityDescription
461
- }
462
- });
463
- };
464
480
  ExclusionDetailsComponent.prototype.getRecordDescription = function () {
465
481
  var _a;
466
482
  if (!((_a = this.processDetails) === null || _a === void 0 ? void 0 : _a.description)) {
@@ -510,15 +526,15 @@
510
526
  ExclusionDetailsComponent.prototype.getEmptyStateDescription = function () {
511
527
  return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_empty_state_description");
512
528
  };
513
- ExclusionDetailsComponent.prototype.getSummaryColumns = function () {
529
+ ExclusionDetailsComponent.prototype.getGroupColumns = function () {
514
530
  return [
515
531
  {
516
532
  field: "description",
517
533
  attributes: ["description"],
518
- header: this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_description"),
534
+ header: this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_group"),
519
535
  type: angularComponents.EnumColumnFieldType.STRING,
520
536
  style: {
521
- width: "300px"
537
+ width: "340px"
522
538
  }
523
539
  },
524
540
  {
@@ -531,24 +547,32 @@
531
547
  width: "100px"
532
548
  },
533
549
  tooltip: this.getColumnStatusTooltip,
534
- badgeConfigs: [
535
- {
536
- enumValue: EnumExclusionProcessStatus.ERROR,
537
- color: angularComponents.EnumBadgeColors.RED
538
- },
539
- {
540
- enumValue: EnumExclusionProcessStatus.PENDING,
541
- color: angularComponents.EnumBadgeColors.YELLOW
542
- },
543
- {
544
- enumValue: EnumExclusionProcessStatus.PROCESSING,
545
- color: angularComponents.EnumBadgeColors.BLUE
546
- },
547
- {
548
- enumValue: EnumExclusionProcessStatus.SUCCESS,
549
- color: angularComponents.EnumBadgeColors.GREEN
550
- }
551
- ]
550
+ badgeConfigs: EXCLUSION_PROCESS_STATUS_BADGE
551
+ }
552
+ ];
553
+ };
554
+ ExclusionDetailsComponent.prototype.getStepColumns = function () {
555
+ return [
556
+ {
557
+ field: "description",
558
+ attributes: ["description"],
559
+ header: this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_step"),
560
+ type: angularComponents.EnumColumnFieldType.STRING,
561
+ style: {
562
+ width: "340px"
563
+ }
564
+ },
565
+ {
566
+ field: "status",
567
+ attributes: ["status"],
568
+ header: this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_status"),
569
+ type: angularComponents.EnumColumnFieldType.ENUM,
570
+ enumPrefix: this.projectConfigs.getTranslationPrefix() + ".logical_delete_enum_exclusion_process_status_",
571
+ style: {
572
+ width: "100px"
573
+ },
574
+ tooltip: this.getColumnStatusTooltip,
575
+ badgeConfigs: EXCLUSION_PROCESS_STATUS_BADGE
552
576
  }
553
577
  ];
554
578
  };
@@ -572,7 +596,14 @@
572
596
  return;
573
597
  }
574
598
  _this.processDetails = process;
575
- _this.loadProcessSummary(process);
599
+ _this._processGroupData = _this.sortGroupsByStartDate(process.groups)
600
+ .map(function (p) { return (__assign(__assign({}, p), { steps: _this.sortStepsByStartDate(p.steps) })); });
601
+ _this.expandedRows = {};
602
+ _this._processGroupData
603
+ .filter(function (p) { return p.status !== EnumExclusionProcessStatus.SUCCESS; })
604
+ .forEach(function (p) {
605
+ _this.expandedRows[p.id] = true;
606
+ });
576
607
  });
577
608
  };
578
609
  ExclusionDetailsComponent.prototype.sortByDate = function (startDate, finishDate) {
@@ -592,21 +623,6 @@
592
623
  var _this = this;
593
624
  return steps.sort(function (a, b) { return _this.sortByDate(a.startDate, b.finishDate); });
594
625
  };
595
- ExclusionDetailsComponent.prototype.loadProcessSummary = function (process) {
596
- var _this = this;
597
- var stepLogs = [];
598
- this.sortGroupsByStartDate(process.groups)
599
- .forEach(function (group) {
600
- var steps = _this.sortStepsByStartDate(group.steps)
601
- .map(function (step) { return ({
602
- description: step.description,
603
- status: step.status,
604
- errorMessage: step.errorMessage
605
- }); });
606
- stepLogs.push.apply(stepLogs, __spread(steps));
607
- });
608
- this._processSummaryData = stepLogs;
609
- };
610
626
  ExclusionDetailsComponent.prototype.disconnectWebSocket = function () {
611
627
  if (this._exclusionProcessStatusChangedSubscribe) {
612
628
  this._exclusionProcessStatusChangedSubscribe.unsubscribe();
@@ -657,7 +673,6 @@
657
673
  });
658
674
  };
659
675
  ExclusionDetailsComponent.ctorParameters = function () { return [
660
- { type: router.Router },
661
676
  { type: router.ActivatedRoute },
662
677
  { type: core$1.TranslateService },
663
678
  { type: LogicalDeleteService },
@@ -671,20 +686,26 @@
671
686
  ], ExclusionDetailsComponent.prototype, "isLoading", null);
672
687
  __decorate([
673
688
  core.Output()
674
- ], ExclusionDetailsComponent.prototype, "processSummaryData", null);
689
+ ], ExclusionDetailsComponent.prototype, "processGroupData", null);
675
690
  __decorate([
676
691
  core.Output()
677
- ], ExclusionDetailsComponent.prototype, "processSummaryColumns", null);
692
+ ], ExclusionDetailsComponent.prototype, "processGroupColumns", null);
693
+ __decorate([
694
+ core.Output()
695
+ ], ExclusionDetailsComponent.prototype, "processStepColumns", null);
678
696
  __decorate([
679
697
  core.Output()
680
698
  ], ExclusionDetailsComponent.prototype, "processDetails", void 0);
681
699
  __decorate([
682
700
  core.Output()
683
701
  ], ExclusionDetailsComponent.prototype, "entityDescription", void 0);
702
+ __decorate([
703
+ core.Output()
704
+ ], ExclusionDetailsComponent.prototype, "expandedRows", void 0);
684
705
  ExclusionDetailsComponent = __decorate([
685
706
  core.Component({
686
707
  selector: "s-exclusion-details",
687
- template: "<s-sidebar [visible]=\"isVisible\" (visibleChange)=\"onVisibilityChanged($event)\" [header]=\"getSidebarTitle()\">\n <s-loading-state [loading]=\"isLoading\">\n <p-panel [showHeader]=\"false\" styleClass=\"s-exclusion-details-record-details-panel\">\n <div class=\"s-exclusion-details-record-details-container\">\n <div class=\"s-exclusion-details-record-icon-background\">\n <em class=\"far fa-file-alt s-exclusion-details-record-icon\"></em>\n </div>\n\n <div class=\"s-exclusion-details-record-details-recordinfo\">\n <span class=\"s-exclusion-details-record-details-type\">\n {{entityDescription}}\n </span>\n <span>\n {{getRecordDescription()}}\n </span>\n </div>\n\n <div class=\"s-exclusion-details-record-details-dateinfo\">\n <span>\n {{getStartDateLabel()}}: {{getInicialDate()}}\n </span>\n <span *ngIf=\"isFinished()\">\n {{getFinishDateLabel()}}: {{getFinishDate()}}\n </span>\n </div>\n </div>\n </p-panel>\n\n <p-panel>\n <p-header>\n {{getSummaryLabel()}}\n </p-header>\n\n <s-empty-state\n *ngIf=\"processSummaryData && !processSummaryData.length\"\n [title]=\"getEmptyStateTitle()\"\n [description]=\"getEmptyStateDescription()\">\n [showPrimaryAction]=\"false\"\n </s-empty-state>\n\n <p-table\n [value]=\"processSummaryData\"\n [columns]=\"processSummaryColumns\"\n dataKey=\"id\"\n [lazy]=\"false\"\n [scrollable]=\"false\"\n [paginator]=\"false\"\n *ngIf=\"processSummaryData && processSummaryData.length\">\n\n <ng-template pTemplate=\"colgroup\" let-columns>\n <colgroup>\n <col *ngFor=\"let col of columns\"\n [style.width]=\"col.width\"\n />\n </colgroup>\n </ng-template>\n\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th *ngFor=\"let col of columns\"\n [id]=\"col.field\"\n [ngStyle]=\"col.style\"\n [pSortableColumn]=\"col.field\">\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.header }}</span>\n <p-sortIcon [field]=\"col.field\" ></p-sortIcon>\n </div>\n </th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\">\n <tr>\n <s-table-columns\n [columns]=\"columns\"\n [rowValue]=\"rowData\"\n [locale]=\"locale\">\n </s-table-columns>\n </tr>\n </ng-template>\n </p-table>\n </p-panel>\n </s-loading-state>\n\n <s-footer>\n <div class=\"ui-fluid\">\n <div class=\"ui-g\">\n <s-button [label]=\"getShowExclusionsButtonLabel()\" (onClick)=\"openExclusions()\"></s-button>\n <s-button [label]=\"getCloseButtonLabel()\" priority=\"link\" (onClick)=\"closeDetails()\"></s-button>\n </div>\n </div>\n </s-footer>\n</s-sidebar>\n",
708
+ template: "<s-sidebar [visible]=\"isVisible\" (visibleChange)=\"onVisibilityChanged($event)\" [header]=\"getSidebarTitle()\">\n <s-loading-state [loading]=\"isLoading\">\n <p-panel [showHeader]=\"false\" styleClass=\"s-exclusion-details-record-details-panel\">\n <div class=\"s-exclusion-details-record-details-container\">\n <div class=\"s-exclusion-details-record-icon-background\">\n <em class=\"far fa-file-alt s-exclusion-details-record-icon\"></em>\n </div>\n\n <div class=\"s-exclusion-details-record-details-recordinfo\">\n <span class=\"s-exclusion-details-record-details-type\">\n {{entityDescription}}\n </span>\n <span>\n {{getRecordDescription()}}\n </span>\n </div>\n\n <div class=\"s-exclusion-details-record-details-dateinfo\">\n <span>\n {{getStartDateLabel()}}: {{getInicialDate()}}\n </span>\n <span *ngIf=\"isFinished()\">\n {{getFinishDateLabel()}}: {{getFinishDate()}}\n </span>\n </div>\n </div>\n </p-panel>\n\n <p-panel>\n <p-header>\n {{getSummaryLabel()}}\n </p-header>\n\n <s-empty-state\n *ngIf=\"processGroupData && !processGroupData.length\"\n [title]=\"getEmptyStateTitle()\"\n [description]=\"getEmptyStateDescription()\">\n [showPrimaryAction]=\"false\"\n </s-empty-state>\n\n <p-table\n [value]=\"processGroupData\"\n [columns]=\"processGroupColumns\"\n dataKey=\"id\"\n [lazy]=\"false\"\n [scrollable]=\"false\"\n [paginator]=\"false\"\n *ngIf=\"processGroupData && processGroupData.length\"\n [expandedRowKeys]=\"expandedRows\">\n\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th id=\"expend-column\" style=\"width: 40px;\"></th>\n <th *ngFor=\"let col of columns\"\n [id]=\"col.field\"\n [ngStyle]=\"col.style\"\n [pSortableColumn]=\"col.field\">\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.header }}</span>\n <p-sortIcon [field]=\"col.field\" ></p-sortIcon>\n </div>\n </th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\" let-expanded=\"expanded\">\n <tr sNavigation [sRowToggler]=\"rowData\">\n <td style=\"width: 40px;\" tabindex=\"0\">\n <em class=\"fa fa-{{ expanded ? 'minus' : 'plus' }}\"></em>\n </td>\n <s-table-columns\n [columns]=\"columns\"\n [rowValue]=\"rowData\"\n [locale]=\"locale\">\n </s-table-columns>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"rowexpansion\" let-rowData let-columns=\"columns\">\n <tr class=\"sds-expanded-row\">\n <td [attr.colspan]=\"columns.length + 1\">\n <p-table \n [value]=\"rowData.steps\"\n [columns]=\"processStepColumns\"\n dataKey=\"id\"\n [paginator]=\"false\"\n [responsive]=\"true\"\n [scrollable]=\"false\"\n [lazy]=\"false\">\n\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th *ngFor=\"let col of columns\"\n [id]=\"col.field\"\n [ngStyle]=\"col.style\"\n [pSortableColumn]=\"col.field\">\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.header }}</span>\n <p-sortIcon [field]=\"col.field\" ></p-sortIcon>\n </div>\n </th>\n </tr>\n </ng-template>\n \n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\">\n <tr>\n <s-table-columns\n [columns]=\"columns\"\n [rowValue]=\"rowData\"\n [locale]=\"locale\">\n </s-table-columns>\n </tr>\n </ng-template>\n </p-table>\n </td>\n </tr>\n </ng-template>\n </p-table>\n </p-panel>\n </s-loading-state>\n\n <s-footer>\n <div class=\"ui-fluid\">\n <div class=\"ui-g\">\n <s-button [label]=\"getCloseButtonLabel()\" priority=\"link\" (onClick)=\"closeDetails()\"></s-button>\n </div>\n </div>\n </s-footer>\n</s-sidebar>\n",
688
709
  encapsulation: core.ViewEncapsulation.None,
689
710
  styles: [".s-exclusion-details-record-details-panel{margin-bottom:10px}.s-exclusion-details-record-details-container{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center}.s-exclusion-details-record-details-recordinfo{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;margin-left:10px;-ms-flex:1;flex:1}.s-exclusion-details-record-details-dateinfo{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;margin-left:10px;-ms-flex-align:end;align-items:flex-end;font-size:12px}.s-exclusion-details-record-details-type{color:#999}.s-exclusion-details-record-icon{font-size:22pt;color:#7e8d95}.s-exclusion-details-record-icon-background{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:16px;background-color:#c1cad1;border-radius:50%;height:60px;width:60px}"]
690
711
  })
@@ -824,7 +845,8 @@
824
845
  var HTTP_CODE_SERVER_ERROR_START = 500;
825
846
  var HTTP_CODE_SERVER_ERROR_END = 600;
826
847
  var ExclusionsListComponent = /** @class */ (function () {
827
- function ExclusionsListComponent(route, translate, formBuilder, changeDetectorRef, logicalDeleteService, filterService, projectConfigs, cdr) {
848
+ function ExclusionsListComponent(router, route, translate, formBuilder, changeDetectorRef, logicalDeleteService, filterService, projectConfigs, cdr) {
849
+ this.router = router;
828
850
  this.route = route;
829
851
  this.translate = translate;
830
852
  this.formBuilder = formBuilder;
@@ -871,6 +893,13 @@
871
893
  }
872
894
  };
873
895
  ExclusionsListComponent.prototype.ngOnDestroy = function () {
896
+ var _a;
897
+ var params = __assign({}, (_a = this.route.snapshot) === null || _a === void 0 ? void 0 : _a.queryParams);
898
+ if (params) {
899
+ delete params.entityName;
900
+ delete params.entityDescription;
901
+ this.router.navigate([], { queryParams: params });
902
+ }
874
903
  this.ngUnsubscribe.next();
875
904
  this.ngUnsubscribe.complete();
876
905
  };
@@ -878,8 +907,8 @@
878
907
  return this.formBuilder.group({
879
908
  description: [undefined, forms.Validators.compose([])],
880
909
  status: [undefined, forms.Validators.compose([])],
881
- startDate: [{ value: undefined, disabled: false }, forms.Validators.compose([])],
882
- endDate: [{ value: undefined, disabled: false }, forms.Validators.compose([])]
910
+ startDate: [{ value: null, disabled: false }, forms.Validators.compose([])],
911
+ endDate: [{ value: null, disabled: false }, forms.Validators.compose([])]
883
912
  });
884
913
  };
885
914
  ExclusionsListComponent.prototype.getGridColumns = function () {
@@ -1152,6 +1181,7 @@
1152
1181
  var ExclusionsListComponent_1;
1153
1182
  ExclusionsListComponent.DATE_FORMAT = "YYYY-MM-DD";
1154
1183
  ExclusionsListComponent.ctorParameters = function () { return [
1184
+ { type: router.Router },
1155
1185
  { type: router.ActivatedRoute },
1156
1186
  { type: core$1.TranslateService },
1157
1187
  { type: forms.FormBuilder },