]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: fix rgw and osd regression in e2e
authorNizamudeen A <nia@redhat.com>
Mon, 24 Feb 2025 09:23:54 +0000 (14:53 +0530)
committerNizamudeen A <nia@redhat.com>
Thu, 13 Mar 2025 04:47:18 +0000 (10:17 +0530)
use aria-label as the selector in tests.

data-testid is not supported through this carbon cds-checkbox
input so we can't use it

regression started after started after #61319 and
https://github.com/ceph/ceph/pull/61478/files#diff-7bd2a1f48bd2a7bcebb744eb04d84706087b6b3c2651c4b1ad085b4b6e03fc6d
where multi-select is removed

Fixes: https://tracker.ceph.com/issues/68871
Signed-off-by: Nizamudeen A <nia@redhat.com>
25 files changed:
src/pybind/mgr/dashboard/frontend/cypress/e2e/block/images.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/cypress/e2e/block/mirroring.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/cypress/e2e/cluster/hosts.po.ts
src/pybind/mgr/dashboard/frontend/cypress/e2e/cluster/logs.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/cypress/e2e/common/forms-helper.feature.po.ts
src/pybind/mgr/dashboard/frontend/cypress/e2e/filesystems/filesystems.e2e-spec.feature
src/pybind/mgr/dashboard/frontend/cypress/e2e/filesystems/snapshots.e2e-spec.feature
src/pybind/mgr/dashboard/frontend/cypress/e2e/filesystems/subvolume-groups.e2e-spec.feature
src/pybind/mgr/dashboard/frontend/cypress/e2e/filesystems/subvolumes.e2e-spec.feature
src/pybind/mgr/dashboard/frontend/cypress/e2e/orchestrator/workflow/02-create-cluster-add-host.feature
src/pybind/mgr/dashboard/frontend/cypress/e2e/orchestrator/workflow/09-services.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/cypress/e2e/page-helper.po.ts
src/pybind/mgr/dashboard/frontend/cypress/e2e/pools/pools.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/buckets.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/buckets.po.ts
src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/configuration.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/configuration.po.ts
src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/users.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/users.po.ts
src/pybind/mgr/dashboard/frontend/cypress/e2e/ui/notification.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/cypress/e2e/ui/user-mgmt.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.html
src/pybind/mgr/dashboard/frontend/src/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component.html
src/pybind/mgr/dashboard/frontend/src/app/shared/directives/dynamic-input-combobox.directive.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/directives/dynamic-input-combobox.directive.ts

index 796f56405707626c1149dc1f21cdffc464fd63f9..deaa1c7fe7e440f789948fb6e29088284d21d8a1 100644 (file)
@@ -18,7 +18,7 @@ describe('Images page', () => {
   after(() => {
     // Deletes images test pool
     pools.navigateTo();
-    pools.delete(poolName, null, null, true);
+    pools.delete(poolName, null, null, true, false, false, true);
     pools.navigateTo();
     pools.existTableCell(poolName, false);
   });
@@ -58,7 +58,7 @@ describe('Images page', () => {
     });
 
     it('should delete image', () => {
-      images.delete(newImageName, null, null, true);
+      images.delete(newImageName, null, null, true, false, false, true);
     });
   });
 
index 810ecd27dcc5f43223959d8ee52dd954983617c7..cb7bad51e58ec75fc72010eb4c984790fd7c7403 100644 (file)
@@ -112,7 +112,7 @@ describe('Mirroring page', () => {
 
     afterEach(() => {
       pools.navigateTo();
-      pools.delete(poolName, null, null, true);
+      pools.delete(poolName, null, null, true, false, false, true);
     });
   });
 });
index 43ef2d5cd50e90fb9bdefa7b98bfcebfa3cfdb36..70957e4dada2f2be6dc1fb4f6bbaac1ddb8d8b5c 100644 (file)
@@ -65,7 +65,7 @@ export class HostsPageHelper extends PageHelper {
   }
 
   remove(hostname: string) {
-    super.delete(hostname, this.columnIndex.hostname, 'hosts', true, false, true);
+    super.delete(hostname, this.columnIndex.hostname, 'hosts', true, false, true, true);
   }
 
   // Add or remove labels on a host, then verify labels in the table
