fix: table info modal, versions - column names

This commit is contained in:
Mihajlo Medjedovic 2024-03-26 19:14:41 +01:00
parent c6595c1f61
commit 801c8c6a9f
4 changed files with 25 additions and 19 deletions

View File

@ -28,6 +28,7 @@ export interface DSMeta {
ODS_TABLE: string
NAME: string
VALUE: string
[key: string]: string
}
export interface Version {
@ -38,6 +39,7 @@ export interface Version {
CHANGED_RECORDS: number
NEW_RECORDS: number
DELETED_RECORDS: number
[key: string]: string | number
}
export interface Sasdata {

View File

@ -19,13 +19,9 @@
class="d-flex clr-justify-content-center w-100"
>
<clr-datagrid>
<ng-container *ngFor="let col of $any(tab.meta[0]) | keyvalue">
<ng-container *ngFor="let col of tab.colsToDisplay">
<clr-dg-column
*ngIf="
tab.colsToDisplay.length < 1 ||
tab.colsToDisplay.includes($any(col.key))
"
>{{ col.key }}</clr-dg-column
>{{ col.colName || col.colKey }}</clr-dg-column
>
</ng-container>
@ -34,14 +30,8 @@
class="clickable-row"
*ngFor="let info of tab.meta"
>
<ng-container *ngFor="let col of $any(info) | keyvalue">
<clr-dg-cell
*ngIf="
tab.colsToDisplay.length < 1 ||
tab.colsToDisplay.includes($any(col.key))
"
>{{ col.value }}</clr-dg-cell
>
<ng-container *ngFor="let col of tab.colsToDisplay">
<clr-dg-cell>{{ info[col.colKey] }}</clr-dg-cell>
</ng-container>
</clr-dg-row>
</clr-datagrid>

View File

@ -54,7 +54,10 @@ export class DatasetInfoComponent implements OnInit, OnChanges {
this.dsmetaTabs.push({
name: info.ODS_TABLE,
title: 'Dataset Meta',
colsToDisplay: ['NAME', 'VALUE'],
colsToDisplay: [
{colKey: 'NAME'},
{colKey: 'VALUE'}
],
meta: [],
onRowClick: (value: DSMeta) => {
this.rowClicked.emit(value)
@ -68,9 +71,17 @@ export class DatasetInfoComponent implements OnInit, OnChanges {
parseVersions() {
this.versionsTabs = [
{
name: 'Table Versions',
name: 'VERSIONS',
title: 'Dataset Meta',
colsToDisplay: ['LOAD_REF', 'USER_NM', 'VERSION_DTTM'],
colsToDisplay: [
{colKey: 'LOAD_REF'},
{colKey: 'USER_NM'},
{colKey: 'VERSION_DTTM'},
{colKey: 'NEW_RECORDS', colName: 'ADD'},
{colKey: 'CHANGED_RECORDS', colName: 'MOD'},
{colKey: 'DELETED_RECORDS', colName: 'DEL'},
{colKey: 'VERSION_DESC'}
],
meta: this.versions,
onRowClick: (value: Version) => {
this.rowClicked.emit(value)

View File

@ -1,11 +1,14 @@
export interface Tab<T> {
export interface Tab<T>{
name: string
title: string
/**
* Columns to be displayed in the the grid
* If empty, all columns will be displayed
*/
colsToDisplay: string[]
colsToDisplay: {
colKey: string
colName?: string
}[]
meta: T[]
onRowClick?: (value: any) => void
}