mgr/dashboard: change privacy protocol field from required to optional

Fixes: https://tracker.ceph.com/issues/54270
Signed-off-by: Avan Thakkar <athakkar@redhat.com>

Privacy protocol field shouldn't be a required field.
This commit is contained in:
Avan Thakkar 2022-02-14 17:48:39 +05:30
parent 2de993b969
commit 2d8f2b8195
4 changed files with 34 additions and 20 deletions

View 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(() => { cy.get(`${this.pages.create.id}`).within(() => {
this.selectServiceType(serviceType); this.selectServiceType(serviceType);
switch (serviceType) { switch (serviceType) {
@ -67,12 +73,14 @@ export class ServicesPageHelper extends PageHelper {
} else { } else {
cy.get('#engine_id').type('800C53F00000'); cy.get('#engine_id').type('800C53F00000');
this.selectOption('auth_protocol', 'SHA'); this.selectOption('auth_protocol', 'SHA');
if (snmpPrivProtocol) {
this.selectOption('privacy_protocol', 'DES'); this.selectOption('privacy_protocol', 'DES');
cy.get('#snmp_v3_priv_password').type('testencrypt');
}
// Credentials // Credentials
cy.get('#snmp_v3_auth_username').type('test'); cy.get('#snmp_v3_auth_username').type('test');
cy.get('#snmp_v3_auth_password').type('testpass'); cy.get('#snmp_v3_auth_password').type('testpass');
cy.get('#snmp_v3_priv_password').type('testencrypt');
} }
break; break;

View File

@ -77,7 +77,20 @@ describe('Services page', () => {
it('should create and delete snmp-gateway service with version V3', () => { it('should create and delete snmp-gateway service with version V3', () => {
services.navigateTo('create'); 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.checkExist('snmp-gateway', true);
services.clickServiceTab('snmp-gateway', 'Details'); services.clickServiceTab('snmp-gateway', 'Details');

View File

@ -63,7 +63,8 @@
</div> </div>
<!-- Service id --> <!-- Service id -->
<div class="form-group row"> <div class="form-group row"
*ngIf="serviceForm.controls.service_type.value !== 'snmp-gateway'">
<label i18n <label i18n
class="cd-col-form-label" class="cd-col-form-label"
[ngClass]="{'required': ['mds', 'rgw', 'nfs', 'iscsi', 'ingress'].includes(serviceForm.controls.service_type.value)}" [ngClass]="{'required': ['mds', 'rgw', 'nfs', 'iscsi', 'ingress'].includes(serviceForm.controls.service_type.value)}"

View File

@ -245,7 +245,7 @@ export class ServiceFormComponent extends CdForm implements OnInit {
null, null,
[ [
CdValidators.requiredIf({ CdValidators.requiredIf({
service_type: 'snmp-gateway', snmp_version: 'V3',
unmanaged: false unmanaged: false
}) })
] ]
@ -254,25 +254,17 @@ export class ServiceFormComponent extends CdForm implements OnInit {
'SHA', 'SHA',
[ [
CdValidators.requiredIf({ CdValidators.requiredIf({
service_type: 'snmp-gateway', snmp_version: 'V3',
unmanaged: false
})
]
],
privacy_protocol: [
null,
[
CdValidators.requiredIf({
service_type: 'snmp-gateway',
unmanaged: false unmanaged: false
}) })
] ]
], ],
privacy_protocol: [null],
snmp_community: [ snmp_community: [
null, null,
[ [
CdValidators.requiredIf({ CdValidators.requiredIf({
service_type: 'snmp-gateway', snmp_version: 'V2c',
unmanaged: false unmanaged: false
}) })
] ]
@ -281,7 +273,7 @@ export class ServiceFormComponent extends CdForm implements OnInit {
null, null,
[ [
CdValidators.requiredIf({ CdValidators.requiredIf({
service_type: 'snmp-gateway', snmp_version: 'V3',
unmanaged: false unmanaged: false
}) })
] ]
@ -290,7 +282,7 @@ export class ServiceFormComponent extends CdForm implements OnInit {
null, null,
[ [
CdValidators.requiredIf({ CdValidators.requiredIf({
service_type: 'snmp-gateway', snmp_version: 'V3',
unmanaged: false unmanaged: false
}) })
] ]
@ -299,7 +291,7 @@ export class ServiceFormComponent extends CdForm implements OnInit {
null, null,
[ [
CdValidators.requiredIf({ CdValidators.requiredIf({
service_type: 'snmp-gateway', privacy_protocol: { op: '!empty' },
unmanaged: false unmanaged: false
}) })
] ]