]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: Use ng-bootstrap for Dropdown
authorTiago Melo <tmelo@suse.com>
Fri, 29 May 2020 19:24:58 +0000 (19:24 +0000)
committerTiago Melo <tmelo@suse.com>
Tue, 9 Jun 2020 16:34:42 +0000 (16:34 +0000)
Fixes: https://tracker.ceph.com/issues/45758
Fixes: https://tracker.ceph.com/issues/45566
Signed-off-by: Tiago Melo <tmelo@suse.com>
36 files changed:
src/pybind/mgr/dashboard/frontend/cypress/integration/block/images.po.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/page-helper.po.ts
src/pybind/mgr/dashboard/frontend/src/app/app.module.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/block.module.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/daemon-list/daemon-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirroring.module.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/overview/overview.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/cluster.module.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool.module.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw.module.ts
src/pybind/mgr/dashboard/frontend/src/app/core/layouts/login-layout/login-layout.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/administration/administration.component.html
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/dashboard-help/dashboard-help.component.html
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/identity/identity.component.html
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation.module.ts
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.scss
src/pybind/mgr/dashboard/frontend/src/app/shared/components/components.module.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/language-selector/language-selector.component.html
src/pybind/mgr/dashboard/frontend/src/app/shared/components/language-selector/language-selector.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/datatable.module.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-actions/table-actions.component.html
src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-key-value/table-key-value.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.html
src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.scss
src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts
src/pybind/mgr/dashboard/frontend/src/styles.scss

