aboutsummaryrefslogtreecommitdiffstats
path: root/portal-lifecyclemgr/src/main/webapp
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2017-01-25 03:41:32 +0000
committerGerrit Code Review <gerrit@open-o.org>2017-01-25 03:41:32 +0000
commitf70f13cc08d7194d4fec1505adf345d565f47c8a (patch)
treede5f4f7166ab69b145902f401b083969ae532e9a /portal-lifecyclemgr/src/main/webapp
parent8f7e7751c35e9821dfa316aed675bf79b564369d (diff)
parent5d17584aa2a6d621e7a986a0d5193f9a52610716 (diff)
Merge "Replace all tabs with spaces"
Diffstat (limited to 'portal-lifecyclemgr/src/main/webapp')
-rw-r--r--portal-lifecyclemgr/src/main/webapp/lifecyclemgr/InputData.html6
-rw-r--r--portal-lifecyclemgr/src/main/webapp/lifecyclemgr/gsolcmmain.html56
-rw-r--r--portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/gsolcm.js778
-rw-r--r--portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/rest.js38
4 files changed, 439 insertions, 439 deletions
diff --git a/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/InputData.html b/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/InputData.html
index b0ebdee9..0c3795c1 100644
--- a/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/InputData.html
+++ b/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/InputData.html
@@ -27,14 +27,14 @@
<link href="css/bootstrap-table.min.css" rel="stylesheet"/>
<script type="text/javascript" src="js/jquery-1.11.2.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="../common/thirdparty/jquery.i18n/jquery.i18n.properties-1.0.9.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/rest.js"></script>
- <script type="text/javascript" src="js/gsolcm.js"></script>
+ <script type="text/javascript" src="js/gsolcm.js"></script>
<script type="text/javascript" src="js/bootstrap-table.min.js"></script>
<script>
$(document).ready(function () {
- new lcmHandler();
+ new lcmHandler();
$('[data-toggle="tooltip"]').tooltip();
var params = new URLSearchParams(window.location.search.slice(1));
diff --git a/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/gsolcmmain.html b/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/gsolcmmain.html
index 4d62f00c..23a3209b 100644
--- a/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/gsolcmmain.html
+++ b/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/gsolcmmain.html
@@ -44,11 +44,11 @@
$('.modal-dialog').draggable();
// $("#detailCont").show();
var jsondata = loadGetServiceData();
-
- $.each(jsondata,function(k,v){
- jsondata[k].createTime= new Date(jsondata[k].createTime).toUTCString();
- });
-
+
+ $.each(jsondata,function(k,v){
+ jsondata[k].createTime= new Date(jsondata[k].createTime).toUTCString();
+ });
+
$('#sai').bootstrapTable({
//Assigning data to table
data: jsondata
@@ -68,7 +68,7 @@
$('#sai').bootstrapTable({}) .on('click-row.bs.table', function (e, row, $element) {
var newURL = "accorTables.html?serviceId="+row.serviceId + "&serviceType="+row.serviceType;
- // var newURL = "accorTables.html?serviceId="+row.serviceId ;
+ // var newURL = "accorTables.html?serviceId="+row.serviceId ;
console.log("URL: "+newURL);
document.getElementById("tabContainer").style.display = "none";
document.getElementById("detailConObj").setAttribute('data', newURL);
@@ -78,9 +78,9 @@
//loadIframe("topoFrame", "chartTopo.html?serviceId="+row.serviceId);
document.getElementById("topoContObj").setAttribute('data', 'TopoAccor.html?serviceId='+row.serviceId);
document.getElementById("topoContDlg").setAttribute('data', 'TopoAccor.html?serviceId='+row.serviceId);
- document.getElementById('inputcontent').setAttribute('data', 'InputData.html?json='+ JSON.stringify(row));
+ document.getElementById('inputcontent').setAttribute('data', 'InputData.html?json='+ JSON.stringify(row));
document.getElementById('inputcontentDlg').setAttribute('data', 'InputData.html?json='+ JSON.stringify(row));
- });
+ });
});
@@ -91,8 +91,8 @@
}
function operateFormatterServiceName(value, row, index){
- var temp = row.serviceId;
- return [
+ var temp = row.serviceId;
+ return [
'<a data-toggle="modal" href="#ModifyModal" style="text-decoration:underline" onclick="return anchorClick(' + temp + ')">' + value + '</a>'
].join('');
}
@@ -285,7 +285,7 @@
<div class="DataTables_sort_wrapper openo-ellipsis ">
<span id="overlayDesc_sorticon"
class="openo-table-th-sorticon overflow_elip leftHeaderAlign openo-table-disable-element ">Service Name
- </span>
+ </span>
</div>
</th>
@@ -362,10 +362,10 @@
<div class="detail" style="margin:10px;border-radius:5px;">
<div class="detail-top" style="margin-top:10px;border-radius:5px;">
<span><h2 style="margin-left: 1%">Detailed Info</h2></span>
-
+
-
-
+
+
<!-- <ul class="nav nav-tabs nav-justified vmapp-margin">
<li class="active basic">
<a href="#" onClick="showDetContMod();" id="" data-toggle="tab">
@@ -620,20 +620,20 @@
</div>
</div>
<div class="modal fade" id="errorDialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal"
- aria-hidden="true">×
- </button>
- <h4 class="modal-title" id="errorDialogTitle" style="text-align:center;"></h4>
- </div>
- <div class="modal-body" id = "errorDialogReason" style="margin-left:20px;margin-bottom:5px;margin-right:10px;"></div>
- <div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal">close</button>
- </div>
- </div>
- </div>
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal"
+ aria-hidden="true">×
+ </button>
+ <h4 class="modal-title" id="errorDialogTitle" style="text-align:center;"></h4>
+ </div>
+ <div class="modal-body" id = "errorDialogReason" style="margin-left:20px;margin-bottom:5px;margin-right:10px;"></div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal">close</button>
+ </div>
+ </div>
+ </div>
</div>
</body>
diff --git a/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/gsolcm.js b/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/gsolcm.js
index 0976d011..d3d1518b 100644
--- a/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/gsolcm.js
+++ b/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/gsolcm.js
@@ -14,43 +14,43 @@
* limitations under the License.
*/
var templateParameters = {
- changed : true,
- // the create params used for ui
- paramJsonObj : {}
+ changed : true,
+ // the create params used for ui
+ paramJsonObj : {}
};
var lcmHandler = function() {
- this._addOwnEvents();
- jQuery.i18n.properties({
- language : 'en-US',
- name : 'lcm-template-parameters-i18n',
- path : 'i18n/',
- mode : 'map'
- });
+ this._addOwnEvents();
+ jQuery.i18n.properties({
+ language : 'en-US',
+ name : 'lcm-template-parameters-i18n',
+ path : 'i18n/',
+ mode : 'map'
+ });
};
lcmHandler.prototype = {
- _addOwnEvents : function() {
- $('#createNS').click(this.okAction);
- },
- okAction : function() {
- if (!checkInputs('create', templateParameters.paramJsonObj)) {
- return;
- }
- var sengMsgObj = collectCreateParamfromUI('', 'create', templateParameters.paramJsonObj);
- var gatewayService = '/openoapi/servicegateway/v1/services';
- $.when(createServiceInstance(sengMsgObj))
- .then(function(response) {
- if (response.status === 'finished') {
- $.when(queryService()).then(function(serviceInstance){
- $('#sai').bootstrapTable("append", serviceInstance);
- });
- $('#vmAppDialog').removeClass('in').css('display','none');
- } else {
- showErrorMessage('Create service failed',response);
- }
- });
- }
+ _addOwnEvents : function() {
+ $('#createNS').click(this.okAction);
+ },
+ okAction : function() {
+ if (!checkInputs('create', templateParameters.paramJsonObj)) {
+ return;
+ }
+ var sengMsgObj = collectCreateParamfromUI('', 'create', templateParameters.paramJsonObj);
+ var gatewayService = '/openoapi/servicegateway/v1/services';
+ $.when(createServiceInstance(sengMsgObj))
+ .then(function(response) {
+ if (response.status === 'finished') {
+ $.when(queryService()).then(function(serviceInstance){
+ $('#sai').bootstrapTable("append", serviceInstance);
+ });
+ $('#vmAppDialog').removeClass('in').css('display','none');
+ } else {
+ showErrorMessage('Create service failed',response);
+ }
+ });
+ }
};
/**
@@ -58,24 +58,24 @@ lcmHandler.prototype = {
* @returns
*/
function initParameterTab() {
- // Service template was not changed. Do not re-initiate the parameter tab.
- if (!templateParameters.changed) {
- return;
- }
- var templateId = $("#svcTempl").val();
- if ('select' === templateId) {
- document.getElementById("templateParameterTab").innerHTML = '';
- return;
- }
- $.when(fetchCreateParameters(templateId))
- .then(function(createParam) {
- // set the create param object
- templateParameters.paramJsonObj = createParam.parameters;
- // convert the create param to UI.
- var components = convertCreateParamsToUI('create', createParam.parameters);
- document.getElementById("templateParameterTab").innerHTML = components;
- templateParameters.changed = false;
- });
+ // Service template was not changed. Do not re-initiate the parameter tab.
+ if (!templateParameters.changed) {
+ return;
+ }
+ var templateId = $("#svcTempl").val();
+ if ('select' === templateId) {
+ document.getElementById("templateParameterTab").innerHTML = '';
+ return;
+ }
+ $.when(fetchCreateParameters(templateId))
+ .then(function(createParam) {
+ // set the create param object
+ templateParameters.paramJsonObj = createParam.parameters;
+ // convert the create param to UI.
+ var components = convertCreateParamsToUI('create', createParam.parameters);
+ document.getElementById("templateParameterTab").innerHTML = components;
+ templateParameters.changed = false;
+ });
}
/**
@@ -86,12 +86,12 @@ function initParameterTab() {
* @returns
*/
function fetchCreateParameters(templateId) {
- //return $.getJSON("./conf/queryCreateParams.json");
- var uri = '/openoapi/servicegateway/v1/createparameters/' + templateId;
- return $.ajax({
- type : "GET",
- url : uri
- });
+ //return $.getJSON("./conf/queryCreateParams.json");
+ var uri = '/openoapi/servicegateway/v1/createparameters/' + templateId;
+ return $.ajax({
+ type : "GET",
+ url : uri
+ });
}
/**
@@ -101,34 +101,34 @@ function fetchCreateParameters(templateId) {
* @return the html component string
*/
function convertCreateParamsToUI(identify, createParam) {
- var components = '';
- // convert host to UI
- if (undefined != createParam.domainHost && 'enum' === createParam.domainHost.type) {
- components = components
- + generateParamComponent(createParam.nodeType, identify,
- createParam.domainHost, false);
- }
- // convert own param to UI
- createParam.additionalParamForNs
- .forEach(function(param) {
- components = components
- + generateParamComponent(createParam.nodeType,
- identify, param, false);
- });
- // convert segments to UI
- createParam.segments.forEach(function(segment) {
- // each segment in a field set.
- components = components + '<fieldset style="margin-left:25px;"><legend>'
- + segment.nodeTemplateName + '</legend>';
- // the identify for segment
- var segmentIdentify = '' == identify ? segment.nodeTemplateName
- : identify + '_' + segment.nodeTemplateName;
- // convert segment to UI
- components = components
- + convertCreateParamsToUI(segmentIdentify, segment);
- components = components + '</fieldset>';
- });
- return components;
+ var components = '';
+ // convert host to UI
+ if (undefined != createParam.domainHost && 'enum' === createParam.domainHost.type) {
+ components = components
+ + generateParamComponent(createParam.nodeType, identify,
+ createParam.domainHost, false);
+ }
+ // convert own param to UI
+ createParam.additionalParamForNs
+ .forEach(function(param) {
+ components = components
+ + generateParamComponent(createParam.nodeType,
+ identify, param, false);
+ });
+ // convert segments to UI
+ createParam.segments.forEach(function(segment) {
+ // each segment in a field set.
+ components = components + '<fieldset style="margin-left:25px;"><legend>'
+ + segment.nodeTemplateName + '</legend>';
+ // the identify for segment
+ var segmentIdentify = '' == identify ? segment.nodeTemplateName
+ : identify + '_' + segment.nodeTemplateName;
+ // convert segment to UI
+ components = components
+ + convertCreateParamsToUI(segmentIdentify, segment);
+ components = components + '</fieldset>';
+ });
+ return components;
}
@@ -139,38 +139,38 @@ function convertCreateParamsToUI(identify, createParam) {
* @returns the check result
*/
function checkInputs(identify, createParam) {
- //check domain host
- if (undefined != createParam.domainHost && 'enum' === createParam.domainHost.type) {
- var value = collectParamValue(identify, createParam.domainHost);
- if ('select' == value) {
- var name = getParamLabel(createParam.nodeType, createParam.domainHost);
- alert( name + ' is required.')
- return false;
- }
- }
- // check parameters
- for(var i= 0; i < createParam.additionalParamForNs.length; i++){
- var param = createParam.additionalParamForNs[i];
- var value = collectParamValue(identify, param);
- if(param.required && ('' === value || ('enum' == param.type && 'select' == value))){
- // the param resource key is nodeType.paramName
- var name = getParamLabel(createParam.nodeType, param);
- alert(name + ' is required.')
- return false;
- }
- }
- // get segments param value from UI
- var segmentcheckResult = true;
- for(var i= 0; i < createParam.segments.length; i++){
- var segment = createParam.segments[i];
- // the identify for segment
- var segmentIdentify = '' == identify ? segment.nodeTemplateName
- : identify + '_' + segment.nodeTemplateName;
- segmentcheckResult = checkInputs(segmentIdentify, segment);
- if (!segmentcheckResult) {
- break;
- }
- }
+ //check domain host
+ if (undefined != createParam.domainHost && 'enum' === createParam.domainHost.type) {
+ var value = collectParamValue(identify, createParam.domainHost);
+ if ('select' == value) {
+ var name = getParamLabel(createParam.nodeType, createParam.domainHost);
+ alert( name + ' is required.')
+ return false;
+ }
+ }
+ // check parameters
+ for(var i= 0; i < createParam.additionalParamForNs.length; i++){
+ var param = createParam.additionalParamForNs[i];
+ var value = collectParamValue(identify, param);
+ if(param.required && ('' === value || ('enum' == param.type && 'select' == value))){
+ // the param resource key is nodeType.paramName
+ var name = getParamLabel(createParam.nodeType, param);
+ alert(name + ' is required.')
+ return false;
+ }
+ }
+ // get segments param value from UI
+ var segmentcheckResult = true;
+ for(var i= 0; i < createParam.segments.length; i++){
+ var segment = createParam.segments[i];
+ // the identify for segment
+ var segmentIdentify = '' == identify ? segment.nodeTemplateName
+ : identify + '_' + segment.nodeTemplateName;
+ segmentcheckResult = checkInputs(segmentIdentify, segment);
+ if (!segmentcheckResult) {
+ break;
+ }
+ }
return segmentcheckResult;
}
@@ -182,39 +182,39 @@ function checkInputs(identify, createParam) {
* @return the html component string
*/
function collectCreateParamfromUI(parentHost,identify, createParam) {
- // the create params used for create msg
- var paramSentObj = {
- domainHost:'',
- nodeTemplateName:'',
- nodeType:'',
- segments:[],
- additionalParamForNs:{}
- };
- // get the domain value
- if (undefined != createParam.domainHost && 'enum' === createParam.domainHost.type) {
- var domain = collectParamValue(identify, createParam.domainHost);
- paramSentObj.domainHost = collectParamValue(identify, createParam.domainHost)
- }
- //if parent domainHost is not '' and local domain host is'', it should be setted as parent
- if('' != parentHost && '' == paramSentObj.domainHost){
- paramSentObj.domainHost = parentHost;
- }
- paramSentObj.nodeTemplateName = createParam.nodeTemplateName;
- paramSentObj.nodeType = createParam.nodeType;
+ // the create params used for create msg
+ var paramSentObj = {
+ domainHost:'',
+ nodeTemplateName:'',
+ nodeType:'',
+ segments:[],
+ additionalParamForNs:{}
+ };
+ // get the domain value
+ if (undefined != createParam.domainHost && 'enum' === createParam.domainHost.type) {
+ var domain = collectParamValue(identify, createParam.domainHost);
+ paramSentObj.domainHost = collectParamValue(identify, createParam.domainHost)
+ }
+ //if parent domainHost is not '' and local domain host is'', it should be setted as parent
+ if('' != parentHost && '' == paramSentObj.domainHost){
+ paramSentObj.domainHost = parentHost;
+ }
+ paramSentObj.nodeTemplateName = createParam.nodeTemplateName;
+ paramSentObj.nodeType = createParam.nodeType;
- // get own param value from UI
- createParam.additionalParamForNs.forEach(function(param) {
- paramSentObj.additionalParamForNs[param.name] = collectParamValue(identify, param);
- });
- // get segments param value from UI
- createParam.segments.forEach(function(segment) {
- // the identify for segment
- var segmentIdentify = '' == identify ? segment.nodeTemplateName
- : identify + '_' + segment.nodeTemplateName;
- var segmentObj = collectCreateParamfromUI(paramSentObj.domainHost, segmentIdentify, segment);
- paramSentObj.segments.push(segmentObj);
- });
- return paramSentObj;
+ // get own param value from UI
+ createParam.additionalParamForNs.forEach(function(param) {
+ paramSentObj.additionalParamForNs[param.name] = collectParamValue(identify, param);
+ });
+ // get segments param value from UI
+ createParam.segments.forEach(function(segment) {
+ // the identify for segment
+ var segmentIdentify = '' == identify ? segment.nodeTemplateName
+ : identify + '_' + segment.nodeTemplateName;
+ var segmentObj = collectCreateParamfromUI(paramSentObj.domainHost, segmentIdentify, segment);
+ paramSentObj.segments.push(segmentObj);
+ });
+ return paramSentObj;
}
/**
@@ -224,8 +224,8 @@ function collectCreateParamfromUI(parentHost,identify, createParam) {
* @returns the value of the param
*/
function collectParamValue(identify, param) {
- var value = $('#' + getParamId(identify, param)).val();
- return value;
+ var value = $('#' + getParamId(identify, param)).val();
+ return value;
}
/**
@@ -235,7 +235,7 @@ function collectParamValue(identify, param) {
* @returns
*/
function getParamId(identify, param) {
- return '' ===identify ? param.name : identify + '_' + param.name;
+ return '' ===identify ? param.name : identify + '_' + param.name;
}
/**
@@ -245,11 +245,11 @@ function getParamId(identify, param) {
* @returns resource string
*/
function getParamLabel(nodeType, param) {
- var name = $.i18n.prop(nodeType + '.' + param.name);
- if (name.length === 0 || name.slice(0, 1) === '[') {
- name = param.name;
- }
- return name;
+ var name = $.i18n.prop(nodeType + '.' + param.name);
+ if (name.length === 0 || name.slice(0, 1) === '[') {
+ name = param.name;
+ }
+ return name;
}
/**
* convert combox component
@@ -260,38 +260,38 @@ function getParamLabel(nodeType, param) {
* @returns
*/
function generateParamComponent(nodeType, identify, param, strReadOnly) {
- // the param resource key is nodeType.paramName
- var name = getParamLabel(nodeType, param);
- var id = getParamId(identify,param);
- var component = '';
- if (param.type === 'string') {
- component = '<div class="mT15 form-group" style="margin-left:0px;">'
- + '<label class="col-sm-5 control-label">'
- + '<span>' + name + '</span>' + generateRequiredLabel(param)
- + '</label>'
- + '<div class="col-sm-5"><input type="text" id="' + id
- + '" name="parameter description" class="form-control" placeholder="'
- + name + '" value="' + param.defaultValue;
- if(strReadOnly){
- component = component + '" readonly="' + strReadOnly + '"/>'+ '</div></div>';
- }else{
- component = component + '"/>'+ '</div></div>';
- }
-
- } else if (param.type === 'enum') {
- component = '<div class="form-group" style="margin-left:0px;margin-bottom:5px;">'
- + '<label class="col-sm-5 control-label">'
- + '<span>' + name + '</span>'
- + '<span class="required">*</span>'
- + '</label>'
- + '<div class="col-sm-5">'
- + '<select class="form-control" style ="padding-top: 0px;padding-bottom: 0px;"'
- + ' id="' + id + '" name="' + param.name + '" value="' + param.defaultValue
- + '">'
- + this.transformToOptions(param.range)
- + '</select></div></div>';
- }
- return component;
+ // the param resource key is nodeType.paramName
+ var name = getParamLabel(nodeType, param);
+ var id = getParamId(identify,param);
+ var component = '';
+ if (param.type === 'string') {
+ component = '<div class="mT15 form-group" style="margin-left:0px;">'
+ + '<label class="col-sm-5 control-label">'
+ + '<span>' + name + '</span>' + generateRequiredLabel(param)
+ + '</label>'
+ + '<div class="col-sm-5"><input type="text" id="' + id
+ + '" name="parameter description" class="form-control" placeholder="'
+ + name + '" value="' + param.defaultValue;
+ if(strReadOnly){
+ component = component + '" readonly="' + strReadOnly + '"/>'+ '</div></div>';
+ }else{
+ component = component + '"/>'+ '</div></div>';
+ }
+
+ } else if (param.type === 'enum') {
+ component = '<div class="form-group" style="margin-left:0px;margin-bottom:5px;">'
+ + '<label class="col-sm-5 control-label">'
+ + '<span>' + name + '</span>'
+ + '<span class="required">*</span>'
+ + '</label>'
+ + '<div class="col-sm-5">'
+ + '<select class="form-control" style ="padding-top: 0px;padding-bottom: 0px;"'
+ + ' id="' + id + '" name="' + param.name + '" value="' + param.defaultValue
+ + '">'
+ + this.transformToOptions(param.range)
+ + '</select></div></div>';
+ }
+ return component;
}
/**
@@ -300,13 +300,13 @@ function generateParamComponent(nodeType, identify, param, strReadOnly) {
* @returns the html string
*/
function transformToOptions(items) {
- var options = '<option value="select">--select--</option>';
- var i;
- for ( var key in items) {
- var option = '<option value="' + key + '">' + items[key] + '</option>';
- options = options + option;
- }
- return options;
+ var options = '<option value="select">--select--</option>';
+ var i;
+ for ( var key in items) {
+ var option = '<option value="' + key + '">' + items[key] + '</option>';
+ options = options + option;
+ }
+ return options;
}
/**
@@ -315,11 +315,11 @@ function transformToOptions(items) {
* @returns the html string
*/
function generateRequiredLabel(parameter) {
- var requiredLabel = '';
- if (parameter.required === 'true') {
- requiredLabel = '<span class="required">*</span>';
- }
- return requiredLabel;
+ var requiredLabel = '';
+ if (parameter.required === 'true') {
+ requiredLabel = '<span class="required">*</span>';
+ }
+ return requiredLabel;
}
/**
@@ -328,30 +328,30 @@ function generateRequiredLabel(parameter) {
* @returns
*/
function createServiceInstance(sengMsgObj) {
- var defer = $.Deferred();
- var parameter = {
- 'service' : {
- 'name' : $('#svcName').val(),
- 'description' : $('#svcDesc').val(),
- 'serviceDefId' : '', //no need now, reserved
- 'templateId' : $("#svcTempl").val(),
- 'parameters' : sengMsgObj
- }
- };
- var serviceGatewayUri = '/openoapi/servicegateway/v1/services';
- $.when($.ajax({
- type : "POST",
- url : serviceGatewayUri,
- contentType : "application/json",
- dataType : "json",
- data : JSON.stringify(parameter)
- }))
- .then(function(response) {
- return queryProgress('create service', response.service.serviceId,response.service.operationId);
- }).then(function(result){
- defer.resolve(result);
- });
- return defer;
+ var defer = $.Deferred();
+ var parameter = {
+ 'service' : {
+ 'name' : $('#svcName').val(),
+ 'description' : $('#svcDesc').val(),
+ 'serviceDefId' : '', //no need now, reserved
+ 'templateId' : $("#svcTempl").val(),
+ 'parameters' : sengMsgObj
+ }
+ };
+ var serviceGatewayUri = '/openoapi/servicegateway/v1/services';
+ $.when($.ajax({
+ type : "POST",
+ url : serviceGatewayUri,
+ contentType : "application/json",
+ dataType : "json",
+ data : JSON.stringify(parameter)
+ }))
+ .then(function(response) {
+ return queryProgress('create service', response.service.serviceId,response.service.operationId);
+ }).then(function(result){
+ defer.resolve(result);
+ });
+ return defer;
}
/**
@@ -361,31 +361,31 @@ function createServiceInstance(sengMsgObj) {
* @returns
*/
function deleteService(rowId, row) {
- var deleteHandle = function(result) {
- if (result) {
- var serviceId = row.serviceId;
- var remove = function() {
- $('#sai').bootstrapTable('remove', {
- field : 'serviceId',
- values : [ serviceId ]
- });
- };
- var failFun = function(responseDesc) {
- $.isLoading("hide");
- showErrorMessage("Delete service failed", responseDesc);
- }
- $.when(deleteServiceInstance(serviceId))
- .then(function(response) {
- if (response.status === 'finished') {
- remove();
- } else {
- showErrorMessage('Create service failed',response);
- }
- });
- ;
- }
- };
- bootbox.confirm("Do you confirm to delete service?", deleteHandle);
+ var deleteHandle = function(result) {
+ if (result) {
+ var serviceId = row.serviceId;
+ var remove = function() {
+ $('#sai').bootstrapTable('remove', {
+ field : 'serviceId',
+ values : [ serviceId ]
+ });
+ };
+ var failFun = function(responseDesc) {
+ $.isLoading("hide");
+ showErrorMessage("Delete service failed", responseDesc);
+ }
+ $.when(deleteServiceInstance(serviceId))
+ .then(function(response) {
+ if (response.status === 'finished') {
+ remove();
+ } else {
+ showErrorMessage('Create service failed',response);
+ }
+ });
+ ;
+ }
+ };
+ bootbox.confirm("Do you confirm to delete service?", deleteHandle);
}
/**
@@ -394,21 +394,21 @@ function deleteService(rowId, row) {
* @returns
*/
function deleteServiceInstance(serviceId) {
- var defer = $.Deferred();
- var deleteUrl = '/openoapi/servicegateway/v1/services/' + serviceId;
- $.when($.ajax({
- type : "DELETE",
- url : deleteUrl,
- contentType : "application/json",
- dataType : "json",
- data : JSON.stringify(parameter)
- }))
- .then(function(response) {
- return queryProgress('delete service', serviceId,response.operationId);
- }).then(function(result){
- defer.resolve(result);
- });
- return defer;
+ var defer = $.Deferred();
+ var deleteUrl = '/openoapi/servicegateway/v1/services/' + serviceId;
+ $.when($.ajax({
+ type : "DELETE",
+ url : deleteUrl,
+ contentType : "application/json",
+ dataType : "json",
+ data : JSON.stringify(parameter)
+ }))
+ .then(function(response) {
+ return queryProgress('delete service', serviceId,response.operationId);
+ }).then(function(result){
+ defer.resolve(result);
+ });
+ return defer;
}
/**
@@ -419,55 +419,55 @@ function deleteServiceInstance(serviceId) {
* @returns
*/
function queryProgress(operation, serviceId, operationId) {
- //show the progress dialog
- $( "#idProgressTitle" ).text(operation);
- $( "#progressContent" ).text('status:');
- $( "#progressbar" ).attr("style","width: 0%");
- $( "#progressDialog" ).modal({backdrop:'static', keyboard:false});
- //set a timer for query operation
- var defer = $.Deferred();
- var queryProgressUril = '/openoapi/servicegateway/v1/services/' + serviceId + '/operations/' + operationId;
- var timerDefer = $.Deferred();
- var timeout = 3600000;
- var fun = function() {
- if (timeout === 0) {
- timerDefer.resolve({
- status : 'error',
- reason : operation + ' timeout!',
- });
- return;
- }
- timeout = timeout - 1000;
- $.when($.ajax({
- type : "GET",
- url : gsoServiceUri
- }))
- .then(function(response) {
- //update progress
- $( "#progressbar" ).attr("style","width: " + response.operation.progress.toString() + "%");
- $( "#progressValue" ).text(response.operation.progress.toString() + '%');
- $( "#progressContent" ).text('status: ' + response.operation.operationContent);
- if (response.operation.result == 'finished' || response.operation.result == 'error') {
- timerDefer.resolve({
- status : response.operation.result ,
- reason : response.operation.reason
- });
- }
- });
- };
- var timerId = setInterval(fun, 1000);
- $.when(timerDefer)
- .then(function(responseDesc) {
- clearInterval(timerId);
- $('#progressDialog').modal('hide');
- defer.resolve({
- status : responseDesc.status,
- reason : responseDesc.reason,
- serviceId:serviceId
- });
+ //show the progress dialog
+ $( "#idProgressTitle" ).text(operation);
+ $( "#progressContent" ).text('status:');
+ $( "#progressbar" ).attr("style","width: 0%");
+ $( "#progressDialog" ).modal({backdrop:'static', keyboard:false});
+ //set a timer for query operation
+ var defer = $.Deferred();
+ var queryProgressUril = '/openoapi/servicegateway/v1/services/' + serviceId + '/operations/' + operationId;
+ var timerDefer = $.Deferred();
+ var timeout = 3600000;
+ var fun = function() {
+ if (timeout === 0) {
+ timerDefer.resolve({
+ status : 'error',
+ reason : operation + ' timeout!',
+ });
+ return;
+ }
+ timeout = timeout - 1000;
+ $.when($.ajax({
+ type : "GET",
+ url : gsoServiceUri
+ }))
+ .then(function(response) {
+ //update progress
+ $( "#progressbar" ).attr("style","width: " + response.operation.progress.toString() + "%");
+ $( "#progressValue" ).text(response.operation.progress.toString() + '%');
+ $( "#progressContent" ).text('status: ' + response.operation.operationContent);
+ if (response.operation.result == 'finished' || response.operation.result == 'error') {
+ timerDefer.resolve({
+ status : response.operation.result ,
+ reason : response.operation.reason
+ });
+ }
+ });
+ };
+ var timerId = setInterval(fun, 1000);
+ $.when(timerDefer)
+ .then(function(responseDesc) {
+ clearInterval(timerId);
+ $('#progressDialog').modal('hide');
+ defer.resolve({
+ status : responseDesc.status,
+ reason : responseDesc.reason,
+ serviceId:serviceId
+ });
- });
- return defer;
+ });
+ return defer;
}
@@ -478,80 +478,80 @@ function queryProgress(operation, serviceId, operationId) {
* @returns the check result
*/
function convertInputsToUI(parentHost, identify, serviceParam) {
- var components = '';
- // convert host to UI
- if (undefined != serviceParam.domainHost && '' != serviceParam.domainHost && parentHost != serviceParam.domainHost) {
- var param ={
- name:'domainHost',
- type:'string',
- defaultValue:getShowVal('domainHost', serviceParam.domainHost),
- required:false
- }
- components = components + generateParamComponent(serviceParam.nodeType, identify,
- param, true);
- }
- // convert own param to UI
- for(var key in serviceParam.additionalParamForNs ){
- var param ={
- name: key,
- type:'string',
- defaultValue:getShowVal(key, serviceParam.additionalParamForNs[key]),
- required:false
- }
- components = components + generateParamComponent(serviceParam.nodeType,
- identify, param, true);
- }
- // convert segments to UI
- serviceParam.segments.forEach(function(segment) {
- // each segment in a field set.
- components = components + '<div class="mT15 form-group"><fieldset style="margin-left:25px;"><legend>'
- + segment.nodeTemplateName + '</legend>';
- // the identify for segment
- var segmentIdentify = '' == identify ? segment.nodeTemplateName
- : identify + '_' + segment.nodeTemplateName;
- // convert segment to UI
- components = components
- + convertInputsToUI(serviceParam.domainHost, segmentIdentify, segment);
- components = components + '</fieldset></div>';
- });
- return components;
+ var components = '';
+ // convert host to UI
+ if (undefined != serviceParam.domainHost && '' != serviceParam.domainHost && parentHost != serviceParam.domainHost) {
+ var param ={
+ name:'domainHost',
+ type:'string',
+ defaultValue:getShowVal('domainHost', serviceParam.domainHost),
+ required:false
+ }
+ components = components + generateParamComponent(serviceParam.nodeType, identify,
+ param, true);
+ }
+ // convert own param to UI
+ for(var key in serviceParam.additionalParamForNs ){
+ var param ={
+ name: key,
+ type:'string',
+ defaultValue:getShowVal(key, serviceParam.additionalParamForNs[key]),
+ required:false
+ }
+ components = components + generateParamComponent(serviceParam.nodeType,
+ identify, param, true);
+ }
+ // convert segments to UI
+ serviceParam.segments.forEach(function(segment) {
+ // each segment in a field set.
+ components = components + '<div class="mT15 form-group"><fieldset style="margin-left:25px;"><legend>'
+ + segment.nodeTemplateName + '</legend>';
+ // the identify for segment
+ var segmentIdentify = '' == identify ? segment.nodeTemplateName
+ : identify + '_' + segment.nodeTemplateName;
+ // convert segment to UI
+ components = components
+ + convertInputsToUI(serviceParam.domainHost, segmentIdentify, segment);
+ components = components + '</fieldset></div>';
+ });
+ return components;
}
function getShowVal(paramName, paramValue){
- if(paramName == 'domainHost'){
- return getHostNameByVal(paramValue);
- }
- else if(paramName == 'location'){
- return getVimNameById(paramValue);
- }
- else if(paramName == 'sdncontroller'){
- return getSdnControllerNameById(paramValue);
- }
- else{
- return paramValue;
- }
+ if(paramName == 'domainHost'){
+ return getHostNameByVal(paramValue);
+ }
+ else if(paramName == 'location'){
+ return getVimNameById(paramValue);
+ }
+ else if(paramName == 'sdncontroller'){
+ return getSdnControllerNameById(paramValue);
+ }
+ else{
+ return paramValue;
+ }
}
function getHostNameByVal(hostDomain){
var requestUrl ="/openoapi/servicegateway/v1/domains";
- var returnObj = '';
- $.ajax({
- type : "GET",
- async: false,
- url : requestUrl,
- contentType : "application/json",
- success : function(jsonobj) {
- jsonobj.forEach(function(host){
- if(host.host == hostDomain){
- returnObj = host.name;
- }
- });
- },
- error : function(xhr, ajaxOptions, thrownError) {
- alert("Error on getting link data : " + xhr.responseText);
- }
- });
- return returnObj;
+ var returnObj = '';
+ $.ajax({
+ type : "GET",
+ async: false,
+ url : requestUrl,
+ contentType : "application/json",
+ success : function(jsonobj) {
+ jsonobj.forEach(function(host){
+ if(host.host == hostDomain){
+ returnObj = host.name;
+ }
+ });
+ },
+ error : function(xhr, ajaxOptions, thrownError) {
+ alert("Error on getting link data : " + xhr.responseText);
+ }
+ });
+ return returnObj;
}
//get the vim name by id.
@@ -566,7 +566,7 @@ function getVimNameById(vimId){
contentType : "application/json",
success : function(jsonobj) {
// TODO return according to the json data received.
- returnObj = jsonobj;
+ returnObj = jsonobj;
},
error : function(xhr, ajaxOptions, thrownError) {
alert("Error on getting link data : " + xhr.responseText);
@@ -587,7 +587,7 @@ function getSdnControllerNameById(sdnControllerId){
contentType : "application/json",
success : function(jsonobj) {
// TODO return according to the json data received.
- returnObj = jsonobj;
+ returnObj = jsonobj;
},
error : function(xhr, ajaxOptions, thrownError) {
alert("Error on getting link data : " + xhr.responseText);
@@ -605,10 +605,10 @@ function getSdnControllerNameById(sdnControllerId){
* @returns
*/
function showErrorMessage(title, result) {
- //show the error dialog
- $( "#errorDialogTitle" ).text(title);
- $( "#errorDialogReason" ).text(result.reason);
- $( "#errorDialog" ).modal({backdrop:'static', keyboard:false});
+ //show the error dialog
+ $( "#errorDialogTitle" ).text(title);
+ $( "#errorDialogReason" ).text(result.reason);
+ $( "#errorDialog" ).modal({backdrop:'static', keyboard:false});
}
/**
@@ -618,9 +618,9 @@ function showErrorMessage(title, result) {
* @returns
*/
function queryService(serviceId) {
- var uri = '/openoapi/servicegateway/v1/services/' + serviceId;
- return $.ajax({
- type : "GET",
- url : uri
- });
+ var uri = '/openoapi/servicegateway/v1/services/' + serviceId;
+ return $.ajax({
+ type : "GET",
+ url : uri
+ });
}
diff --git a/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/rest.js b/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/rest.js
index f7a01ea2..aa6e591e 100644
--- a/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/rest.js
+++ b/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/rest.js
@@ -51,7 +51,7 @@ $(function () {
$('.table tr:odd').addClass('active');
$('#false').click(function () {
/*$('#vmAppDialog').addClass('in').css({'display': 'block'});*/
- $('#vmAppDialog').modal();
+ $('#vmAppDialog').modal();
});
$('.close,.button-previous').click(function () {
$('#vmAppDialog').removeClass('in').css('display', 'none');
@@ -126,9 +126,9 @@ $(function () {
* @returns
*/
function generateTemplatesComponent(){
- var defer = $.Deferred();
- $.when(
- queryTemplates()
+ var defer = $.Deferred();
+ $.when(
+ queryTemplates()
).then(
function (tmplatesResponse) {
var templatesInfo = translateToTemplatesInfo(tmplatesResponse);
@@ -143,11 +143,11 @@ function generateTemplatesComponent(){
* @returns
*/
function queryTemplates() {
- var queryTemplatesUrl = '/openoapi/catalog/v1/servicetemplates';
- return $.ajax({
- type : "GET",
- url : queryTemplatesUrl
- });
+ var queryTemplatesUrl = '/openoapi/catalog/v1/servicetemplates';
+ return $.ajax({
+ type : "GET",
+ url : queryTemplatesUrl
+ });
}
/**
@@ -156,14 +156,14 @@ function queryTemplates() {
* @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;
+ 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**********************************************/
@@ -188,7 +188,7 @@ function loadGetServiceData(){
data: JSON.stringify(parameter),
success : function(jsonobj) {
// TODO return according to the json data received.
- returnVal = jsonobj;
+ returnVal = jsonobj;
},
error : function(xhr, ajaxOptions, thrownError) {
alert("Error on getting link data : " + xhr.responseText);
@@ -211,7 +211,7 @@ function loadServiceDetails(serviceId){
contentType : "application/json",
success : function(jsonobj) {
// TODO return according to the json data received.
- returnObj = jsonobj;
+ returnObj = jsonobj;
},
error : function(xhr, ajaxOptions, thrownError) {
alert("Error on getting link data : " + xhr.responseText);