index 167c35cb99757d2a290c029cc4b3ecce85375909..78bc68de023f7ffadbe36d3ef8bc63fbea6ccc1f 100644 (file)
@@ -54,7 +54,7 @@ describe('Logs page', () => {
 
     it('should delete pool and check audit logs reacted', () => {
       pools.navigateTo();
-      pools.delete(poolname, null, null, true);
+      pools.delete(poolname, null, null, true, false, false, true);
       logs.checkAuditForPoolFunction(poolname, 'delete', hour, minute);
     });
   });
index 6252fc7e99d89dcdcad65851147b1fb44bc2f649..6af9dd842d6224ef03efe6421d1f7f3c71d81890 100644 (file)
@@ -74,6 +74,10 @@ Then('I check the tick box in carbon modal', () => {
   cy.get('cds-modal input#confirmation_input').click({ force: true });
 });
 
+Then('I confirm the resource {string}', (name: string) => {
+  cy.get('cds-modal input#resource_name').type(name);
+});
+
 And('I confirm to {string}', (action: string) => {
   cy.contains('cd-modal button', action).click();
   cy.get('cd-modal').should('not.exist');
index 289adcc7693d026d234fbff969f9f3688c8a8d84..13921249f08b06c97990bb2b46fec88a189253b5 100644 (file)
@@ -26,6 +26,6 @@ Feature: CephFS Management
         And I select a row "test_cephfs"
         And I click on "Remove" button from the table actions
         Then I should see the carbon modal
-        And I check the tick box in carbon modal
+        And I confirm the resource "test_cephfs"
         And I click on "Remove File System" button
         Then I should not see a row with "test_cephfs"
index 67f0e10cb0020460e27de36d65f3750d96342284..f2f80e8cc08f2846c9cc8c437c7cc172afb7460e 100644 (file)
@@ -60,7 +60,7 @@ Feature: CephFS Snapshot Management
         And I go to the "Subvolumes" tab
         And I select a row "test_clone" in the expanded row
         And I click on "Remove" button from the table actions in the expanded row
-        And I check the tick box in carbon modal
+        And I confirm the resource "test_clone"
         And I click on "Remove Subvolume" button
         Then I wait for "5" seconds
         And I should not see a row with "test_clone" in the expanded row
@@ -71,7 +71,7 @@ Feature: CephFS Snapshot Management
         And I go to the "Snapshots" tab
         And I select a row "test_snapshot" in the expanded row
         And I click on "Remove" button from the table actions in the expanded row
-        And I check the tick box in carbon modal
+        And I confirm the resource "test_snapshot"
         And I click on "Remove Snapshot" button
         Then I should not see a row with "test_snapshot" in the expanded row
 
@@ -81,7 +81,7 @@ Feature: CephFS Snapshot Management
         And I go to the "Subvolumes" tab
         When I select a row "test_subvolume" in the expanded row
         And I click on "Remove" button from the table actions in the expanded row
-        And I check the tick box in carbon modal
+        And I confirm the resource "test_subvolume"
         And I click on "Remove Subvolume" button
         Then I should not see a row with "test_subvolume" in the expanded row
 
@@ -90,6 +90,6 @@ Feature: CephFS Snapshot Management
         And I select a row "test_cephfs"
         And I click on "Remove" button from the table actions
         Then I should see the carbon modal
-        And I check the tick box in carbon modal
+        And I confirm the resource "test_cephfs"
         And I click on "Remove File System" button
         Then I should not see a row with "test_cephfs"
index cc0835146b7b23ae60be4c9dfd9a5886e7b3057a..17fe6baa2d0f12bd79526a05cc57d2ec2abeb439 100644 (file)
@@ -37,7 +37,7 @@ Feature: CephFS Subvolume Group management
         And I go to the "Subvolume groups" tab
         When I select a row "test_subvolume_group" in the expanded row
         And I click on "Remove" button from the table actions in the expanded row
-        And I check the tick box in carbon modal
+        And I confirm the resource "test_subvolume_group"
         And I click on "Remove subvolume group" button
         Then I should not see a row with "test_subvolume_group" in the expanded row
 
@@ -46,6 +46,6 @@ Feature: CephFS Subvolume Group management
         And I select a row "test_cephfs"
         And I click on "Remove" button from the table actions
         Then I should see the carbon modal
-        And I check the tick box in carbon modal
+        And I confirm the resource "test_cephfs"
         And I click on "Remove File System" button
         Then I should not see a row with "test_cephfs_edit"
index cf3df6e3f30696050172afc5714a6f1f61a96388..e79a8c25207a0dd9fbb68fe30376d55f4472f66c 100644 (file)
@@ -37,7 +37,7 @@ Feature: CephFS Subvolume management
         And I go to the "Subvolumes" tab
         When I select a row "test_subvolume" in the expanded row
         And I click on "Remove" button from the table actions in the expanded row
-        And I check the tick box in carbon modal
+        And I confirm the resource "test_subvolume"
         And I click on "Remove Subvolume" button
         Then I should not see a row with "test_subvolume" in the expanded row
 
@@ -46,6 +46,6 @@ Feature: CephFS Subvolume management
         And I select a row "test_cephfs"
         And I click on "Remove" button from the table actions
         Then I should see the carbon modal
-        And I check the tick box in carbon modal
+        And I confirm the resource "test_cephfs"
         And I click on "Remove File System" button
         Then I should not see a row with "test_cephfs_edit"
index 0c62d576aa569309a200e15038265e05caf53c8b..ba9acdc40b074a57b5c9a01206e29f20b1106d79 100644 (file)
@@ -29,7 +29,7 @@ Feature: Cluster expansion host addition
         When I select a row "<hostname>"
         And I click on "Remove" button from the table actions
         Then I should see the carbon modal
-        And I check the tick box in carbon modal
+        And I confirm the resource "<hostname>"
         And I click on "Remove Host" button
         And I should not see a row with "<hostname>"
 
index 88b8ab4c9ea5a101312786507dad40e414898a90..03d4a8785187ed86ec3d7347958aacf560a4afeb 100644 (file)
@@ -98,6 +98,7 @@ describe('Services page', () => {
     cy.get('cd-service-details').within(() => {
       services.checkServiceStatus('snmp-gateway');
     });
+    services.clickServiceTab('snmp-gateway', 'Daemons');
 
     services.deleteService('snmp-gateway');
   });
@@ -111,6 +112,7 @@ describe('Services page', () => {
     cy.get('cd-service-details').within(() => {
       services.checkServiceStatus('snmp-gateway');
     });
+    services.clickServiceTab('snmp-gateway', 'Daemons');
 
     services.deleteService('snmp-gateway');
   });
index 85e15be330e877d7505ff29acb99b4cd67733d80..78ef39682ab820765e5fc4fe98c0105a1501d6a3 100644 (file)
@@ -334,7 +334,8 @@ export abstract class PageHelper {
     section?: string,
     cdsModal = false,
     isMultiselect = false,
-    shouldReload = false
+    shouldReload = false,
+    confirmInput = false
   ) {
     const action: string = section === 'hosts' ? 'remove' : 'delete';
 
@@ -347,10 +348,14 @@ export abstract class PageHelper {
 
     // Convert action to SentenceCase and Confirms deletion
     const actionUpperCase = action.charAt(0).toUpperCase() + action.slice(1);
-    cy.get('input[name="confirmation"]').click({ force: true });
+    if (confirmInput) {
+      cy.get('cds-modal input#resource_name').type(name, { force: true });
+    } else {
+      cy.get('[aria-label="confirmation"]').click({ force: true });
+    }
 
     if (cdsModal) {
-      cy.get('cds-modal button').contains(actionUpperCase).click();
+      cy.get('cds-modal button').contains(actionUpperCase).click({ force: true });
       // Wait for modal to close
       cy.get('cds-modal').should('not.exist');
     } else {
index ba342344af4532fa2709778014e8ae6d8d16dfda..eea6ba5de6e15b23dde60308b2c20477a9d32762 100644 (file)
@@ -47,7 +47,7 @@ describe('Pools page', () => {
     });
 
     it('should delete a pool', () => {
-      pools.delete(poolName, null, null, true);
+      pools.delete(poolName, null, null, true, false, false, true);
     });
   });
 
@@ -65,7 +65,7 @@ describe('Pools page', () => {
     });
 
     it('should delete the pool', () => {
-      pools.delete(poolName, null, null, true);
+      pools.delete(poolName, null, null, true, false, false, true);
     });
   });
 });
