@seniorsistemas/exclusion-process-component 0.1.0 → 0.2.1-2d8fcb05-679c-44e2-bb03-d0034a226dc9

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/seniorsistemas-exclusion-process-component.umd.js +127 -36
  2. package/bundles/seniorsistemas-exclusion-process-component.umd.js.map +1 -1
  3. package/bundles/seniorsistemas-exclusion-process-component.umd.min.js +2 -2
  4. package/bundles/seniorsistemas-exclusion-process-component.umd.min.js.map +1 -1
  5. package/esm2015/exclusion-details/exclusion-details.component.js +88 -10
  6. package/esm2015/exclusion-details/protocols/exclusion-process-status-changed.js +1 -0
  7. package/esm2015/exclusion-details/protocols/web-socket-event-data.js +1 -0
  8. package/esm2015/exclusions-list/exclusions-list.component.js +23 -15
  9. package/esm2015/exclusions-list/exclusions-list.routing.js +2 -2
  10. package/esm2015/services/logical-delete.service.js +10 -11
  11. package/esm5/exclusion-details/exclusion-details.component.js +93 -10
  12. package/esm5/exclusion-details/protocols/exclusion-process-status-changed.js +1 -0
  13. package/esm5/exclusion-details/protocols/web-socket-event-data.js +1 -0
  14. package/esm5/exclusions-list/exclusions-list.component.js +24 -16
  15. package/esm5/exclusions-list/exclusions-list.routing.js +2 -2
  16. package/esm5/services/logical-delete.service.js +13 -12
  17. package/exclusion-details/exclusion-details.component.d.ts +11 -1
  18. package/exclusion-details/protocols/exclusion-process-status-changed.d.ts +8 -0
  19. package/exclusion-details/protocols/web-socket-event-data.d.ts +6 -0
  20. package/exclusions-list/exclusions-list.component.d.ts +6 -4
  21. package/fesm2015/seniorsistemas-exclusion-process-component.js +117 -32
  22. package/fesm2015/seniorsistemas-exclusion-process-component.js.map +1 -1
  23. package/fesm5/seniorsistemas-exclusion-process-component.js +126 -34
  24. package/fesm5/seniorsistemas-exclusion-process-component.js.map +1 -1
  25. package/package.json +14 -6
  26. package/seniorsistemas-exclusion-process-component.metadata.json +1 -1
  27. package/services/logical-delete.service.d.ts +1 -1
@@ -6,10 +6,11 @@ import { TableModule } from 'primeng/table';
6
6
  import { EnumColumnFieldType, EnumBadgeColors, SidebarModule, ButtonModule, TableModule as TableModule$1, LoadingStateModule, LocaleModule, EmptyStateModule, FieldType, FormField, LocaleService, ControlErrorsModule, InfoSignModule, DynamicFormModule, TokenListModule } from '@seniorsistemas/angular-components';
7
7
  import * as moment from 'moment';
8
8
  import { Router, ActivatedRoute, RouterModule } from '@angular/router';
9
+ import { TranslateService, TranslateModule } from '@ngx-translate/core';
9
10
  import { throwError, Subject } from 'rxjs';
10
11
  import { catchError, map, takeUntil, finalize } from 'rxjs/operators';
12
+ import { WebsocketService } from '@senior-gestao-empresarial/angular-components';
11
13
  import { HttpParams, HttpClient } from '@angular/common/http';
12
- import { TranslateService, TranslateModule } from '@ngx-translate/core';
13
14
  import { MessageService } from 'primeng/api';
14
15
  import { Validators, FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms';
15
16
  import { DialogModule } from 'primeng/dialog';
@@ -62,7 +63,6 @@ let LogicalDeleteService = class LogicalDeleteService {
62
63
  this.projectConfigs = projectConfigs;
63
64
  const entityUrl = `${projectConfigs.getDomain()}/${projectConfigs.getService()}`;
64
65
  this.exclusionProcessUrl = `${entityUrl}/entities/exclusionProcess`;
65
- this.listExclusionsUrl = `${entityUrl}/entities/exclusionProcess`;
66
66
  this.defaultCatch = this.defaultCatch.bind(this);
67
67
  }
68
68
  defaultCatch() {
@@ -131,9 +131,16 @@ let LogicalDeleteService = class LogicalDeleteService {
131
131
  if (!((_a = value.contents) === null || _a === void 0 ? void 0 : _a.length)) {
132
132
  return null;
133
133
  }
134
- return value.contents[0];
134
+ return this.mapExclusionsDates(value.contents[0]);
135
135
  }));
