diff --git a/src/pybind/mgr/dashboard_v2/frontend/src/app/shared/datatable/datatable.module.ts b/src/pybind/mgr/dashboard_v2/frontend/src/app/shared/datatable/datatable.module.ts index 1c3b8701e17..df7ca994dad 100644 --- a/src/pybind/mgr/dashboard_v2/frontend/src/app/shared/datatable/datatable.module.ts +++ b/src/pybind/mgr/dashboard_v2/frontend/src/app/shared/datatable/datatable.module.ts @@ -1,6 +1,7 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; +import { RouterModule } from '@angular/router'; import { NgxDatatableModule } from '@swimlane/ngx-datatable'; @@ -16,7 +17,8 @@ import { TableComponent } from './table/table.component'; NgxDatatableModule, FormsModule, PipesModule, - ComponentsModule + ComponentsModule, + RouterModule ], declarations: [ TableComponent, diff --git a/src/pybind/mgr/dashboard_v2/frontend/src/app/shared/datatable/table-key-value/table-key-value.component.spec.ts b/src/pybind/mgr/dashboard_v2/frontend/src/app/shared/datatable/table-key-value/table-key-value.component.spec.ts index 12f3893b614..4bbca79b78f 100644 --- a/src/pybind/mgr/dashboard_v2/frontend/src/app/shared/datatable/table-key-value/table-key-value.component.spec.ts +++ b/src/pybind/mgr/dashboard_v2/frontend/src/app/shared/datatable/table-key-value/table-key-value.component.spec.ts @@ -1,5 +1,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { FormsModule } from '@angular/forms'; +import { RouterTestingModule } from '@angular/router/testing'; import { NgxDatatableModule } from '@swimlane/ngx-datatable'; @@ -14,7 +15,7 @@ describe('TableKeyValueComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ TableComponent, TableKeyValueComponent ], - imports: [ FormsModule, NgxDatatableModule, ComponentsModule ] + imports: [ FormsModule, NgxDatatableModule, ComponentsModule, RouterTestingModule ] }) .compileComponents(); })); diff --git a/src/pybind/mgr/dashboard_v2/frontend/src/app/shared/datatable/table/table.component.html b/src/pybind/mgr/dashboard_v2/frontend/src/app/shared/datatable/table/table.component.html index 8779c937baf..043362f7393 100644 --- a/src/pybind/mgr/dashboard_v2/frontend/src/app/shared/datatable/table/table.component.html +++ b/src/pybind/mgr/dashboard_v2/frontend/src/app/shared/datatable/table/table.component.html @@ -80,3 +80,9 @@ let-value="value"> + + + {{ value }} + diff --git a/src/pybind/mgr/dashboard_v2/frontend/src/app/shared/datatable/table/table.component.spec.ts b/src/pybind/mgr/dashboard_v2/frontend/src/app/shared/datatable/table/table.component.spec.ts index 37b204ddf65..43c9ce1a7aa 100644 --- a/src/pybind/mgr/dashboard_v2/frontend/src/app/shared/datatable/table/table.component.spec.ts +++ b/src/pybind/mgr/dashboard_v2/frontend/src/app/shared/datatable/table/table.component.spec.ts @@ -1,5 +1,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { FormsModule } from '@angular/forms'; +import { RouterTestingModule } from '@angular/router/testing'; import { NgxDatatableModule, TableColumn } from '@swimlane/ngx-datatable'; @@ -26,7 +27,7 @@ describe('TableComponent', () => { async(() => { TestBed.configureTestingModule({ declarations: [TableComponent], - imports: [NgxDatatableModule, FormsModule, ComponentsModule] + imports: [NgxDatatableModule, FormsModule, ComponentsModule, RouterTestingModule] }).compileComponents(); }) ); diff --git a/src/pybind/mgr/dashboard_v2/frontend/src/app/shared/datatable/table/table.component.ts b/src/pybind/mgr/dashboard_v2/frontend/src/app/shared/datatable/table/table.component.ts index 2cb66623ad9..db158649453 100644 --- a/src/pybind/mgr/dashboard_v2/frontend/src/app/shared/datatable/table/table.component.ts +++ b/src/pybind/mgr/dashboard_v2/frontend/src/app/shared/datatable/table/table.component.ts @@ -28,6 +28,7 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges { @ViewChild(TableDetailsDirective) detailTemplate: TableDetailsDirective; @ViewChild('tableCellBoldTpl') tableCellBoldTpl: TemplateRef; @ViewChild('sparklineTpl') sparklineTpl: TemplateRef; + @ViewChild('routerLinkTpl') routerLinkTpl: TemplateRef; // This is the array with the items to be shown. @Input() data: any[]; @@ -102,6 +103,7 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges { _addTemplates () { this.cellTemplates.bold = this.tableCellBoldTpl; this.cellTemplates.sparkline = this.sparklineTpl; + this.cellTemplates.routerLink = this.routerLinkTpl; } ngOnChanges(changes) { diff --git a/src/pybind/mgr/dashboard_v2/frontend/src/app/shared/enum/cell-template.enum.ts b/src/pybind/mgr/dashboard_v2/frontend/src/app/shared/enum/cell-template.enum.ts index 88959e0bad8..7c85bbe08c7 100644 --- a/src/pybind/mgr/dashboard_v2/frontend/src/app/shared/enum/cell-template.enum.ts +++ b/src/pybind/mgr/dashboard_v2/frontend/src/app/shared/enum/cell-template.enum.ts @@ -1,4 +1,5 @@ export enum CellTemplate { bold = 'bold', - sparkline = 'sparkline' + sparkline = 'sparkline', + routerLink = 'routerLink' }