summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorj00302280 <j00101220@huawei.com>2016-10-21 18:43:03 +0800
committerj00302280 <j00101220@huawei.com>2016-10-21 18:43:03 +0800
commita002e434296d32d4d14d4fd628db11b52966524a (patch)
treea5450b05a9585bfca58c86af7fba93ea51a8b99f
parent61a456234d16a62467452a6349e6899e83fdb3c7 (diff)
Issue ID: GSO-37
Change-Id: I376471bf15f5c090d8e574e13524d736011a7a3e Signed-off-by: j00302280 <j00101220@huawei.com>
-rw-r--r--openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/rest.js67
1 files changed, 63 insertions, 4 deletions
diff --git a/openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/rest.js b/openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/rest.js
index 75d61ac3..ed860901 100644
--- a/openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/rest.js
+++ b/openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/rest.js
@@ -111,45 +111,104 @@ $(function () {
}
});
});
+ //init the templates combo
+ $.when(
+ generateTemplatesComponent()
+ ).then(
+ function (templates) {
+ document.getElementById("svcTempl").innerHTML = templates;
+ }
+ );
})
+/**
+ * generate the templates Component
+ * @returns
+ */
+function generateTemplatesComponent(){
+ var defer = $.Deferred();
+ $.when(
+ queryTemplates()
+ ).then(
+ function (tmplatesResponse) {
+ var templatesInfo = translateToTemplatesInfo(tmplatesResponse);
+ defer.resolve(templatesInfo);
+ }
+ )
+ return defer;
+}
+
+/**
+ * query templates
+ * @returns
+ */
+function queryTemplates() {
+ var queryTemplatesUrl = '/openoapi/catalog/v1/servicetemplates';
+ return $.ajax({
+ type : "GET",
+ url : queryTemplatesUrl
+ });
+}
+
+/**
+ * generate templates html string
+ * @param templates
+ * @returns
+ */
+function translateToTemplatesInfo(templates) {
+ var options = '<option value="select">--select--</option>';
+ var i;
+ for (i = 0; i < templates.length; i += 1) {
+ var option = '<option value="' + templates[i].serviceTemplateId + '">' + templates[i].templateName
+ + '</option>';
+ options = options + option;
+ }
+ return options;
+}
+
/*******************************************Get Service**********************************************/
function loadGetServiceData(){
- var requestUrl = url + "/openoapi/inventory/v1/services";
+ var returnVal;
+ var requestUrl = "/openoapi/inventory/v1/services";
$
.ajax({
type : "POST",
url : requestUrl,
+ async: false,
contentType : "application/json",
success : function(jsonobj) {
// TODO return according to the json data received.
- return jsonobj;
+ returnVal = jsonobj;
},
error : function(xhr, ajaxOptions, thrownError) {
alert("Error on getting link data : " + xhr.responseText);
}
});
+ return returnVal;
}
/*********************************************Get Service Details********************************************/
function loadServiceDetails(serviceId){
// TODO re-confirm the latest url.
- var requestUrl = url + "/openoapi/lifecyclemgr/v1/services/toposequence/" + serviceId;
+ var requestUrl ="/openoapi/gso/v1/services/toposequence/" + serviceId;
+ var returnObj;
$
.ajax({
type : "GET",
+ async: false,
url : requestUrl,
contentType : "application/json",
success : function(jsonobj) {
// TODO return according to the json data received.
- return jsonobj;
+ returnObj = jsonobj;
},
error : function(xhr, ajaxOptions, thrownError) {
alert("Error on getting link data : " + xhr.responseText);
}
});
+ return returnObj;
}
function anchorClick(serviceId){