aboutsummaryrefslogtreecommitdiffstats
path: root/openo-portal
diff options
context:
space:
mode:
authorjin xin <j00101220@huawei.com>2016-11-02 08:08:15 +0000
committerGerrit Code Review <gerrit@open-o.org>2016-11-02 08:08:15 +0000
commitdb63077a9b12f28fd02578072a4023f1602db21b (patch)
treee93cb040f19e43b389447051de44e2e97e612af3 /openo-portal
parent5a5b61df65d99fe2737e2371eb0ca5ab658990d6 (diff)
parent5e2bb857ed1a804259ac0a27fac1cdcd041442ab (diff)
Merge "Issue-Id: GSO-88 Fix js error and add i18n support" into sun
Diffstat (limited to 'openo-portal')
-rw-r--r--openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/gsolcmmain.html1
-rw-r--r--openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/gsolcm.js24
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 e097e3ff..3e7d167d 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"});
});
}