diff --git a/projects/components/src/table/data/table-cdk-data-source.ts b/projects/components/src/table/data/table-cdk-data-source.ts index b3df3334e..03ef8e194 100644 --- a/projects/components/src/table/data/table-cdk-data-source.ts +++ b/projects/components/src/table/data/table-cdk-data-source.ts @@ -33,10 +33,9 @@ export class TableCdkDataSource implements DataSource { private readonly cachedValues: Map = new Map(); private lastRowChange: StatefulTableRow | undefined; private readonly rowsChange$: Subject = new Subject(); - private readonly loadingStateSubject: Subject> = new Subject< - Observable - >(); - public loadingStateChange$: Observable> = this.loadingStateSubject.asObservable(); + private readonly loadingStateSubject: Subject = new Subject(); + + public loadingStateChange$: Observable = this.loadingStateSubject.asObservable(); public constructor( private readonly tableDataSourceProvider: TableDataSourceProvider, @@ -54,7 +53,7 @@ export class TableCdkDataSource implements DataSource { public connect(): Observable> { this.buildChangeObservable() .pipe( - tap(() => this.loadingStateSubject.next(NEVER)), + tap(() => this.loadingStateSubject.next({ loading$: NEVER })), mergeMap(([columnConfigs, pageEvent, filters, changedColumn, changedRow]) => this.buildDataObservable(columnConfigs, pageEvent, filters, changedColumn, changedRow) ) @@ -64,7 +63,7 @@ export class TableCdkDataSource implements DataSource { return this.rowsChange$.pipe( tap(rows => this.cacheRows(rows)), tap(rows => this.cacheFilterableValues(rows)), - tap(rows => this.loadingStateSubject.next(of(rows))) + tap(rows => this.loadingStateSubject.next({ loading$: of(rows), hide: rows.length > 1 })) ); } @@ -264,7 +263,7 @@ export class TableCdkDataSource implements DataSource { : rows ), catchError(error => { - this.loadingStateSubject.next(throwError(error)); + this.loadingStateSubject.next({ loading$: throwError(error) }); return []; }) @@ -324,3 +323,8 @@ export class TableCdkDataSource implements DataSource { } } } + +export interface TableLoadingState { + loading$: Observable; + hide?: boolean; +} diff --git a/projects/components/src/table/table.component.scss b/projects/components/src/table/table.component.scss index 9f2dc0330..015680d7e 100644 --- a/projects/components/src/table/table.component.scss +++ b/projects/components/src/table/table.component.scss @@ -1,11 +1,12 @@ @import 'mixins'; @import 'layout'; -:host { +.table { display: flex; flex-direction: column; height: 100%; width: 100%; + position: relative; } .title-row { @@ -18,6 +19,7 @@ .table { width: 100%; + flex: 1 1 0; overflow: auto; } @@ -108,7 +110,10 @@ } .state-watcher { - flex: 1 1; + height: 100%; + width: 100%; + position: absolute; + background: transparent; } .pagination-controls { diff --git a/projects/components/src/table/table.component.ts b/projects/components/src/table/table.component.ts index 56058d7ee..dca6e127c 100644 --- a/projects/components/src/table/table.component.ts +++ b/projects/components/src/table/table.component.ts @@ -46,116 +46,129 @@ import { } from './table-api'; import { TableColumnConfigExtended, TableService } from './table.service'; -// tslint:disable max-file-line-count +// tslint:disable: template-cyclomatic-complexity component-max-inline-declarations max-file-line-count @Component({ selector: 'ht-table', styleUrls: ['./table.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, template: ` - - -
- - -
+ + +
+ + -
-
- +
+
+
+ + +
+
+ - - - - + + +
+
+ + + + + - - - - - - - + + + + - - - - + + + + + + + +
- - - - - - + + +
+ +
- - - -
- -
- - -
- + +
+ +
` }) diff --git a/projects/observability/src/pages/explorer/explorer.component.scss b/projects/observability/src/pages/explorer/explorer.component.scss index 41c06f9d4..e01cca1ac 100644 --- a/projects/observability/src/pages/explorer/explorer.component.scss +++ b/projects/observability/src/pages/explorer/explorer.component.scss @@ -16,7 +16,6 @@ .visualization-panel { padding-top: 8px; - .label { @include body-1-medium; } @@ -31,7 +30,7 @@ .results-panel { overflow: hidden; - + flex: 1 1 auto; .label { @include body-1-medium; }