From 8ae8f7eba59880eb81b985e98d87961e631013c7 Mon Sep 17 00:00:00 2001 From: svishnev Date: Mon, 2 Jul 2018 14:05:17 +0300 Subject: archive fix & archive/filter toggle removed Issue-ID: SDC-1383 Change-Id: I38548e5e0b5cce224e0d1324a97f9edce6dc0cfb Signed-off-by: svishnev --- .../creation/SoftwareProductCreation.js | 12 +- .../creation/SoftwareProductCreationView.jsx | 33 ++- .../SoftwareProductCreationViewWithFilter.jsx | 330 --------------------- 3 files changed, 19 insertions(+), 356 deletions(-) delete mode 100644 openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreationViewWithFilter.jsx (limited to 'openecomp-ui/src/sdc-app/onboarding/softwareProduct') diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreation.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreation.js index 9a7d257d7d..539bc12ca7 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreation.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreation.js @@ -14,11 +14,8 @@ * permissions and limitations under the License. */ import { connect } from 'react-redux'; -import featureToggle from 'sdc-app/features/featureToggle.js'; -import { featureToggleNames } from 'sdc-app/features/FeaturesConstants.js'; import SoftwareProductCreationActionHelper from './SoftwareProductCreationActionHelper.js'; import SoftwareProductCreationView from './SoftwareProductCreationView.jsx'; -import SoftwareProductCreationViewWithFilter from './SoftwareProductCreationViewWithFilter.jsx'; import ValidationHelper from 'sdc-app/common/helpers/ValidationHelper.js'; import SoftwareProductActionHelper from '../SoftwareProductActionHelper.js'; import VersionsPageActionHelper from 'sdc-app/onboarding/versionsPage/VersionsPageActionHelper.js'; @@ -30,13 +27,6 @@ import UniqueTypesHelper from 'sdc-app/common/helpers/UniqueTypesHelper.js'; import i18n from 'nfvo-utils/i18n/i18n.js'; import { itemType } from 'sdc-app/common/helpers/ItemsHelperConstants.js'; -const ToggledSoftwareProductCreationView = featureToggle( - featureToggleNames.FILTER -)({ - OnComp: SoftwareProductCreationViewWithFilter, - OffComp: SoftwareProductCreationView -}); - export const mapStateToProps = ({ finalizedLicenseModelList, users: { usersList }, @@ -130,4 +120,4 @@ export const mapActionsToProps = dispatch => { export default connect(mapStateToProps, mapActionsToProps, null, { withRef: true -})(ToggledSoftwareProductCreationView); +})(SoftwareProductCreationView); diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreationView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreationView.jsx index 432493065f..c9693d4f93 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreationView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreationView.jsx @@ -1,5 +1,5 @@ /*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright © 2016-2018 European Support Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -91,13 +91,10 @@ class SoftwareProductCreationView extends React.Component { onChange={name => onDataChanged( { name }, - SP_CREATION_FORM_NAME, - { - name: name => - this.validateName(name) - } + SP_CREATION_FORM_NAME ) } + onBlur={this.validateIsNameUnique} isValid={genericFieldInfo.name.isValid} errorText={genericFieldInfo.name.errorText} type="text" @@ -207,17 +204,15 @@ class SoftwareProductCreationView extends React.Component { } getVendorList() { - let { finalizedLicenseModelList } = this.props; + let { vendorList } = this.props; return [{ enum: '', title: i18n('please select...') }].concat( - sortByStringProperty(finalizedLicenseModelList, 'name').map( - vendor => { - return { - enum: vendor.id, - title: vendor.name - }; - } - ) + sortByStringProperty(vendorList, 'name').map(vendor => { + return { + enum: vendor.id, + title: vendor.name + }; + }) ); } @@ -270,6 +265,13 @@ class SoftwareProductCreationView extends React.Component { }; } + validateIsNameUnique = e => { + const value = e.target.value; + if (value) { + this.props.isNameUnique(value, 'name', SP_CREATION_FORM_NAME); + } + }; + validate() { this.props.onValidateForm(SP_CREATION_FORM_NAME); } @@ -290,6 +292,7 @@ const OnboardingProcedure = ({ onboardingMethod === onboardingMethodConst.NETWORK_PACKAGE } + errorText={genericFieldInfo.onboardingMethod.errorText} onChange={() => onDataChanged( { diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreationViewWithFilter.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreationViewWithFilter.jsx deleted file mode 100644 index c9693d4f93..0000000000 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreationViewWithFilter.jsx +++ /dev/null @@ -1,330 +0,0 @@ -/*! - * Copyright © 2016-2018 European Support Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ -import React from 'react'; -import PropTypes from 'prop-types'; -import i18n from 'nfvo-utils/i18n/i18n.js'; -import Validator from 'nfvo-utils/Validator.js'; -import Input from 'nfvo-components/input/validation/Input.jsx'; -import Form from 'nfvo-components/input/validation/Form.jsx'; -import GridSection from 'nfvo-components/grid/GridSection.jsx'; -import GridItem from 'nfvo-components/grid/GridItem.jsx'; - -import { SP_CREATION_FORM_NAME } from './SoftwareProductCreationConstants.js'; -import sortByStringProperty from 'nfvo-utils/sortByStringProperty.js'; - -import SoftwareProductCategoriesHelper from 'sdc-app/onboarding/softwareProduct/SoftwareProductCategoriesHelper.js'; -import { onboardingMethod as onboardingMethodConst } from '../SoftwareProductConstants.js'; - -const SoftwareProductPropType = PropTypes.shape({ - id: PropTypes.string, - name: PropTypes.string, - description: PropTypes.string, - category: PropTypes.string, - subCategory: PropTypes.string, - vendorId: PropTypes.string -}); - -class SoftwareProductCreationView extends React.Component { - static propTypes = { - data: SoftwareProductPropType, - finalizedLicenseModelList: PropTypes.array, - softwareProductCategories: PropTypes.array, - VSPNames: PropTypes.object, - usersList: PropTypes.array, - onDataChanged: PropTypes.func.isRequired, - onSubmit: PropTypes.func.isRequired, - onCancel: PropTypes.func.isRequired - }; - - render() { - let { - softwareProductCategories, - data = {}, - onDataChanged, - onCancel, - genericFieldInfo, - disableVendor - } = this.props; - let { - name, - description, - vendorId, - subCategory, - onboardingMethod - } = data; - - const vendorList = this.getVendorList(); - return ( -
- {genericFieldInfo && ( -
- (this.validationForm = validationForm) - } - hasButtons={true} - onSubmit={() => this.submit()} - onReset={() => onCancel()} - labledButtons={true} - isValid={this.props.isFormValid} - submitButtonText={i18n('Create')} - formReady={this.props.formReady} - onValidateForm={() => this.validate()}> - - - - onDataChanged( - { name }, - SP_CREATION_FORM_NAME - ) - } - onBlur={this.validateIsNameUnique} - isValid={genericFieldInfo.name.isValid} - errorText={genericFieldInfo.name.errorText} - type="text" - className="field-section" - data-test-id="new-vsp-name" - /> - this.onSelectVendor(e)} - isValid={genericFieldInfo.vendorId.isValid} - errorText={ - genericFieldInfo.vendorId.errorText - } - className="input-options-select" - groupClassName="bootstrap-input-options" - data-test-id="new-vsp-vendor"> - {vendorList.map(vendor => ( - - ))} - - this.onSelectSubCategory(e)} - isValid={ - genericFieldInfo.subCategory.isValid - } - errorText={ - genericFieldInfo.subCategory.errorText - } - className="input-options-select" - groupClassName="bootstrap-input-options" - data-test-id="new-vsp-category"> - - {softwareProductCategories.map( - category => - category.subcategories && ( - - {category.subcategories.map( - sub => ( - - ) - )} - - ) - )} - - - - - onDataChanged( - { description }, - SP_CREATION_FORM_NAME - ) - } - isValid={ - genericFieldInfo.description.isValid - } - errorText={ - genericFieldInfo.description.errorText - } - type="textarea" - className="field-section" - data-test-id="new-vsp-description" - /> - - - - - )} -
- ); - } - - getVendorList() { - let { vendorList } = this.props; - - return [{ enum: '', title: i18n('please select...') }].concat( - sortByStringProperty(vendorList, 'name').map(vendor => { - return { - enum: vendor.id, - title: vendor.name - }; - }) - ); - } - - onSelectVendor(e) { - const selectedIndex = e.target.selectedIndex; - const vendorId = e.target.options[selectedIndex].value; - this.props.onDataChanged({ vendorId }, SP_CREATION_FORM_NAME); - } - - onSelectSubCategory(e) { - const selectedIndex = e.target.selectedIndex; - const subCategory = e.target.options[selectedIndex].value; - let { softwareProductCategories, onDataChanged } = this.props; - let category = SoftwareProductCategoriesHelper.getCurrentCategoryOfSubCategory( - subCategory, - softwareProductCategories - ); - onDataChanged({ category, subCategory }, SP_CREATION_FORM_NAME); - } - - submit() { - let { - data: softwareProduct, - finalizedLicenseModelList, - usersList - } = this.props; - softwareProduct.vendorName = finalizedLicenseModelList.find( - vendor => vendor.id === softwareProduct.vendorId - ).name; - this.props.onSubmit(softwareProduct, usersList); - } - - validateName(value) { - const { data: { id }, VSPNames } = this.props; - const isExists = Validator.isItemNameAlreadyExistsInList({ - itemId: id, - itemName: value, - list: VSPNames - }); - - return !isExists - ? { isValid: true, errorText: '' } - : { - isValid: false, - errorText: i18n( - "Software product by the name '" + - value + - "' already exists. Software product name must be unique" - ) - }; - } - - validateIsNameUnique = e => { - const value = e.target.value; - if (value) { - this.props.isNameUnique(value, 'name', SP_CREATION_FORM_NAME); - } - }; - - validate() { - this.props.onValidateForm(SP_CREATION_FORM_NAME); - } -} - -const OnboardingProcedure = ({ - onboardingMethod, - onDataChanged, - genericFieldInfo -}) => { - return ( - - - - onDataChanged( - { - onboardingMethod: - onboardingMethodConst.NETWORK_PACKAGE - }, - SP_CREATION_FORM_NAME - ) - } - type="radio" - data-test-id="new-vsp-creation-procedure-heat" - /> - - - - onDataChanged( - { onboardingMethod: onboardingMethodConst.MANUAL }, - SP_CREATION_FORM_NAME - ) - } - type="radio" - data-test-id="new-vsp-creation-procedure-manual" - /> - - - ); -}; - -export default SoftwareProductCreationView; -- cgit 1.2.3-korg