index 2a79e8ebab32007cb7f7a4495750bb57473a7ebc..c5a8441be5d5f234802a7e3d1f15c5bfe20ce0c0 100644 (file)
@@ -28,7 +28,7 @@ describe('RGW buckets page', () => {
     });
 
     it('should delete bucket', () => {
-      buckets.delete(bucket_name, null, null, true, true);
+      buckets.delete(bucket_name, null, null, true, false, false, true);
     });
 
     it('should create bucket with object locking enabled', () => {
@@ -41,7 +41,7 @@ describe('RGW buckets page', () => {
       buckets.edit(bucket_name, BucketsPageHelper.USERS[1], true);
       buckets.getDataTables().should('contain.text', BucketsPageHelper.USERS[1]);
 
-      buckets.delete(bucket_name, null, null, true, true);
+      buckets.delete(bucket_name, null, null, true, false, false, true);
     });
   });
 
@@ -55,7 +55,7 @@ describe('RGW buckets page', () => {
       buckets.create(bucket_name, BucketsPageHelper.USERS[0]);
       buckets.testInvalidEdit(bucket_name);
       buckets.navigateTo();
-      buckets.delete(bucket_name, null, null, true, true);
+      buckets.delete(bucket_name, null, null, true, false, false, true);
     });
   });
 });
