diff options
20 files changed, 116 insertions, 83 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java index b5ca183ab7..72a38bbb5d 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java @@ -20,8 +20,6 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl; -import static org.openecomp.sdc.tosca.datatypes.ToscaNodeType.VFC_NODE_TYPE_PREFIX; - import org.apache.commons.collections4.CollectionUtils; import org.openecomp.core.utilities.json.JsonUtil; import org.openecomp.sdc.common.errors.CoreException; @@ -60,6 +58,8 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import static org.openecomp.sdc.tosca.datatypes.ToscaNodeType.COMPUTE_TYPE_PREFIX; + public class ComponentManagerImpl implements ComponentManager { private static final MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); private ComponentDao componentDao; @@ -154,9 +154,8 @@ public class ComponentManagerImpl implements ComponentManager { } private void updateComponentName(ComponentEntity component) { - final String NAME_PREFIX = VFC_NODE_TYPE_PREFIX + "heat."; ComponentData data = component.getComponentCompositionData(); - data.setName(NAME_PREFIX + data.getDisplayName()); + data.setName(COMPUTE_TYPE_PREFIX + data.getDisplayName()); component.setComponentCompositionData(data); } @@ -209,21 +208,23 @@ public class ComponentManagerImpl implements ComponentManager { ComponentEntity retrieved = getComponent(component.getVspId(), component.getVersion(), component.getId()); - if (vspInfoDao.isManual(component.getVspId(), component.getVersion())) { + boolean isManual = vspInfoDao.isManual(component.getVspId(), component.getVersion()); + if (isManual) { validateComponentUpdateManual(component, retrieved, user); } ComponentCompositionSchemaInput schemaInput = new ComponentCompositionSchemaInput(); - schemaInput.setManual(vspInfoDao.isManual(component.getVspId(), component.getVersion())); + schemaInput.setManual(isManual); schemaInput.setComponent(retrieved.getComponentCompositionData()); CompositionEntityValidationData validationData = compositionEntityDataManager .validateEntity(component, SchemaTemplateContext.composition, schemaInput); if (CollectionUtils.isEmpty(validationData.getErrors())) { - updateComponentName(component); + if (isManual) { + updateComponentName(component); + } componentDao.update(component); - //componentDao.updateVspLatestModificationTime(component.getVspId(), component.getVersion()); } mdcDataDebugMessage.debugExitMessage("VSP id, component id", component.getVspId(), component.getId()); @@ -233,28 +234,8 @@ public class ComponentManagerImpl implements ComponentManager { private void validateComponentUpdateManual(ComponentEntity component, ComponentEntity retrieved, String user) { - Collection<ComponentEntity> vspComponentList = listComponents(component.getVspId() - , component.getVersion(), user); - //Removing check from name as we will ignore passed value - // and re-genarate new name from displayName - // List<String> invalidParameters = new LinkedList<>(); - // if (!component.getComponentCompositionData().getName().equals(retrieved - // .getComponentCompositionData().getName())) { - // invalidParameters.add(NAME); - // } - // if (!invalidParameters.isEmpty()) { - // String msg = String.format(VFC_ATTRIBUTE_UPDATE_NOT_ALLOWED_MSG, StringUtils - // .join(invalidParameters, ", ")); - // MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - // LoggerTragetServiceName.UPDATE_COMPONENT, ErrorLevel.ERROR.name(), - // LoggerErrorCode.DATA_ERROR.getErrorCode(), msg); - // - // throw new CoreException( - // new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION) - // .withId(VendorSoftwareProductErrorCodes.VFC_ATTRIBUTE_UPDATE_NOT_ALLOWED) - // .withMessage(msg).build()); - // } - + Collection<ComponentEntity> vspComponentList = + listComponents(component.getVspId(), component.getVersion(), user); //VFC name should be unique within VSP //Removing VFC with same ID from list to avoid self compare for(ComponentEntity ce : vspComponentList) { @@ -265,8 +246,6 @@ public class ComponentManagerImpl implements ComponentManager { } if (!isVfcNameUnique(vspComponentList, component.getComponentCompositionData() .getDisplayName())) { - final String VSP_VFC_DUPLICATE_NAME_MSG = "VFC with specified name " - + "already present in given VSP."; MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.UPDATE_COMPONENT, ErrorLevel.ERROR.name(), LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Component with same name already " + @@ -274,7 +253,7 @@ public class ComponentManagerImpl implements ComponentManager { throw new CoreException( new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION) .withId(VendorSoftwareProductErrorCodes.VSP_VFC_DUPLICATE_NAME) - .withMessage(VSP_VFC_DUPLICATE_NAME_MSG).build()); + .withMessage("VFC with specified name already present in given VSP.").build()); } } diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/TranslationContext.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/TranslationContext.java index a0034a3828..ddbcaf72b9 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/TranslationContext.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/TranslationContext.java @@ -25,14 +25,12 @@ import org.openecomp.config.api.ConfigurationManager; import org.openecomp.core.utilities.CommonMethods; import org.openecomp.core.utilities.file.FileContentHandler; import org.openecomp.sdc.common.errors.CoreException; -import org.openecomp.sdc.common.errors.ErrorCode; import org.openecomp.sdc.common.utils.SdcCommon; import org.openecomp.sdc.datatypes.configuration.ImplementationConfiguration; import org.openecomp.sdc.heat.datatypes.manifest.FileData; import org.openecomp.sdc.heat.datatypes.manifest.ManifestFile; import org.openecomp.sdc.heat.datatypes.model.Resource; import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate; -import org.openecomp.sdc.tosca.datatypes.model.RequirementAssignment; import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate; import org.openecomp.sdc.tosca.services.ToscaUtil; import org.openecomp.sdc.translator.datatypes.heattotosca.to.TranslatedHeatResource; @@ -42,6 +40,7 @@ import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolida import org.openecomp.sdc.translator.services.heattotosca.ConfigConstants; import org.openecomp.sdc.translator.services.heattotosca.Constants; import org.openecomp.sdc.translator.services.heattotosca.NameExtractor; +import org.openecomp.sdc.translator.services.heattotosca.errors.DuplicateResourceIdsInDifferentFilesErrorBuilder; import org.openecomp.sdc.translator.services.heattotosca.globaltypes.GlobalTypesGenerator; import java.io.InputStream; @@ -385,10 +384,7 @@ public class TranslationContext { } if(nodeAbstractNodeTemplateIdMap.containsKey(originalNodeTemplateId)){ - throw new CoreException((new ErrorCode.ErrorCodeBuilder()) - .withMessage("Resource with id " - + originalNodeTemplateId + " occures more than once in different addOn files") - .build()); + throw new CoreException(new DuplicateResourceIdsInDifferentFilesErrorBuilder(originalNodeTemplateId).build()); } nodeAbstractNodeTemplateIdMap.put(originalNodeTemplateId, abstractNodeTemplateId); this.getUnifiedSubstitutionData().get(serviceTemplateFileName).setNodesRelatedAbstractNode( diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationDataUtil.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationDataUtil.java index b86038d175..5d1bb1c61e 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationDataUtil.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationDataUtil.java @@ -31,6 +31,7 @@ import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolida import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.PortTemplateConsolidationData; import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.RequirementAssignmentData; import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.TypeComputeConsolidationData; +import org.openecomp.sdc.translator.services.heattotosca.errors.DuplicateResourceIdsInDifferentFilesErrorBuilder; import java.util.ArrayList; import java.util.Collection; @@ -154,10 +155,7 @@ public class ConsolidationDataUtil { if(isNestedResourceIdOccuresInDifferentNestedFiles(context, nestedHeatFileName, nestedNodeTemplateId)){ - throw new CoreException((new ErrorCode.ErrorCodeBuilder()) - .withMessage("Resource with id " - + nestedNodeTemplateId + " occures more than once in different addOn " - + "files").build()); + throw new CoreException(new DuplicateResourceIdsInDifferentFilesErrorBuilder(nestedNodeTemplateId).build()); } ConsolidationData consolidationData = context.getConsolidationData(); diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationService.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationService.java index 16a6301968..d3f2a721c9 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationService.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationService.java @@ -24,6 +24,7 @@ import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolida import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.PortTemplateConsolidationData; import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.RequirementAssignmentData; import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.TypeComputeConsolidationData; +import org.openecomp.sdc.translator.services.heattotosca.errors.DuplicateResourceIdsInDifferentFilesErrorBuilder; import java.util.ArrayList; import java.util.Collection; @@ -637,20 +638,16 @@ public class ConsolidationService { NodeTemplate startingPortNodeTemplate = nodeTemplates.get(portNodeTemplateIdList.get(0)); if (Objects.isNull(startingPortNodeTemplate)) { - throw new CoreException((new ErrorCode.ErrorCodeBuilder()) - .withMessage("Resource with id " - + portNodeTemplateIdList.get(0) + " occures more than once in different addOn files") - .build()); + throw new CoreException( + new DuplicateResourceIdsInDifferentFilesErrorBuilder(portNodeTemplateIdList.get(0)).build()); } for (int i = 1; i < portNodeTemplateIdList.size(); i++) { NodeTemplate portNodeTemplate = nodeTemplates.get(portNodeTemplateIdList.get(i)); if (Objects.isNull(portNodeTemplate)) { - throw new CoreException((new ErrorCode.ErrorCodeBuilder()) - .withMessage("Resource with id " - + portNodeTemplateIdList.get(i) + " occures more than once in different addOn " - + "files").build()); + throw new CoreException( + new DuplicateResourceIdsInDifferentFilesErrorBuilder(portNodeTemplateIdList.get(i)).build()); } if (!isPropertySimilarBetweenNodeTemplates(propertyToCheck, portNodeTemplateIdList, nodeTemplates)) { @@ -695,9 +692,8 @@ public class ConsolidationService { for (int i = 1; i < entityNodeTemplateIds.size(); i++) { NodeTemplate currentNodeTemplate = idToNodeTemplate.get(entityNodeTemplateIds.get(i)); if (Objects.isNull(currentNodeTemplate)) { - throw new CoreException((new ErrorCode.ErrorCodeBuilder()) - .withMessage("Resource with id " - + entityNodeTemplateIds.get(i) + " occures more than once in different addOn files").build()); + throw new CoreException( + new DuplicateResourceIdsInDifferentFilesErrorBuilder(entityNodeTemplateIds.get(i)).build()); } if(propertyExistCondition != isPropertyExistInNodeTemplate(propertyToCheck, currentNodeTemplate)){ return false; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/errors/DuplicateResourceIdsInDifferentFilesErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/errors/DuplicateResourceIdsInDifferentFilesErrorBuilder.java new file mode 100644 index 0000000000..a75e8b391d --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/errors/DuplicateResourceIdsInDifferentFilesErrorBuilder.java @@ -0,0 +1,16 @@ +package org.openecomp.sdc.translator.services.heattotosca.errors; + +import org.openecomp.sdc.common.errors.BaseErrorBuilder; +import org.openecomp.sdc.common.errors.ErrorCategory; + +public final class DuplicateResourceIdsInDifferentFilesErrorBuilder extends BaseErrorBuilder { + + private static final String DUPLICATE_RESOURCE_ID_MSG = "Resource with id %s occurs more than once in " + + "different addOn files"; + + public DuplicateResourceIdsInDifferentFilesErrorBuilder(String resourceId) { + getErrorCodeBuilder().withId(TranslatorErrorCodes.DUPLICATE_RESOURCE_ID_IN_DIFFERENT_FILES) + .withCategory(ErrorCategory.APPLICATION) + .withMessage(String.format(DUPLICATE_RESOURCE_ID_MSG, resourceId)); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/errors/TranslatorErrorCodes.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/errors/TranslatorErrorCodes.java index bfcf834ae1..5afb1ae3c2 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/errors/TranslatorErrorCodes.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/errors/TranslatorErrorCodes.java @@ -29,4 +29,5 @@ public class TranslatorErrorCodes { "REFERENCE_TO_UNSUPPORTED_RESOURCE"; public static final String NOT_IN_SYNC_NUMBER_OF_INTERFACES = "NOT_IN_SYNC_NUMBER_OF_INTERFACES"; public static final String INVALID_PROPERTY_VALUE = "INVALID_PROPERTY_VALUE"; + public static final String DUPLICATE_RESOURCE_ID_IN_DIFFERENT_FILES = "DUPLICATE_RESOURCE_ID_IN_DIFFERENT_FILES"; } diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionMixPatternFullTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionMixPatternFullTest.java index b1946b3f9b..9399b91ce1 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionMixPatternFullTest.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionMixPatternFullTest.java @@ -2,7 +2,10 @@ package org.openecomp.sdc.translator.services.heattotosca.impl.fulltest; import org.junit.Assert; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation.BaseFullTranslationTest; @@ -19,6 +22,9 @@ public class UnifiedCompositionMixPatternFullTest extends BaseFullTranslationTes // do not delete this function. it prevents the superclass setup from running } + @Rule + public ExpectedException exception = ExpectedException.none(); + @Test public void testMixPatterns() throws IOException { inputFilesPath = @@ -52,16 +58,13 @@ public class UnifiedCompositionMixPatternFullTest extends BaseFullTranslationTes @Test public void testDuplicateResourceIdsInDiffAddOnFiles() throws IOException { + exception.expect(CoreException.class); + exception.expectMessage("Resource with id lb_0_int_oam_int_0_port occurs more " + + "than once in different addOn files"); + inputFilesPath = "/mock/services/heattotosca/fulltest/mixPatterns/duplicateResourceIdsInDiffAddOnFiles/in"; - - try { - testTranslationWithInit(); - }catch(Exception e){ - log.debug("",e); - Assert.assertEquals(e.getMessage(), "Resource with id lb_0_int_oam_int_0_port occures more " + - "than once in different addOn files"); - } + testTranslationWithInit(); } @Test diff --git a/openecomp-ui/src/nfvo-components/modal/GlobalModal.js b/openecomp-ui/src/nfvo-components/modal/GlobalModal.js index f282046125..4e7a1a16a4 100644 --- a/openecomp-ui/src/nfvo-components/modal/GlobalModal.js +++ b/openecomp-ui/src/nfvo-components/modal/GlobalModal.js @@ -114,7 +114,9 @@ export class GlobalModalView extends React.Component { <Modal.Body> {ComponentToRender ? <ComponentToRender {...modalComponentProps}/> : - <div> {msg && msg.split('\n').map(txt => <span> {txt} <br/> </span>)} </div> + msg && typeof msg === 'string' ? + <div> {msg.split('\n').map(txt => <span> {txt} <br/> </span>)} </div> : + msg } </Modal.Body> {(onConfirmed || onDeclined || type !== typeEnum.DEFAULT) && diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorView.jsx index aa1321c24a..8473c1a2be 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorView.jsx @@ -245,6 +245,7 @@ class EntitlementPoolsEditorView extends React.Component { <Tab disabled={isTabsDisabled} tabId={tabIds.SP_LIMITS} data-test-id='sp-limits-tab' title={i18n('SP Limits')}> {selectedTab === tabIds.SP_LIMITS && <EntitlementPoolsLimits + isReadOnlyMode={isReadOnlyMode} limitType={limitType.SERVICE_PROVIDER} limitsList={limitsList.filter(item => item.type === limitType.SERVICE_PROVIDER)} selectedLimit={this.state.selectedLimit} @@ -254,19 +255,33 @@ class EntitlementPoolsEditorView extends React.Component { <Tab disabled={isTabsDisabled} tabId={tabIds.VENDOR_LIMITS} data-test-id='vendor-limits-tab' title={i18n('Vendor Limits')}> {selectedTab === tabIds.VENDOR_LIMITS && <EntitlementPoolsLimits + isReadOnlyMode={isReadOnlyMode} limitType={limitType.VENDOR} limitsList={limitsList.filter(item => item.type === limitType.VENDOR)} selectedLimit={this.state.selectedLimit} onCloseLimitEditor={() => this.onCloseLimitEditor()} onSelectLimit={limit => this.onSelectLimit(limit)}/>} </Tab> - {selectedTab !== tabIds.GENERAL ? - <Button disabled={this.state.selectedLimit} className='add-limit-button' tabId={tabIds.ADD_LIMIT_BUTTON} btnType='link' iconName='plus'>{i18n('Add Limit')}</Button> : + { + selectedTab !== tabIds.GENERAL ? + <Button + disabled={this.state.selectedLimit || isReadOnlyMode} + className='add-limit-button' + tabId={tabIds.ADD_LIMIT_BUTTON} + btnType='link' + iconName='plus'> + {i18n('Add Limit')} + </Button> + : <div></div> // Render empty div to not break tabs } </Tabs> <GridSection className='license-model-modal-buttons entitlement-pools-editor-buttons'> - {!this.state.selectedLimit && <Button btnType='default' disabled={!this.props.isFormValid} onClick={() => this.submit()} type='reset'>{i18n('Save')}</Button>} + {!this.state.selectedLimit && + <Button btnType='default' disabled={!this.props.isFormValid || isReadOnlyMode} onClick={() => this.submit()} type='reset'> + {i18n('Save')} + </Button> + } <Button btnType={this.state.selectedLimit ? 'default' : 'outline'} onClick={() => this.props.onCancel()} type='reset'> {i18n('Cancel')} </Button> diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsLimits.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsLimits.js index ae53a753c0..1eb6eebff8 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsLimits.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsLimits.js @@ -44,7 +44,7 @@ const mapActionsToProps = (dispatch) => { data:{ msg: i18n(`Are you sure you want to delete ${limit.name}?`), confirmationButtonText: i18n('Delete'), - title: i18n('Warning'), + title: i18n('Delete'), onConfirmed: ()=> EntitlementPoolsActionHelper.deleteLimit(dispatch, {limit, entitlementPool: parent, licenseModelId, version}).then(() => selectedLimit === limit.id && onCloseLimitEditor() ) diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditor.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditor.js index 62c6663833..fa21109541 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditor.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditor.js @@ -43,8 +43,9 @@ const mapActionsToProps = (dispatch, {licenseModelId, version}) => { onDeleteEntitlementPool: entitlementPool => dispatch({ type: globalMoadlActions.GLOBAL_MODAL_WARNING, data:{ - msg: generateConfirmationMsg(entitlementPool), - title: i18n('Warning'), + msg: generateConfirmationMsg(entitlementPool), + confirmationButtonText: i18n('Delete'), + title: i18n('Delete'), onConfirmed: ()=>EntitlementPoolsActionHelper.deleteEntitlementPool(dispatch, { licenseModelId, entitlementPoolId: entitlementPool.id, diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditor.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditor.js index 83473a30bb..fc892387c6 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditor.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditor.js @@ -44,7 +44,8 @@ const mapActionsToProps = (dispatch, {licenseModelId}) => { type: globalMoadlActions.GLOBAL_MODAL_WARNING, data:{ msg: generateConfirmationMsg(featureGroup), - title: i18n('Warning'), + confirmationButtonText: i18n('Delete'), + title: i18n('Delete'), onConfirmed: ()=>FeatureGroupsActionHelper.deleteFeatureGroup(dispatch, {featureGroupId: featureGroup.id, licenseModelId, version}) } }), diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementListEditor.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementListEditor.js index 72a99e26ce..92c2550c1c 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementListEditor.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementListEditor.js @@ -45,7 +45,8 @@ const mapActionsToProps = (dispatch, {licenseModelId}) => { type: globalMoadlActions.GLOBAL_MODAL_WARNING, data:{ msg: i18n(`Are you sure you want to delete "${licenseAgreement.name}"?`), - title: i18n('Warning'), + confirmationButtonText: i18n('Delete'), + title: i18n('Delete'), onConfirmed: ()=>LicenseAgreementActionHelper.deleteLicenseAgreement(dispatch, {licenseModelId, licenseAgreementId: licenseAgreement.id, version}) } }) diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorView.jsx index 647e205cb5..70fb43ee88 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorView.jsx @@ -269,7 +269,8 @@ class LicenseKeyGroupsEditorView extends React.Component { limitsList={limitsList.filter(item => item.type === limitType.SERVICE_PROVIDER)} selectedLimit={this.state.selectedLimit} onCloseLimitEditor={() => this.onCloseLimitEditor()} - onSelectLimit={limit => this.onSelectLimit(limit)}/>} + onSelectLimit={limit => this.onSelectLimit(limit)} + isReadOnlyMode={isReadOnlyMode} />} </Tab> <Tab tabId={tabIds.VENDOR_LIMITS} disabled={isTabsDisabled} data-test-id='general-tab' title={i18n('Vendor Limits')}> {selectedTab === tabIds.VENDOR_LIMITS && @@ -278,16 +279,29 @@ class LicenseKeyGroupsEditorView extends React.Component { limitsList={limitsList.filter(item => item.type === limitType.VENDOR)} selectedLimit={this.state.selectedLimit} onCloseLimitEditor={() => this.onCloseLimitEditor()} - onSelectLimit={limit => this.onSelectLimit(limit)}/>} + onSelectLimit={limit => this.onSelectLimit(limit)} + isReadOnlyMode={isReadOnlyMode} />} </Tab> {selectedTab !== tabIds.GENERAL ? - <Button disabled={this.state.selectedLimit} className='add-limit-button' tabId={tabIds.ADD_LIMIT_BUTTON} btnType='link' iconName='plus'>{i18n('Add Limit')}</Button> : + <Button + className='add-limit-button' + tabId={tabIds.ADD_LIMIT_BUTTON} + btnType='link' + iconName='plus' + disabled={this.state.selectedLimit || isReadOnlyMode}> + {i18n('Add Limit')} + </Button> + : <div></div> // Render empty div to not break tabs } </Tabs> <GridSection className='license-model-modal-buttons license-key-group-editor-buttons'> - {!this.state.selectedLimit && <Button btnType='default' disabled={!this.props.isFormValid} onClick={() => this.submit()} type='reset'>{i18n('Save')}</Button>} + {!this.state.selectedLimit && + <Button btnType='default' disabled={!this.props.isFormValid || isReadOnlyMode} onClick={() => this.submit()} type='reset'> + {i18n('Save')} + </Button> + } <Button btnType={this.state.selectedLimit ? 'default' : 'outline'} onClick={() => this.props.onCancel()} type='reset'> {i18n('Cancel')} </Button> diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsLimits.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsLimits.js index 7745a12fec..0e20a6a486 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsLimits.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsLimits.js @@ -45,7 +45,7 @@ const mapActionsToProps = (dispatch) => { data:{ msg: i18n(`Are you sure you want to delete ${limit.name}?`), confirmationButtonText: i18n('Delete'), - title: i18n('Warning'), + title: i18n('Delete'), onConfirmed: ()=> LicenseKeyGroupsActionHelper.deleteLimit(dispatch, {limit, licenseKeyGroup: parent, licenseModelId, version}).then(() => selectedLimit === limit.id && onCloseLimitEditor() ) diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditor.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditor.js index a8cf1eb0a1..c1d937394a 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditor.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditor.js @@ -42,8 +42,9 @@ const mapActionsToProps = (dispatch, {licenseModelId, version}) => { onDeleteLicenseKeyGroupClick: licenseKeyGroup => dispatch({ type: globalMoadlActions.GLOBAL_MODAL_WARNING, data:{ - msg: generateConfirmationMsg(licenseKeyGroup), - title: i18n('Warning'), + msg: generateConfirmationMsg(licenseKeyGroup), + confirmationButtonText: i18n('Delete'), + title: i18n('Delete'), onConfirmed: ()=>LicenseKeyGroupsActionHelper.deleteLicenseKeyGroup(dispatch, {licenseModelId, licenseKeyGroupId:licenseKeyGroup.id, version}) } }) diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditor.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditor.jsx index d4b7e5c898..110e5137e1 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditor.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditor.jsx @@ -179,7 +179,7 @@ class LimitEditor extends React.Component { </GridItem> </GridSection> <GridSection className='limit-editor-buttons'> - <Button btnType='outline' disabled={!isFormValid} onClick={() => this.submit()} type='reset'>{i18n('Save')}</Button> + <Button btnType='outline' disabled={!isFormValid || isReadOnlyMode} onClick={() => this.submit()} type='reset'>{i18n('Save')}</Button> <Button btnType='outline' color='gray' onClick={onCancel} type='reset'>{i18n('Cancel')}</Button> </GridSection> </Form> diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/Limits.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/Limits.jsx index b144f63968..4841d0335c 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/Limits.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/Limits.jsx @@ -61,10 +61,9 @@ class Limits extends React.Component { } return ( <div className='license-model-limits-view'> - <ListEditorView - isReadOnlyMode={isReadOnlyMode}> + <ListEditorView isReadOnlyMode={isReadOnlyMode}> {this.props.selectedLimit === NEW_LIMIT_TEMP_ID && limitEditor.data && - <LimitEditor limitsNames={limitsNames} onCancel={onCloseLimitEditor} onSubmit={ () => this.submit()}/> + <LimitEditor limitsNames={limitsNames} onCancel={onCloseLimitEditor} onSubmit={ () => this.submit()} isReadOnlyMode={isReadOnlyMode}/> } {limitsList.length === 0 && !limitEditor.data && <div className='no-limits-text'>{i18n('There are no limits')}</div>} {limitsList.map(limit => @@ -75,7 +74,13 @@ class Limits extends React.Component { clickable={!selectedLimit} isReadOnlyMode={isReadOnlyMode} limit={limit}/> - {limit.id === selectedLimit && limitEditor.data && <LimitEditor limitsNames={limitsNames} onCancel={onCloseLimitEditor} onSubmit={ () => this.submit()}/>} + {limit.id === selectedLimit && limitEditor.data && + <LimitEditor + limitsNames={limitsNames} + onCancel={onCloseLimitEditor} + onSubmit={ () => this.submit()} + isReadOnlyMode={isReadOnlyMode} /> + } </div> )} </ListEditorView> diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/processes/SoftwareProductComponentProcessesList.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/processes/SoftwareProductComponentProcessesList.js index 826201162c..8c359db869 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/processes/SoftwareProductComponentProcessesList.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/processes/SoftwareProductComponentProcessesList.js @@ -48,6 +48,8 @@ const mapActionsToProps = (dispatch, {componentId, softwareProductId}) => { type: modalActionTypes.GLOBAL_MODAL_WARNING, data:{ msg: i18n(`Are you sure you want to delete "${process.name}"?`), + confirmationButtonText: i18n('Delete'), + title: i18n('Delete'), onConfirmed: ()=> SoftwareProductComponentProcessesActionHelper.deleteProcess(dispatch, {process, softwareProductId, version, componentId}) } diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcesses.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcesses.js index afd6331324..c70452919b 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcesses.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcesses.js @@ -43,6 +43,8 @@ const mapActionsToProps = (dispatch, {softwareProductId}) => { type: modalActionTypes.GLOBAL_MODAL_WARNING, data:{ msg: i18n(`Are you sure you want to delete "${process.name}"?`), + confirmationButtonText: i18n('Delete'), + title: i18n('Delete'), onConfirmed: ()=> SoftwareProductProcessesActionHelper.deleteProcess(dispatch, {process, softwareProductId, version}) } |