mirror of
https://github.com/ceph/ceph
synced 2025-01-02 00:52:22 +00:00
mgr/dashboard_v2: add router link table template
Signed-off-by: Tiago Melo <tmelo@suse.com>
This commit is contained in:
parent
afd896da40
commit
1a9619d9b3
@ -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,
|
||||
|
@ -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();
|
||||
}));
|
||||
|
@ -80,3 +80,9 @@
|
||||
let-value="value">
|
||||
<cd-sparkline [data]="value"></cd-sparkline>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #routerLinkTpl
|
||||
let-row="row"
|
||||
let-value="value">
|
||||
<a [routerLink]="[row.cdLink]">{{ value }}</a>
|
||||
</ng-template>
|
||||
|
@ -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();
|
||||
})
|
||||
);
|
||||
|
@ -28,6 +28,7 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges {
|
||||
@ViewChild(TableDetailsDirective) detailTemplate: TableDetailsDirective;
|
||||
@ViewChild('tableCellBoldTpl') tableCellBoldTpl: TemplateRef<any>;
|
||||
@ViewChild('sparklineTpl') sparklineTpl: TemplateRef<any>;
|
||||
@ViewChild('routerLinkTpl') routerLinkTpl: TemplateRef<any>;
|
||||
|
||||
// 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) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
export enum CellTemplate {
|
||||
bold = 'bold',
|
||||
sparkline = 'sparkline'
|
||||
sparkline = 'sparkline',
|
||||
routerLink = 'routerLink'
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user