index 86dbe5c8a40917489e793561f50ef0877942ae13..ade9158ca8463ee30c1a7fb23a4ac85faede61d5 100644 (file)
@@ -12,8 +12,8 @@ export class BucketsPageHelper extends PageHelper {
   pages = pages;
 
   columnIndex = {
-    name: 3,
-    owner: 4
+    name: 2,
+    owner: 3
   };
 
   versioningStateEnabled = 'Enabled';
@@ -51,7 +51,7 @@ export class BucketsPageHelper extends PageHelper {
 
   @PageHelper.restrictTo(pages.index.url)
   edit(name: string, new_owner: string, isLocking = false) {
-    this.navigateEdit(name, false, false, null, true);
+    this.navigateEdit(name, false, false, null);
 
     // Placement target is not allowed to be edited and should be hidden
     cy.get('input[name=placement-target]').should('not.exist');
@@ -107,7 +107,7 @@ export class BucketsPageHelper extends PageHelper {
     cy.get('@versioningValueCell').should('have.text', this.versioningStateEnabled);
 
     // Disable versioning:
-    this.navigateEdit(name, false, true, null, true);
+    this.navigateEdit(name, false, true, null);
 
     cy.get('label[for=versioning_input]').click();
     cy.get('input[name=versioning]').should('not.be.checked');
@@ -167,7 +167,7 @@ export class BucketsPageHelper extends PageHelper {
   }
 
   testInvalidEdit(name: string) {
-    this.navigateEdit(name, false, true, null, true);
+    this.navigateEdit(name, false, true, null);
 
     cy.get('input[name=versioning]').should('exist').and('not.be.checked');
 
index d1e4836aeb1721089b93d67e6afa66426d83f6f7..3cb1224fb04093d446954c08c8e014e3739c2dd2 100644 (file)
@@ -25,7 +25,7 @@ describe('RGW configuration page', () => {
   describe('create and edit encryption configuration', () => {
     it('should create configuration', () => {
       configurations.create('vault', 'agent', 'transit', 'https://localhost:8080');
-      configurations.getFirstTableCell('SSE_KMS').should('exist');
+      configurations.getFirstTableCell('kms').should('exist');
     });
 
     it('should edit configuration', () => {
index 871c94d98a60d02fe96023ec1ba4c9e6f23ec519..cc49804d9fa3ec81a5f873d2c16c3081552eac1d 100644 (file)
@@ -14,22 +14,22 @@ export class ConfigurationPageHelper extends PageHelper {
     this.selectKmsProvider(provider);
     cy.get('#kms_provider').should('have.class', 'ng-valid');
     this.selectAuthMethod(auth_method);
-    cy.get('#auth_method').should('have.class', 'ng-valid');
+    cy.get('#auth').should('have.class', 'ng-valid');
     this.selectSecretEngine(secret_engine);
     cy.get('#secret_engine').should('have.class', 'ng-valid');
-    cy.get('#address').type(address);
-    cy.get('#address').should('have.value', address);
-    cy.get('#address').should('have.class', 'ng-valid');
+    cy.get('#addr').type(address);
+    cy.get('#addr').should('have.value', address);
+    cy.get('#addr').should('have.class', 'ng-valid');
     cy.contains('button', 'Submit').click();
     cy.wait(500);
     cy.get('cd-table').should('exist');
-    this.getFirstTableCell('SSE_KMS').should('exist');
+    this.getFirstTableCell('kms').should('exist');
   }
 
   edit(new_address: string) {
-    this.navigateEdit('SSE_KMS', true, false);
-    cy.get('#address').clear().type(new_address);
-    cy.get('#address').should('have.class', 'ng-valid');
+    this.navigateEdit('kms', true, false);
+    cy.get('#addr').clear().type(new_address);
+    cy.get('#addr').should('have.class', 'ng-valid');
     cy.get('#kms_provider').should('be.disabled');
     cy.contains('button', 'Submit').click();
     this.getFirstTableCell(new_address);
@@ -40,7 +40,7 @@ export class ConfigurationPageHelper extends PageHelper {
   }
 
   private selectAuthMethod(auth_method: string) {
-    return this.selectOption('auth_method', auth_method);
+    return this.selectOption('auth', auth_method);
   }
 
   private selectSecretEngine(secret_engine: string) {
index 69b72a5a6b86c74a6025113521791f036705da6b..396231b52b52efd0adb38cabb62384b6517e49fd 100644 (file)
@@ -29,7 +29,7 @@ describe('RGW users page', () => {
     });
 
     it('should delete user', () => {
-      users.delete(user_name, null, null, true, true);
+      users.delete(user_name, null, null, true, false, false, true);
     });
   });
 
index 59062088a24cd2285006831e77a07710642efb10..c2bc0bf5ff804018435bf56e61be9e198fa6b5f5 100644 (file)
@@ -34,7 +34,7 @@ export class UsersPageHelper extends PageHelper {
 
   @PageHelper.restrictTo(pages.index.url)
   edit(name: string, new_fullname: string, new_email: string, new_maxbuckets: string) {
-    this.navigateEdit(name, false, true, null, true);
+    this.navigateEdit(name, false, true, null);
 
     // Change the full name field
     cy.get('input#display_name').click().clear({ force: true }).type(new_fullname, { force: true });
@@ -111,7 +111,7 @@ export class UsersPageHelper extends PageHelper {
       .should('have.text', 'The entered value must be >= 1.');
 
     this.navigateTo();
-    this.delete(tenant + '$' + uname, null, null, true, true);
+    this.delete(tenant + '$' + uname, null, null, true, false, false, true);
   }
 
   invalidEdit() {
@@ -121,7 +121,7 @@ export class UsersPageHelper extends PageHelper {
     this.navigateTo('create');
     this.create(tenant, uname, 'xxx', 'xxx@xxx', '50');
     const name = tenant + '$' + uname;
-    this.navigateEdit(name, false, true, null, true);
+    this.navigateEdit(name, false, true, null);
 
     // put invalid email to make field invalid
     cy.get('#email')
@@ -153,6 +153,6 @@ export class UsersPageHelper extends PageHelper {
       .should('have.text', 'The entered value must be >= 1.');
 
     this.navigateTo();
-    this.delete(tenant + '$' + uname, null, null, true, true);
+    this.delete(tenant + '$' + uname, null, null, true, false, false, true);
   }
 }
index 8112b89744ff38c2d0f75ffdb9532349bbecc4a0..3a85d3f5b7463c60074dc9459c31bd6768beea7c 100644 (file)
@@ -16,7 +16,7 @@ describe('Notification page', () => {
   after(() => {
     cy.login();
     pools.navigateTo();
-    pools.delete(poolName, null, null, true, false, true);
+    pools.delete(poolName, null, null, true, false, true, true);
   });
 
   beforeEach(() => {
index c7c105078f5301cddd057775b25d8190cef48e4d..347f36bf12c48fa124f602f43a6eec08f876b265 100644 (file)
@@ -30,7 +30,7 @@ describe('User Management page', () => {
     });
 
     it('should delete a user', () => {
-      userMgmt.delete(user_name, null, null, true);
+      userMgmt.delete(user_name, null, null, true, false, false, true);
     });
   });
 });
index 122084410f3017ededca78aa86cb0bc71345dd11..a56877512f99ae90b6db44b006e22a845b99c8df 100644 (file)
@@ -8,7 +8,7 @@
       <cd-table [data]="osds"
                 (fetchData)="getOsdList($event)"
                 [columns]="columns"
-                selectionType="single"
+                selectionType="multiClick"
                 [hasDetails]="true"
                 (setExpandedRow)="setExpandedRow($event)"
                 (updateSelection)="updateSelection($event)"
index e041e6d8a71363af5f46794908b67db78e57063b..0871c12f5133526f11d0e574e1d33f1cb8c23644 100644 (file)
@@ -39,6 +39,7 @@
                           autofocus
                           [required]="true"
                           modal-primary-focus
+                          ariaLabel="confirmation"
                           i18n>Yes, I am sure.</cds-checkbox>
           </ng-container>
           <ng-template #highImpactDeletion>
index ce376c93832178fefbb612902b80e56a388bd621..f04251142917bdc462ac1ae755aed6165709497b 100644 (file)
@@ -5,8 +5,7 @@ import { Component, EventEmitter } from '@angular/core';
 import { ComboBoxItem } from '../models/combo-box.model';
 
 @Component({
-  template: `<div cdDynamicInputCombobox
-                  [items]="[]"></div>`,
+  template: `<div cdDynamicInputCombobox [items]="[]"></div>`
 })
 class MockComponent {
   items: ComboBoxItem[] = [{ content: 'Item1', name: 'Item1' }];
@@ -16,18 +15,15 @@ class MockComponent {
 }
 
 describe('DynamicInputComboboxDirective', () => {
-
-  let component: MockComponent;
   let fixture: ComponentFixture<MockComponent>;
   let directive: DynamicInputComboboxDirective;
 
   beforeEach(() => {
     TestBed.configureTestingModule({
-      declarations: [DynamicInputComboboxDirective, MockComponent],
+      declarations: [DynamicInputComboboxDirective, MockComponent]
     }).compileComponents();
 
     fixture = TestBed.createComponent(MockComponent);
-    component = fixture.componentInstance;
 
     directive = fixture.debugElement.children[0].injector.get(DynamicInputComboboxDirective);
     fixture.detectChanges();
@@ -50,11 +46,13 @@ describe('DynamicInputComboboxDirective', () => {
   }));
 
   it('should not unselect selected items', fakeAsync(() => {
-    const selectedItems: ComboBoxItem[] = [{
-      content: 'selectedItem',
-      name: 'selectedItem',
-      selected: true
-    }];
+    const selectedItems: ComboBoxItem[] = [
+      {
+        content: 'selectedItem',
+        name: 'selectedItem',
+        selected: true
+      }
+    ];
 
     directive.items = selectedItems;
 
@@ -66,5 +64,5 @@ describe('DynamicInputComboboxDirective', () => {
 
     expect(directive.items[0].content).toBe(selectedItems[0].content);
     expect(directive.items[0].selected).toBeTruthy();
-  }))
+  }));
 });
index 2645e466ec6e960a2bbf327e601b0ef28968c834..54f8ce093425a3e9de3d4991037174d13a791ea7 100644 (file)
@@ -38,10 +38,7 @@ export class DynamicInputComboboxDirective implements OnInit, OnDestroy {
 
   ngOnInit() {
     this.searchSubscription = this.searchSubject
-      .pipe(
-        debounceTime(DEBOUNCE_TIMER),
-        distinctUntilChanged()
-      )
+      .pipe(debounceTime(DEBOUNCE_TIMER), distinctUntilChanged())
       .subscribe((searchString) => {
         // Already selected items should be selected in the dropdown
         // even if the items are updated again
@@ -52,15 +49,13 @@ export class DynamicInputComboboxDirective implements OnInit, OnDestroy {
           return { ...item, selected };
         });
 
-        const exists = this.items.some(
-          (item: ComboBoxItem) => item.content === searchString
-        );
+        const exists = this.items.some((item: ComboBoxItem) => item.content === searchString);
 
-      if (!exists) {
-        this.items = this.items.concat({ content: searchString, name: searchString });
-      }
-      this.updatedItems.emit(this.items);
-      this.combBoxService.emit({ searchString });
+        if (!exists) {
+          this.items = this.items.concat({ content: searchString, name: searchString });
+        }
+        this.updatedItems.emit(this.items);
+        this.combBoxService.emit({ searchString });
       });
   }