From 5e2bb857ed1a804259ac0a27fac1cdcd041442ab Mon Sep 17 00:00:00 2001 From: Luji7 Date: Wed, 2 Nov 2016 14:57:22 +0800 Subject: Issue-Id: GSO-88 Fix js error and add i18n support Change-Id: I6868341308222bf56ff1f4037115725fe8f3885e Signed-off-by: Luji7 --- .../src/main/webapp/lifecyclemgr/gsolcmmain.html | 1 + .../src/main/webapp/lifecyclemgr/js/gsolcm.js | 24 +++++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/gsolcmmain.html b/openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/gsolcmmain.html index a2828b7d..121c7ddb 100644 --- a/openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/gsolcmmain.html +++ b/openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/gsolcmmain.html @@ -30,6 +30,7 @@ + diff --git a/openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/gsolcm.js b/openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/gsolcm.js index 907f4821..7173f644 100644 --- a/openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/gsolcm.js +++ b/openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/gsolcm.js @@ -21,6 +21,12 @@ var templateParameters = { var lcmHandler = function () { this._addOwnEvents(); + jQuery.i18n.properties({ + language:'en-US', + name:'lcm-template-parameters-i18n', + path:'i18n/', + mode:'map' + }); }; lcmHandler.prototype = { @@ -454,15 +460,23 @@ function transformToOptions(items) { function generateComponent(inputPara) { var component = '
' + '' + '
' + '' + + showName(inputPara) + '" value="' + inputPara.value + '" />' + '
'; return component; } +function showName(inputPara) { + var name = $.i18n.prop(inputPara.name) + if(name.length === 0 || name.slice(0, 1) === '[') { + name = inputPara.showName; + } + return name; +} + function generateRequiredLabel(parameter) { var requiredLabel = ''; if (parameter.required === 'true') { @@ -602,7 +616,7 @@ function createServiceInstance(gatewayService, lcmUri, serviceInstance) { status: responseDesc.status, statusDescription: responseDesc.statusDescription, errorCode: responseDesc.errorCode - }}}); + }}); } } ); @@ -729,7 +743,7 @@ function deleteNonGsoServiceInstance(gatewayService, lcmUri, instanceId, remove, } } ).fail(function() { - failFun({status: "fail", statusDescription: "delete service failed.", errorCode: "500"}}); + failFun({status: "fail", statusDescription: "delete service failed.", errorCode: "500"}); }); } else { failFun(responseDesc); @@ -738,7 +752,7 @@ function deleteNonGsoServiceInstance(gatewayService, lcmUri, instanceId, remove, ); } ).fail(function() { - failFun({status: "fail", statusDescription: "delete service failed.", errorCode: "500"}}); + failFun({status: "fail", statusDescription: "delete service failed.", errorCode: "500"}); }); } -- cgit 1.2.3-korg