diff options
author | talig <talig@amdocs.com> | 2017-12-20 14:30:43 +0200 |
---|---|---|
committer | Vitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com> | 2017-12-21 11:12:33 +0000 |
commit | 8e9c0653dd6c6862123c9609ae34e1206d86456e (patch) | |
tree | 5eeef00ec0677133baa439ca8d7ffd7aca4804b6 /openecomp-ui/src/sdc-app/onboarding/licenseModel/overview | |
parent | 785ebcc95de3e064e843bec04ba7a209d854fc7c (diff) |
Add collaboration feature
Issue-ID: SDC-767
Change-Id: I14fb4c1f54086ed03a56a7ff7fab9ecd40381795
Signed-off-by: talig <talig@amdocs.com>
Diffstat (limited to 'openecomp-ui/src/sdc-app/onboarding/licenseModel/overview')
12 files changed, 102 insertions, 70 deletions
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverview.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverview.js index 9d714ec62d..54941aaaf0 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverview.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverview.js @@ -15,12 +15,20 @@ */ import {connect} from 'react-redux'; import LicenseModelActionHelper from 'sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js'; -import VersionControllerUtils from 'nfvo-components/panel/versionController/VersionControllerUtils.js'; import LicenseModelOverviewView from './LicenseModelOverviewView.jsx'; import {overviewEditorHeaders, selectedButton} from './LicenseModelOverviewConstants.js'; import licenseModelOverviewActionHelper from './licenseModelOverviewActionHelper.js'; -export const mapStateToProps = ({licenseModel: {licenseModelEditor, entitlementPool, licenseAgreement, featureGroup, licenseKeyGroup, licenseModelOverview}}) => { +export const mapStateToProps = ({ + licenseModel: { + licenseModelEditor, + entitlementPool, + licenseAgreement, + featureGroup, + licenseKeyGroup, + licenseModelOverview + } +}) => { let modalHeader, licensingDataList; let isDisplayModal = false; @@ -128,6 +136,7 @@ export const mapStateToProps = ({licenseModel: {licenseModelEditor, entitlementP modalHeader = overviewEditorHeaders.LICENSE_KEY_GROUP; isDisplayModal = true; } + let orphanDataList = [ ...featureGroup.featureGroupsList.reduce(checkFG, []), ...entitlementPool.entitlementPoolsList.reduce(checkEP, []), @@ -140,8 +149,8 @@ export const mapStateToProps = ({licenseModel: {licenseModelEditor, entitlementP if (selectedTab === null) { selectedTab = (licensingDataList.length) ? selectedButton.VLM_LIST_VIEW : selectedButton.NOT_IN_USE; } + return { - isReadOnlyMode: VersionControllerUtils.isReadOnly(licenseModelEditor.data), isDisplayModal, modalHeader, licenseModelId: licenseModelEditor.data.id, diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewView.jsx index 77289a3e08..39109af9a3 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewView.jsx @@ -14,6 +14,7 @@ * permissions and limitations under the License. */ import React from 'react'; +import PropTypes from 'prop-types'; import i18n from 'nfvo-utils/i18n/i18n.js'; import Modal from 'nfvo-components/modal/Modal.jsx'; import classNames from 'classnames'; @@ -47,25 +48,25 @@ const setModalClassName = (modalHeader) => { class LicenseModelOverviewView extends React.Component { static propTypes = { - isDisplayModal: React.PropTypes.bool, - isReadOnlyMode: React.PropTypes.bool, - licenseModelId: React.PropTypes.string, - licensingDataList: React.PropTypes.array, - orphanDataList: React.PropTypes.array, - modalHeader: React.PropTypes.string, - selectedTab: React.PropTypes.string, - onTabSelect: React.PropTypes.func, - onCallVCAction: React.PropTypes.func, - onClose: React.PropTypes.func + isDisplayModal: PropTypes.bool, + isReadOnlyMode: PropTypes.bool, + licenseModelId: PropTypes.string, + licensingDataList: PropTypes.array, + orphanDataList: PropTypes.array, + modalHeader: PropTypes.string, + selectedTab: PropTypes.string, + onTabSelect: PropTypes.func, + onCallVCAction: PropTypes.func, + onClose: PropTypes.func }; render() { - let {isDisplayModal, modalHeader, licensingDataList, selectedTab, onTabSelect, orphanDataList} = this.props; + let {isDisplayModal, modalHeader, licensingDataList, selectedTab, onTabSelect, orphanDataList, isReadOnlyMode} = this.props; let selectedInUse = selectedTab !== selectedButton.NOT_IN_USE; let dataList = selectedInUse ? licensingDataList : orphanDataList; return( <div className='license-model-overview'> - <SummaryView/> + <SummaryView isReadOnlyMode={isReadOnlyMode}/> <div className={classNames('overview-list-section ', !selectedInUse ? 'overview-list-orphans' : '' )}> <div className='vlm-list-tab-panel'> <ListButtons onTabSelect={onTabSelect} @@ -91,16 +92,16 @@ class LicenseModelOverviewView extends React.Component { } renderModalBody(modalHeader) { - let {licenseModelId, version} = this.props; + let {licenseModelId, version, isReadOnlyMode} = this.props; switch (modalHeader) { case overviewEditorHeaders.ENTITLEMENT_POOL: - return <EntitlementPoolsEditor version={version} licenseModelId={licenseModelId} isReadOnlyMode={false}/>; + return <EntitlementPoolsEditor version={version} licenseModelId={licenseModelId} isReadOnlyMode={isReadOnlyMode}/>; case overviewEditorHeaders.LICENSE_AGREEMENT: - return <LicenseAgreementEditor version={version} licenseModelId={licenseModelId} isReadOnlyMode={false}/>; + return <LicenseAgreementEditor version={version} licenseModelId={licenseModelId} isReadOnlyMode={isReadOnlyMode}/>; case overviewEditorHeaders.FEATURE_GROUP: - return <FeatureGroupEditor version={version} licenseModelId={licenseModelId} isReadOnlyMode={false}/>; + return <FeatureGroupEditor version={version} licenseModelId={licenseModelId} isReadOnlyMode={isReadOnlyMode}/>; case overviewEditorHeaders.LICENSE_KEY_GROUP: - return <LicenseKeyGroupsEditor version={version} licenseModelId={licenseModelId} isReadOnlyMode={false}/>; + return <LicenseKeyGroupsEditor version={version} licenseModelId={licenseModelId} isReadOnlyMode={isReadOnlyMode}/>; } } } diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/SummaryView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/SummaryView.jsx index 6fcdb477e6..4053f14ced 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/SummaryView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/SummaryView.jsx @@ -13,21 +13,24 @@ * or implied. See the License for the specific language governing * permissions and limitations under the License. */ -import React from 'react'; +import React, {Component} from 'react'; import i18n from 'nfvo-utils/i18n/i18n.js'; import {default as VendorDataView} from './summary/VendorDataView.js'; import {default as SummaryCountList} from './summary/SummaryCountList.js'; -function SummaryView() { - return( - <div className='overview-top-section'> - <div className='overview-title'>{i18n('overview')}</div> - <div className='license-model-overview-top'> - <VendorDataView/> - <SummaryCountList/> +class SummaryView extends Component { + render() { + const {isReadOnlyMode} = this.props; + return( + <div className='overview-top-section'> + <div className='page-title'>{i18n('overview')}</div> + <div className='license-model-overview-top'> + <VendorDataView isReadOnlyMode={isReadOnlyMode}/> + <SummaryCountList isReadOnlyMode={isReadOnlyMode}/> + </div> </div> - </div> - ); + ); + } } export default SummaryView; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/VLMListView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/VLMListView.jsx index ec05e37681..012bd6e158 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/VLMListView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/VLMListView.jsx @@ -14,6 +14,7 @@ * permissions and limitations under the License. */ import React, {Component} from 'react'; +import PropTypes from 'prop-types'; import {Collapse} from 'react-bootstrap'; import LicenseAgreement from './listItems/LicenseAgreement.jsx'; import EntitlementPool from './listItems/EntitlementPool.jsx'; @@ -24,8 +25,8 @@ import {overviewEditorHeaders} from './LicenseModelOverviewConstants.js'; class VLMListView extends Component { static propTypes = { - licensingDataList: React.PropTypes.array, - showInUse: React.PropTypes.bool + licensingDataList: PropTypes.array, + showInUse: PropTypes.bool }; state = { diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/listItemsComponents/AdditionalDataCol.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/listItemsComponents/AdditionalDataCol.jsx index 5b5daafb4f..ffc0991354 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/listItemsComponents/AdditionalDataCol.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/listItemsComponents/AdditionalDataCol.jsx @@ -14,6 +14,7 @@ * permissions and limitations under the License. */ import React from 'react'; +import PropTypes from 'prop-types'; function AdditionalDataCol({children}) { return ( @@ -27,9 +28,9 @@ function AdditionalDataCol({children}) { } AdditionalDataCol.propTypes = { - children: React.PropTypes.oneOfType([ - React.PropTypes.arrayOf(React.PropTypes.node), - React.PropTypes.node + children: PropTypes.oneOfType([ + PropTypes.arrayOf(PropTypes.node), + PropTypes.node ]) }; @@ -43,9 +44,9 @@ function AdditionalDataElement({className, name, value}) { } AdditionalDataElement.propTypes = { - name: React.PropTypes.string, - value: React.PropTypes.string, - className: React.PropTypes.string + name: PropTypes.string, + value: PropTypes.string, + className: PropTypes.string }; export {AdditionalDataCol, AdditionalDataElement}; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/listItemsComponents/ArrowCol.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/listItemsComponents/ArrowCol.jsx index a5eb9d27dd..29aec64bdd 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/listItemsComponents/ArrowCol.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/listItemsComponents/ArrowCol.jsx @@ -14,6 +14,7 @@ * permissions and limitations under the License. */ import React from 'react'; +import PropTypes from 'prop-types'; import classNames from 'classnames'; function ArrowCol ({isCollapsed, length}) { @@ -28,8 +29,8 @@ function ArrowCol ({isCollapsed, length}) { } ArrowCol.propTypes = { - isCollapsed: React.PropTypes.bool, - length: React.PropTypes.number + isCollapsed: PropTypes.bool, + length: PropTypes.number }; export default ArrowCol; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/listItemsComponents/ItemInfo.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/listItemsComponents/ItemInfo.jsx index 655a0dd4a8..95ae123974 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/listItemsComponents/ItemInfo.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/listItemsComponents/ItemInfo.jsx @@ -14,6 +14,7 @@ * permissions and limitations under the License. */ import React from 'react'; +import PropTypes from 'prop-types'; function ItemInfo({name, description, children}) { return ( @@ -28,11 +29,11 @@ function ItemInfo({name, description, children}) { } ItemInfo.propTypes = { - name: React.PropTypes.string, - description: React.PropTypes.string, - children: React.PropTypes.oneOfType([ - React.PropTypes.arrayOf(React.PropTypes.node), - React.PropTypes.node + name: PropTypes.string, + description: PropTypes.string, + children: PropTypes.oneOfType([ + PropTypes.arrayOf(PropTypes.node), + PropTypes.node ]) }; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/LicenseModelDescriptionEdit.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/LicenseModelDescriptionEdit.jsx index f4d6d4d42c..af759f1206 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/LicenseModelDescriptionEdit.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/LicenseModelDescriptionEdit.jsx @@ -14,22 +14,23 @@ * permissions and limitations under the License. */ import React from 'react'; -import Input from 'nfvo-components/input/validation/Input.jsx'; import i18n from 'nfvo-utils/i18n/i18n.js'; +import Input from 'nfvo-components/input/validation/Input.jsx'; class LicenseModelDescriptionEdit extends React.Component { render() { //TODO check if buttons let {onDataChanged, description, genericFieldInfo} = this.props; - let saveButtonClassName = (genericFieldInfo.description.isValid) ? 'description-save' : 'description-save disabled'; + let {isValid, errorText} = genericFieldInfo.description; + let saveButtonClassName = isValid ? 'description-save' : 'description-save disabled'; return( <div className='vendor-description-edit'> <Input onChange={description => onDataChanged({description})} value={description} - isValid={genericFieldInfo.description.isValid} - errorText={genericFieldInfo.description.errorText} + isValid={isValid} + errorText={errorText} className='description-edit-textarea' type='textarea'/> <div className='buttons-row'> @@ -50,7 +51,7 @@ class LicenseModelDescriptionEdit extends React.Component { let {onSubmit, data, description} = this.props; onSubmit({ ...data, - description: description + description: description.trim() }); } } diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/ListButtons.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/ListButtons.jsx index f02c82d205..3fcac3c1d8 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/ListButtons.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/ListButtons.jsx @@ -14,6 +14,7 @@ * permissions and limitations under the License. */ import React from 'react'; +import PropTypes from 'prop-types'; import {selectedButton} from '../LicenseModelOverviewConstants.js'; import Tabs from 'sdc-ui/lib/react/Tabs.js'; import Tab from 'sdc-ui/lib/react/Tab.js'; @@ -43,8 +44,8 @@ function ListButtons ({onTabSelect, selectedTab, hasOrphans, hasLicensing}) { } ListButtons.propTypes = { - onTabSelect: React.PropTypes.func, - selectedInUse: React.PropTypes.bool + onTabSelect: PropTypes.func, + selectedInUse: PropTypes.bool }; export default ListButtons; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/SummaryCountItem.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/SummaryCountItem.jsx index 6ec84e16ca..50c547e042 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/SummaryCountItem.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/SummaryCountItem.jsx @@ -24,7 +24,8 @@ function SummaryCountItem ({name, counter, onAdd, onNavigate, isReadOnlyMode}) <span className='item-name' onClick={onNavigate}>{name}</span> <span className='item-count' onClick={onNavigate} data-test-id={'vlm-summary-vendor-counter-' + name.toLowerCase().replace(/\s/g,'-')}>({counter})</span> </div> - <SVGIcon name='plusCircle' disabled={isReadOnlyMode} color='secondary' onClick={onAdd} data-test-id={'vlm-summary-vendor-add-btn-' + name.toLowerCase().replace(/\s/g,'-')}/> + <SVGIcon name='plusCircle' disabled={isReadOnlyMode} className={isReadOnlyMode ? 'disabled' : ''} + color='secondary' onClick={onAdd} data-test-id={'vlm-summary-vendor-add-btn-' + name.toLowerCase().replace(/\s/g,'-')}/> </div> ); } diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/SummaryCountList.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/SummaryCountList.js index c69a092d23..15b6649543 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/SummaryCountList.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/SummaryCountList.js @@ -16,9 +16,9 @@ import React from 'react'; import {connect} from 'react-redux'; -import VersionControllerUtils from 'nfvo-components/panel/versionController/VersionControllerUtils.js'; +import ScreensHelper from 'sdc-app/common/helpers/ScreensHelper.js'; +import {enums, screenTypes} from 'sdc-app/onboarding/OnboardingConstants.js'; -import OnboardingActionHelper from '../../../OnboardingActionHelper.js'; import EntitlementPoolsActionHelper from '../../entitlementPools/EntitlementPoolsActionHelper.js'; import LicenseAgreementActionHelper from '../../licenseAgreement/LicenseAgreementActionHelper.js'; import LicenseKeyGroupsActionHelper from '../../licenseKeyGroups/LicenseKeyGroupsActionHelper.js'; @@ -27,27 +27,32 @@ import FeatureGroupsActionHelper from '../../featureGroups/FeatureGroupsActionHe import {overviewItems} from '../LicenseModelOverviewConstants.js'; import SummaryCountItem from './SummaryCountItem.jsx'; -export const mapStateToProps = ({licenseModel: {licenseModelEditor, licenseAgreement: {licenseAgreementList}, - featureGroup: {featureGroupsList}, entitlementPool: {entitlementPoolsList}, licenseKeyGroup: {licenseKeyGroupsList}}}) => { +export const mapStateToProps = ({ + licenseModel: { + licenseModelEditor, + licenseAgreement: {licenseAgreementList}, + featureGroup: {featureGroupsList}, + entitlementPool: {entitlementPoolsList}, + licenseKeyGroup: {licenseKeyGroupsList} + } +}) => { let {vendorName, description, id, version} = licenseModelEditor.data; - - let isReadOnlyMode = VersionControllerUtils.isReadOnly(licenseModelEditor.data); - let counts = [ {name: overviewItems.LICENSE_AGREEMENTS, count: licenseAgreementList.length}, {name: overviewItems.FEATURE_GROUPS, count: featureGroupsList.length}, {name: overviewItems.ENTITLEMENT_POOLS, count: entitlementPoolsList.length}, {name: overviewItems.LICENSE_KEY_GROUPS, count: licenseKeyGroupsList.length}, ]; + return { vendorName, licenseModelId: id, description, counts, - isReadOnlyMode, version }; + }; const mapActionsToProps = (dispatch) => { @@ -71,22 +76,27 @@ const mapActionsToProps = (dispatch) => { } }, onNavigateClick: ({name, licenseModelId, version}) => { + let screenToNavigate; switch (name) { case overviewItems.ENTITLEMENT_POOLS: - OnboardingActionHelper.navigateToEntitlementPools(dispatch, {licenseModelId, version}); + screenToNavigate = enums.SCREEN.ENTITLEMENT_POOLS; break; case overviewItems.FEATURE_GROUPS: - OnboardingActionHelper.navigateToFeatureGroups(dispatch, {licenseModelId, version}); + screenToNavigate = enums.SCREEN.FEATURE_GROUPS; break; case overviewItems.LICENSE_AGREEMENTS: - OnboardingActionHelper.navigateToLicenseAgreements(dispatch, {licenseModelId, version}); + screenToNavigate = enums.SCREEN.LICENSE_AGREEMENTS; break; case overviewItems.LICENSE_KEY_GROUPS: - OnboardingActionHelper.navigateToLicenseKeyGroups(dispatch, {licenseModelId, version}); + screenToNavigate = enums.SCREEN.LICENSE_KEY_GROUPS; break; default: break; } + ScreensHelper.loadScreen(dispatch, { + screen: screenToNavigate, screenType: screenTypes.LICENSE_MODEL, + props: {licenseModelId, version} + }); } }; }; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/VendorDataView.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/VendorDataView.js index 532ca32f8e..616355de41 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/VendorDataView.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/VendorDataView.js @@ -23,17 +23,19 @@ import ValidationHelper from 'sdc-app/common/helpers/ValidationHelper.js'; import licenseModelOverviewActionHelper from '../licenseModelOverviewActionHelper.js'; import LicenseModelActionHelper from '../../LicenseModelActionHelper.js'; import LicenseModelDescriptionEdit from './LicenseModelDescriptionEdit.jsx'; -import VersionControllerUtils from 'nfvo-components/panel/versionController/VersionControllerUtils.js'; import {VLM_DESCRIPTION_FORM} from '../LicenseModelOverviewConstants.js'; -export const mapStateToProps = ({licenseModel: {licenseModelEditor: {data}, licenseModelOverview: {descriptionEditor: {data: descriptionData = {}, genericFieldInfo} }}}) => { +export const mapStateToProps = ({ + licenseModel: { + licenseModelEditor: {data}, + licenseModelOverview: {descriptionEditor: {data: descriptionData = {}, genericFieldInfo}} + } +}) => { let {description} = descriptionData; - let isReadOnlyMode = VersionControllerUtils.isReadOnly(data); return { data, description, - genericFieldInfo, - isReadOnlyMode + genericFieldInfo }; }; |