summaryrefslogtreecommitdiffstats
path: root/openecomp-ui/src/sdc-app/onboarding/softwareProduct
diff options
context:
space:
mode:
authorsvishnev <shlomo-stanisla.vishnevetskiy@amdocs.com>2018-07-02 14:05:17 +0300
committerEinav Keidar <einavw@amdocs.com>2018-07-03 07:44:48 +0000
commit8ae8f7eba59880eb81b985e98d87961e631013c7 (patch)
tree036a293b92bb8e45e4fef455cdde0f3c0fd8e0c4 /openecomp-ui/src/sdc-app/onboarding/softwareProduct
parent4cc66168639fc4448023b73c9e42363823dd4788 (diff)
archive fix & archive/filter toggle removed
Issue-ID: SDC-1383 Change-Id: I38548e5e0b5cce224e0d1324a97f9edce6dc0cfb Signed-off-by: svishnev <shlomo-stanisla.vishnevetskiy@amdocs.com>
Diffstat (limited to 'openecomp-ui/src/sdc-app/onboarding/softwareProduct')
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreation.js12
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreationView.jsx33
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreationViewWithFilter.jsx330
3 files changed, 19 insertions, 356 deletions
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 (
- <div className="software-product-creation-page">
- {genericFieldInfo && (
- <Form
- ref={validationForm =>
- (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()}>
- <GridSection hasLastColSet>
- <GridItem colSpan="2">
- <Input
- value={name}
- label={i18n('Name')}
- isRequired={true}
- onChange={name =>
- 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"
- />
- <Input
- label={i18n('Vendor')}
- type="select"
- value={vendorId}
- overlayPos="bottom"
- isRequired={true}
- disabled={disableVendor}
- onChange={e => 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 => (
- <option
- key={vendor.title}
- value={vendor.enum}>
- {vendor.title}
- </option>
- ))}
- </Input>
- <Input
- label={i18n('Category')}
- type="select"
- value={subCategory}
- isRequired={true}
- onChange={e => 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">
- <option key="" value="">
- {i18n('please select…')}
- </option>
- {softwareProductCategories.map(
- category =>
- category.subcategories && (
- <optgroup
- key={category.name}
- label={category.name}>
- {category.subcategories.map(
- sub => (
- <option
- key={
- sub.uniqueId
- }
- value={
- sub.uniqueId
- }>{`${
- sub.name
- } (${
- category.name
- })`}</option>
- )
- )}
- </optgroup>
- )
- )}
- </Input>
- </GridItem>
- <GridItem colSpan="2" stretch lastColInRow>
- <Input
- value={description}
- label={i18n('Description')}
- isRequired={true}
- overlayPos="bottom"
- onChange={description =>
- 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"
- />
- </GridItem>
- </GridSection>
- <OnboardingProcedure
- genericFieldInfo={genericFieldInfo}
- onboardingMethod={onboardingMethod}
- onDataChanged={onDataChanged}
- />
- </Form>
- )}
- </div>
- );
- }
-
- 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 (
- <GridSection title={i18n('Onboarding procedure')}>
- <GridItem colSpan={4}>
- <Input
- label={i18n('Network Package')}
- overlayPos="top"
- checked={
- onboardingMethod ===
- onboardingMethodConst.NETWORK_PACKAGE
- }
- errorText={genericFieldInfo.onboardingMethod.errorText}
- onChange={() =>
- onDataChanged(
- {
- onboardingMethod:
- onboardingMethodConst.NETWORK_PACKAGE
- },
- SP_CREATION_FORM_NAME
- )
- }
- type="radio"
- data-test-id="new-vsp-creation-procedure-heat"
- />
- </GridItem>
- <GridItem colSpan={4}>
- <Input
- label={i18n('Manual')}
- overlayPos="bottom"
- checked={onboardingMethod === onboardingMethodConst.MANUAL}
- isValid={genericFieldInfo.onboardingMethod.isValid}
- errorText={genericFieldInfo.onboardingMethod.errorText}
- onChange={() =>
- onDataChanged(
- { onboardingMethod: onboardingMethodConst.MANUAL },
- SP_CREATION_FORM_NAME
- )
- }
- type="radio"
- data-test-id="new-vsp-creation-procedure-manual"
- />
- </GridItem>
- </GridSection>
- );
-};
-
-export default SoftwareProductCreationView;