136
136
  }
137
+ mapExclusionsDates(exclusionProcess) {
138
+ var _a;
139
+ return Object.assign(Object.assign({}, exclusionProcess), { startDate: exclusionProcess.startDate ? moment(exclusionProcess.startDate).toDate() : null, finishDate: exclusionProcess.finishDate ? moment(exclusionProcess.finishDate).toDate() : null, groups: (_a = exclusionProcess.groups) === null || _a === void 0 ? void 0 : _a.map(group => {
140
+ var _a;
141
+ return (Object.assign(Object.assign({}, group), { startDate: group.startDate ? moment(group.startDate).toDate() : null, finishDate: group.finishDate ? moment(group.finishDate).toDate() : null, steps: (_a = group.steps) === null || _a === void 0 ? void 0 : _a.map(step => (Object.assign(Object.assign({}, step), { startDate: step.startDate ? moment(step.startDate).toDate() : null, finishDate: step.finishDate ? moment(step.finishDate).toDate() : null }))) }));
142
+ }) });
143
+ }
137
144
  listExclusions(entityName, params = {}) {
138
145
  if (params.filterQuery) {
139
146
  params.filterQuery += ` and lower(entityName) eq lower('${entityName}')`;
@@ -144,14 +151,7 @@ let LogicalDeleteService = class LogicalDeleteService {
144
151
  return this.http.get(this.exclusionProcessUrl, { params: this.getListQueryParams(params) })
145
152
  .pipe(this.defaultCatch())
146
153
  .pipe(map(value => {
147
- value.contents.forEach(p => {
148
- if (p.startDate) {
149
- p.startDate = moment(p.startDate).toDate();
150
- }
151
- if (p.finishDate) {
152
- p.finishDate = moment(p.finishDate).toDate();
153
- }
154
- });
154
+ value.contents = value.contents.map(this.mapExclusionsDates);
155
155
  return value;
156
156
  }));
157
157
  }
@@ -203,22 +203,32 @@ let ExclusionDetailsComponent = class ExclusionDetailsComponent {
203
203
  ngOnDestroy() {
204
204
  this.ngUnsubscribe.next();
205
205
  this.ngUnsubscribe.complete();
206
+ this.disconnectWebSocket();
206
207
  }
207
208
  showDetails(details) {
208
- this.processDetails = null;
209
+ this._exclusionDetails = details;
209
210
  this._entityName = details.entityName;
210
211
  this._isVisible = true;
211
212
  this._processSummaryData = [];
213
+ this.processDetails = null;
212
214
  this.entityDescription = details.entityDescription;
213
215
  this.loadProcessDetails(details);
216
+ this.connectWebSocket();
217
+ }
218
+ onVisibilityChanged(event) {
219
+ this.closeDetails();
214
220
  }
215
221
  closeDetails() {
216
222
  this._isVisible = false;
223
+ this._exclusionDetails = null;
224
+ this._processSummaryData = [];
225
+ this.disconnectWebSocket();
217
226
  }
218
227
  openExclusions() {
219
228
  this.closeDetails();
220
- this.router.navigate(["exclusions-list", this._entityName], {
229
+ this.router.navigate([], {
221
230
  queryParams: {
231
+ entityName: this._entityName,
222
232
  entityDescription: this.entityDescription
223
233
  }
224
234
  });
@@ -235,14 +245,14 @@ let ExclusionDetailsComponent = class ExclusionDetailsComponent {
235
245
  if (!((_a = this.processDetails) === null || _a === void 0 ? void 0 : _a.startDate)) {
236
246
  return "";
237
247
  }
238
- return moment(this.processDetails.startDate).format("DD/MM/YYYY HH:mm");
248
+ return moment(this.processDetails.startDate).format("DD/MM/YYYY HH:mm:ss");
239
249
  }
240
250
  getFinishDate() {
241
251
  var _a;
242
252
  if (!((_a = this.processDetails) === null || _a === void 0 ? void 0 : _a.finishDate)) {
243
253
  return "";
244
254
  }
245
- return moment(this.processDetails.finishDate).format("DD/MM/YYYY HH:mm");
255
+ return moment(this.processDetails.finishDate).format("DD/MM/YYYY HH:mm:ss");
246
256
  }
247
257
  isFinished() {
248
258
  var _a;
@@ -329,14 +339,34 @@ let ExclusionDetailsComponent = class ExclusionDetailsComponent {
329
339
  .pipe(takeUntil(this.ngUnsubscribe))
330
340
  .pipe(finalize(() => this._isLoading = false))
331
341
  .subscribe((process) => {
342
+ if (!process) {
343
+ return;
344
+ }
332
345
  this.processDetails = process;
333
346
  this.loadProcessSummary(process);
334
347
  });
335
348
  }
349
+ sortByDate(startDate, finishDate) {
350
+ if (startDate.getTime() > finishDate.getTime()) {
351
+ return 1;
352
+ }
353
+ if (startDate.getTime() < finishDate.getTime()) {
354
+ return -1;
355
+ }
356
+ return 0;
357
+ }
358
+ sortGroupsByStartDate(groups) {
359
+ return groups.sort((a, b) => this.sortByDate(a.startDate, b.finishDate));
360
+ }
361
+ sortStepsByStartDate(steps) {
362
+ return steps.sort((a, b) => this.sortByDate(a.startDate, b.finishDate));
363
+ }
336
364
  loadProcessSummary(process) {
337
365
  const stepLogs = [];
338
- process.groups.forEach(group => {
339
- const steps = group.steps.map(step => ({
366
+ this.sortGroupsByStartDate(process.groups)
367
+ .forEach(group => {
368
+ const steps = this.sortStepsByStartDate(group.steps)
369
+ .map(step => ({
340
370
  description: step.description,
341
371
  status: step.status,
342
372
  errorMessage: step.errorMessage
@@ -345,6 +375,53 @@ let ExclusionDetailsComponent = class ExclusionDetailsComponent {
345
375
  });
346
376
  this._processSummaryData = stepLogs;
347
377
  }
378
+ disconnectWebSocket() {
379
+ if (this._exclusionProcessStatusChangedSubscribe) {
380
+ this._exclusionProcessStatusChangedSubscribe.unsubscribe();
381
+ this._exclusionProcessStatusChangedSubscribe = null;
382
+ }
383
+ if (this._websocketService) {
384
+ this._websocketService.disconnect();
385
+ this._websocketService = null;
386
+ }
387
+ }
388
+ connectWebSocket() {
389
+ if (this._websocketService) {
390
+ this.disconnectWebSocket();
391
+ }
392
+ this._websocketService = new WebsocketService();
393
+ this._websocketService
394
+ .onConnect()
395
+ .pipe(takeUntil(this.ngUnsubscribe))
396
+ .subscribe(() => {
397
+ this.startListeningWebhookEvents();
398
+ });
399
+ }
400
+ startListeningWebhookEvents() {
401
+ this._websocketService
402
+ .onError()
403
+ .pipe(takeUntil(this.ngUnsubscribe))
404
+ .subscribe((data) => {
405
+ console.error('onError', data);
406
+ });
407
+ this._exclusionProcessStatusChangedSubscribe = this._websocketService
408
+ .onEvent({
409
+ domain: this.projectConfigs.getDomain(),
410
+ service: this.projectConfigs.getService(),
411
+ primitive: "exclusionProcessStatusChanged"
412
+ })
413
+ .pipe(takeUntil(this.ngUnsubscribe))
414
+ .subscribe((event) => {
415
+ const { data } = event;
416
+ if (this._exclusionDetails.processId && data.pid === this._exclusionDetails.processId) {
417
+ this.loadProcessDetails(this._exclusionDetails);
418
+ return;
419
+ }
420
+ if (this._exclusionDetails.recordId && data.recordId === this._exclusionDetails.recordId) {
421
+ this.loadProcessDetails(this._exclusionDetails);
422
+ }
423
+ });
424
+ }
348
425
  };
349
426
  ExclusionDetailsComponent.ctorParameters = () => [
350
427
  { type: Router },
@@ -374,7 +451,7 @@ __decorate([
374
451
  ExclusionDetailsComponent = __decorate([
375
452
  Component({
376
453
  selector: "s-exclusion-details",
377
- template: "<s-sidebar [visible]=\"isVisible\" (visibleChange)=\"closeDetails()\" [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",
454
+ 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",
378
455
  encapsulation: ViewEncapsulation.None,
379
456
  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}"]
380
457
  })
@@ -505,7 +582,7 @@ var ExclusionsListComponent_1;
505
582
  const HTTP_CODE_SERVER_ERROR_START = 500;
506
583
  const HTTP_CODE_SERVER_ERROR_END = 600;
507
584
  let ExclusionsListComponent = ExclusionsListComponent_1 = class ExclusionsListComponent {
508
- constructor(route, translate, formBuilder, changeDetectorRef, logicalDeleteService, filterService, projectConfigs) {
585
+ constructor(route, translate, formBuilder, changeDetectorRef, logicalDeleteService, filterService, projectConfigs, cdr) {
509
586
  this.route = route;
510
587
  this.translate = translate;
511
588
  this.formBuilder = formBuilder;
@@ -513,6 +590,7 @@ let ExclusionsListComponent = ExclusionsListComponent_1 = class ExclusionsListCo
513
590
  this.logicalDeleteService = logicalDeleteService;
514
591
  this.filterService = filterService;
515
592
  this.projectConfigs = projectConfigs;
593
+ this.cdr = cdr;
516
594
  this.currentListParams = { page: 0, size: 10, sort: [], filterData: {} };
517
595
  this.showLoader = false;
518
596
  this.totalRecords = 0;
@@ -530,27 +608,22 @@ let ExclusionsListComponent = ExclusionsListComponent_1 = class ExclusionsListCo
530
608
  .subscribe((data) => {
531
609
  this.locale = data.localeConfig;
532
610
  });
533
- this.route.params
534
- .pipe(takeUntil(this.ngUnsubscribe))
535
- .subscribe((params) => {
536
- this.entityName = params.entityName;
537
- this.showBasedOnRoute();
538
- });
539
611
  this.route.queryParams
540
612
  .pipe(takeUntil(this.ngUnsubscribe))
541
613
  .subscribe((queryParams) => {
614
+ this.entityName = queryParams.entityName;
542
615
  this.entityDescription = queryParams.entityDescription;
543
616
  this.processId = queryParams.processId;
544
- this.showBasedOnRoute();
545
617
  });
546
618
  }
547
- showBasedOnRoute() {
619
+ ngAfterViewInit() {
548
620
  if (this.entityName && this.entityDescription && this.processId) {
549
621
  this.exclusionDetailsComponent.showDetails({
550
622
  processId: this.processId,
551
623
  entityDescription: this.entityDescription,
552
624
  entityName: this.entityName
553
625
  });
626
+ this.cdr.detectChanges();
554
627
  }
555
628
  }
556
629
  ngOnDestroy() {
@@ -585,6 +658,7 @@ let ExclusionsListComponent = ExclusionsListComponent_1 = class ExclusionsListCo
585
658
  style: {
586
659
  width: "100px"
587
660
  },
661
+ tooltip: this.getColumnStatusTooltip,
588
662
  badgeConfigs: [
589
663
  {
590
664
  enumValue: EnumExclusionProcessStatus.ERROR,
@@ -609,7 +683,7 @@ let ExclusionsListComponent = ExclusionsListComponent_1 = class ExclusionsListCo
609
683
  attributes: ["startDate"],
610
684
  header: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_start`),
611
685
  type: EnumColumnFieldType.DATE,
612
- dateFormat: "DD/MM/YYYY HH:mm",
686
+ dateFormat: "DD/MM/YYYY HH:mm:ss",
613
687
  style: {
614
688
  width: "100px"
615
689
  }
@@ -619,13 +693,19 @@ let ExclusionsListComponent = ExclusionsListComponent_1 = class ExclusionsListCo
619
693
  attributes: ["finishDate"],
620
694
  header: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_finish`),
621
695
  type: EnumColumnFieldType.DATE,
622
- dateFormat: "DD/MM/YYYY HH:mm",
696
+ dateFormat: "DD/MM/YYYY HH:mm:ss",
623
697
  style: {
624
698
  width: "100px"
625
699
  }
626
700
  }
627
701
  ];
628
702
  }
703
+ getColumnStatusTooltip(rowValue) {
704
+ if (rowValue.errorMessage) {
705
+ return rowValue.errorMessage;
706
+ }
707
+ return null;
708
+ }
629
709
  getFilterFields() {
630
710
  const translationPrefix = this.projectConfigs.getTranslationPrefix();
631
711
  return [
@@ -768,8 +848,12 @@ let ExclusionsListComponent = ExclusionsListComponent_1 = class ExclusionsListCo
768
848
  const filterQuery = this.getFilterQuery();
769
849
  const displayFields = [
770
850
  "recordId",
851
+ "errorMessage",
771
852
  ...this.gridColumns.map(column => column.field)
772
853
  ];
854
+ if (!sort.length) {
855
+ sort.push({ field: 'startDate', order: -1 });
856
+ }
773
857
  this.listExclusions({ page, size, sort, filterQuery, displayFields });
774
858
  }
775
859
  listExclusions(params) {
@@ -818,7 +902,8 @@ ExclusionsListComponent.ctorParameters = () => [
818
902
  { type: ChangeDetectorRef },
819
903
  { type: LogicalDeleteService },
820
904
  { type: FilterService },
821
- { type: LogicalDeleteConfigService }
905
+ { type: LogicalDeleteConfigService },
906
+ { type: ChangeDetectorRef }
822
907
  ];
823
908
  __decorate([
824
909
  ViewChild("exclusionsTable")
@@ -828,7 +913,7 @@ __decorate([
828
913
  ], ExclusionsListComponent.prototype, "exclusionDetailsComponent", void 0);
829
914
  ExclusionsListComponent = ExclusionsListComponent_1 = __decorate([
830
915
  Component({
831
- template: "<div>\n <form [formGroup]=\"filterFormGroup\" autocomplete=\"off\">\n <p-panel\n *sLoadingState=\"showLoader\"\n styleClass=\"form-group\"\n [toggleable]=\"true\"\n [(collapsed)]=\"filtersPanelCollapsed\"\n (onAfterToggle)=\"focusInput('description')\"\n >\n <p-header>\n {{ getFiltersTitle() }}\n <s-token-list\n [tokens]=\"searchTokens\"\n (tokenRemoved)=\"onRemoveToken($event)\"\n [removableTokens]=\"true\"\n ></s-token-list>\n </p-header>\n <div>\n <s-dynamic-form\n [fields]=\"filterFields\"\n [form]=\"filterFormGroup\"\n [errorMessages]=\"{ pattern: getErrorInvalid() }\"\n ></s-dynamic-form>\n </div>\n <p-footer>\n <div class=\"ui-g\">\n <div class=\"ui-g-12\">\n <button\n id=\"filter-button\"\n class=\"ui-button\"\n type=\"submit\"\n pButton\n [label]=\"getFilterButtonTitle()\"\n (click)=\"onSearch()\"\n ></button>\n <button\n id=\"clear-button\"\n class=\"ui-button ui-button-link\"\n type=\"button\"\n pButton\n [label]=\"getClearButtonTitle()\"\n (click)=\"onClear()\"\n ></button>\n </div>\n </div>\n </p-footer>\n </p-panel>\n </form>\n <p-panel *sLoadingState=\"showLoader\">\n <p-header>\n {{ getTitle() }}\n </p-header>\n <ng-container>\n <s-empty-state\n *ngIf=\"serverError && !showLoader\"\n iconClass=\"fa fa-exclamation-triangle\"\n title=\"{{ getErrorServerTitle() | translate }}\"\n primaryActionLabel=\"{{ 'error_server_try_again' | translate }}\"\n (primaryAction)=\"resetGrid()\"\n description=\"{{ getErrorServerDescription() | translate }}\"\n ></s-empty-state>\n\n <s-empty-state\n *ngIf=\"!showLoader && !serverError && totalRecords === 0\"\n [title]=\"getEmptyStateTitle()\"\n [showPrimaryAction]=\"false\"\n [description]=\"getEmptyStateDescription()\"\n ></s-empty-state>\n\n <div class=\"ui-g\">\n <div class=\"ui-g-12\">\n <p-table\n #exclusionsTable\n id=\"exclusionsTable\"\n [hidden]=\"totalRecords === 0 || serverError\"\n [value]=\"gridData\"\n [columns]=\"gridColumns\"\n dataKey=\"id\"\n [lazy]=\"true\"\n [scrollable]=\"true\"\n [resizableColumns]=\"true\"\n sortMode=\"multiple\"\n [paginator]=\"true\"\n [totalRecords]=\"totalRecords\"\n [rows]=\"10\"\n rows=\"10\"\n [rowsPerPageOptions]=\"[10, 20, 50, 100]\"\n (onLazyLoad)=\"onGridChange($event)\"\n >\n <ng-template pTemplate=\"colgroup\" let-columns>\n <colgroup>\n <col\n *ngFor=\"let col of columns\"\n [style.width]=\"col.width\"\n />\n </colgroup>\n </ng-template>\n\n <ng-template\n pTemplate=\"header\"\n let-columns\n >\n <tr>\n <th *ngFor=\"let col of columns\"\n [id]=\"col.field\"\n [pSortableColumn]=\"col.field\"\n [ngStyle]=\"col.style\"\n pResizableColumn\n >\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">\n {{ col.header }}\n </span>\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\n </div>\n </th>\n <th id=\"action-column\" style=\"width: 100px\">\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ getActionsColumnLabel() }}</span>\n </div>\n </th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\">\n <tr [pSelectableRow]=\"rowData\">\n <s-table-columns\n [columns]=\"columns\"\n [rowValue]=\"rowData\"\n [locale]=\"locale\">\n </s-table-columns>\n <td style=\"width: 100px\">\n <s-button\n id=\"details-button\"\n priority=\"default\"\n [label]=\"getDetailsButtonTitle()\"\n [auxiliary]=\"true\"\n (onClick)=\"onClickDetails(rowData)\">\n </s-button>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"paginatorright\">\n <s-table-paging\n [table]=\"exclusionsTable\"\n [totalRecords]=\"totalRecords\"\n ></s-table-paging>\n </ng-template>\n </p-table>\n </div>\n </div>\n </ng-container>\n </p-panel>\n</div>\n\n<s-exclusion-details></s-exclusion-details>\n",
916
+ template: "<div>\n <form [formGroup]=\"filterFormGroup\" autocomplete=\"off\">\n <p-panel\n *sLoadingState=\"showLoader\"\n styleClass=\"form-group\"\n [toggleable]=\"true\"\n [(collapsed)]=\"filtersPanelCollapsed\"\n (onAfterToggle)=\"focusInput('description')\"\n >\n <p-header>\n {{ getFiltersTitle() }}\n <s-token-list\n [tokens]=\"searchTokens\"\n (tokenRemoved)=\"onRemoveToken($event)\"\n [removableTokens]=\"true\"\n ></s-token-list>\n </p-header>\n <div>\n <s-dynamic-form\n [fields]=\"filterFields\"\n [form]=\"filterFormGroup\"\n [errorMessages]=\"{ pattern: getErrorInvalid() }\"\n ></s-dynamic-form>\n </div>\n <p-footer>\n <div class=\"ui-g\">\n <div class=\"ui-g-12\">\n <button\n id=\"filter-button\"\n class=\"ui-button\"\n type=\"submit\"\n pButton\n [label]=\"getFilterButtonTitle()\"\n (click)=\"onSearch()\"\n ></button>\n <button\n id=\"clear-button\"\n class=\"ui-button ui-button-link\"\n type=\"button\"\n pButton\n [label]=\"getClearButtonTitle()\"\n (click)=\"onClear()\"\n ></button>\n </div>\n </div>\n </p-footer>\n </p-panel>\n </form>\n <p-panel *sLoadingState=\"showLoader\">\n <p-header>\n {{ getTitle() }}\n </p-header>\n <ng-container>\n <s-empty-state\n *ngIf=\"serverError && !showLoader\"\n iconClass=\"fa fa-exclamation-triangle\"\n title=\"{{ getErrorServerTitle() | translate }}\"\n primaryActionLabel=\"{{ 'error_server_try_again' | translate }}\"\n (primaryAction)=\"resetGrid()\"\n description=\"{{ getErrorServerDescription() | translate }}\"\n ></s-empty-state>\n\n <s-empty-state\n *ngIf=\"!showLoader && !serverError && totalRecords === 0\"\n [title]=\"getEmptyStateTitle()\"\n [showPrimaryAction]=\"false\"\n [description]=\"getEmptyStateDescription()\"\n ></s-empty-state>\n\n <div class=\"ui-g\">\n <div class=\"ui-g-12\">\n <p-table\n #exclusionsTable\n id=\"exclusionsTable\"\n [hidden]=\"totalRecords === 0 || serverError\"\n [value]=\"gridData\"\n [columns]=\"gridColumns\"\n dataKey=\"id\"\n [lazy]=\"true\"\n [scrollable]=\"true\"\n [resizableColumns]=\"true\"\n sortMode=\"multiple\"\n [paginator]=\"true\"\n [totalRecords]=\"totalRecords\"\n [rows]=\"10\"\n sortField=\"startDate\"\n sortOrder=\"-1\"\n rows=\"10\"\n [rowsPerPageOptions]=\"[10, 20, 50, 100]\"\n (onLazyLoad)=\"onGridChange($event)\"\n >\n <ng-template pTemplate=\"colgroup\" let-columns>\n <colgroup>\n <col\n *ngFor=\"let col of columns\"\n [style.width]=\"col.width\"\n />\n </colgroup>\n </ng-template>\n\n <ng-template\n pTemplate=\"header\"\n let-columns\n >\n <tr>\n <th *ngFor=\"let col of columns\"\n [id]=\"col.field\"\n [pSortableColumn]=\"col.field\"\n [ngStyle]=\"col.style\"\n pResizableColumn\n >\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">\n {{ col.header }}\n </span>\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\n </div>\n </th>\n <th id=\"action-column\" style=\"width: 100px\">\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ getActionsColumnLabel() }}</span>\n </div>\n </th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\">\n <tr [pSelectableRow]=\"rowData\">\n <s-table-columns\n [columns]=\"columns\"\n [rowValue]=\"rowData\"\n [locale]=\"locale\">\n </s-table-columns>\n <td style=\"width: 100px\">\n <s-button\n id=\"details-button\"\n priority=\"default\"\n [label]=\"getDetailsButtonTitle()\"\n [auxiliary]=\"true\"\n (onClick)=\"onClickDetails(rowData)\">\n </s-button>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"paginatorright\">\n <s-table-paging\n [table]=\"exclusionsTable\"\n [totalRecords]=\"totalRecords\"\n ></s-table-paging>\n </ng-template>\n </p-table>\n </div>\n </div>\n </ng-container>\n </p-panel>\n</div>\n\n<s-exclusion-details></s-exclusion-details>\n",
832
917
  providers: []
833
918
  })
834
919
  ], ExclusionsListComponent);
@@ -906,7 +991,7 @@ const routes = [
906
991
  },
907
992
  children: [
908
993
  {
909
- path: ":entityName",
994
+ path: "",
910
995
  component: ExclusionsListComponent
911
996
  }
912
997
  ]