select item from workspace- skipping versions page
Change-Id: Iebd3bb33703c2d47265ba133f7b74ec961ba8b2f
Issue-ID: SDC-864
Signed-off-by: miriame <miriam.eini@amdocs.com>
diff --git a/openecomp-ui/src/sdc-app/common/helpers/ScreensHelper.js b/openecomp-ui/src/sdc-app/common/helpers/ScreensHelper.js
index d8fa026..ecee47d 100644
--- a/openecomp-ui/src/sdc-app/common/helpers/ScreensHelper.js
+++ b/openecomp-ui/src/sdc-app/common/helpers/ScreensHelper.js
@@ -277,13 +277,13 @@
}
},
- loadLandingScreen(dispatch, {previousScreenName, props: {licenseModelId, softwareProductId, version}}) {
- const screenType = this.getScreenType(previousScreenName);
- let screen = screenType === screenTypes.SOFTWARE_PRODUCT ?
+ loadLandingScreen(dispatch, {previousScreenName, screenType, props: {licenseModelId, softwareProductId, version}}) {
+ let selectedScreenType = screenType ? screenType : this.getScreenType(previousScreenName);
+ let screen = selectedScreenType === screenTypes.SOFTWARE_PRODUCT ?
enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE :
enums.SCREEN.LICENSE_MODEL_OVERVIEW;
let props = {licenseModelId, softwareProductId, version};
- return this.loadScreen(dispatch, {screen, screenType, props});
+ return this.loadScreen(dispatch, {screen, screenType: selectedScreenType, props});
}
};
diff --git a/openecomp-ui/src/sdc-app/onboarding/OnboardingPunchOut.jsx b/openecomp-ui/src/sdc-app/onboarding/OnboardingPunchOut.jsx
index 9057120..06c95b0 100644
--- a/openecomp-ui/src/sdc-app/onboarding/OnboardingPunchOut.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/OnboardingPunchOut.jsx
@@ -19,6 +19,7 @@
import {connect} from 'react-redux';
import isEqual from 'lodash/isEqual.js';
import objectValues from 'lodash/values.js';
+import lodashUnionBy from 'lodash/unionBy.js';
import i18n from 'nfvo-utils/i18n/i18n.js';
import Application from 'sdc-app/Application.jsx';
@@ -233,8 +234,11 @@
handleData(data) {
let {breadcrumbs: {selectedKeys = []} = {}} = data;
let dispatch = action => store.dispatch(action);
- let {currentScreen, users: {usersList}, softwareProductList, licenseModelList, softwareProduct: {softwareProductEditor: {data: vspData = {}},
+ let {currentScreen, users: {usersList}, softwareProductList, finalizedSoftwareProductList, licenseModelList, finalizedLicenseModelList,
+ softwareProduct: {softwareProductEditor: {data: vspData = {}},
softwareProductComponents = {}, softwareProductQuestionnaire = {}}} = store.getState();
+ const wholeSoftwareProductList = [...softwareProductList, ...finalizedSoftwareProductList];
+ const wholeLicenseModelList = [...licenseModelList, ...finalizedLicenseModelList];
let {props: {version, isReadOnlyMode}, screen} = currentScreen;
let {componentEditor: {data: componentData = {}, qdata: componentQData = {}}} = softwareProductComponents;
@@ -269,15 +273,15 @@
} else if (selectedKeys.length === 1 || selectedKeys[1] === enums.BREADCRUMS.LICENSE_MODEL) {
let [licenseModelId, , licenseModelScreen] = selectedKeys;
- let licenseModel = licenseModelList.find(vlm => vlm.id === licenseModelId);
+ let licenseModel = wholeLicenseModelList.find(vlm => vlm.id === licenseModelId);
ScreensHelper.loadScreen(dispatch, {screen: licenseModelScreen, screenType: screenTypes.LICENSE_MODEL,
props: {licenseModelId, version, licenseModel, usersList}});
} else if (selectedKeys.length <= 4 && selectedKeys[1] === enums.BREADCRUMS.SOFTWARE_PRODUCT) {
let [licenseModelId, , softwareProductId, softwareProductScreen] = selectedKeys;
let softwareProduct = softwareProductId ?
- softwareProductList.find(({id}) => id === softwareProductId) :
- softwareProductList.find(({vendorId}) => vendorId === licenseModelId);
+ wholeSoftwareProductList.find(({id}) => id === softwareProductId) :
+ wholeSoftwareProductList.find(({vendorId}) => vendorId === licenseModelId);
if (!softwareProductId) {
softwareProductId = softwareProduct.id;
}
@@ -298,8 +302,8 @@
} else if (selectedKeys.length === 5 && selectedKeys[1] === enums.BREADCRUMS.SOFTWARE_PRODUCT && selectedKeys[3] === enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENTS) {
let [licenseModelId, , softwareProductId, , componentId] = selectedKeys;
let softwareProduct = softwareProductId ?
- softwareProductList.find(({id}) => id === softwareProductId) :
- softwareProductList.find(({vendorId}) => vendorId === licenseModelId);
+ wholeSoftwareProductList.find(({id}) => id === softwareProductId) :
+ wholeSoftwareProductList.find(({vendorId}) => vendorId === licenseModelId);
if (!softwareProductId) {
softwareProductId = softwareProduct.id;
}
@@ -309,8 +313,8 @@
} else if (selectedKeys.length === 6 && selectedKeys[1] === enums.BREADCRUMS.SOFTWARE_PRODUCT && selectedKeys[3] === enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENTS) {
let [licenseModelId, , softwareProductId, , componentId, componentScreen] = selectedKeys;
let softwareProduct = softwareProductId ?
- softwareProductList.find(({id}) => id === softwareProductId) :
- softwareProductList.find(({vendorId}) => vendorId === licenseModelId);
+ wholeSoftwareProductList.find(({id}) => id === softwareProductId) :
+ wholeSoftwareProductList.find(({vendorId}) => vendorId === licenseModelId);
if (!softwareProductId) {
softwareProductId = softwareProduct.id;
}
@@ -337,8 +341,8 @@
{versionsList: {itemType, itemId}},
softwareProduct: {softwareProductEditor: {data: currentSoftwareProduct = {onboardingMethod: ''}},
softwareProductComponents: {componentsList}}} = store.getState();
- const wholeSoftwareProductList = [...softwareProductList, ...finalizedSoftwareProductList];
- const wholeLicenseModelList = [...licenseModelList, ...finalizedLicenseModelList];
+ const wholeSoftwareProductList = lodashUnionBy(softwareProductList, finalizedSoftwareProductList, 'id');
+ const wholeLicenseModelList = lodashUnionBy(licenseModelList, finalizedLicenseModelList, 'id');
let breadcrumbsData = {itemType, itemId, currentScreen, wholeLicenseModelList, wholeSoftwareProductList, currentSoftwareProduct, componentsList};
if (currentScreen.forceBreadCrumbsUpdate || !isEqual(breadcrumbsData, this.prevBreadcrumbsData) || this.breadcrumbsPrefixSelected) {
diff --git a/openecomp-ui/src/sdc-app/onboarding/onboard/Onboard.js b/openecomp-ui/src/sdc-app/onboarding/onboard/Onboard.js
index 3422920..a308e1e 100644
--- a/openecomp-ui/src/sdc-app/onboarding/onboard/Onboard.js
+++ b/openecomp-ui/src/sdc-app/onboarding/onboard/Onboard.js
@@ -21,8 +21,6 @@
import LicenseModelCreationActionHelper from '../licenseModel/creation/LicenseModelCreationActionHelper.js';
import SoftwareProductCreationActionHelper from '../softwareProduct/creation/SoftwareProductCreationActionHelper.js';
import sortByStringProperty from 'nfvo-utils/sortByStringProperty.js';
-import ScreensHelper from 'sdc-app/common/helpers/ScreensHelper.js';
-import {enums, screenTypes} from 'sdc-app/onboarding/OnboardingConstants.js';
export const mapStateToProps = ({
@@ -91,18 +89,11 @@
const mapActionsToProps = (dispatch) => {
return {
- onSelectLicenseModel({id: licenseModelId, name}, users) {
- ScreensHelper.loadScreen(dispatch, {
- screen: enums.SCREEN.VERSIONS_PAGE, screenType: screenTypes.LICENSE_MODEL,
- props: {licenseModelId, licenseModel: {name}, usersList: users}
- });
+ onSelectLicenseModel({id: licenseModelId, name}, users, tab) {
+ OnboardActionHelper.loadVLMScreen(dispatch, {id: licenseModelId, name}, users, tab);
},
- onSelectSoftwareProduct(softwareProduct, users) {
- let {id: softwareProductId, vendorId: licenseModelId, licensingVersion, name} = softwareProduct;
- ScreensHelper.loadScreen(dispatch, {
- screen: enums.SCREEN.SOFTWARE_PRODUCT_VERSIONS_PAGE, screenType: screenTypes.SOFTWARE_PRODUCT,
- props: {softwareProductId, softwareProduct: {name, vendorId: licenseModelId, licensingVersion}, usersList: users}
- });
+ onSelectSoftwareProduct(softwareProduct, users, tab) {
+ OnboardActionHelper.loadVSPScreen(dispatch, softwareProduct, users, tab);
},
onAddSoftwareProductClick: (vendorId) => SoftwareProductCreationActionHelper.open(dispatch, vendorId),
onAddLicenseModelClick: () => LicenseModelCreationActionHelper.open(dispatch),
diff --git a/openecomp-ui/src/sdc-app/onboarding/onboard/OnboardActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/onboard/OnboardActionHelper.js
index 6ebb408..8920568 100644
--- a/openecomp-ui/src/sdc-app/onboarding/onboard/OnboardActionHelper.js
+++ b/openecomp-ui/src/sdc-app/onboarding/onboard/OnboardActionHelper.js
@@ -13,7 +13,13 @@
* or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
-import {actionTypes} from './OnboardConstants.js';
+import {tabsMapping, actionTypes} from './OnboardConstants.js';
+import ScreensHelper from 'sdc-app/common/helpers/ScreensHelper.js';
+import {enums, screenTypes} from 'sdc-app/onboarding/OnboardingConstants.js';
+import VersionsPageActionHelper from 'sdc-app/onboarding/versionsPage/VersionsPageActionHelper.js';
+import {catalogItemStatuses} from 'sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogConstants.js';
+import {itemTypes} from 'sdc-app/onboarding/versionsPage/VersionsPageConstants.js';
+import PermissionsActionHelper from 'sdc-app/onboarding/permissions/PermissionsActionHelper.js';
const OnboardActionHelper = {
resetOnboardStore(dispatch) {
@@ -39,6 +45,64 @@
type: actionTypes.CHANGE_SEARCH_VALUE,
searchValue: ''
});
+ },
+
+ loadVLMScreen(dispatch, {id: licenseModelId, name}, users, tab) {
+ if (tab === tabsMapping.WORKSPACE) {
+ VersionsPageActionHelper.fetchVersions(dispatch, {itemId: licenseModelId, itemType: itemTypes.LICENSE_MODEL}).then(({results})=> {
+ results = results.filter((version) => version.status === catalogItemStatuses.DRAFT);
+ if (results.length !== 1) {
+ ScreensHelper.loadScreen(dispatch, {
+ screen: enums.SCREEN.VERSIONS_PAGE, screenType: screenTypes.LICENSE_MODEL,
+ props: {licenseModelId, licenseModel: {name}, usersList: users}
+ });
+ }
+ else {
+ PermissionsActionHelper.fetchItemUsers(dispatch, {itemId: licenseModelId, allUsers: users}).then(() =>
+ ScreensHelper.loadLandingScreen(dispatch, {screenType: screenTypes.LICENSE_MODEL, props: {licenseModelId, version: results[0]}})
+ );
+ }
+ });
+ }
+ if (tab === tabsMapping.CATALOG) {
+ ScreensHelper.loadScreen(dispatch, {
+ screen: enums.SCREEN.VERSIONS_PAGE, screenType: screenTypes.LICENSE_MODEL,
+ props: {licenseModelId, licenseModel: {name}, usersList: users}
+ });
+ }
+ },
+ loadVSPScreen(dispatch, softwareProduct, users, tab) {
+ let {id: softwareProductId, vendorId: licenseModelId, licensingVersion, name} = softwareProduct;
+ if (tab === tabsMapping.WORKSPACE) {
+ VersionsPageActionHelper.fetchVersions(dispatch,{itemId: softwareProductId, itemType: itemTypes.SOFTWARE_PRODUCT}).then(({results})=> {
+ results = results.filter((version) => version.status === catalogItemStatuses.DRAFT);
+ if (results.length !== 1) {
+ ScreensHelper.loadScreen(dispatch, {
+ screen: enums.SCREEN.SOFTWARE_PRODUCT_VERSIONS_PAGE, screenType: screenTypes.SOFTWARE_PRODUCT,
+ props: {
+ softwareProductId,
+ softwareProduct: {name, vendorId: licenseModelId, licensingVersion},
+ usersList: users
+ }
+ });
+ }
+ else {
+ PermissionsActionHelper.fetchItemUsers(dispatch, {itemId: softwareProductId, allUsers: users}).then(() =>
+ ScreensHelper.loadLandingScreen(dispatch, {screenType: screenTypes.SOFTWARE_PRODUCT, props: {softwareProductId, licenseModelId, version: results[0]}})
+ );
+ }
+ });
+ }
+ if (tab === tabsMapping.CATALOG) {
+ ScreensHelper.loadScreen(dispatch, {
+ screen: enums.SCREEN.SOFTWARE_PRODUCT_VERSIONS_PAGE, screenType: screenTypes.SOFTWARE_PRODUCT,
+ props: {
+ softwareProductId,
+ softwareProduct: {name, vendorId: licenseModelId, licensingVersion},
+ usersList: users
+ }
+ });
+ }
}
};
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 1004472..60a5aae 100644
--- a/openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogView.jsx
@@ -19,6 +19,7 @@
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 CatalogHeaderTabs = ({onTabPress, activeTab}) => (
<div className='catalog-header-tabs'>
@@ -58,8 +59,8 @@
users={users}
onAddVLM={onAddLicenseModelClick}
onAddVSP={onAddSoftwareProductClick}
- onSelectVLM={onSelectLicenseModel}
- onSelectVSP={onSelectSoftwareProduct}
+ onSelectVLM={(item, users) => onSelectLicenseModel(item, users, WCTabsMapping.CATALOG)}
+ onSelectVSP={(item, users) => onSelectSoftwareProduct(item, users, WCTabsMapping.CATALOG)}
filter={searchValue}
onMigrate={onMigrate}/>
);
@@ -71,8 +72,8 @@
users={users}
onAddVSP={onAddSoftwareProductClick}
onAddVLM={onAddLicenseModelClick}
- onSelectVSP={onSelectSoftwareProduct}
- onSelectVLM={onSelectLicenseModel}
+ onSelectVSP={(item, users) => onSelectSoftwareProduct(item, users, WCTabsMapping.CATALOG)}
+ onSelectVLM={(item, users) => onSelectLicenseModel(item, users, WCTabsMapping.CATALOG)}
vspOverlay={vspOverlay}
onVendorSelect={onVendorSelect}
selectedVendor={selectedVendor}
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 523bbb2..a937c11 100644
--- a/openecomp-ui/src/sdc-app/onboarding/onboard/workspace/WorkspaceView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/onboard/workspace/WorkspaceView.jsx
@@ -16,6 +16,7 @@
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';
const WorkspaceView = (props) => {
let {
@@ -34,8 +35,8 @@
users={users}
onAddVLM={onAddLicenseModelClick}
onAddVSP={onAddSoftwareProductClick}
- onSelectVLM={onSelectLicenseModel}
- onSelectVSP={onSelectSoftwareProduct}
+ onSelectVLM={(item, users) => onSelectLicenseModel(item, users, tabsMapping.WORKSPACE)}
+ onSelectVSP={(item, users) => onSelectSoftwareProduct(item, users, tabsMapping.WORKSPACE)}
onMigrate={onMigrate}
filter={searchValue} />
</div>
diff --git a/openecomp-ui/src/sdc-app/onboarding/userNotifications/UserNotifications.jsx b/openecomp-ui/src/sdc-app/onboarding/userNotifications/UserNotifications.jsx
index c01424e..635dfa7 100644
--- a/openecomp-ui/src/sdc-app/onboarding/userNotifications/UserNotifications.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/userNotifications/UserNotifications.jsx
@@ -54,7 +54,7 @@
</div>
<div className='notification-action'>
<div className={classnames('action-button', {'hidden': read})} onClick={() => onActionClicked(notification)}>
- {eventType === notificationType.PERMISSION_CHANGED ? i18n('Accept') : i18n('Sync')}
+ {eventType === notificationType.PERMISSION_CHANGED ? i18n('OK') : i18n('Sync')}
</div>
</div>
</div>
@@ -128,4 +128,4 @@
}
}
-export default UserNotifications;
+export default UserNotifications;
\ No newline at end of file
diff --git a/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPageActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPageActionHelper.js
index 5286829..edf30fe 100644
--- a/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPageActionHelper.js
+++ b/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPageActionHelper.js
@@ -32,6 +32,7 @@
itemType,
itemId
});
+ return Promise.resolve(response);
});
},