]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.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)
committerLaura Flores <lflores@redhat.com>
Mon, 21 Feb 2022 19:05:17 +0000 (19:05 +0000)
Signed-off-by: Aaryan Porwal <aaryanporwal2233@gmail.com>
(cherry picked from commit ad5b3f200529fc0bc511ce99eed338afcaef6a62)

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 f6f1ed9cbb4406beb7d8886a052fcb87c6060c14..902d9f5bc7676d19aae24f977535c111103e00b8 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 421390ffccde445ae5109fad0265df34b5c3ea5c..ba94be7101f0b03d7b26f45d743706e825fb1748 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 16556c9590a35bef3494ef51740b4eac387c236e..debc7bd53d25a7709d5fe9434a0e978bc2430e82 100644 (file)
@@ -42,6 +42,7 @@ export class TelemetryComponent extends CdForm implements OnInit {
   sendToUrl = '';
   sendToDeviceUrl = '';
   step = 1;
+  showContactInfo = false;
 
   constructor(
     public actionLabels: ActionLabelsI18n,
@@ -148,6 +149,10 @@ export class TelemetryComponent extends CdForm implements OnInit {
     );
   }
 
+  toggleIdent() {
+    this.showContactInfo = !this.showContactInfo;
+  }
+
   updateConfig() {
     this.updatedConfig = {};
     for (const option of Object.values(this.options)) {