Skip to content

fix: use titlecase for better dataset table headers representation #1883

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import { ActivatedRoute } from "@angular/router";
import { JsonHeadPipe } from "shared/pipes/json-head.pipe";
import { DatePipe } from "@angular/common";
import { FileSizePipe } from "shared/pipes/filesize.pipe";
import { TitleCasePipe } from "shared/pipes/title-case.pipe";

const getConfig = () => ({});

Expand Down Expand Up @@ -78,6 +79,7 @@ describe("DatasetTableComponent", () => {
JsonHeadPipe,
DatePipe,
FileSizePipe,
TitleCasePipe,
],
declarations: [DatasetTableComponent],
});
Expand Down
5 changes: 5 additions & 0 deletions src/app/datasets/dataset-table/dataset-table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import { ActivatedRoute } from "@angular/router";
import { JsonHeadPipe } from "shared/pipes/json-head.pipe";
import { DatePipe } from "@angular/common";
import { FileSizePipe } from "shared/pipes/filesize.pipe";
import { TitleCasePipe } from "shared/pipes/title-case.pipe";
import { actionMenu } from "shared/modules/dynamic-material-table/utilizes/default-table-settings";
import { TableConfigService } from "shared/services/table-config.service";
export interface SortChangeEvent {
Expand Down Expand Up @@ -145,6 +146,7 @@ export class DatasetTableComponent implements OnInit, OnDestroy {
private jsonHeadPipe: JsonHeadPipe,
private datePipe: DatePipe,
private fileSize: FileSizePipe,
private titleCase: TitleCasePipe,
private tableConfigService: TableConfigService,
) {}

Expand Down Expand Up @@ -461,6 +463,9 @@ export class DatasetTableComponent implements OnInit, OnDestroy {
convertedColumn.renderImage = true;
}

convertedColumn.header =
column.header || this.titleCase.transform(column.name);

return convertedColumn;
});
}
Expand Down
3 changes: 3 additions & 0 deletions src/app/datasets/datasets.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ import { DatasetDetailDynamicComponent } from "./dataset-detail/dataset-detail-d
import { DatasetDetailWrapperComponent } from "./dataset-detail/dataset-detail-wrapper.component";
import { JsonHeadPipe } from "shared/pipes/json-head.pipe";
import { ThumbnailPipe } from "shared/pipes/thumbnail.pipe";
import { TitleCasePipe } from "shared/pipes/title-case.pipe";

@NgModule({
imports: [
CommonModule,
Expand Down Expand Up @@ -183,6 +185,7 @@ import { ThumbnailPipe } from "shared/pipes/thumbnail.pipe";
ADAuthService,
SharedScicatFrontendModule,
FileSizePipe,
TitleCasePipe,
],
exports: [
DashboardComponent,
Expand Down
Loading