summaryrefslogtreecommitdiffstats
path: root/openecomp-ui/src/sdc-app/onboarding/onboard/OnboardActionHelper.js
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-ui/src/sdc-app/onboarding/onboard/OnboardActionHelper.js')
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/onboard/OnboardActionHelper.js219
1 files changed, 134 insertions, 85 deletions
diff --git a/openecomp-ui/src/sdc-app/onboarding/onboard/OnboardActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/onboard/OnboardActionHelper.js
index 892056855f..87ec2d148e 100644
--- a/openecomp-ui/src/sdc-app/onboarding/onboard/OnboardActionHelper.js
+++ b/openecomp-ui/src/sdc-app/onboarding/onboard/OnboardActionHelper.js
@@ -13,97 +13,146 @@
* or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
-import {tabsMapping, 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 { 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 { 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) {
- dispatch({
- type: actionTypes.RESET_ONBOARD_STORE
- });
- },
- changeActiveTab(dispatch, activeTab) {
- this.clearSearchValue(dispatch);
- dispatch({
- type: actionTypes.CHANGE_ACTIVE_ONBOARD_TAB,
- activeTab
- });
- },
- changeSearchValue(dispatch, searchValue) {
- dispatch({
- type: actionTypes.CHANGE_SEARCH_VALUE,
- searchValue
- });
- },
- clearSearchValue(dispatch) {
- dispatch({
- type: actionTypes.CHANGE_SEARCH_VALUE,
- searchValue: ''
- });
- },
+ resetOnboardStore(dispatch) {
+ dispatch({
+ type: actionTypes.RESET_ONBOARD_STORE
+ });
+ },
+ changeActiveTab(dispatch, activeTab) {
+ this.clearSearchValue(dispatch);
+ dispatch({
+ type: actionTypes.CHANGE_ACTIVE_ONBOARD_TAB,
+ activeTab
+ });
+ },
+ changeSearchValue(dispatch, searchValue) {
+ dispatch({
+ type: actionTypes.CHANGE_SEARCH_VALUE,
+ searchValue
+ });
+ },
+ clearSearchValue(dispatch) {
+ dispatch({
+ 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
- }
- });
- }
- }
+ 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
+ }
+ });
+ }
+ }
};
export default OnboardActionHelper;