summaryrefslogtreecommitdiffstats
path: root/openecomp-ui/src/sdc-app/onboarding/versionsPage/creation/VersionsPageCreationActionHelper.js
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-ui/src/sdc-app/onboarding/versionsPage/creation/VersionsPageCreationActionHelper.js')
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/versionsPage/creation/VersionsPageCreationActionHelper.js109
1 files changed, 60 insertions, 49 deletions
diff --git a/openecomp-ui/src/sdc-app/onboarding/versionsPage/creation/VersionsPageCreationActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/versionsPage/creation/VersionsPageCreationActionHelper.js
index bc038689a4..6e3be705c0 100644
--- a/openecomp-ui/src/sdc-app/onboarding/versionsPage/creation/VersionsPageCreationActionHelper.js
+++ b/openecomp-ui/src/sdc-app/onboarding/versionsPage/creation/VersionsPageCreationActionHelper.js
@@ -15,65 +15,76 @@
*/
import RestAPIUtil from 'nfvo-utils/RestAPIUtil.js';
import Configuration from 'sdc-app/config/Configuration.js';
-import {actionTypes} from './VersionsPageCreationConstants.js';
-import {modalContentMapper} from 'sdc-app/common/modal/ModalContentMapper.js';
-import {actionTypes as modalActionTypes} from 'nfvo-components/modal/GlobalModalConstants.js';
+import { actionTypes } from './VersionsPageCreationConstants.js';
+import { modalContentMapper } from 'sdc-app/common/modal/ModalContentMapper.js';
+import { actionTypes as modalActionTypes } from 'nfvo-components/modal/GlobalModalConstants.js';
import i18n from 'nfvo-utils/i18n/i18n.js';
import ItemsHelper from 'sdc-app/common/helpers/ItemsHelper.js';
-import {actionTypes as VersionsPageActionTypes} from '../VersionsPageConstants.js';
+import { actionTypes as VersionsPageActionTypes } from '../VersionsPageConstants.js';
-function baseUrl({itemId, baseVersion}) {
- const restPrefix = Configuration.get('restPrefix');
- return `${restPrefix}/v1.0/items/${itemId}/versions/${baseVersion.id}/`;
+function baseUrl({ itemId, baseVersion }) {
+ const restPrefix = Configuration.get('restPrefix');
+ return `${restPrefix}/v1.0/items/${itemId}/versions/${baseVersion.id}/`;
}
-function createVersion({itemId, baseVersion, payload: {description, creationMethod} }) {
- return RestAPIUtil.post(baseUrl({itemId, baseVersion}), {description, creationMethod});
+function createVersion({
+ itemId,
+ baseVersion,
+ payload: { description, creationMethod }
+}) {
+ return RestAPIUtil.post(baseUrl({ itemId, baseVersion }), {
+ description,
+ creationMethod
+ });
}
-
export default {
+ open(dispatch, { itemType, itemId, additionalProps, baseVersion }) {
+ dispatch({
+ type: actionTypes.OPEN
+ });
- open(dispatch, {itemType, itemId, additionalProps, baseVersion}) {
- dispatch({
- type: actionTypes.OPEN
- });
-
- dispatch({
- type: modalActionTypes.GLOBAL_MODAL_SHOW,
- data: {
- modalComponentName: modalContentMapper.VERSION_CREATION,
- modalComponentProps: {itemType, itemId, additionalProps, baseVersion},
- title: i18n('New Version - From {name}', {name: baseVersion.name})
- }
- });
- },
-
- close(dispatch){
- dispatch({
- type: actionTypes.CLOSE
- });
+ dispatch({
+ type: modalActionTypes.GLOBAL_MODAL_SHOW,
+ data: {
+ modalComponentName: modalContentMapper.VERSION_CREATION,
+ modalComponentProps: {
+ itemType,
+ itemId,
+ additionalProps,
+ baseVersion
+ },
+ title: i18n('New Version - From {name}', {
+ name: baseVersion.name
+ })
+ }
+ });
+ },
- dispatch({
- type: modalActionTypes.GLOBAL_MODAL_CLOSE
- });
- },
+ close(dispatch) {
+ dispatch({
+ type: actionTypes.CLOSE
+ });
- createVersion(dispatch, {itemId, baseVersion, payload}){
- return createVersion({itemId, baseVersion, payload}).then(result => {
- return ItemsHelper.fetchVersions({itemId}).then(response => {
- dispatch({
- type: VersionsPageActionTypes.VERSIONS_LOADED,
- versions: response.results,
- itemId
- });
- dispatch({
- type: actionTypes.VERSION_CREATED,
- result
- });
- return result;
- });
- });
- }
+ dispatch({
+ type: modalActionTypes.GLOBAL_MODAL_CLOSE
+ });
+ },
+ createVersion(dispatch, { itemId, baseVersion, payload }) {
+ return createVersion({ itemId, baseVersion, payload }).then(result => {
+ return ItemsHelper.fetchVersions({ itemId }).then(response => {
+ dispatch({
+ type: VersionsPageActionTypes.VERSIONS_LOADED,
+ versions: response.results,
+ itemId
+ });
+ dispatch({
+ type: actionTypes.VERSION_CREATED,
+ result
+ });
+ return result;
+ });
+ });
+ }
};