From 946b14c580b1d4445c56f7eb08d224dd67c4fd89 Mon Sep 17 00:00:00 2001 From: Volker Theile Date: Mon, 9 Nov 2020 14:51:53 +0100 Subject: [PATCH] mgr/dashboard: Use pipe instead of calling function within template This PR introduces the 'ngx-pipe-function' package to call functions in templates. Fixes: https://tracker.ceph.com/issues/48051 Signed-off-by: Volker Theile --- .../mgr/dashboard/frontend/package-lock.json | 15 +++++++++++++++ src/pybind/mgr/dashboard/frontend/package.json | 1 + .../osd/osd-details/osd-details.component.spec.ts | 12 +++--------- .../src/app/ceph/shared/ceph-shared.module.ts | 3 ++- .../shared/smart-list/smart-list.component.html | 12 ++++++------ .../smart-list/smart-list.component.spec.ts | 9 ++++++++- .../shared/smart-list/smart-list.component.ts | 6 ++---- 7 files changed, 37 insertions(+), 21 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/package-lock.json b/src/pybind/mgr/dashboard/frontend/package-lock.json index f18990cc0c00e..b12e6fbcc0a1a 100644 --- a/src/pybind/mgr/dashboard/frontend/package-lock.json +++ b/src/pybind/mgr/dashboard/frontend/package-lock.json @@ -14930,6 +14930,21 @@ } } }, + "ngx-pipe-function": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/ngx-pipe-function/-/ngx-pipe-function-1.0.0.tgz", + "integrity": "sha512-AFWZ3icsq+0/nxFZtqRGZ03nRFoHcxVkZNGIi4ZQbdl5QLP3FmNTHGMmigohSeCV785l3YmPDUEx+6qwdGynMw==", + "requires": { + "tslib": "^1.9.0" + }, + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, "ngx-toastr": { "version": "13.1.0", "resolved": "https://registry.npmjs.org/ngx-toastr/-/ngx-toastr-13.1.0.tgz", diff --git a/src/pybind/mgr/dashboard/frontend/package.json b/src/pybind/mgr/dashboard/frontend/package.json index 8ef91ae374db1..ef75886fe296d 100644 --- a/src/pybind/mgr/dashboard/frontend/package.json +++ b/src/pybind/mgr/dashboard/frontend/package.json @@ -100,6 +100,7 @@ "ng-block-ui": "3.0.2", "ng-click-outside": "7.0.0", "ng2-charts": "2.3.0", + "ngx-pipe-function": "^1.0.0", "ngx-toastr": "13.1.0", "rxjs": "6.6.3", "simplebar-angular": "2.3.0", diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.spec.ts index 03041b2fd9b42..ebb1ef04481d4 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.spec.ts @@ -4,8 +4,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; import { TablePerformanceCounterComponent } from '~/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component'; -import { DeviceListComponent } from '~/app/ceph/shared/device-list/device-list.component'; -import { SmartListComponent } from '~/app/ceph/shared/smart-list/smart-list.component'; +import { CephSharedModule } from '~/app/ceph/shared/ceph-shared.module'; import { SharedModule } from '~/app/shared/shared.module'; import { configureTestBed } from '~/testing/unit-test-helper'; import { OsdDetailsComponent } from './osd-details.component'; @@ -15,13 +14,8 @@ describe('OsdDetailsComponent', () => { let fixture: ComponentFixture; configureTestBed({ - imports: [HttpClientTestingModule, NgbNavModule, SharedModule], - declarations: [ - OsdDetailsComponent, - DeviceListComponent, - SmartListComponent, - TablePerformanceCounterComponent - ] + imports: [HttpClientTestingModule, NgbNavModule, SharedModule, CephSharedModule], + declarations: [OsdDetailsComponent, TablePerformanceCounterComponent] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/ceph-shared.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/ceph-shared.module.ts index 010bc573ea559..9e9f2917a4749 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/ceph-shared.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/ceph-shared.module.ts @@ -2,6 +2,7 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; +import { NgxPipeFunctionModule } from 'ngx-pipe-function'; import { DataTableModule } from '~/app/shared/datatable/datatable.module'; import { SharedModule } from '~/app/shared/shared.module'; @@ -9,7 +10,7 @@ import { DeviceListComponent } from './device-list/device-list.component'; import { SmartListComponent } from './smart-list/smart-list.component'; @NgModule({ - imports: [CommonModule, DataTableModule, SharedModule, NgbNavModule], + imports: [CommonModule, DataTableModule, SharedModule, NgbNavModule, NgxPipeFunctionModule], exports: [DeviceListComponent, SmartListComponent], declarations: [DeviceListComponent, SmartListComponent] }) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.html index 78e0c15785037..063d0c29af81d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.html @@ -8,11 +8,11 @@ dashboard. - No SMART data available. - +