]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: telemetry activate: show ident fields when checked
authorAaryan Porwal <aaryanporwal2233@gmail.com>
Sun, 6 Jun 2021 22:08:37 +0000 (03:38 +0530)
committerAaryan Porwal <aaryanporwal2233@gmail.com>
Sun, 20 Jun 2021 06:47:03 +0000 (12:17 +0530)
Signed-off-by: Aaryan Porwal <aaryanporwal2233@gmail.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.ts

index 69690668392f9891818dc49792431082692a4294..e3c0a6c1739aed6499c229c0932ac419c544677c 100644 (file)
                   <input type="checkbox"
                          class="custom-control-input"
                          id="channel_ident"
-                         formControlName="channel_ident">
+                         formControlName="channel_ident"
+                         (click)="toggleIdent()">
                   <label class="custom-control-label"
                          for="channel_ident"></label>
                 </div>
               </div>
             </div>
+            <ng-container *ngIf="showContactInfo">
             <legend>
               <ng-container i18n>Contact Information</ng-container>
               <cd-helper i18n>Submitting any contact information is completely optional and disabled by default.</cd-helper>
                        i18n-placeholder>
               </div>
             </div>
+          </ng-container>
             <legend i18n>Advanced Settings</legend>
             <div class="form-group row">
               <label class="cd-col-form-label"
index 34f93dfaafdf5e5da83c2645b652524cdebf98f0..8fb542247594276cd2a74ae713d9a3e7680ad981 100644 (file)
@@ -80,6 +80,29 @@ describe('TelemetryComponent', () => {
       expect(component).toBeTruthy();
     });
 
+    it('should show/hide ident fields on checking/unchecking', () => {
+      const getContactField = () =>
+        fixture.debugElement.nativeElement.querySelector('input[id=contact]');
+      const getDescriptionField = () =>
+        fixture.debugElement.nativeElement.querySelector('input[id=description]');
+
+      // Initially hidden.
+      expect(getContactField()).toBeFalsy();
+      expect(getDescriptionField()).toBeFalsy();
+
+      // Show fields.
+      component.toggleIdent();
+      fixture.detectChanges();
+      expect(getContactField()).toBeTruthy();
+      expect(getDescriptionField()).toBeTruthy();
+
+      // Hide fields.
+      component.toggleIdent();
+      fixture.detectChanges();
+      expect(getContactField()).toBeFalsy();
+      expect(getDescriptionField()).toBeFalsy();
+    });
+
     it('should set module enability to true correctly', () => {
       expect(component.moduleEnabled).toBeTruthy();
     });
index 8edb7b6a927d700989040dfb0060f4d954cfa768..758612dd472a54665999157f29e640531a98a7bd 100644 (file)
@@ -42,6 +42,7 @@ export class TelemetryComponent extends CdForm implements OnInit {
   sendToUrl = '';
   sendToDeviceUrl = '';
   step = 1;
+  showContactInfo = false;
 
   constructor(
     public actionLabels: ActionLabelsI18n,
@@ -137,6 +138,10 @@ export class TelemetryComponent extends CdForm implements OnInit {
     );
   }
 
+  toggleIdent() {
+    this.showContactInfo = !this.showContactInfo;
+  }
+
   updateConfig() {
     const config = {};
     _.forEach(Object.values(this.options), (option) => {