@seniorsistemas/exclusion-process-component 0.3.1 → 0.4.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.
@@ -409,6 +409,7 @@
409
409
  this._processGroupColumns = [];
410
410
  this._processStepColumns = [];
411
411
  this.ngUnsubscribe = new rxjs.Subject();
412
+ this.subscriptionLoadProcess = null;
412
413
  }
413
414
  Object.defineProperty(ExclusionDetailsComponent.prototype, "isVisible", {
414
415
  get: function () {
@@ -509,6 +510,9 @@
509
510
  ExclusionDetailsComponent.prototype.getCloseButtonLabel = function () {
510
511
  return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_close");
511
512
  };
513
+ ExclusionDetailsComponent.prototype.getUpdateButtonLabel = function () {
514
+ return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_update");
515
+ };
512
516
  ExclusionDetailsComponent.prototype.getSummaryLabel = function () {
513
517
  return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_summary");
514
518
  };
@@ -583,14 +587,32 @@
583
587
  }
584
588
  return null;
585
589
  };
590
+ ExclusionDetailsComponent.prototype.updateDetails = function () {
591
+ if (!this._exclusionDetails) {
592
+ return;
593
+ }
594
+ this.loadProcessDetails(this._exclusionDetails);
595
+ };
596
+ ExclusionDetailsComponent.prototype.abortRunningLoadProcessCall = function () {
597
+ if (this.subscriptionLoadProcess) {
598
+ if (this.subscriptionLoadProcess.closed) {
599
+ this.subscriptionLoadProcess = null;
600
+ }
601
+ else {
602
+ this.subscriptionLoadProcess.unsubscribe();
603
+ this.subscriptionLoadProcess = null;
604
+ }
605
+ }
606
+ };
586
607
  ExclusionDetailsComponent.prototype.loadProcessDetails = function (details, firstLoad) {
587
608
  var _this = this;
588
609
  if (firstLoad === void 0) { firstLoad = false; }
589
610
  this._isLoading = true;
611
+ this.abortRunningLoadProcessCall();
590
612
  var processObservable = details.processId
591
613
  ? this.logicalDeleteService.getProcessDetails(details.processId)
592
614
  : this.logicalDeleteService.getLatestProcessDetails(details.recordId);
593
- processObservable
615
+ this.subscriptionLoadProcess = processObservable
594
616
  .pipe(operators.takeUntil(this.ngUnsubscribe))
595
617
  .pipe(operators.finalize(function () { return _this._isLoading = false; }))
596
618
  .subscribe(function (process) {
@@ -606,21 +628,20 @@
606
628
  .forEach(function (p) {
607
629
  _this.expandedRows[p.id] = true;
608
630
  });
609
- _this.checkIfProcessDone();
631
+ if (_this.isProcessFinished()) {
632
+ _this.disconnectWebSocket();
633
+ }
610
634
  if (!firstLoad) {
611
635
  _this.checkIfProcessWasSuccessuful();
612
636
  }
613
637
  });
614
638
  };
615
- ExclusionDetailsComponent.prototype.checkIfProcessDone = function () {
639
+ ExclusionDetailsComponent.prototype.isProcessFinished = function () {
616
640
  if (!this._processGroupData.length) {
617
- return;
641
+ return false;
618
642
  }
619
- var isProcessFinished = this._processGroupData
643
+ return this._processGroupData
620
644
  .every(function (p) { return p.status === EnumExclusionProcessStatus.ERROR || p.status === EnumExclusionProcessStatus.SUCCESS; });
621
- if (isProcessFinished) {
622
- this.disconnectWebSocket();
623
- }
624
645
  };
625
646
  ExclusionDetailsComponent.prototype.checkIfProcessWasSuccessuful = function () {
626
647
  var isProcessSuccessful = this._processGroupData
@@ -673,6 +694,9 @@
673
694
  .pipe(operators.takeUntil(this.ngUnsubscribe))
674
695
  .subscribe(function () {
675
696
  _this.startListeningWebhookEvents();
697
+ if (_this.processDetails && !_this.isProcessFinished()) {
698
+ _this.loadProcessDetails(_this._exclusionDetails);
699
+ }
676
700
  });
677
701
  };
678
702
  ExclusionDetailsComponent.prototype.startListeningWebhookEvents = function () {
@@ -680,9 +704,7 @@
680
704
  this._websocketService
681
705
  .onError()
682
706
  .pipe(operators.takeUntil(this.ngUnsubscribe))
683
- .subscribe(function (data) {
684
- console.error('onError', data);
685
- });
707
+ .subscribe(function (data) { return console.error('onWSError', data); });
686
708
  this._exclusionProcessStatusChangedSubscribe = this._websocketService
687
709
  .onEvent({
688
710
  domain: this.projectConfigs.getDomain(),
@@ -737,9 +759,9 @@
737
759
  ExclusionDetailsComponent = __decorate([
738
760
  core.Component({
739
761
  selector: "s-exclusion-details",
740
- 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",
762
+ 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-12 s-exclusion-details-footer\">\n <s-button [label]=\"getUpdateButtonLabel()\" priority=\"link\" (onClick)=\"updateDetails()\"></s-button>\n <s-button [label]=\"getCloseButtonLabel()\" priority=\"link\" (onClick)=\"closeDetails()\"></s-button>\n </div>\n </div>\n </s-footer>\n</s-sidebar>\n",
741
763
  encapsulation: core.ViewEncapsulation.None,
742
- 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}"]
764
+ 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}.s-exclusion-details-footer{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:justify;justify-content:space-between}"]
743
765
  })
744
766
  ], ExclusionDetailsComponent);
745
767
  return ExclusionDetailsComponent;
@@ -911,7 +933,7 @@
911
933
  .subscribe(function (queryParams) {
912
934
  _this.entityName = queryParams.entityName;
913
935
  _this.entityDescription = queryParams.entityDescription;
914
- _this.processId = queryParams.processId;
936
+ _this.processId = queryParams.processId || queryParams.pid;
915
937
  });
916
938
  };
917
939
  ExclusionsListComponent.prototype.ngAfterViewInit = function () {