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 --- .../licenseModel/creation/LicenseModelCreation.js | 12 +- .../creation/LicenseModelCreationView.jsx | 50 ++-- .../LicenseModelCreationViewWithFilter.jsx | 116 -------- .../src/sdc-app/onboarding/onboard/OnboardView.jsx | 20 +- .../sdc-app/onboarding/onboard/filter/Filter.jsx | 10 +- .../onboardingCatalog/OnboardingCatalogView.jsx | 94 +----- .../OnboardingCatalogViewWithFilter.jsx | 147 --------- .../onboard/onboardingCatalog/VendorItem.jsx | 6 +- .../onboarding/onboard/workspace/WorkspaceView.jsx | 39 ++- .../onboard/workspace/WorkspaceViewWithFilter.jsx | 67 ----- .../creation/SoftwareProductCreation.js | 12 +- .../creation/SoftwareProductCreationView.jsx | 33 ++- .../SoftwareProductCreationViewWithFilter.jsx | 330 --------------------- .../onboarding/versionsPage/VersionsPage.jsx | 9 +- 14 files changed, 82 insertions(+), 863 deletions(-) delete mode 100644 openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationViewWithFilter.jsx delete mode 100644 openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogViewWithFilter.jsx delete mode 100644 openecomp-ui/src/sdc-app/onboarding/onboard/workspace/WorkspaceViewWithFilter.jsx delete mode 100644 openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreationViewWithFilter.jsx (limited to 'openecomp-ui/src/sdc-app/onboarding') diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreation.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreation.js index c6a0702a57..94eef113b1 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreation.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreation.js @@ -14,11 +14,8 @@ * 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 LicenseModelCreationActionHelper from './LicenseModelCreationActionHelper.js'; import LicenseModelCreationView from './LicenseModelCreationView.jsx'; -import LicenseModelCreationViewWithFilter from './LicenseModelCreationViewWithFilter.jsx'; import ValidationHelper from 'sdc-app/common/helpers/ValidationHelper.js'; import LicenseModelActionHelper from 'sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js'; @@ -31,13 +28,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 ToggledLicenseModelCreationView = featureToggle( - featureToggleNames.FILTER -)({ - OnComp: LicenseModelCreationViewWithFilter, - OffComp: LicenseModelCreationView -}); - export const mapStateToProps = ({ users: { usersList }, licenseModelList, @@ -118,5 +108,5 @@ export const mapActionsToProps = dispatch => { }; export default connect(mapStateToProps, mapActionsToProps)( - ToggledLicenseModelCreationView + LicenseModelCreationView ); diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationView.jsx index 59c4152213..8c5d966938 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationView.jsx @@ -1,22 +1,21 @@ -/*! - * 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. * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * + * 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. + * 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 { LICENSE_MODEL_CREATION_FORM_NAME } from './LicenseModelCreationConstants.js'; @@ -61,13 +60,12 @@ class LicenseModelCreationView extends React.Component { onChange={vendorName => onDataChanged( { vendorName }, - LICENSE_MODEL_CREATION_FORM_NAME, - { - vendorName: name => - this.validateName(name) - } + LICENSE_MODEL_CREATION_FORM_NAME ) } + onBlur={e => + this.validateIsNameUnique(e.target.value) + } isValid={genericFieldInfo.vendorName.isValid} errorText={genericFieldInfo.vendorName.errorText} type="text" @@ -102,24 +100,12 @@ class LicenseModelCreationView extends React.Component { this.props.onSubmit(licenseModel, usersList); } - validateName(value) { - const { data: { id }, VLMNames } = this.props; - const isExists = Validator.isItemNameAlreadyExistsInList({ - itemId: id, - itemName: value, - list: VLMNames - }); - - return !isExists - ? { isValid: true, errorText: '' } - : { - isValid: false, - errorText: i18n( - "License model by the name '" + - value + - "' already exists. License model name must be unique" - ) - }; + validateIsNameUnique(value) { + this.props.isNameUnique( + value, + 'vendorName', + LICENSE_MODEL_CREATION_FORM_NAME + ); } validate() { diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationViewWithFilter.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationViewWithFilter.jsx deleted file mode 100644 index 8c5d966938..0000000000 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationViewWithFilter.jsx +++ /dev/null @@ -1,116 +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 Input from 'nfvo-components/input/validation/Input.jsx'; -import Form from 'nfvo-components/input/validation/Form.jsx'; -import { LICENSE_MODEL_CREATION_FORM_NAME } from './LicenseModelCreationConstants.js'; - -const LicenseModelPropType = PropTypes.shape({ - id: PropTypes.string, - vendorName: PropTypes.string, - description: PropTypes.string -}); - -class LicenseModelCreationView extends React.Component { - static propTypes = { - data: LicenseModelPropType, - VLMNames: PropTypes.object, - usersList: PropTypes.array, - onDataChanged: PropTypes.func.isRequired, - onSubmit: PropTypes.func.isRequired, - onValidateForm: PropTypes.func.isRequired, - onCancel: PropTypes.func.isRequired - }; - - render() { - let { data = {}, onDataChanged, genericFieldInfo } = this.props; - let { vendorName, description } = data; - return ( -
- {genericFieldInfo && ( -
this.submit()} - submitButtonText={i18n('Create')} - onReset={() => this.props.onCancel()} - labledButtons={true} - isValid={this.props.isFormValid} - formReady={this.props.formReady} - onValidateForm={() => this.validate()}> - - onDataChanged( - { vendorName }, - LICENSE_MODEL_CREATION_FORM_NAME - ) - } - onBlur={e => - this.validateIsNameUnique(e.target.value) - } - isValid={genericFieldInfo.vendorName.isValid} - errorText={genericFieldInfo.vendorName.errorText} - type="text" - isRequired={true} - className="field-section" - /> - - onDataChanged( - { description }, - LICENSE_MODEL_CREATION_FORM_NAME - ) - } - isValid={genericFieldInfo.description.isValid} - errorText={genericFieldInfo.description.errorText} - type="textarea" - className="field-section" - /> -
- )} -
- ); - } - - submit() { - const { data: licenseModel, usersList } = this.props; - this.props.onSubmit(licenseModel, usersList); - } - - validateIsNameUnique(value) { - this.props.isNameUnique( - value, - 'vendorName', - LICENSE_MODEL_CREATION_FORM_NAME - ); - } - - validate() { - this.props.onValidateForm(LICENSE_MODEL_CREATION_FORM_NAME); - } -} - -export default LicenseModelCreationView; diff --git a/openecomp-ui/src/sdc-app/onboarding/onboard/OnboardView.jsx b/openecomp-ui/src/sdc-app/onboarding/onboard/OnboardView.jsx index 0fc64b328c..c5cf2926d4 100644 --- a/openecomp-ui/src/sdc-app/onboarding/onboard/OnboardView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/onboard/OnboardView.jsx @@ -16,9 +16,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import OnboardingCatalogView from './onboardingCatalog/OnboardingCatalogView.jsx'; -import OnboardingCatalogViewWithFilter from './onboardingCatalog/OnboardingCatalogViewWithFilter.jsx'; import WorkspaceView from './workspace/WorkspaceView.jsx'; -import WorkspaceViewWithFilter from './workspace/WorkspaceViewWithFilter.jsx'; import { tabsMapping } from './OnboardConstants.js'; import i18n from 'nfvo-utils/i18n/i18n.js'; import classnames from 'classnames'; @@ -27,8 +25,6 @@ import objectValues from 'lodash/values.js'; import { catalogItemTypes } from './onboardingCatalog/OnboardingCatalogConstants.js'; import NotificationsView from 'sdc-app/onboarding/userNotifications/NotificationsView.jsx'; import Filter from 'sdc-app/onboarding/onboard/filter/Filter.jsx'; -import featureToggle from 'sdc-app/features/featureToggle.js'; -import { featureToggleNames } from 'sdc-app/features/FeaturesConstants.js'; const OnboardHeaderTabs = ({ onTabClick, activeTab }) => (
(
); -const ToggledOnboardingCatalogView = featureToggle(featureToggleNames.FILTER)({ - OnComp: OnboardingCatalogViewWithFilter, - OffComp: OnboardingCatalogView -}); - -const ToggledWorkspaceView = featureToggle(featureToggleNames.FILTER)({ - OnComp: WorkspaceViewWithFilter, - OffComp: WorkspaceView -}); - const OnboardHeader = ({ onSearch, activeTab, onTabClick, searchValue }) => (
@@ -98,11 +84,11 @@ class OnboardView extends React.Component { renderViewByTab(activeTab) { switch (activeTab) { case tabsMapping.WORKSPACE: - return ; + return ; case tabsMapping.CATALOG: - return ; + return ; default: - return ; + return ; } } diff --git a/openecomp-ui/src/sdc-app/onboarding/onboard/filter/Filter.jsx b/openecomp-ui/src/sdc-app/onboarding/onboard/filter/Filter.jsx index a00357c7b9..dadbbfd720 100644 --- a/openecomp-ui/src/sdc-app/onboarding/onboard/filter/Filter.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/onboard/filter/Filter.jsx @@ -17,8 +17,6 @@ import { connect } from 'react-redux'; import React from 'react'; import PropTypes from 'prop-types'; -import featureToggle from 'sdc-app/features/featureToggle.js'; -import { featureToggleNames } from 'sdc-app/features/FeaturesConstants.js'; import { tabsMapping as onboardTabsMapping } from '../OnboardConstants.js'; import { actionTypes } from './FilterConstants.js'; @@ -69,10 +67,4 @@ Filter.PropTypes = { activeTab: PropTypes.number }; -export default featureToggle(featureToggleNames.FILTER)( - connect(mapStateToProps, mapActionsToProps)(Filter) -); - -export const ConnectedFilter = connect(mapStateToProps, mapActionsToProps)( - Filter -); +export default connect(mapStateToProps, mapActionsToProps)(Filter); diff --git a/openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogView.jsx b/openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogView.jsx index a416d36075..86c437d888 100644 --- a/openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogView.jsx @@ -15,64 +15,12 @@ */ import React from 'react'; import i18n from 'nfvo-utils/i18n/i18n.js'; -import classnames from 'classnames'; import DetailsCatalogView from 'sdc-app/onboarding/onboard/DetailsCatalogView.jsx'; import VendorCatalogView from './VendorCatalogView.jsx'; import { tabsMapping } from './OnboardingCatalogConstants.js'; import { tabsMapping as WCTabsMapping } from 'sdc-app/onboarding/onboard/OnboardConstants.js'; -import featureToggle from 'sdc-app/features/featureToggle.js'; -import { featureToggleNames } from 'sdc-app/features/FeaturesConstants.js'; -const Separator = () =>
; - -const Tab = ({ onTabPress, title, dataTestId, activeTab, tabMapping }) => ( -
onTabPress(tabMapping)} - data-test-id={dataTestId}> - {title} -
-); - -const ArchiveTab = featureToggle(featureToggleNames.ARCHIVE_ITEM)(Tab); -const ArchiveTabSeparator = featureToggle(featureToggleNames.ARCHIVE_ITEM)( - Separator -); - -const CatalogHeaderTabs = props => ( -
- - - - - -
-); - -const CatalogHeader = ({ activeTab, onTabPress }) => ( -
- -
-); - -const FilterCatalogHeader = () => ( +const CatalogHeader = () => (
@@ -82,19 +30,11 @@ const FilterCatalogHeader = () => (
); -const FeaturedCatalogHeader = featureToggle(featureToggleNames.FILTER)({ - OnComp: FilterCatalogHeader, - OffComp: CatalogHeader -}); - class OnboardingCatalogView extends React.Component { renderViewByTab(activeTab) { const { - finalizedLicenseModelList: licenseModelList, - fullLicenseModelList, users, vspOverlay, - finalizedSoftwareProductList: softwareProductList, onSelectLicenseModel, onSelectSoftwareProduct, onAddLicenseModelClick, @@ -104,16 +44,17 @@ class OnboardingCatalogView extends React.Component { selectedVendor, searchValue, onMigrate, - archivedSoftwareProductList, - archivedLicenseModelList + filteredItems } = this.props; + const { vlmList, vspList } = filteredItems; + switch (activeTab) { case tabsMapping.ARCHIVE: return ( onSelectLicenseModel( @@ -136,8 +77,8 @@ class OnboardingCatalogView extends React.Component { case tabsMapping.ACTIVE: return ( - {!selectedVendor && ( - onSearch(event.target.value)} - activeTab={activeTab} - onTabPress={tab => onCatalogTabClick(tab)} - searchValue={searchValue} - /> - )} + {!selectedVendor && } {this.renderViewByTab(activeTab)}
); diff --git a/openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogViewWithFilter.jsx b/openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogViewWithFilter.jsx deleted file mode 100644 index 86c437d888..0000000000 --- a/openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogViewWithFilter.jsx +++ /dev/null @@ -1,147 +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 i18n from 'nfvo-utils/i18n/i18n.js'; -import DetailsCatalogView from 'sdc-app/onboarding/onboard/DetailsCatalogView.jsx'; -import VendorCatalogView from './VendorCatalogView.jsx'; -import { tabsMapping } from './OnboardingCatalogConstants.js'; -import { tabsMapping as WCTabsMapping } from 'sdc-app/onboarding/onboard/OnboardConstants.js'; - -const CatalogHeader = () => ( -
-
-
- {i18n('ONBOARD CATALOG')} -
-
-
-); - -class OnboardingCatalogView extends React.Component { - renderViewByTab(activeTab) { - const { - users, - vspOverlay, - onSelectLicenseModel, - onSelectSoftwareProduct, - onAddLicenseModelClick, - onAddSoftwareProductClick, - onVspOverlayChange, - onVendorSelect, - selectedVendor, - searchValue, - onMigrate, - filteredItems - } = this.props; - - const { vlmList, vspList } = filteredItems; - - switch (activeTab) { - case tabsMapping.ARCHIVE: - return ( - - onSelectLicenseModel( - item, - users, - WCTabsMapping.CATALOG - ) - } - onSelectVSP={(item, users) => - onSelectSoftwareProduct( - item, - users, - WCTabsMapping.CATALOG - ) - } - filter={searchValue} - onMigrate={onMigrate} - /> - ); - case tabsMapping.ACTIVE: - return ( - - onSelectLicenseModel( - item, - users, - WCTabsMapping.CATALOG - ) - } - onSelectVSP={(item, users) => - onSelectSoftwareProduct( - item, - users, - WCTabsMapping.CATALOG - ) - } - filter={searchValue} - onMigrate={onMigrate} - /> - ); - case tabsMapping.BY_VENDOR: - default: - return ( - - onSelectSoftwareProduct( - item, - users, - WCTabsMapping.CATALOG - ) - } - onSelectVLM={(item, users) => - onSelectLicenseModel( - item, - users, - WCTabsMapping.CATALOG - ) - } - vspOverlay={vspOverlay} - onVendorSelect={onVendorSelect} - selectedVendor={selectedVendor} - onVspOverlayChange={onVspOverlayChange} - onMigrate={onMigrate} - filter={searchValue} - /> - ); - } - } - - render() { - const { selectedVendor, catalogActiveTab: activeTab } = this.props; - return ( -
- {!selectedVendor && } - {this.renderViewByTab(activeTab)} -
- ); - } -} - -export default OnboardingCatalogView; diff --git a/openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/VendorItem.jsx b/openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/VendorItem.jsx index aec8e9bdb1..fda47ef3e8 100644 --- a/openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/VendorItem.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/VendorItem.jsx @@ -68,9 +68,9 @@ class VendorItem extends React.Component { onClick={e => this.handleVspCountClick(e)} data-test-id="catalog-vsp-count" disabled={!softwareProductList.length}> - {i18n('{length} VSPs', { - length: softwareProductList.length - })} + {`${softwareProductList.length.toString()} ${i18n( + 'VSPs' + )}`} {shouldShowOverlay && softwareProductList.length > 0 && ( diff --git a/openecomp-ui/src/sdc-app/onboarding/onboard/workspace/WorkspaceView.jsx b/openecomp-ui/src/sdc-app/onboarding/onboard/workspace/WorkspaceView.jsx index 2f17867af1..bef88df14d 100644 --- a/openecomp-ui/src/sdc-app/onboarding/onboard/workspace/WorkspaceView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/onboard/workspace/WorkspaceView.jsx @@ -1,34 +1,35 @@ -/*! - * 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. * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * + * 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. + * 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 DetailsCatalogView from '../DetailsCatalogView.jsx'; import i18n from 'nfvo-utils/i18n/i18n.js'; import { tabsMapping } from 'sdc-app/onboarding/onboard/OnboardConstants.js'; +import { tabsMapping as catalogTabsMappping } from '../onboardingCatalog/OnboardingCatalogConstants.js'; const WorkspaceView = props => { let { - licenseModelList, - softwareProductList, onAddLicenseModelClick, users, onAddSoftwareProductClick, onSelectLicenseModel, onSelectSoftwareProduct, searchValue, - onMigrate + onMigrate, + catalogActiveTab, + filteredItems: { vspList, vlmList } } = props; return ( @@ -37,11 +38,19 @@ const WorkspaceView = props => { {i18n('WORKSPACE')}
onSelectLicenseModel(item, users, tabsMapping.WORKSPACE) } diff --git a/openecomp-ui/src/sdc-app/onboarding/onboard/workspace/WorkspaceViewWithFilter.jsx b/openecomp-ui/src/sdc-app/onboarding/onboard/workspace/WorkspaceViewWithFilter.jsx deleted file mode 100644 index bef88df14d..0000000000 --- a/openecomp-ui/src/sdc-app/onboarding/onboard/workspace/WorkspaceViewWithFilter.jsx +++ /dev/null @@ -1,67 +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 DetailsCatalogView from '../DetailsCatalogView.jsx'; -import i18n from 'nfvo-utils/i18n/i18n.js'; -import { tabsMapping } from 'sdc-app/onboarding/onboard/OnboardConstants.js'; -import { tabsMapping as catalogTabsMappping } from '../onboardingCatalog/OnboardingCatalogConstants.js'; - -const WorkspaceView = props => { - let { - onAddLicenseModelClick, - users, - onAddSoftwareProductClick, - onSelectLicenseModel, - onSelectSoftwareProduct, - searchValue, - onMigrate, - catalogActiveTab, - filteredItems: { vspList, vlmList } - } = props; - - return ( -
-
- {i18n('WORKSPACE')} -
- - onSelectLicenseModel(item, users, tabsMapping.WORKSPACE) - } - onSelectVSP={(item, users) => - onSelectSoftwareProduct(item, users, tabsMapping.WORKSPACE) - } - onMigrate={onMigrate} - filter={searchValue} - /> -
- ); -}; - -export default WorkspaceView; 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; diff --git a/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.jsx b/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.jsx index 504de99e12..983d144969 100644 --- a/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.jsx @@ -20,7 +20,6 @@ import Tree from 'nfvo-components/tree/Tree.jsx'; import SVGIcon from 'sdc-ui/lib/react/SVGIcon.js'; import Button from 'sdc-ui/lib/react/Button.js'; import i18n from 'nfvo-utils/i18n/i18n.js'; -import featureToggle from 'sdc-app/features/featureToggle.js'; const ArchiveRestoreButton = ({ depricateAction, title, isArchived }) => (
@@ -34,7 +33,7 @@ const ArchiveRestoreButton = ({ depricateAction, title, isArchived }) => ( ) : ( @@ -46,10 +45,6 @@ const ArchivedTitle = () => (
{i18n('Archived')}
); -const FeatureDepricatedButton = featureToggle('ARCHIVE_ITEM')( - ArchiveRestoreButton -); - const VersionPageTitle = ({ itemName, isArchived, @@ -64,7 +59,7 @@ const VersionPageTitle = ({ {isArchived ? : null}
{isCollaborator && ( - onRestore() : () => onArchive() -- cgit 1.2.3-korg