Open Larisa-Staroverova opened 3 years ago
@WeizhengSap suggested to make the following refactoring:
configurator-attribute-read-only.component.ts
createAttributeIdForConfigurator
by attributeId
/**
* Retrieves a unique key for config attribute to be sent to configurator.
*
* @return {string} - Generated attribute ID
*/
get attributeId(): string {
return this.configAttributeTypeUtilsService.createAttributeIdForConfigurator(
this.attribute
);
}
configurator-attribute-header.component.ts
createAttributeUiKey
by attributeUiKey
/**
* Retrieves unique key for configurator attribute on the UI.
*
* @return {string} - Generated attribute UI key
*/
get attributeUiKey(): string {
return this.configAttributeTypeUtilsService.createAttributeUiKey(
'label',
this.attribute.name
);
}
isAttributeGroup
and getConflictMessageKey
have groupType
as parameter. This parameter can be removed, because groupType
is input variable in the component. It can be used directly.
/**
* Verifies whether the group type is attribute group
*
* @param groupType {Configurator.GroupType} - group type
* @return {boolean} - 'true' if the group type is 'attribute group' otherwise 'false'
*/
isAttributeGroup(groupType: Configurator.GroupType): boolean {
if (Configurator.GroupType.ATTRIBUTE_GROUP === groupType) {
return true;
}
return false;
}
/**
* Retrieves a certain conflict link key depending on the current group type for translation.
*
* @param groupType {Configurator.GroupType}- group type
* @return {string} - the conflict link key
*/
getConflictMessageKey(groupType: Configurator.GroupType): string {
return groupType === Configurator.GroupType.CONFLICT_GROUP
? 'configurator.conflict.viewConfigurationDetails'
: 'configurator.conflict.viewConflictDetails';
}
configurator-attribute-base.component.ts
attribute
and use this.attribute
/**
* Get code from attribute.
* The code is not a mandatory attribute (since not available for VC flavour),
* still it is mandatory in the context of CPQ. Calling this method therefore only
* makes sense when CPQ is active. In case the method is called in the wrong context, an exception will
* be thrown.
*
* @param {Configurator.Attribute} attribute - Attribute
* @returns {number} Attribute code
*/
getAttributeCode(attribute: Configurator.Attribute): number {
return this.configAttributeTypeUtilsService.getAttributeCode(attribute);
}
configurator-attribute-input-field.component.ts
createAttributeIdForConfigurator
by attributeId
/**
* Retrieves a unique key for config attribute to be sent to configurator.
*
* @return {string} - Generated attribute ID
*/
get attributeId(): string | undefined {
return this.configAttributeTypeUtilsService?.createAttributeIdForConfigurator(
this.attribute
);
}
createAriaLabelledBy
by ariaLabelledBy
/**
* Retrieves a unique key for aria-labelled-by.
*
* @return {string} - Generated aria-labelled-by attribute
*/
get ariaLabelledBy(): string | undefined {
return this.configAttributeTypeUtilsService?.createAriaLabelledBy(
'label',
this.attribute.name
);
}
this task could / should be done in the major release