From: Volker Theile Date: Fri, 22 Feb 2019 13:46:38 +0000 (+0100) Subject: mgr/dashboard: Relocate empty pipe X-Git-Tag: v14.1.1~103^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F26588%2Fhead;p=ceph.git mgr/dashboard: Relocate empty pipe Move empty pipe into shared/pipes directory. Signed-off-by: Volker Theile --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-list/role-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-list/role-list.component.ts index 007f4bbbea8a..ba7c1e9cff25 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-list/role-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-list/role-list.component.ts @@ -7,13 +7,13 @@ import { forkJoin } from 'rxjs'; import { RoleService } from '../../../shared/api/role.service'; import { ScopeService } from '../../../shared/api/scope.service'; import { CriticalConfirmationModalComponent } from '../../../shared/components/critical-confirmation-modal/critical-confirmation-modal.component'; -import { EmptyPipe } from '../../../shared/empty.pipe'; import { CellTemplate } from '../../../shared/enum/cell-template.enum'; import { NotificationType } from '../../../shared/enum/notification-type.enum'; import { CdTableAction } from '../../../shared/models/cd-table-action'; import { CdTableColumn } from '../../../shared/models/cd-table-column'; import { CdTableSelection } from '../../../shared/models/cd-table-selection'; import { Permission } from '../../../shared/models/permissions'; +import { EmptyPipe } from '../../../shared/pipes/empty.pipe'; import { AuthStorageService } from '../../../shared/services/auth-storage.service'; import { NotificationService } from '../../../shared/services/notification.service'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.ts index 8ef93957cd2a..800e54c72a6e 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.ts @@ -5,12 +5,12 @@ import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal'; import { UserService } from '../../../shared/api/user.service'; import { CriticalConfirmationModalComponent } from '../../../shared/components/critical-confirmation-modal/critical-confirmation-modal.component'; -import { EmptyPipe } from '../../../shared/empty.pipe'; import { NotificationType } from '../../../shared/enum/notification-type.enum'; import { CdTableAction } from '../../../shared/models/cd-table-action'; import { CdTableColumn } from '../../../shared/models/cd-table-column'; import { CdTableSelection } from '../../../shared/models/cd-table-selection'; import { Permission } from '../../../shared/models/permissions'; +import { EmptyPipe } from '../../../shared/pipes/empty.pipe'; import { AuthStorageService } from '../../../shared/services/auth-storage.service'; import { NotificationService } from '../../../shared/services/notification.service'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/empty.pipe.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/empty.pipe.spec.ts deleted file mode 100644 index 462907906f36..000000000000 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/empty.pipe.spec.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { EmptyPipe } from './empty.pipe'; - -describe('EmptyPipe', () => { - const pipe = new EmptyPipe(); - - it('create an instance', () => { - expect(pipe).toBeTruthy(); - }); - - it('transforms with empty value', () => { - const value = undefined; - expect(pipe.transform(value)).toBe('-'); - }); - - it('transforms with some value', () => { - const value = 'foo'; - expect(pipe.transform(value)).toBe('foo'); - }); -}); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/empty.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/empty.pipe.ts deleted file mode 100644 index 7ee51b63bb2e..000000000000 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/empty.pipe.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Pipe, PipeTransform } from '@angular/core'; - -import * as _ from 'lodash'; - -@Pipe({ - name: 'empty' -}) -export class EmptyPipe implements PipeTransform { - transform(value: any): any { - return _.isUndefined(value) || _.isNull(value) ? '-' : value; - } -} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/empty.pipe.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/empty.pipe.spec.ts new file mode 100644 index 000000000000..462907906f36 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/empty.pipe.spec.ts @@ -0,0 +1,19 @@ +import { EmptyPipe } from './empty.pipe'; + +describe('EmptyPipe', () => { + const pipe = new EmptyPipe(); + + it('create an instance', () => { + expect(pipe).toBeTruthy(); + }); + + it('transforms with empty value', () => { + const value = undefined; + expect(pipe.transform(value)).toBe('-'); + }); + + it('transforms with some value', () => { + const value = 'foo'; + expect(pipe.transform(value)).toBe('foo'); + }); +}); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/empty.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/empty.pipe.ts new file mode 100644 index 000000000000..7ee51b63bb2e --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/empty.pipe.ts @@ -0,0 +1,12 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +import * as _ from 'lodash'; + +@Pipe({ + name: 'empty' +}) +export class EmptyPipe implements PipeTransform { + transform(value: any): any { + return _.isUndefined(value) || _.isNull(value) ? '-' : value; + } +} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/pipes.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/pipes.module.ts index 8ca806514b7d..0e53746f9d6b 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/pipes.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/pipes.module.ts @@ -1,13 +1,13 @@ import { CommonModule, DatePipe } from '@angular/common'; import { NgModule } from '@angular/core'; -import { EmptyPipe } from '../empty.pipe'; import { CdDatePipe } from './cd-date.pipe'; import { CephReleaseNamePipe } from './ceph-release-name.pipe'; import { CephShortVersionPipe } from './ceph-short-version.pipe'; import { DimlessBinaryPerSecondPipe } from './dimless-binary-per-second.pipe'; import { DimlessBinaryPipe } from './dimless-binary.pipe'; import { DimlessPipe } from './dimless.pipe'; +import { EmptyPipe } from './empty.pipe'; import { EncodeUriPipe } from './encode-uri.pipe'; import { FilterPipe } from './filter.pipe'; import { HealthColorPipe } from './health-color.pipe';