diff options
author | Luji7 <lu.ji3@zte.com.cn> | 2016-11-02 14:57:22 +0800 |
---|---|---|
committer | Luji7 <lu.ji3@zte.com.cn> | 2016-11-02 14:57:22 +0800 |
commit | 5e2bb857ed1a804259ac0a27fac1cdcd041442ab (patch) | |
tree | eb79ab269f7ca31a63e08e55879ae6dba822af14 | |
parent | 1bed6b22733ff18a0ff7b9a78b91f0eabd7062b9 (diff) |
Issue-Id: GSO-88 Fix js error and add i18n support
Change-Id: I6868341308222bf56ff1f4037115725fe8f3885e
Signed-off-by: Luji7 <lu.ji3@zte.com.cn>
-rw-r--r-- | openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/gsolcmmain.html | 1 | ||||
-rw-r--r-- | openo-portal/portal-lifecyclemgr/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 @@ <script type="text/javascript" src="js/bootstrap-table.min.js"></script>
<script type="text/javascript" src="js/gsolcm.js"></script>
<script type="text/javascript" src="../common/thirdparty/bootbox/bootbox.min.js"></script>
+ <script type="text/javascript" src="../common/thirdparty/jquery.i18n/jquery.i18n.properties-1.0.9.js"></script>
<script type="text/javascript" src="js/jquery.bootstrap-growl.min.js"></script>
<script type="text/javascript" src="js/jquery.isloading.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.12.1.min.js"></script>
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 = '<div class="mT15 form-group" style="margin-left:25px;">' + '<label class="col-sm-3 control-label">' + - '<span>' + inputPara.showName + '</span>' + generateRequiredLabel(inputPara) + + '<span>' + showName(inputPara) + '</span>' + generateRequiredLabel(inputPara) + '</label>' + '<div class="col-sm-7">' + '<input type="text" id="' + inputPara.id + '" name="parameter description" class="form-control" placeholder="' + - inputPara.showName + '" value="' + inputPara.value + '" />' + + showName(inputPara) + '" value="' + inputPara.value + '" />' + '</div></div>'; 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"}); }); } |