From e6dde695296417375ca9f3868126f3307ed278af Mon Sep 17 00:00:00 2001 From: mahesh Date: Tue, 22 Sep 2015 14:28:54 +0530 Subject: [PATCH 1/2] fixing APPFAC-3446 --- .../src/site/blocks/application/add/ajax/add.jag | 14 +++++++------- .../default/templates/application/get/js/get.js | 2 +- .../default/templates/application/get/template.jag | 5 ++++- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/modules/jaggery-apps/appmgt/src/site/blocks/application/add/ajax/add.jag b/modules/jaggery-apps/appmgt/src/site/blocks/application/add/ajax/add.jag index 7a686aa71..13e81b18a 100755 --- a/modules/jaggery-apps/appmgt/src/site/blocks/application/add/ajax/add.jag +++ b/modules/jaggery-apps/appmgt/src/site/blocks/application/add/ajax/add.jag @@ -43,12 +43,10 @@ var log=new Log(); var applicationDescription = replaceSpecialCharacters(request.getParameter("applicationDescription")); var applicationType = request.getParameter("appType"); var repositoryType = request.getParameter("repositoryType"); - log.info(repositoryType) - var repoAccessibility = request.getParameter("repoAccessibility"); + var repoAccessibility = request.getParameter("repoAccessibility"); var userName = request.getParameter("userName"); var applicationURL = request.getParameter("applicationURL"); var appTypeDisplayName1 = request.getParameter("appTypeDisplayName"); - log.info("applicationType + " + applicationType); var response = {}; if (jagg.module("permission").isUserAccessGrantedForPlatform(PERMISSION_APPLICATION_CREATE)) { try { @@ -64,15 +62,12 @@ var log=new Log(); // is created. if(!isApplicationDuplicateWithSession(applicationKey,applicationName, repositoryType, applicationDescription, applicationType, userName,appTypeDisplayName)){ - log.info("inside if 1") for (var provider in repositoryProviders) { if (repositoryType == repositoryProviders[provider]) { - log.info("repositoryType if 2") result = mod.createApplicationBPEL(applicationName, applicationKey, applicationDescription, applicationType, repoAccessibility, repositoryType, userName, applicationURL, 'trunk', LIFE_CYCLE_NAME); - log.info(result) message = "Application was created under Repository type ".concat(repositoryType); response.message = message; response.result = 1; @@ -85,7 +80,8 @@ var log=new Log(); response.message = message; response.result = 0; } - + // this session parameter is to , show the application creation started message only once + session.put("appCreationStartedFlag_" + applicationKey, true); print(response); } catch (e) { @@ -126,6 +122,8 @@ var log=new Log(); log.error(e); status = generateValidationResponse(false, msg); } + // this session parameter is to , show the application creation started message only once + session.put("appCreationStartedFlag_" + applicationKey, true); print(status); } else if (action == "uploadExistingApplication") { var registryMod = jagg.module("registry"); @@ -190,6 +188,8 @@ var log=new Log(); response.message = "You don't have permission to create application"; response.result = 0; } + // this session parameter is to , show the application creation started message only once + session.put("appCreationStartedFlag_" + applicationKey, true); print(response); } catch (e) { diff --git a/modules/jaggery-apps/appmgt/src/site/themes/default/templates/application/get/js/get.js b/modules/jaggery-apps/appmgt/src/site/themes/default/templates/application/get/js/get.js index f73a08c3c..a7344ec2c 100755 --- a/modules/jaggery-apps/appmgt/src/site/themes/default/templates/application/get/js/get.js +++ b/modules/jaggery-apps/appmgt/src/site/themes/default/templates/application/get/js/get.js @@ -14,7 +14,7 @@ var popoverAdded = false; // page initialization $(document).ready(function() { // show the application creation status as a notification - if("created" == userAction) { + if(appCreationStartedFlag) { showTopMessage("Application creation started."); } // set current version diff --git a/modules/jaggery-apps/appmgt/src/site/themes/default/templates/application/get/template.jag b/modules/jaggery-apps/appmgt/src/site/themes/default/templates/application/get/template.jag index 373c274d0..4d5dee24f 100755 --- a/modules/jaggery-apps/appmgt/src/site/themes/default/templates/application/get/template.jag +++ b/modules/jaggery-apps/appmgt/src/site/themes/default/templates/application/get/template.jag @@ -10,7 +10,8 @@ var servicePath = appFacURL + getProperty(WEB_CONTEXT_ROOT); var iconUrl = appFacURL + getProperty(WEB_CONTEXT_ROOT) + "/site/blocks/application/get/ajax/list.jag?action=getAppIcon&applicationKey=" + applicationKey; var applicationInfo = outputs.applicationInfo; - + var appCreationStartedFlag = session.get("appCreationStartedFlag_" + applicationKey); + session.remove("appCreationStartedFlag_" + applicationKey); var appName = ""; if(applicationInfo){ if (applicationInfo.name) { @@ -57,6 +58,8 @@ var fgdmAllowedStage = JSON.parse('<%=stringify(outputs.fineGrainedDomainMappingAllowedStage)%>'); var previousVersion = "<%=previousVersion%>"; var lifeCycleName = "<%=LIFE_CYCLE_NAME%>"; + var appCreationStartedFlag = "<%=appCreationStartedFlag%>"; + appCreationStartedFlag = JSON.parse(appCreationStartedFlag); From b8757e5b07afc75c8aab16bac8e8aa5b80f1f1ca Mon Sep 17 00:00:00 2001 From: mahesh Date: Tue, 22 Sep 2015 14:41:20 +0530 Subject: [PATCH 2/2] moving application creation started flag to constants.jag --- modules/jaggery-apps/appmgt/src/jagg/constants.jag | 3 +++ .../appmgt/src/site/blocks/application/add/ajax/add.jag | 6 +++--- .../themes/default/templates/application/get/template.jag | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/jaggery-apps/appmgt/src/jagg/constants.jag b/modules/jaggery-apps/appmgt/src/jagg/constants.jag index 4d50fab7d..9a89ad789 100755 --- a/modules/jaggery-apps/appmgt/src/jagg/constants.jag +++ b/modules/jaggery-apps/appmgt/src/jagg/constants.jag @@ -265,6 +265,9 @@ var MUTUALSSL_HEADER_USERNAME_URL = "http://mutualssl.carbon.wso2.org"; var CLOUD_HEADER_USERNAME_URL = "http://cloud.carbon.wso2.org/username"; var CLOUD_HEADER_SECRET_URL = "http://cloud.carbon.wso2.org/secret"; +//for application creation started message + +var APPLICATION_CREATION_STARTED_FLAG = "appCreationStartedFlag_"; var PAGES={ APP_HOME : "APP_HOME", USER_HOME : "USER_HOME", diff --git a/modules/jaggery-apps/appmgt/src/site/blocks/application/add/ajax/add.jag b/modules/jaggery-apps/appmgt/src/site/blocks/application/add/ajax/add.jag index 13e81b18a..aaa04ad53 100755 --- a/modules/jaggery-apps/appmgt/src/site/blocks/application/add/ajax/add.jag +++ b/modules/jaggery-apps/appmgt/src/site/blocks/application/add/ajax/add.jag @@ -81,7 +81,7 @@ var log=new Log(); response.result = 0; } // this session parameter is to , show the application creation started message only once - session.put("appCreationStartedFlag_" + applicationKey, true); + session.put(APPLICATION_CREATION_STARTED_FLAG + applicationKey, true); print(response); } catch (e) { @@ -123,7 +123,7 @@ var log=new Log(); status = generateValidationResponse(false, msg); } // this session parameter is to , show the application creation started message only once - session.put("appCreationStartedFlag_" + applicationKey, true); + session.put(APPLICATION_CREATION_STARTED_FLAG + applicationKey, true); print(status); } else if (action == "uploadExistingApplication") { var registryMod = jagg.module("registry"); @@ -189,7 +189,7 @@ var log=new Log(); response.result = 0; } // this session parameter is to , show the application creation started message only once - session.put("appCreationStartedFlag_" + applicationKey, true); + session.put(APPLICATION_CREATION_STARTED_FLAG + applicationKey, true); print(response); } catch (e) { diff --git a/modules/jaggery-apps/appmgt/src/site/themes/default/templates/application/get/template.jag b/modules/jaggery-apps/appmgt/src/site/themes/default/templates/application/get/template.jag index 4d5dee24f..9fe0636aa 100755 --- a/modules/jaggery-apps/appmgt/src/site/themes/default/templates/application/get/template.jag +++ b/modules/jaggery-apps/appmgt/src/site/themes/default/templates/application/get/template.jag @@ -10,8 +10,8 @@ var servicePath = appFacURL + getProperty(WEB_CONTEXT_ROOT); var iconUrl = appFacURL + getProperty(WEB_CONTEXT_ROOT) + "/site/blocks/application/get/ajax/list.jag?action=getAppIcon&applicationKey=" + applicationKey; var applicationInfo = outputs.applicationInfo; - var appCreationStartedFlag = session.get("appCreationStartedFlag_" + applicationKey); - session.remove("appCreationStartedFlag_" + applicationKey); + var appCreationStartedFlag = session.get(APPLICATION_CREATION_STARTED_FLAG + applicationKey); + session.remove(APPLICATION_CREATION_STARTED_FLAG + applicationKey); var appName = ""; if(applicationInfo){ if (applicationInfo.name) {