From 33dbdf6492d05e7e2ce89eaee5ab69cd882943b3 Mon Sep 17 00:00:00 2001 From: Tiago Melo Date: Fri, 29 May 2020 09:55:29 +0000 Subject: [PATCH] mgr/dashboard: Use ng-bootstrap for Tooltip Fixes: https://tracker.ceph.com/issues/45754 Signed-off-by: Tiago Melo --- .../frontend/src/app/app.component.ts | 12 ++++--- .../src/app/ceph/block/block.module.ts | 5 ++- .../ceph/block/mirroring/mirroring.module.ts | 2 -- .../rbd-configuration-form.component.spec.ts | 4 +-- .../rbd-details/rbd-details.component.html | 12 +++---- .../rbd-details/rbd-details.component.spec.ts | 5 ++- .../block/rbd-form/rbd-form.component.spec.ts | 4 +-- .../block/rbd-list/rbd-list.component.spec.ts | 5 ++- .../src/app/ceph/cluster/cluster.module.ts | 5 ++- .../silence-form/silence-form.component.html | 10 +++--- .../silence-form.component.spec.ts | 4 +-- .../nfs-form-client.component.html | 2 +- .../frontend/src/app/ceph/nfs/nfs.module.ts | 5 +-- .../pool/pool-form/pool-form.component.html | 16 ++++----- .../pool-form/pool-form.component.spec.ts | 20 +++++------ .../pool/pool-form/pool-form.component.ts | 20 +++++------ .../frontend/src/app/ceph/pool/pool.module.ts | 5 ++- .../rgw-user-form.component.html | 36 +++++++++---------- .../rgw-user-form.component.spec.ts | 4 +-- .../frontend/src/app/ceph/rgw/rgw.module.ts | 7 ++-- .../workbench-layout.component.ts | 12 +------ .../app/core/navigation/navigation.module.ts | 2 -- .../shared/components/components.module.ts | 5 ++- .../select-badges.component.spec.ts | 5 ++- .../components/select/select.component.html | 2 +- .../select/select.component.spec.ts | 5 ++- .../usage-bar/usage-bar.component.html | 2 +- .../usage-bar/usage-bar.component.spec.ts | 4 +-- .../mgr/dashboard/frontend/src/styles.scss | 4 --- 29 files changed, 97 insertions(+), 127 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/app.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/app.component.ts index 20bbac20fba..5f483cc9456 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/app.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/app.component.ts @@ -1,6 +1,6 @@ import { Component } from '@angular/core'; -import { NgbPopoverConfig } from '@ng-bootstrap/ng-bootstrap'; +import { NgbPopoverConfig, NgbTooltipConfig } from '@ng-bootstrap/ng-bootstrap'; @Component({ selector: 'cd-root', @@ -8,9 +8,11 @@ import { NgbPopoverConfig } from '@ng-bootstrap/ng-bootstrap'; styleUrls: ['./app.component.scss'] }) export class AppComponent { - constructor(config: NgbPopoverConfig) { - config.autoClose = 'outside'; - config.container = 'body'; - config.placement = 'bottom'; + constructor(popoverConfig: NgbPopoverConfig, tooltipConfig: NgbTooltipConfig) { + popoverConfig.autoClose = 'outside'; + popoverConfig.container = 'body'; + popoverConfig.placement = 'bottom'; + + tooltipConfig.container = 'body'; } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/block.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/block.module.ts index c568b0bcd1a..f63bb3d53d6 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/block.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/block.module.ts @@ -3,14 +3,13 @@ import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { RouterModule, Routes } from '@angular/router'; -import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; +import { NgbNavModule, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'; import { TreeModule } from 'angular-tree-component'; import { NgBootstrapFormValidationModule } from 'ng-bootstrap-form-validation'; import { BsDatepickerModule } from 'ngx-bootstrap/datepicker'; import { BsDropdownModule } from 'ngx-bootstrap/dropdown'; import { ModalModule } from 'ngx-bootstrap/modal'; import { ProgressbarModule } from 'ngx-bootstrap/progressbar'; -import { TooltipModule } from 'ngx-bootstrap/tooltip'; import { ActionLabels, URLVerbs } from '../../shared/constants/app.constants'; import { FeatureTogglesGuardService } from '../../shared/services/feature-toggles-guard.service'; @@ -64,7 +63,7 @@ import { RbdTrashRestoreModalComponent } from './rbd-trash-restore-modal/rbd-tra ProgressbarModule.forRoot(), BsDropdownModule.forRoot(), BsDatepickerModule.forRoot(), - TooltipModule.forRoot(), + NgbTooltipModule, ModalModule.forRoot(), SharedModule, RouterModule, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirroring.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirroring.module.ts index f5659558479..ecbf6c41ada 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirroring.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirroring.module.ts @@ -8,7 +8,6 @@ import { NgBootstrapFormValidationModule } from 'ng-bootstrap-form-validation'; import { BsDropdownModule } from 'ngx-bootstrap/dropdown'; import { ModalModule } from 'ngx-bootstrap/modal'; import { ProgressbarModule } from 'ngx-bootstrap/progressbar'; -import { TooltipModule } from 'ngx-bootstrap/tooltip'; import { SharedModule } from '../../../shared/shared.module'; @@ -42,7 +41,6 @@ import { PoolListComponent } from './pool-list/pool-list.component'; ProgressbarModule.forRoot(), BsDropdownModule.forRoot(), ModalModule.forRoot(), - TooltipModule.forRoot(), NgBootstrapFormValidationModule ], declarations: [ diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-form/rbd-configuration-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-form/rbd-configuration-form.component.spec.ts index ebffe8a5a8c..e334098a901 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-form/rbd-configuration-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-form/rbd-configuration-form.component.spec.ts @@ -5,7 +5,6 @@ import { By } from '@angular/platform-browser'; import { ComponentLoaderFactory } from 'ngx-bootstrap/component-loader'; import { PositioningService } from 'ngx-bootstrap/positioning'; -import { TooltipConfig, TooltipModule } from 'ngx-bootstrap/tooltip'; import { configureTestBed, FormHelper, i18nProviders } from '../../../../testing/unit-test-helper'; import { DirectivesModule } from '../../../shared/directives/directives.module'; @@ -24,12 +23,11 @@ describe('RbdConfigurationFormComponent', () => { let fh: FormHelper; configureTestBed({ - imports: [ReactiveFormsModule, TooltipModule, DirectivesModule, SharedModule], + imports: [ReactiveFormsModule, DirectivesModule, SharedModule], declarations: [RbdConfigurationFormComponent], providers: [ ComponentLoaderFactory, PositioningService, - TooltipConfig, RbdConfigurationService, FormatterService, DimlessBinaryPerSecondPipe, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-details/rbd-details.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-details/rbd-details.component.html index 6189e97ebf2..73187903102 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-details/rbd-details.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-details/rbd-details.component.html @@ -62,7 +62,7 @@ N/A @@ -77,7 +77,7 @@ N/A @@ -147,12 +147,12 @@ let-value="value"> Image + i18n-ngbTooltip + ngbTooltip="This setting overrides the global value">Image Global + i18n-ngbTooltip + ngbTooltip="This is the global value. No value for this option has been set for this image.">Global diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-details/rbd-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-details/rbd-details.component.spec.ts index c555cb10254..409fe50d14e 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-details/rbd-details.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-details/rbd-details.component.spec.ts @@ -1,8 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; -import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; -import { TooltipModule } from 'ngx-bootstrap/tooltip'; +import { NgbNavModule, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'; import { configureTestBed } from '../../../../testing/unit-test-helper'; import { SharedModule } from '../../../shared/shared.module'; @@ -16,7 +15,7 @@ describe('RbdDetailsComponent', () => { configureTestBed({ declarations: [RbdDetailsComponent, RbdSnapshotListComponent, RbdConfigurationListComponent], - imports: [SharedModule, TooltipModule.forRoot(), RouterTestingModule, NgbNavModule] + imports: [SharedModule, NgbTooltipModule, RouterTestingModule, NgbNavModule] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.spec.ts index 31a984079a8..f0ba4ad48e4 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.spec.ts @@ -3,7 +3,6 @@ import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testin import { ReactiveFormsModule } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; -import { TooltipModule } from 'ngx-bootstrap/tooltip'; import { ToastrModule } from 'ngx-toastr'; @@ -35,8 +34,7 @@ describe('RbdFormComponent', () => { ReactiveFormsModule, RouterTestingModule, ToastrModule.forRoot(), - SharedModule, - TooltipModule + SharedModule ], declarations: [RbdFormComponent, RbdConfigurationFormComponent], providers: [ diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.spec.ts index 2a425a7b08c..38b6061fad1 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.spec.ts @@ -3,10 +3,9 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { RouterTestingModule } from '@angular/router/testing'; -import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; +import { NgbNavModule, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'; import { BsDropdownModule } from 'ngx-bootstrap/dropdown'; import { ModalModule } from 'ngx-bootstrap/modal'; -import { TooltipModule } from 'ngx-bootstrap/tooltip'; import { ToastrModule } from 'ngx-toastr'; import { BehaviorSubject, of } from 'rxjs'; @@ -47,7 +46,7 @@ describe('RbdListComponent', () => { BsDropdownModule.forRoot(), NgbNavModule, ModalModule.forRoot(), - TooltipModule.forRoot(), + NgbTooltipModule, ToastrModule.forRoot(), RouterTestingModule, HttpClientTestingModule diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/cluster.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/cluster.module.ts index ab71ef5bc66..f597a57ace7 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/cluster.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/cluster.module.ts @@ -3,14 +3,13 @@ import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { RouterModule } from '@angular/router'; -import { NgbNavModule, NgbTypeaheadModule } from '@ng-bootstrap/ng-bootstrap'; +import { NgbNavModule, NgbTooltipModule, NgbTypeaheadModule } from '@ng-bootstrap/ng-bootstrap'; import { TreeModule } from 'angular-tree-component'; import { NgBootstrapFormValidationModule } from 'ng-bootstrap-form-validation'; import { BsDatepickerModule } from 'ngx-bootstrap/datepicker'; import { BsDropdownModule } from 'ngx-bootstrap/dropdown'; import { ModalModule } from 'ngx-bootstrap/modal'; import { TimepickerModule } from 'ngx-bootstrap/timepicker'; -import { TooltipModule } from 'ngx-bootstrap/tooltip'; import { OrchestratorDocModalComponent } from '../../shared/components/orchestrator-doc-modal/orchestrator-doc-modal.component'; import { SharedModule } from '../../shared/shared.module'; @@ -76,7 +75,7 @@ import { TelemetryComponent } from './telemetry/telemetry.component'; BsDropdownModule.forRoot(), BsDatepickerModule.forRoot(), ModalModule.forRoot(), - TooltipModule.forRoot(), + NgbTooltipModule, MgrModulesModule, NgbTypeaheadModule, TimepickerModule.forRoot(), diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.html index cd491bf67f5..60076414b62 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.html @@ -5,7 +5,7 @@
+ [ngbTooltip]="config.tooltip">
@@ -37,16 +37,16 @@ diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.spec.ts index c0446c0bac7..b331140d655 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.spec.ts @@ -5,10 +5,10 @@ import { By } from '@angular/platform-browser'; import { ActivatedRoute, Router, Routes } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; +import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'; import * as _ from 'lodash'; import { BsDatepickerDirective, BsDatepickerModule } from 'ngx-bootstrap/datepicker'; import { BsModalService } from 'ngx-bootstrap/modal'; -import { TooltipModule } from 'ngx-bootstrap/tooltip'; import { ToastrModule } from 'ngx-toastr'; import { of, throwError } from 'rxjs'; @@ -62,7 +62,7 @@ describe('SilenceFormComponent', () => { BsDatepickerModule.forRoot(), SharedModule, ToastrModule.forRoot(), - TooltipModule.forRoot(), + NgbTooltipModule, ReactiveFormsModule ], providers: [ diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.html index 03fdc53c8d9..f2cb26b1882 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.html @@ -19,7 +19,7 @@ {{ (index + 1) | ordinal }} × + ngbTooltip="Remove">×
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs.module.ts index 568e47280f1..e72b1cd39a7 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs.module.ts @@ -3,7 +3,7 @@ import { NgModule } from '@angular/core'; import { ReactiveFormsModule } from '@angular/forms'; import { RouterModule } from '@angular/router'; -import { NgbNavModule, NgbTypeaheadModule } from '@ng-bootstrap/ng-bootstrap'; +import { NgbNavModule, NgbTooltipModule, NgbTypeaheadModule } from '@ng-bootstrap/ng-bootstrap'; import { NgBootstrapFormValidationModule } from 'ng-bootstrap-form-validation'; import { SharedModule } from '../../shared/shared.module'; @@ -21,7 +21,8 @@ import { NfsListComponent } from './nfs-list/nfs-list.component'; NgbNavModule, CommonModule, NgbTypeaheadModule, - NgBootstrapFormValidationModule + NgBootstrapFormValidationModule, + NgbTooltipModule ], declarations: [ NfsListComponent, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.html index 8e6fd0aa6b3..b21e94f8e1a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.html @@ -233,10 +233,10 @@ @@ -293,15 +293,15 @@ @@ -354,8 +354,8 @@ @@ -393,15 +393,15 @@ @@ -415,10 +415,10 @@