diff options
author | svishnev <shlomo-stanisla.vishnevetskiy@amdocs.com> | 2018-07-02 14:05:17 +0300 |
---|---|---|
committer | Einav Keidar <einavw@amdocs.com> | 2018-07-03 07:44:48 +0000 |
commit | 8ae8f7eba59880eb81b985e98d87961e631013c7 (patch) | |
tree | 036a293b92bb8e45e4fef455cdde0f3c0fd8e0c4 /openecomp-ui | |
parent | 4cc66168639fc4448023b73c9e42363823dd4788 (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')
18 files changed, 89 insertions, 869 deletions
diff --git a/openecomp-ui/package.json b/openecomp-ui/package.json index 8bab189f61..2b060f2801 100644 --- a/openecomp-ui/package.json +++ b/openecomp-ui/package.json @@ -50,7 +50,7 @@ "react-sortable": "^1.2.0", "react-transition-group": "^2.3.1", "redux": "^3.7.2", - "sdc-ui": "1.6.46", + "sdc-ui": "1.6.53", "uuid-js": "^0.7.5", "validator": "^4.3.0" }, diff --git a/openecomp-ui/src/nfvo-utils/i18n/en.json b/openecomp-ui/src/nfvo-utils/i18n/en.json index ce6f7ea4bf..b241489433 100644 --- a/openecomp-ui/src/nfvo-utils/i18n/en.json +++ b/openecomp-ui/src/nfvo-utils/i18n/en.json @@ -366,6 +366,7 @@ "Archive item": "Archive item", "Item successfully Archived": "Item successfully Archived", "Item successfully Restored": "Item successfully Restored", + "VSPs": "VSPs", "VendorSoftwareProduct": "VSP", "VendorSoftwareProduct/category": "Category", 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 ( - <div> - {genericFieldInfo && ( - <Form - ref="validationForm" - hasButtons={true} - onSubmit={() => this.submit()} - submitButtonText={i18n('Create')} - onReset={() => this.props.onCancel()} - labledButtons={true} - isValid={this.props.isFormValid} - formReady={this.props.formReady} - onValidateForm={() => this.validate()}> - <Input - value={vendorName} - label={i18n('Vendor Name')} - data-test-id="vendor-name" - onChange={vendorName => - 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" - /> - <Input - isRequired={true} - value={description} - label={i18n('Description')} - data-test-id="vendor-description" - overlayPos="bottom" - onChange={description => - onDataChanged( - { description }, - LICENSE_MODEL_CREATION_FORM_NAME - ) - } - isValid={genericFieldInfo.description.isValid} - errorText={genericFieldInfo.description.errorText} - type="textarea" - className="field-section" - /> - </Form> - )} - </div> - ); - } - - 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 }) => ( <div className="onboard-header-tabs"> <div @@ -50,16 +46,6 @@ const OnboardHeaderTabs = ({ onTabClick, activeTab }) => ( </div> ); -const ToggledOnboardingCatalogView = featureToggle(featureToggleNames.FILTER)({ - OnComp: OnboardingCatalogViewWithFilter, - OffComp: OnboardingCatalogView -}); - -const ToggledWorkspaceView = featureToggle(featureToggleNames.FILTER)({ - OnComp: WorkspaceViewWithFilter, - OffComp: WorkspaceView -}); - const OnboardHeader = ({ onSearch, activeTab, onTabClick, searchValue }) => ( <div className="onboard-header"> <OnboardHeaderTabs activeTab={activeTab} onTabClick={onTabClick} /> @@ -98,11 +84,11 @@ class OnboardView extends React.Component { renderViewByTab(activeTab) { switch (activeTab) { case tabsMapping.WORKSPACE: - return <ToggledWorkspaceView {...this.props} />; + return <WorkspaceView {...this.props} />; case tabsMapping.CATALOG: - return <ToggledOnboardingCatalogView {...this.props} />; + return <OnboardingCatalogView {...this.props} />; default: - return <ToggledWorkspaceView {...this.props} />; + return <WorkspaceView {...this.props} />; } } 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 = () => <div className="tab-separator" />; - -const Tab = ({ onTabPress, title, dataTestId, activeTab, tabMapping }) => ( - <div - className={classnames('catalog-header-tab', { - active: activeTab === tabMapping - })} - onClick={() => onTabPress(tabMapping)} - data-test-id={dataTestId}> - {title} - </div> -); - -const ArchiveTab = featureToggle(featureToggleNames.ARCHIVE_ITEM)(Tab); -const ArchiveTabSeparator = featureToggle(featureToggleNames.ARCHIVE_ITEM)( - Separator -); - -const CatalogHeaderTabs = props => ( - <div className="catalog-header-tabs"> - <Tab - {...props} - title={i18n('ACTIVE')} - dataTestId="catalog-all-tab" - tabMapping={tabsMapping.ACTIVE} - /> - <Separator /> - <Tab - {...props} - title={i18n('BY VENDOR')} - dataTestId="catalog-header-tab" - tabMapping={tabsMapping.BY_VENDOR} - /> - <ArchiveTabSeparator /> - <ArchiveTab - {...props} - title={i18n('ARCHIVE')} - dataTestId="catalog-archive-tab" - tabMapping={tabsMapping.ARCHIVE} - /> - </div> -); - -const CatalogHeader = ({ activeTab, onTabPress }) => ( - <div className="catalog-header"> - <CatalogHeaderTabs activeTab={activeTab} onTabPress={onTabPress} /> - </div> -); - -const FilterCatalogHeader = () => ( +const CatalogHeader = () => ( <div className="catalog-header"> <div className="catalog-header-tabs"> <div className="catalog-header-tab active"> @@ -82,19 +30,11 @@ const FilterCatalogHeader = () => ( </div> ); -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 ( <DetailsCatalogView - VLMList={archivedLicenseModelList} - VSPList={archivedSoftwareProductList} + VLMList={vlmList} + VSPList={vspList} users={users} onSelectVLM={(item, users) => onSelectLicenseModel( @@ -136,8 +77,8 @@ class OnboardingCatalogView extends React.Component { case tabsMapping.ACTIVE: return ( <DetailsCatalogView - VLMList={licenseModelList} - VSPList={softwareProductList} + VLMList={vlmList} + VSPList={vspList} users={users} onAddVLM={onAddLicenseModelClick} onAddVSP={onAddSoftwareProductClick} @@ -163,7 +104,7 @@ class OnboardingCatalogView extends React.Component { default: return ( <VendorCatalogView - licenseModelList={fullLicenseModelList} + licenseModelList={vlmList} users={users} onAddVSP={onAddSoftwareProductClick} onAddVLM={onAddLicenseModelClick} @@ -193,23 +134,10 @@ class OnboardingCatalogView extends React.Component { } render() { - const { - selectedVendor, - catalogActiveTab: activeTab, - onCatalogTabClick, - onSearch, - searchValue - } = this.props; + const { selectedVendor, catalogActiveTab: activeTab } = this.props; return ( <div className="catalog-wrapper"> - {!selectedVendor && ( - <FeaturedCatalogHeader - onSearch={event => onSearch(event.target.value)} - activeTab={activeTab} - onTabPress={tab => onCatalogTabClick(tab)} - searchValue={searchValue} - /> - )} + {!selectedVendor && <CatalogHeader />} {this.renderViewByTab(activeTab)} </div> ); 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 = () => ( - <div className="catalog-header"> - <div className="catalog-header-tabs"> - <div className="catalog-header-tab active"> - {i18n('ONBOARD CATALOG')} - </div> - </div> - </div> -); - -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 ( - <DetailsCatalogView - VLMList={vlmList} - VSPList={vspList} - users={users} - onSelectVLM={(item, users) => - onSelectLicenseModel( - item, - users, - WCTabsMapping.CATALOG - ) - } - onSelectVSP={(item, users) => - onSelectSoftwareProduct( - item, - users, - WCTabsMapping.CATALOG - ) - } - filter={searchValue} - onMigrate={onMigrate} - /> - ); - case tabsMapping.ACTIVE: - return ( - <DetailsCatalogView - VLMList={vlmList} - VSPList={vspList} - users={users} - onAddVLM={onAddLicenseModelClick} - onAddVSP={onAddSoftwareProductClick} - onSelectVLM={(item, users) => - onSelectLicenseModel( - item, - users, - WCTabsMapping.CATALOG - ) - } - onSelectVSP={(item, users) => - onSelectSoftwareProduct( - item, - users, - WCTabsMapping.CATALOG - ) - } - filter={searchValue} - onMigrate={onMigrate} - /> - ); - case tabsMapping.BY_VENDOR: - default: - return ( - <VendorCatalogView - licenseModelList={vlmList} - users={users} - onAddVSP={onAddSoftwareProductClick} - onAddVLM={onAddLicenseModelClick} - onSelectVSP={(item, users) => - 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 ( - <div className="catalog-wrapper"> - {!selectedVendor && <CatalogHeader />} - {this.renderViewByTab(activeTab)} - </div> - ); - } -} - -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' + )}`} </Button> {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')} </div> <DetailsCatalogView - VLMList={licenseModelList} - VSPList={softwareProductList} + VLMList={vlmList} + VSPList={vspList} users={users} - onAddVLM={onAddLicenseModelClick} - onAddVSP={onAddSoftwareProductClick} + onAddVLM={ + catalogActiveTab === catalogTabsMappping.ACTIVE + ? onAddLicenseModelClick + : undefined + } + onAddVSP={ + catalogActiveTab === catalogTabsMappping.ACTIVE + ? onAddSoftwareProductClick + : undefined + } onSelectVLM={(item, users) => 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 ( - <div className="catalog-wrapper workspace-view"> - <div className="catalog-header workspace-header"> - {i18n('WORKSPACE')} - </div> - <DetailsCatalogView - VLMList={vlmList} - VSPList={vspList} - users={users} - onAddVLM={ - catalogActiveTab === catalogTabsMappping.ACTIVE - ? onAddLicenseModelClick - : undefined - } - onAddVSP={ - catalogActiveTab === catalogTabsMappping.ACTIVE - ? onAddSoftwareProductClick - : undefined - } - onSelectVLM={(item, users) => - onSelectLicenseModel(item, users, tabsMapping.WORKSPACE) - } - onSelectVSP={(item, users) => - onSelectSoftwareProduct(item, users, tabsMapping.WORKSPACE) - } - onMigrate={onMigrate} - filter={searchValue} - /> - </div> - ); -}; - -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 ( - <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; 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 }) => ( <div className="deprecate-btn-wrapper"> @@ -34,7 +33,7 @@ const ArchiveRestoreButton = ({ depricateAction, title, isArchived }) => ( ) : ( <SVGIcon name="archiveBox" - title={i18n('Archive item')} + title={i18n('Archive')} color="secondary" onClick={depricateAction} /> @@ -46,10 +45,6 @@ const ArchivedTitle = () => ( <div className="archived-title">{i18n('Archived')}</div> ); -const FeatureDepricatedButton = featureToggle('ARCHIVE_ITEM')( - ArchiveRestoreButton -); - const VersionPageTitle = ({ itemName, isArchived, @@ -64,7 +59,7 @@ const VersionPageTitle = ({ {isArchived ? <ArchivedTitle /> : null} </div> {isCollaborator && ( - <FeatureDepricatedButton + <ArchiveRestoreButton isArchived={isArchived} depricateAction={ isArchived ? () => onRestore() : () => onArchive() diff --git a/openecomp-ui/test/onboard/filter/filterView.test.js b/openecomp-ui/test/onboard/filter/filterView.test.js index 536f02cf49..5e3c93bef2 100644 --- a/openecomp-ui/test/onboard/filter/filterView.test.js +++ b/openecomp-ui/test/onboard/filter/filterView.test.js @@ -18,14 +18,14 @@ import React from 'react'; import { mount } from 'enzyme'; import { Provider } from 'react-redux'; import { storeCreator } from 'sdc-app/AppStore.js'; -import { ConnectedFilter } from 'sdc-app/onboarding//onboard//filter/Filter.jsx'; +import Filter from 'sdc-app/onboarding//onboard/filter/Filter.jsx'; describe('Filter component view Tests', () => { it('simple jsx test', () => { const store = storeCreator(); const wrapper = mount( <Provider store={store}> - <ConnectedFilter /> + <Filter /> </Provider> ); const filter = wrapper.find('.catalog-filter'); diff --git a/openecomp-ui/yarn.lock b/openecomp-ui/yarn.lock index 90765cf785..d42cdbd434 100644 --- a/openecomp-ui/yarn.lock +++ b/openecomp-ui/yarn.lock @@ -9475,9 +9475,9 @@ scss-tokenizer@^0.2.3: js-base64 "^2.1.8" source-map "^0.4.2" -sdc-ui@1.6.46: - version "1.6.46" - resolved "https://registry.yarnpkg.com/sdc-ui/-/sdc-ui-1.6.46.tgz#c9a759fd5d407774d7e805b09705353d51b869a1" +sdc-ui@1.6.53: + version "1.6.53" + resolved "https://registry.yarnpkg.com/sdc-ui/-/sdc-ui-1.6.53.tgz#acb6faba9a7d5f64702f4a19c4efbc5fae331f63" dependencies: "@angular/common" "~2.4.8" "@angular/core" "~2.4.8" |