Add collaboration feature

Issue-ID: SDC-767
Change-Id: I14fb4c1f54086ed03a56a7ff7fab9ecd40381795
Signed-off-by: talig <talig@amdocs.com>
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementActionHelper.js
index e9d922c..b4f03a6 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementActionHelper.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementActionHelper.js
@@ -17,7 +17,7 @@
 import Configuration from 'sdc-app/config/Configuration.js';
 import {actionTypes as licenseAgreementActionTypes} from './LicenseAgreementConstants.js';
 import FeatureGroupsActionHelper from 'sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsActionHelper.js';
-import LicenseModelActionHelper from 'sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js';
+import ItemsHelper from 'sdc-app/common/helpers/ItemsHelper.js';
 
 function baseUrl(licenseModelId, version) {
 	const restPrefix = Configuration.get('restPrefix');
@@ -29,6 +29,10 @@
 	return RestAPIUtil.fetch(`${baseUrl(licenseModelId, version)}`);
 }
 
+function fetchLicenseAgreement(licenseModelId, licenseAgreementId, version) {
+	return RestAPIUtil.fetch(`${baseUrl(licenseModelId, version)}/${licenseAgreementId}`);
+}
+
 function postLicenseAgreement(licenseModelId, licenseAgreement, version) {
 	return RestAPIUtil.post(baseUrl(licenseModelId, version), {
 		name: licenseAgreement.name,
@@ -65,6 +69,10 @@
 		}));
 	},
 
+	fetchLicenseAgreement(dispatch, {licenseModelId, licenseAgreementId, version}) {
+		return fetchLicenseAgreement(licenseModelId, licenseAgreementId, version);
+	},
+
 	openLicenseAgreementEditor(dispatch, {licenseModelId, licenseAgreement, version}) {
 		FeatureGroupsActionHelper.fetchFeatureGroupsList(dispatch, {licenseModelId, version});
 		dispatch({
@@ -84,12 +92,14 @@
 		if (previousLicenseAgreement) {
 			return putLicenseAgreement(licenseModelId, previousLicenseAgreement, licenseAgreement, version).then(() => {
 				this.fetchLicenseAgreementList(dispatch, {licenseModelId, version});
+				ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id});
 			});
 		}
 		else {
 			return postLicenseAgreement(licenseModelId, licenseAgreement, version).then(() => {
 				this.fetchLicenseAgreementList(dispatch, {licenseModelId, version});
 				FeatureGroupsActionHelper.fetchFeatureGroupsList(dispatch, {licenseModelId, version});
+				ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id});
 			});
 		}
 	},
@@ -100,6 +110,7 @@
 				type: licenseAgreementActionTypes.DELETE_LICENSE_AGREEMENT,
 				licenseAgreementId
 			});
+			ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id});
 		});
 	},
 
@@ -108,11 +119,5 @@
 			type: licenseAgreementActionTypes.licenseAgreementEditor.SELECT_TAB,
 			tab
 		});
-	},
-
-	switchVersion(dispatch, {licenseModelId, version}) {
-		LicenseModelActionHelper.fetchLicenseModelById(dispatch, {licenseModelId, version}).then(() => {
-			this.fetchLicenseAgreementList(dispatch, {licenseModelId, version});
-		});
 	}
 };