From ed666dddbcebf40c6d3a903769ea2b9ebffb98a8 Mon Sep 17 00:00:00 2001 From: John Rassa Date: Fri, 31 May 2024 07:42:30 -0400 Subject: [PATCH] misc updates/fix from downstream --- src/app/common/dialog/dialog.model.ts | 2 +- .../loading-overlay/loading-overlay.component.spec.ts | 3 --- .../pipes/utc-date-pipe/utc-date-utils.service.ts | 11 +++++++++-- src/app/common/table/asy-table-data-source.ts | 2 +- .../table/column-chooser/column-chooser.component.ts | 11 +---------- .../expander/asy-expander-column.component.html | 2 +- .../selection/asy-selection-column.component.html | 5 ----- .../table/columns/text/text-column.component.html | 2 +- .../table/columns/text/text-column.component.ts | 6 ++++-- src/app/common/table/filter/asy-filter.directive.ts | 2 +- .../asy-header-list-filter.component.html | 2 +- .../asy-header-list-filter.component.ts | 6 +++++- .../asy-header-text-filter.component.ts | 9 +-------- .../asy-sort-header/asy-sort-header.component.html | 2 -- 14 files changed, 26 insertions(+), 39 deletions(-) diff --git a/src/app/common/dialog/dialog.model.ts b/src/app/common/dialog/dialog.model.ts index f1bae4bb..15d72e33 100644 --- a/src/app/common/dialog/dialog.model.ts +++ b/src/app/common/dialog/dialog.model.ts @@ -13,7 +13,7 @@ export class DialogReturn { export function isDialogActionOK() { return (source$: Observable>) => - source$.pipe(filter((result) => result.action === DialogAction.OK)); + source$.pipe(filter((result) => result?.action === DialogAction.OK)); } export function mapToDialogReturnData() { diff --git a/src/app/common/loading-overlay/loading-overlay.component.spec.ts b/src/app/common/loading-overlay/loading-overlay.component.spec.ts index 21be2f17..70da0526 100644 --- a/src/app/common/loading-overlay/loading-overlay.component.spec.ts +++ b/src/app/common/loading-overlay/loading-overlay.component.spec.ts @@ -1,5 +1,4 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; import { LoadingOverlayComponent } from './loading-overlay.component'; @@ -19,8 +18,6 @@ describe('LoadingOverlayComponent', () => { it('should display loading overlay and loading spinner', () => { fixture.componentRef.setInput('isLoading', true); fixture.detectChanges(); - // expect(rootHTMLElement.innerHTML).toEqual(''); - // expect(fixture.debugElement.query(By.css('.overlay'))).toBeDefined(); expect(rootHTMLElement.getElementsByClassName('overlay').length).toEqual(1); expect(rootHTMLElement.getElementsByClassName('overlay-spinner').length).toEqual(1); expect(rootHTMLElement.getElementsByClassName('alert').length).toEqual(0); diff --git a/src/app/common/pipes/utc-date-pipe/utc-date-utils.service.ts b/src/app/common/pipes/utc-date-pipe/utc-date-utils.service.ts index 02b69c6b..117adc6f 100644 --- a/src/app/common/pipes/utc-date-pipe/utc-date-utils.service.ts +++ b/src/app/common/pipes/utc-date-pipe/utc-date-utils.service.ts @@ -7,7 +7,7 @@ export class UtcDateUtils { value: string | number | Date | DateTime | null | undefined, format?: string ): string { - if (null != value) { + if (value) { let luxonDate; if (value instanceof DateTime) { luxonDate = value; @@ -15,8 +15,15 @@ export class UtcDateUtils { luxonDate = DateTime.fromJSDate(value).toUTC(); } else if (typeof value === 'number') { luxonDate = DateTime.fromMillis(value).toUTC(); - } else if (typeof value === 'string') { + } else { luxonDate = DateTime.fromISO(value).toUTC(); + + if (!luxonDate.isValid) { + luxonDate = DateTime.fromFormat(value, 'D').toUTC(); + } + if (!luxonDate.isValid) { + luxonDate = DateTime.fromFormat(value, 'M-d-yyyy').toUTC(); + } if (!luxonDate.isValid) { // converts a string of milliseconds into a number value = +value; diff --git a/src/app/common/table/asy-table-data-source.ts b/src/app/common/table/asy-table-data-source.ts index e3a15ff0..81f6c457 100644 --- a/src/app/common/table/asy-table-data-source.ts +++ b/src/app/common/table/asy-table-data-source.ts @@ -86,7 +86,7 @@ export class AsyTableDataSource extends DataSource { switchMap(([search, filter]) => pagingOptions$.pipe(map((pagingOptions) => [pagingOptions, search, filter])) ), - tap(([pagingOptions]) => { + tap(() => { this.loading$.next(true); this.pagingResults$.next(NULL_PAGING_RESULTS); }), diff --git a/src/app/common/table/column-chooser/column-chooser.component.ts b/src/app/common/table/column-chooser/column-chooser.component.ts index 90bd7dab..914fc599 100644 --- a/src/app/common/table/column-chooser/column-chooser.component.ts +++ b/src/app/common/table/column-chooser/column-chooser.component.ts @@ -6,16 +6,7 @@ import { moveItemInArray } from '@angular/cdk/drag-drop'; import { TitleCasePipe } from '@angular/common'; -import { - Component, - EventEmitter, - Input, - OnInit, - Output, - booleanAttribute, - input, - output -} from '@angular/core'; +import { Component, Input, OnInit, booleanAttribute, input, output } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { LocalStorageService } from '../../storage/local-storage.service'; diff --git a/src/app/common/table/columns/expander/asy-expander-column.component.html b/src/app/common/table/columns/expander/asy-expander-column.component.html index 2c1f0bcd..87fd8fb7 100644 --- a/src/app/common/table/columns/expander/asy-expander-column.component.html +++ b/src/app/common/table/columns/expander/asy-expander-column.component.html @@ -4,7 +4,7 @@ @if (isExpandable(index, item)) {
diff --git a/src/app/common/table/columns/selection/asy-selection-column.component.html b/src/app/common/table/columns/selection/asy-selection-column.component.html index 4a75fd36..6bb07c72 100644 --- a/src/app/common/table/columns/selection/asy-selection-column.component.html +++ b/src/app/common/table/columns/selection/asy-selection-column.component.html @@ -9,7 +9,6 @@ [checked]="_isAllSelected$ | async" (change)="_toggleAll()" /> - } @@ -23,10 +22,6 @@ [disabled]="!isSelectable(_isMultiTemplateDataRows ? dataIndex : index, result)" (change)="toggle(_isMultiTemplateDataRows ? dataIndex : index, result)" /> - diff --git a/src/app/common/table/columns/text/text-column.component.html b/src/app/common/table/columns/text/text-column.component.html index 1c62c390..8e0cc561 100644 --- a/src/app/common/table/columns/text/text-column.component.html +++ b/src/app/common/table/columns/text/text-column.component.html @@ -12,6 +12,6 @@ - {{ obj[name] }} + {{ obj[name] ?? defaultValue }} diff --git a/src/app/common/table/columns/text/text-column.component.ts b/src/app/common/table/columns/text/text-column.component.ts index ad6f0e1c..f39fd3da 100644 --- a/src/app/common/table/columns/text/text-column.component.ts +++ b/src/app/common/table/columns/text/text-column.component.ts @@ -1,6 +1,6 @@ import { CdkTableModule } from '@angular/cdk/table'; import { CommonModule } from '@angular/common'; -import { Component } from '@angular/core'; +import { Component, input } from '@angular/core'; import { AsySortHeaderComponent } from '../../sort/asy-sort-header/asy-sort-header.component'; import { AsyAbstractValueColumnComponent } from '../asy-abstract-value-column.component'; @@ -12,4 +12,6 @@ import { AsyAbstractValueColumnComponent } from '../asy-abstract-value-column.co templateUrl: './text-column.component.html', styleUrls: ['./text-column.component.scss'] }) -export class TextColumnComponent extends AsyAbstractValueColumnComponent {} +export class TextColumnComponent extends AsyAbstractValueColumnComponent { + readonly defaultValue = input(''); +} diff --git a/src/app/common/table/filter/asy-filter.directive.ts b/src/app/common/table/filter/asy-filter.directive.ts index 5f954778..ebe69271 100644 --- a/src/app/common/table/filter/asy-filter.directive.ts +++ b/src/app/common/table/filter/asy-filter.directive.ts @@ -1,4 +1,4 @@ -import { Directive, Input, input } from '@angular/core'; +import { Directive, input } from '@angular/core'; import isEmpty from 'lodash/isEmpty'; diff --git a/src/app/common/table/filter/asy-header-list-filter/asy-header-list-filter.component.html b/src/app/common/table/filter/asy-header-list-filter/asy-header-list-filter.component.html index 938f644e..a4147626 100644 --- a/src/app/common/table/filter/asy-header-list-filter/asy-header-list-filter.component.html +++ b/src/app/common/table/filter/asy-header-list-filter/asy-header-list-filter.component.html @@ -28,7 +28,7 @@ (overlayOutsideClick)="isOpen.set(false)" >