]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: change privacy protocol field from required to optional
authorAvan Thakkar <athakkar@redhat.com>
Mon, 14 Feb 2022 12:18:39 +0000 (17:48 +0530)
committerAvan Thakkar <athakkar@redhat.com>
Wed, 16 Feb 2022 10:09:27 +0000 (15:39 +0530)
Fixes: https://tracker.ceph.com/issues/54270
Signed-off-by: Avan Thakkar <athakkar@redhat.com>
Privacy protocol field shouldn't be a required field.

(cherry picked from commit 2d8f2b8195a0f0c7a21d4ec5061b1b51a3aade2c)

src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/09-services.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-form/service-form.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-form/service-form.component.ts

index 6987b6f20f52e91654033a69e7f1b37f6cd577f0..d1c100ed33545fb7f0c78b0a23f642b780f31284 100644 (file)
@@ -37,7 +37,13 @@ export class ServicesPageHelper extends PageHelper {
     });
   }
 
-  addService(serviceType: string, exist?: boolean, count = '1', snmpVersion?: string) {
+  addService(
+    serviceType: string,
+    exist?: boolean,
+    count = '1',
+    snmpVersion?: string,
+    snmpPrivProtocol?: boolean
+  ) {
     cy.get(`${this.pages.create.id}`).within(() => {
       this.selectServiceType(serviceType);
       switch (serviceType) {
@@ -67,12 +73,14 @@ export class ServicesPageHelper extends PageHelper {
           } else {
             cy.get('#engine_id').type('800C53F00000');
             this.selectOption('auth_protocol', 'SHA');
-            this.selectOption('privacy_protocol', 'DES');
+            if (snmpPrivProtocol) {
+              this.selectOption('privacy_protocol', 'DES');
+              cy.get('#snmp_v3_priv_password').type('testencrypt');
+            }
 
             // Credentials
             cy.get('#snmp_v3_auth_username').type('test');
             cy.get('#snmp_v3_auth_password').type('testpass');
-            cy.get('#snmp_v3_priv_password').type('testencrypt');
           }
           break;
 
index 0c1eecb2b8a52c81d3923fdba6ffbfb10cd0cb87..80fce476c2b09678af3ba57262be441593909dd8 100644 (file)
@@ -40,7 +40,20 @@ describe('Services page', () => {
 
   it('should create and delete snmp-gateway service with version V3', () => {
     services.navigateTo('create');
-    services.addService('snmp-gateway', false, '1', 'V3');
+    services.addService('snmp-gateway', false, '1', 'V3', true);
+    services.checkExist('snmp-gateway', true);
+
+    services.clickServiceTab('snmp-gateway', 'Details');
+    cy.get('cd-service-details').within(() => {
+      services.checkServiceStatus('snmp-gateway');
+    });
+
+    services.deleteService('snmp-gateway');
+  });
+
+  it('should create and delete snmp-gateway service with version V3 and w/o privacy protocol', () => {
+    services.navigateTo('create');
+    services.addService('snmp-gateway', false, '1', 'V3', false);
     services.checkExist('snmp-gateway', true);
 
     services.clickServiceTab('snmp-gateway', 'Details');
index e1e8317e9bf6543262e34a7740f5f030d07c9641..24dac8871f740a4fab1a607794d51b3457a8c485 100644 (file)
@@ -63,7 +63,8 @@
           </div>
 
         <!-- Service id -->
-        <div class="form-group row">
+        <div class="form-group row"
+             *ngIf="serviceForm.controls.service_type.value !== 'snmp-gateway'">
           <label i18n
                  class="cd-col-form-label"
                  [ngClass]="{'required': ['mds', 'rgw', 'nfs', 'iscsi', 'ingress'].includes(serviceForm.controls.service_type.value)}"
index 06fe53bae056d194a4e08ae458c4cc73b36e093b..d45d939d587128367131b00a7302a21c7dbdfe4f 100644 (file)
@@ -245,7 +245,7 @@ export class ServiceFormComponent extends CdForm implements OnInit {
         null,
         [
           CdValidators.requiredIf({
-            service_type: 'snmp-gateway',
+            snmp_version: 'V3',
             unmanaged: false
           })
         ]
@@ -254,25 +254,17 @@ export class ServiceFormComponent extends CdForm implements OnInit {
         'SHA',
         [
           CdValidators.requiredIf({
-            service_type: 'snmp-gateway',
-            unmanaged: false
-          })
-        ]
-      ],
-      privacy_protocol: [
-        null,
-        [
-          CdValidators.requiredIf({
-            service_type: 'snmp-gateway',
+            snmp_version: 'V3',
             unmanaged: false
           })
         ]
       ],
+      privacy_protocol: [null],
       snmp_community: [
         null,
         [
           CdValidators.requiredIf({
-            service_type: 'snmp-gateway',
+            snmp_version: 'V2c',
             unmanaged: false
           })
         ]
@@ -281,7 +273,7 @@ export class ServiceFormComponent extends CdForm implements OnInit {
         null,
         [
           CdValidators.requiredIf({
-            service_type: 'snmp-gateway',
+            snmp_version: 'V3',
             unmanaged: false
           })
         ]
@@ -290,7 +282,7 @@ export class ServiceFormComponent extends CdForm implements OnInit {
         null,
         [
           CdValidators.requiredIf({
-            service_type: 'snmp-gateway',
+            snmp_version: 'V3',
             unmanaged: false
           })
         ]
@@ -299,7 +291,7 @@ export class ServiceFormComponent extends CdForm implements OnInit {
         null,
         [
           CdValidators.requiredIf({
-            service_type: 'snmp-gateway',
+            privacy_protocol: { op: '!empty' },
             unmanaged: false
           })
         ]