index c43b838e3f08e2f8163d503f74afa199e4800aa7..f744920c3cd71ab2b1eab36292219fa09b6b0a0d 100644 (file)
@@ -51,7 +51,7 @@ export class ImagesPageHelper extends PageHelper {
 
     // click on the drop down and selects the move to trash option
     cy.get('.table-actions button.dropdown-toggle').first().click();
-    cy.get('li.move-to-trash').click();
+    cy.get('button.move-to-trash').click();
 
     cy.contains('button', 'Move Image').should('be.visible').click();
 
@@ -71,12 +71,12 @@ export class ImagesPageHelper extends PageHelper {
     cy.contains('button', 'Restore').click();
 
     // wait for pop-up to be visible (checks for title of pop-up)
-    cy.get('#name').should('be.visible');
+    cy.get('cd-modal #name').should('be.visible');
 
     // If a new name for the image is passed, it changes the name of the image
     if (newName !== undefined) {
       // click name box and send new name
-      cy.get('#name').clear().type(newName);
+      cy.get('cd-modal #name').clear().type(newName);
     }
 
     cy.contains('button', 'Restore Image').click();
index 2aaf901bd53009403bfe5622c2b54a85a29bd11c..bc0bd1435c11ff8108ac42f03d65b7853921bcfe 100644 (file)
@@ -214,10 +214,10 @@ export abstract class PageHelper {
   filterTable(name: string, option: string) {
     this.waitDataTableToLoad();
 
-    cy.get('.tc_filter_name > a').click();
+    cy.get('.tc_filter_name > button').click();
     cy.contains(`.tc_filter_name .dropdown-item`, name).click();
 
-    cy.get('.tc_filter_option > a').click();
+    cy.get('.tc_filter_option > button').click();
     cy.contains(`.tc_filter_option .dropdown-item`, option).click();
   }
 
@@ -245,11 +245,11 @@ export abstract class PageHelper {
 
     // Clicks on table Delete button
     cy.get('.table-actions button.dropdown-toggle').first().click(); // open submenu
-    cy.get('li.delete a').click(); // click on "delete" menu item
+    cy.get('button.delete').click(); // click on "delete" menu item
 
     // Confirms deletion
-    cy.get('.custom-control-label').click();
-    cy.contains('button', 'Delete').click();
+    cy.get('cd-modal .custom-control-label').click();
+    cy.contains('cd-modal button', 'Delete').click();
 
     // Wait for modal to close
     cy.get('cd-modal').should('not.exist');
index 350ba718f7ca7e3bd4a42c1cc305fddca1e53a6b..fb930c95a8828d29ada2d37cc0f712a29dc2db52 100644 (file)
@@ -12,8 +12,6 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 import { JwtModule } from '@auth0/angular-jwt';
 import { I18n } from '@ngx-translate/i18n-polyfill';
 import { NgBootstrapFormValidationModule } from 'ng-bootstrap-form-validation';
-
-import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
 import { ToastrModule } from 'ngx-toastr';
 
 import { AppRoutingModule } from './app-routing.module';
@@ -45,7 +43,6 @@ export function jwtTokenGetter() {
     CoreModule,
     SharedModule,
     CephModule,
-    BsDropdownModule.forRoot(),
     JwtModule.forRoot({
       config: {
         tokenGetter: jwtTokenGetter
index c1357864d5dcee0bf17adb5f3c74f4625bdfd950..4aa8039ddea1c93669bacb9be603e4460c41d70a 100644 (file)
@@ -7,7 +7,6 @@ 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 { ActionLabels, URLVerbs } from '../../shared/constants/app.constants';
@@ -59,7 +58,6 @@ import { RbdTrashRestoreModalComponent } from './rbd-trash-restore-modal/rbd-tra
     FormsModule,
     ReactiveFormsModule,
     NgbNavModule,
-    BsDropdownModule.forRoot(),
     BsDatepickerModule.forRoot(),
     NgbTooltipModule,
     ModalModule.forRoot(),
index a4b883fcb6c95a6c92447177cc192b1c7e2a00df..e7b3b96c9c5d148d9e8176e48e8c8682a6a6a56d 100644 (file)
@@ -280,7 +280,7 @@ export class IscsiTargetDetailsComponent implements OnChanges, OnInit {
       const tempData = this.metadata[node.data.cdId] || {};
 
       if (node.data.cdId === 'root') {
-        this.detailTable?.toggleColumn({ target: { name: 'default', checked: true } });
+        this.detailTable?.toggleColumn({ prop: 'default', isHidden: true });
         this.data = _.map(this.settings.target_default_controls, (value, key) => {
           value = this.format(value);
           return {
@@ -300,7 +300,7 @@ export class IscsiTargetDetailsComponent implements OnChanges, OnInit {
           });
         }
       } else if (node.data.cdId.toString().startsWith('disk_')) {
-        this.detailTable?.toggleColumn({ target: { name: 'default', checked: true } });
+        this.detailTable?.toggleColumn({ prop: 'default', isHidden: true });
         this.data = _.map(this.settings.disk_default_controls[tempData.backstore], (value, key) => {
           value = this.format(value);
           return {
@@ -326,7 +326,7 @@ export class IscsiTargetDetailsComponent implements OnChanges, OnInit {
           }
         });
       } else {
-        this.detailTable?.toggleColumn({ target: { name: 'default', checked: false } });
+        this.detailTable?.toggleColumn({ prop: 'default', isHidden: false });
         this.data = _.map(tempData, (value, key) => {
           return {
             displayName: key,
index 5bfd945963a0060dcdb39e8aff4b6c6b22c99faa..b2a511bf2897f943292969ffd17979c34ba502cd 100644 (file)
@@ -2,8 +2,6 @@ import { HttpClientTestingModule } from '@angular/common/http/testing';
 import { ComponentFixture, TestBed } from '@angular/core/testing';
 import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 
-import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
-
 import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
 import { SharedModule } from '../../../../shared/shared.module';
 import { MirrorHealthColorPipe } from '../mirror-health-color.pipe';
@@ -15,12 +13,7 @@ describe('DaemonListComponent', () => {
 
   configureTestBed({
     declarations: [DaemonListComponent, MirrorHealthColorPipe],
-    imports: [
-      BrowserAnimationsModule,
-      SharedModule,
-      BsDropdownModule.forRoot(),
-      HttpClientTestingModule
-    ],
+    imports: [BrowserAnimationsModule, SharedModule, HttpClientTestingModule],
     providers: i18nProviders
   });
 
index 207d148682f1d01c43b00a90628f40d52762d524..48483693be068e65fe5c432ff9af4b23897b28eb 100644 (file)
@@ -3,7 +3,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
 import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 
 import { NgbNavModule, NgbProgressbarModule } from '@ng-bootstrap/ng-bootstrap';
-import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
 
 import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
 import { SharedModule } from '../../../../shared/shared.module';
@@ -19,7 +18,6 @@ describe('ImageListComponent', () => {
     imports: [
       BrowserAnimationsModule,
       SharedModule,
-      BsDropdownModule.forRoot(),
       NgbNavModule,
       NgbProgressbarModule,
       HttpClientTestingModule
index 917de076da08b75d2af02ca82ed9dee2944edd7d..b41fe55ccd1e2dfdc07226de5a15d14d2593b2ab 100644 (file)
@@ -5,7 +5,6 @@ import { RouterModule } from '@angular/router';
 
 import { NgbNavModule, NgbProgressbarModule } from '@ng-bootstrap/ng-bootstrap';
 import { NgBootstrapFormValidationModule } from 'ng-bootstrap-form-validation';
-import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
 import { ModalModule } from 'ngx-bootstrap/modal';
 
 import { SharedModule } from '../../../shared/shared.module';
@@ -38,7 +37,6 @@ import { PoolListComponent } from './pool-list/pool-list.component';
     FormsModule,
     ReactiveFormsModule,
     NgbProgressbarModule,
-    BsDropdownModule.forRoot(),
     ModalModule.forRoot(),
     NgBootstrapFormValidationModule
   ],
index 128a8c811956daebeda32a211f917e254e90c8d0..0ef017448cd485a5e0519400b0882f7bc127a773 100644 (file)
@@ -4,7 +4,6 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 import { RouterTestingModule } from '@angular/router/testing';
 
 import { NgbNavModule, NgbProgressbarModule } from '@ng-bootstrap/ng-bootstrap';
-import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
 import { ToastrModule } from 'ngx-toastr';
 
 import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
@@ -30,7 +29,6 @@ describe('OverviewComponent', () => {
     imports: [
       BrowserAnimationsModule,
       SharedModule,
-      BsDropdownModule.forRoot(),
       NgbNavModule,
       NgbProgressbarModule,
       HttpClientTestingModule,
index 5978425b8203e24313c3816d83a3863e66ea50da..e5a8f36666df7f67eb8b23234229b0cfabd96dbe 100644 (file)
@@ -3,7 +3,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
 import { RouterTestingModule } from '@angular/router/testing';
 
 import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
-import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
 import { ToastrModule } from 'ngx-toastr';
 
 import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
@@ -20,7 +19,6 @@ describe('PoolListComponent', () => {
     imports: [
       BrowserAnimationsModule,
       SharedModule,
-      BsDropdownModule.forRoot(),
       HttpClientTestingModule,
       RouterTestingModule,
       ToastrModule.forRoot()
index b349282bb8a7925d64db4836bff2e3a1cd41776a..7bb8f2e7420285a903fc495208580319e0109992 100644 (file)
@@ -3,9 +3,9 @@ import { FormsModule } from '@angular/forms';
 import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 import { RouterTestingModule } from '@angular/router/testing';
 
+import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
 import { NgxDatatableModule } from '@swimlane/ngx-datatable';
 import { ChartsModule } from 'ng2-charts';
-import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
 
 import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
 import { ComponentsModule } from '../../../shared/components/components.module';
@@ -27,7 +27,7 @@ describe('RbdConfigurationListComponent', () => {
       NgxDatatableModule,
       RouterTestingModule,
       ComponentsModule,
-      BsDropdownModule.forRoot(),
+      NgbDropdownModule,
       ChartsModule,
       PipesModule
     ],
index 38b6061fad1fa6e6223fd76620287932f9475391..b2cbe21a8ae051ad1d9d6ce4505f62987b895504 100644 (file)
@@ -4,7 +4,6 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 import { RouterTestingModule } from '@angular/router/testing';
 
 import { NgbNavModule, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
-import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
 import { ModalModule } from 'ngx-bootstrap/modal';
 import { ToastrModule } from 'ngx-toastr';
 import { BehaviorSubject, of } from 'rxjs';
@@ -43,7 +42,6 @@ describe('RbdListComponent', () => {
     imports: [
       BrowserAnimationsModule,
       SharedModule,
-      BsDropdownModule.forRoot(),
       NgbNavModule,
       ModalModule.forRoot(),
       NgbTooltipModule,
index f597a57ace7eb8f7207875c8bb546f1da6df64f3..930db911083f93985dd1290505815514bfeb0a66 100644 (file)
@@ -7,7 +7,6 @@ import { NgbNavModule, NgbTooltipModule, NgbTypeaheadModule } from '@ng-bootstra
 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';
 
@@ -72,7 +71,6 @@ import { TelemetryComponent } from './telemetry/telemetry.component';
     RouterModule,
     FormsModule,
     ReactiveFormsModule,
-    BsDropdownModule.forRoot(),
     BsDatepickerModule.forRoot(),
     ModalModule.forRoot(),
     NgbTooltipModule,
index 60f82860549fda2bfe9272fbc7793b86b1da3b9b..a70ccd0b802149cee74a0352fa8ccd80b64a23ec 100644 (file)
@@ -4,7 +4,6 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 import { RouterTestingModule } from '@angular/router/testing';
 
 import { NgBootstrapFormValidationModule } from 'ng-bootstrap-form-validation';
-import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
 import { ToastrModule } from 'ngx-toastr';
 
 import {
@@ -27,7 +26,6 @@ describe('HostDetailsComponent', () => {
     imports: [
       BrowserAnimationsModule,
       HttpClientTestingModule,
-      BsDropdownModule.forRoot(),
       NgBootstrapFormValidationModule.forRoot(),
       RouterTestingModule,
       CephModule,
index 9fff78b96938df350b7c25f204ab50d9be75386e..cb103afab6d12cd31361f013104215c90d048cfe 100644 (file)
@@ -3,7 +3,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 import { RouterTestingModule } from '@angular/router/testing';
 
-import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
 import { ToastrModule } from 'ngx-toastr';
 import { of } from 'rxjs';
 
@@ -34,7 +33,6 @@ describe('HostsComponent', () => {
       CephSharedModule,
       SharedModule,
       HttpClientTestingModule,
-      BsDropdownModule.forRoot(),
       RouterTestingModule,
       ToastrModule.forRoot(),
       CephModule,
index b03e28a76c7d9fe7d01ff108c46e41b912da72c4..ea0db7a3a608a6b065814433fd13f16c19938e4b 100644 (file)
@@ -5,6 +5,7 @@ import { By } from '@angular/platform-browser';
 import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 import { RouterTestingModule } from '@angular/router/testing';
 
+import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
 import * as _ from 'lodash';
 import { BsModalService } from 'ngx-bootstrap/modal';
 import { ToastrModule } from 'ngx-toastr';
@@ -97,6 +98,7 @@ describe('OsdListComponent', () => {
       ToastrModule.forRoot(),
       CephModule,
       ReactiveFormsModule,
+      NgbDropdownModule,
       RouterTestingModule,
       CoreModule,
       RouterTestingModule
@@ -360,7 +362,7 @@ describe('OsdListComponent', () => {
       const tableActionElement = fixture.debugElement.query(By.directive(TableActionsComponent));
       const toClassName = TestBed.inject(TableActionsComponent).toClassName;
       const getActionClasses = (action: CdTableAction) =>
-        tableActionElement.query(By.css(`.${toClassName(action.name)} .dropdown-item`)).classes;
+        tableActionElement.query(By.css(`[ngbDropdownItem].${toClassName(action.name)}`)).classes;
 
       component.tableActions.forEach((action) => {
         if (action.name === 'Create') {
index e22347a8b1b93d1a0a8277f146db80747f1a7da4..088202764fe085d57bc0b39d61cc2b013f741f5b 100644 (file)
@@ -3,7 +3,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
 import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 import { RouterTestingModule } from '@angular/router/testing';
 
-import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
 import { BsModalRef, BsModalService, ModalModule } from 'ngx-bootstrap/modal';
 import { ToastrModule } from 'ngx-toastr';
 import { of } from 'rxjs';
@@ -30,7 +29,6 @@ describe('SilenceListComponent', () => {
     imports: [
       BrowserAnimationsModule,
       SharedModule,
-      BsDropdownModule.forRoot(),
       ModalModule.forRoot(),
       ToastrModule.forRoot(),
       RouterTestingModule,
index 4a936bf6ee8c650cd4ba72e0814ad3054a3928c6..0b81aafee05cadb883e19efbf4c8e4e24e5704dd 100644 (file)
@@ -5,7 +5,6 @@ import { RouterModule, Routes } from '@angular/router';
 
 import { NgbNavModule, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
 import { NgBootstrapFormValidationModule } from 'ng-bootstrap-form-validation';
-import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
 
 import { ActionLabels, URLVerbs } from '../../shared/constants/app.constants';
 import { SharedModule } from '../../shared/shared.module';
@@ -25,7 +24,6 @@ import { PoolListComponent } from './pool-list/pool-list.component';
     SharedModule,
     RouterModule,
     ReactiveFormsModule,
-    BsDropdownModule,
     NgbTooltipModule,
     BlockModule,
     NgBootstrapFormValidationModule
index 970661139526dd9ede4b552fde148310051bf1e8..00557b04d088f8a868e134e5fb0e65bb4d9a3e6b 100644 (file)
@@ -5,7 +5,6 @@ import { RouterModule, Routes } from '@angular/router';
 
 import { NgbNavModule, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
 import { NgBootstrapFormValidationModule } from 'ng-bootstrap-form-validation';
-import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
 import { ModalModule } from 'ngx-bootstrap/modal';
 
 import { ActionLabels, URLVerbs } from '../../shared/constants/app.constants';
@@ -42,7 +41,6 @@ import { RgwUserSwiftKeyModalComponent } from './rgw-user-swift-key-modal/rgw-us
     FormsModule,
     ReactiveFormsModule,
     PerformanceCounterModule,
-    BsDropdownModule.forRoot(),
     NgbNavModule,
     ModalModule.forRoot(),
     RouterModule,
index 46a744f21a75f94c355456d66c536d1a21126546..bd8a5ec1db295a387a3f3deca71601b86f001c7f 100644 (file)
@@ -3,7 +3,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 
 import { BsDatepickerModule } from 'ngx-bootstrap/datepicker';
-import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
 
 import { RouterTestingModule } from '@angular/router/testing';
 import { SharedModule } from '../../../shared/shared.module';
@@ -18,7 +17,6 @@ describe('LoginLayoutComponent', () => {
       declarations: [LoginLayoutComponent],
       imports: [
         BrowserAnimationsModule,
-        BsDropdownModule.forRoot(),
         BsDatepickerModule.forRoot(),
         HttpClientTestingModule,
         RouterTestingModule,
index 52d045ca645f8bcbca2310dea8e1a27e19d35626..fa4b38d167a5928073b73e61d0aa801541720186 100644 (file)
@@ -1,7 +1,7 @@
-<div dropdown
-     class="btn-group"
+<div ngbDropdown
+     placement="bottom-right"
      *ngIf="userPermission.read">
-  <a dropdownToggle
+  <a ngbDropdownToggle
      class="dropdown-toggle"
      i18n-title
      title="Dashboard Settings">
@@ -9,18 +9,14 @@
     <span i18n
           class="d-md-none">Dashboard Settings</span>
   </a>
-  <ul *dropdownMenu
-      class="dropdown-menu dropdown-menu-right"
-      role="menu">
-    <li *ngIf="userPermission.read">
-      <a i18n
-         class="dropdown-item"
-         routerLink="/user-management">User management</a>
-    </li>
-    <li *ngIf="configOptPermission.read">
-      <a i18n
-         class="dropdown-item"
-         routerLink="/telemetry">Telemetry configuration</a>
-    </li>
-  </ul>
+  <div ngbDropdownMenu>
+    <button ngbDropdownItem
+            *ngIf="userPermission.read"
+            routerLink="/user-management"
+            i18n>User management</button>
+    <button ngbDropdownItem
+            *ngIf="configOptPermission.read"
+            routerLink="/telemetry"
+            i18n>Telemetry configuration</button>
+  </div>
 </div>
index 122bcfd5943d273e85fdad3f76d3f6e2f900dee8..7d092ccdd7daf5de9eb93c49028b6dbd988e2f32 100644 (file)
@@ -6,35 +6,26 @@
          name="token" />
 </form>
 
-<div class="btn-group"
-     dropdown>
-  <a dropdownToggle
-     class="dropdown-toggle"
+<div ngbDropdown
+     placement="bottom-right">
+  <a ngbDropdownToggle
      i18n-title
      title="Help">
     <i [ngClass]="[icons.questionCircle]"></i>
     <span i18n
           class="d-md-none">Help</span>
   </a>
-  <ul *dropdownMenu
-      class="dropdown-menu dropdown-menu-right"
-      role="menu">
-    <li>
-      <a i18n
-         class="dropdown-item"
-         [ngClass]="{'disabled': !docsUrl}"
-         href="{{ docsUrl }}"
-         target="_blank">Documentation</a>
-    </li>
-    <li>
-      <a i18n
-         class="dropdown-item"
-         (click)="goToApiDocs()">API</a>
-    </li>
-    <li>
-      <a i18n
-         class="dropdown-item"
-         (click)="openAboutModal()">About</a>
-    </li>
-  </ul>
+  <div ngbDropdownMenu>
+    <a ngbDropdownItem
+       [ngClass]="{'disabled': !docsUrl}"
+       href="{{ docsUrl }}"
+       target="_blank"
+       i18n>Documentation</a>
+    <button ngbDropdownItem
+            (click)="goToApiDocs()"
+            i18n>API</button>
+    <button ngbDropdownItem
+            (click)="openAboutModal()"
+            i18n>About</button>
+  </div>
 </div>
index 629a635e81151dbf5fc5f10db5570078b77b1621..bf0f22fbb4a1970bf28fcdbd2a3ca15c03f79885 100644 (file)
@@ -1,38 +1,27 @@
-<div dropdown
-     class="btn-group">
-  <a dropdownToggle
-     class="dropdown-toggle"
+<div ngbDropdown
+     placement="bottom-right">
+  <a ngbDropdownToggle
      i18n-title
      title="Logged in user">
     <i [ngClass]="[icons.user]"></i>
     <span i18n
           class="d-md-none">Logged in user</span>
   </a>
-  <ul *dropdownMenu
-      class="dropdown-menu dropdown-menu-right"
-      role="menu">
-    <li class="disabled"
-        role="menuitem">
-      <a i18n
-         class="dropdown-item disabled"
-         href="#">Signed in as
-      <strong>{{ username }}</strong></a>
-    </li>
+  <div ngbDropdownMenu>
+    <button ngbDropdownItem
+            disabled
+            i18n>Signed in as <strong>{{ username }}</strong></button>
     <li class="dropdown-divider"></li>
-    <li *ngIf="!sso"
-        role="menuitem">
-      <a class="dropdown-item"
-         routerLink="/user-profile/edit">
-        <i [ngClass]="[icons.lock]"></i>
-        <span i18n>Change password</span>
-      </a>
-    </li>
-    <li role="menuitem">
-      <a class="dropdown-item"
-         (click)="logout()">
-        <i [ngClass]="[icons.signOut]"></i>
-        <span i18n>Sign out</span>
-      </a>
-    </li>
-  </ul>
+    <button ngbDropdownItem
+            *ngIf="!sso"
+            routerLink="/user-profile/edit">
+      <i [ngClass]="[icons.lock]"></i>
+      <span i18n>Change password</span>
+    </button>
+    <button ngbDropdownItem
+            (click)="logout()">
+      <i [ngClass]="[icons.signOut]"></i>
+      <span i18n>Sign out</span>
+    </button>
+  </div>
 </div>
index bee03ba03a4fff09f9b48fbea50b478a3f67e1c2..ba35621835033ea8791267d6731c456a7d424a4e 100644 (file)
@@ -2,8 +2,8 @@ import { CommonModule } from '@angular/common';
 import { NgModule } from '@angular/core';
 import { RouterModule } from '@angular/router';
 
+import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
 import { CollapseModule } from 'ngx-bootstrap/collapse';
-import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
 import { SimplebarAngularModule } from 'simplebar-angular';
 
 import { AppRoutingModule } from '../../app-routing.module';
@@ -23,7 +23,7 @@ import { NotificationsComponent } from './notifications/notifications.component'
     CommonModule,
     AuthModule,
     CollapseModule.forRoot(),
-    BsDropdownModule.forRoot(),
+    NgbDropdownModule,
     AppRoutingModule,
     SharedModule,
     SimplebarAngularModule,
index c3c0f942f6dd19e6d304ab67625252dd53038968..3075f452c7a828fae70ca9be05e3a44a40a63928 100644 (file)
@@ -55,7 +55,7 @@
     }
   }
 
-  .navbar-nav > li > .cd-navbar > [dropdown] > a,
+  .navbar-nav > li > .cd-navbar > [ngbDropdown] > a,
   .navbar-nav > li > .cd-navbar > a,
   .navbar-nav > li > a {
     color: $color-nav-links;
     color: $color-nav-links;
   }
 
-  .navbar-nav > li > .cd-navbar > [dropdown] > a:hover,
-  .navbar-nav > li > .cd-navbar > [dropdown].open > a,
+  .navbar-nav > li > .cd-navbar > [ngbDropdown] > a:hover,
+  .navbar-nav > li > .cd-navbar > [ngbDropdown].open > a,
   .navbar-nav > li > .cd-navbar > a:hover,
   .navbar-nav > li > a:hover,
   .navbar-nav > li:hover {
     background-color: $color-nav-links-hover;
   }
 
-  .navbar-nav > .open > .cd-navbar > [dropdown] > a,
-  .navbar-nav > .open > .cd-navbar > [dropdown] > a:hover,
+  .navbar-nav > .open > .cd-navbar > [ngbDropdown] > a,
+  .navbar-nav > .open > .cd-navbar > [ngbDropdown] > a:hover,
   .navbar-nav > .open > .cd-navbar > a,
   .navbar-nav > .open > .cd-navbar > a:focus,
   .navbar-nav > .open > .cd-navbar > a:hover,
index 2368cb1e231938eacd9fb5078fa29e41c41266c7..d555e08a51c19cdffbbf9b942e69e4c865fbab52 100644 (file)
@@ -5,6 +5,7 @@ import { RouterModule } from '@angular/router';
 
 import {
   NgbAlertModule,
+  NgbDropdownModule,
   NgbPopoverModule,
   NgbProgressbarModule,
   NgbTooltipModule
@@ -12,7 +13,6 @@ import {
 import { NgBootstrapFormValidationModule } from 'ng-bootstrap-form-validation';
 import { ClickOutsideModule } from 'ng-click-outside';
 import { ChartsModule } from 'ng2-charts';
-import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
 import { ModalModule } from 'ngx-bootstrap/modal';
 import { SimplebarAngularModule } from 'simplebar-angular';
 
@@ -55,7 +55,7 @@ import { ViewCacheComponent } from './view-cache/view-cache.component';
     PipesModule,
     ModalModule.forRoot(),
     DirectivesModule,
-    BsDropdownModule,
+    NgbDropdownModule,
     NgBootstrapFormValidationModule,
     ClickOutsideModule,
     SimplebarAngularModule,
index 8b00718bf4f6f89a54a92deee95dbe3d538499ed..96084a40de56d72d51af7d438689c9f2507aea25 100644 (file)
@@ -1,20 +1,19 @@
-<div dropdown
-     class="btn-group"
+<div ngbDropdown
+     placement="bottom-right"
      *ngIf="isDropdown">
-  <a dropdownToggle
-     class="dropdown-toggle"
-     data-toggle="dropdown"
+  <a ngbDropdownToggle
      i18n-title
      title="Select a Language">
     {{ supportedLanguages[selectedLanguage] }}
   </a>
-  <ul *dropdownMenu
-      class="dropdown-menu dropdown-menu-right">
-    <li *ngFor="let lang of supportedLanguages | keyvalue">
-      <a class="dropdown-item"
-         (click)="changeLanguage(lang.key)">{{ lang.value }}</a>
-    </li>
-  </ul>
+  <div ngbDropdownMenu>
+    <ng-container *ngFor="let lang of supportedLanguages | keyvalue">
+      <button ngbDropdownItem
+              (click)="changeLanguage(lang.key)">
+        {{ lang.value }}
+      </button>
+    </ng-container>
+  </div>
 </div>
 
 <select *ngIf="!isDropdown"
index 966f9661b9506de41cecb8ebfa7f68f4421e020c..9ed9cc05de28911d2c8c9aa33f47453ee85fb0d8 100644 (file)
@@ -16,17 +16,18 @@ export class LanguageSelectorComponent implements OnInit {
   @Input()
   isDropdown = true;
 
-  supportedLanguages: Record<string, any> = SupportedLanguages;
+  supportedLanguages: Record<string, any> = {};
   selectedLanguage: string;
 
   constructor(private localeService: BsLocaleService, private languageService: LanguageService) {}
 
   ngOnInit() {
     this.selectedLanguage = this.languageService.getLocale();
+
     this.defineUsedLanguage();
 
     this.languageService.getLanguages().subscribe((langs) => {
-      this.supportedLanguages = _.pick(this.supportedLanguages, langs) as Object;
+      this.supportedLanguages = _.pick(SupportedLanguages, langs) as Object;
     });
   }
 
index 479f6cabc93abe5cde4d9cc981ff794d7487be59..26aee6fce37c3dfca2f42be56dd948d25a8457fb 100644 (file)
@@ -3,8 +3,8 @@ import { NgModule } from '@angular/core';
 import { FormsModule } from '@angular/forms';
 import { RouterModule } from '@angular/router';
 
+import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
 import { NgxDatatableModule } from '@swimlane/ngx-datatable';
-import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
 
 import { ComponentsModule } from '../components/components.module';
 import { PipesModule } from '../pipes/pipes.module';
@@ -17,7 +17,7 @@ import { TableComponent } from './table/table.component';
     CommonModule,
     NgxDatatableModule,
     FormsModule,
-    BsDropdownModule.forRoot(),
+    NgbDropdownModule,
     PipesModule,
     ComponentsModule,
     RouterModule
index 1f20fc29f5abc7221d31a4ea7aa3cc168eeaa918..68ae24696a5ff120678ec0db4b4a335a592325fd 100644 (file)
@@ -1,5 +1,4 @@
-<div class="btn-group"
-     dropdown>
+<div class="btn-group">
   <ng-container *ngIf="getCurrentButton() as action">
     <button type="button"
             class="btn btn-{{btnColor}}"
@@ -7,33 +6,36 @@
             (click)="useClickAction(action)"
             [routerLink]="useRouterLink(action)"
             [preserveFragment]="action.preserveFragment ? '' : null">
-      <i [ngClass]="[action.icon]"></i><span>{{ action.name }}</span>
+
+      <i [ngClass]="[action.icon]"></i>
+      <span>{{ action.name }}</span>
     </button>
   </ng-container>
-  <button type="button"
-          dropdownToggle
-          *ngIf="showDropDownActions()"
-          class="btn btn-{{btnColor}} dropdown-toggle dropdown-toggle-split">
-    <ng-container *ngIf="dropDownOnly">{{ dropDownOnly }} </ng-container>
-    <span *ngIf="!dropDownOnly"
-          class="sr-only"></span>
-  </button>
-  <ul *dropdownMenu
-      class="dropdown-menu"
-      role="menu">
-    <ng-container *ngFor="let action of dropDownActions">
-      <li role="menuitem"
-          class="{{ toClassName(action['name']) }}"
-          data-toggle="tooltip"
-          title="{{ useDisableDesc(action) }}">
-        <a class="dropdown-item"
-           (click)="useClickAction(action)"
-           [routerLink]="useRouterLink(action)"
-           [preserveFragment]="action.preserveFragment ? '' : null"
-           [ngClass]="{'disabled': disableSelectionAction(action)}">
-          <i [ngClass]="[action.icon]"></i><span>{{ action.name }}</span>
-        </a>
-      </li>
-    </ng-container>
-  </ul>
+  <div class="btn-group"
+       ngbDropdown
+       placement="bottom-right"
+       role="group"
+       aria-label="Button group with nested dropdown">
+    <button class="btn btn-{{btnColor}} dropdown-toggle-split"
+            *ngIf="showDropDownActions()"
+            ngbDropdownToggle>
+      <ng-container *ngIf="dropDownOnly">{{ dropDownOnly }} </ng-container>
+      <span *ngIf="!dropDownOnly"
+            class="sr-only"></span>
+    </button>
+    <div class="dropdown-menu"
+         ngbDropdownMenu>
+      <ng-container *ngFor="let action of dropDownActions">
+        <button ngbDropdownItem
+                class="{{ toClassName(action['name']) }}"
+                (click)="useClickAction(action)"
+                [routerLink]="useRouterLink(action)"
+                [preserveFragment]="action.preserveFragment ? '' : null"
+                [disabled]="disableSelectionAction(action)">
+          <i [ngClass]="[action.icon]"></i>
+          <span>{{ action.name }}</span>
+        </button>
+      </ng-container>
+    </div>
+  </div>
 </div>
index c25cb54404b9b04a9258db5fa3cbf3ae1fd7db06..d69d6298ecdc747638966bf8d1de7b996d6f610d 100644 (file)
@@ -2,8 +2,8 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
 import { FormsModule } from '@angular/forms';
 import { RouterTestingModule } from '@angular/router/testing';
 
+import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
 import { NgxDatatableModule } from '@swimlane/ngx-datatable';
-import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
 
 import { configureTestBed } from '../../../../testing/unit-test-helper';
 import { ComponentsModule } from '../../components/components.module';
@@ -25,7 +25,7 @@ describe('TableKeyValueComponent', () => {
       NgxDatatableModule,
       ComponentsModule,
       RouterTestingModule,
-      BsDropdownModule.forRoot(),
+      NgbDropdownModule,
       PipesModule
     ]
   });
index c3ac07f1512131dd7be057b89bb0ddf14118a7e6..95bb3ecf74176d1a8f7b12dff59fd9580b29c07e 100644 (file)
     <!-- column filters -->
     <div *ngIf="columnFilters.length !== 0"
          class="btn-group widget-toolbar">
-      <div dropdown
-           class="btn-group tc_filter_name">
-        <a dropdownToggle
-           class="btn btn-light dropdown-toggle"
-           data-toggle="dropdown">
+      <div ngbDropdown
+           placement="bottom-right"
+           class="tc_filter_name">
+        <button ngbDropdownToggle
+                class="btn btn-light">
           <i [ngClass]="[icons.large, icons.filter]"></i>
           {{ selectedFilter.column.name }}
-        </a>
-        <ul *dropdownMenu
-            class="dropdown-menu px-1"
-            role="menu">
-          <li *ngFor="let filter of columnFilters"
-              role="menuitem">
-            <a href=""
-               class="dropdown-item"
-               (click)="onSelectFilter(filter); false">{{ filter.column.name }}</a>
-          </li>
-        </ul>
+        </button>
+        <div ngbDropdownMenu>
+          <ng-container *ngFor="let filter of columnFilters">
+            <button ngbDropdownItem
+                    (click)="onSelectFilter(filter); false">{{ filter.column.name }}</button>
+          </ng-container>
+        </div>
       </div>
-      <div dropdown
-           class="btn-group tc_filter_option">
-        <a dropdownToggle
-           class="btn btn-light dropdown-toggle"
-           [class.disabled]="selectedFilter.options.length === 0"
-           data-toggle="dropdown">
-           {{ selectedFilter.value ? selectedFilter.value.formatted: 'Any' }}
-        </a>
-        <ul *dropdownMenu
-            class="dropdown-menu px-1"
-            role="menu">
-          <li *ngFor="let option of selectedFilter.options"
-              role="menuitem">
-            <a href=""
-               class="dropdown-item"
-               (click)="onChangeFilter(selectedFilter, option); false">{{ option.formatted }}
+
+      <div ngbDropdown
+           placement="bottom-right"
+           class="tc_filter_option">
+        <button ngbDropdownToggle
+                class="btn btn-light"
+                [class.disabled]="selectedFilter.options.length === 0">
+          {{ selectedFilter.value ? selectedFilter.value.formatted: 'Any' }}
+        </button>
+        <div ngbDropdownMenu>
+          <ng-container *ngFor="let option of selectedFilter.options">
+            <button ngbDropdownItem
+                    (click)="onChangeFilter(selectedFilter, option); false">
+              {{ option.formatted }}
               <i *ngIf="selectedFilter.value !== undefined && (selectedFilter.value.raw === option.raw)"
                  [ngClass]="[icons.check]"></i>
-            </a>
-          </li>
-        </ul>
+            </button>
+          </ng-container>
+        </div>
       </div>
     </div>
     <!-- end column filters -->
@@ -74,7 +68,7 @@
          *ngIf="searchField">
       <span class="input-group-prepend">
         <span class="input-group-text">
-        <i [ngClass]="[icons.search]"></i>
+          <i [ngClass]="[icons.search]"></i>
         </span>
       </span>
       <input class="form-control"
 
     <!-- show hide columns -->
     <div class="widget-toolbar">
-      <div dropdown
-           [autoClose]="false"
-           class="dropdown tc_menuitem tc_menuitem_cluster">
-        <a dropdownToggle
-           class="btn btn-light dropdown-toggle tc_columnBtn"
-           data-toggle="dropdown">
+      <div ngbDropdown
+           autoClose="outside"
+           class="tc_menuitem">
+        <button ngbDropdownToggle
+                class="btn btn-light tc_columnBtn">
           <i [ngClass]="[icons.large, icons.table]"></i>
-        </a>
-        <ul *dropdownMenu
-            class="dropdown-menu px-3">
+        </button>
+        <div ngbDropdownMenu>
           <ng-container *ngFor="let column of columns">
-            <li *ngIf="column.name !== ''" >
-              <div class="custom-control custom-checkbox">
+            <button ngbDropdownItem
+                    *ngIf="column.name !== ''"
+                    (click)="toggleColumn(column); false;">
+              <div class="custom-control custom-checkbox py-0">
                 <input class="custom-control-input"
                        type="checkbox"
-                       (change)="toggleColumn($event)"
                        [name]="column.prop"
                        [id]="column.prop"
                        [checked]="!column.isHidden">
                 <label class="custom-control-label"
                        [for]="column.prop">{{ column.name }}</label>
               </div>
-            </li>
+            </button>
           </ng-container>
-        </ul>
+        </div>
       </div>
     </div>
     <!-- end show hide columns -->
index 4a5f9ae8a6267a2c6f08618c3d83bf378716348e..31209f50532bfc510bc82305d76599b470c21034 100644 (file)
     }
   }
 
-  .dropdown-menu {
-    white-space: nowrap;
-    & li {
-      cursor: default;
-      & label {
-        width: 100%;
-        margin-bottom: 0;
-        padding-left: 0;
-        padding-right: 0;
-        cursor: pointer;
-        &:hover {
-          background-color: $color-table-dropdown-bg;
-        }
-        & input {
-          cursor: pointer;
-        }
-      }
-    }
-  }
   .dataTables_length > input {
     line-height: 25px;
     text-align: right;
index d5f598777fde14973a8694082e1069dba14f4442..bfb53a6cb2fd2cebc06c84f6d6014962641f8319 100644 (file)
@@ -3,9 +3,9 @@ import { FormsModule } from '@angular/forms';
 import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 import { RouterTestingModule } from '@angular/router/testing';
 
+import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
 import { NgxDatatableModule } from '@swimlane/ngx-datatable';
 import * as _ from 'lodash';
-import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
 
 import { configureTestBed } from '../../../../testing/unit-test-helper';
 import { ComponentsModule } from '../../components/components.module';
@@ -42,7 +42,7 @@ describe('TableComponent', () => {
       FormsModule,
       ComponentsModule,
       RouterTestingModule,
-      BsDropdownModule.forRoot(),
+      NgbDropdownModule,
       PipesModule
     ]
   });
@@ -436,10 +436,8 @@ describe('TableComponent', () => {
   describe('after ngInit', () => {
     const toggleColumn = (prop: string, checked: boolean) => {
       component.toggleColumn({
-        target: {
-          name: prop,
-          checked: checked
-        }
+        prop: prop,
+        isHidden: checked
       });
     };
 
index 35b750d029a89325c7526dd8fce4fa305aa91fc3..b08d7a489f26f52dc45f2ffcf82a80fe76b46dc7 100644 (file)
@@ -693,11 +693,11 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O
     this.updateSelection.emit(_.clone(this.selection));
   }
 
-  toggleColumn($event: any) {
-    const prop: TableColumnProp = $event.target.name;
-    const hide = !$event.target.checked;
+  toggleColumn(column: CdTableColumn) {
+    const prop: TableColumnProp = column.prop;
+    const hide = !column.isHidden;
     if (hide && this.tableColumns.length === 1) {
-      $event.target.checked = true;
+      column.isHidden = true;
       return;
     }
     _.find(this.localColumns, (c: CdTableColumn) => c.prop === prop).isHidden = hide;
index ab63ed5ae57f7df2641051121918585528f3a37d..d89ed504a54d74fa45c9ac9ddd99f1dec2399b13 100644 (file)
@@ -168,6 +168,10 @@ option {
 .dropdown-menu {
   min-width: 50px;
   z-index: 999999;
+
+  button.dropdown-item:focus {
+    outline: none;
+  }
 }
 .dropdown-menu > li > a {
   color: $color-dropdown-menu;