diff options
author | Luji7 <lu.ji3@zte.com.cn> | 2016-09-18 17:20:12 +0800 |
---|---|---|
committer | Luji7 <lu.ji3@zte.com.cn> | 2016-09-18 17:20:12 +0800 |
commit | 96f794f06d167a8b619c8b514a535bda3203ac14 (patch) | |
tree | b615756856d8bb4dd1c31f2c0419d4c40cb5450d /openo-portal/portal-lifecyclemgr | |
parent | 332febfadf4ff8b777d5f58f0e68c0287a515afe (diff) |
add location configuration of vims in gui
Change-Id: I68d3e3856f17a1739055b5a90d12ab2c955f59f7
Signed-off-by: Luji7 <lu.ji3@zte.com.cn>
Diffstat (limited to 'openo-portal/portal-lifecyclemgr')
-rw-r--r-- | openo-portal/portal-lifecyclemgr/gsolcmmain.html | 2 | ||||
-rw-r--r-- | openo-portal/portal-lifecyclemgr/js/gsolcm.js | 63 |
2 files changed, 61 insertions, 4 deletions
diff --git a/openo-portal/portal-lifecyclemgr/gsolcmmain.html b/openo-portal/portal-lifecyclemgr/gsolcmmain.html index 715f8616..0b68d768 100644 --- a/openo-portal/portal-lifecyclemgr/gsolcmmain.html +++ b/openo-portal/portal-lifecyclemgr/gsolcmmain.html @@ -29,7 +29,7 @@ <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/bootstrap-table.min.js"></script>
- <script type="text/javascript" src="gsolcm.js"></script>
+ <script type="text/javascript" src="js/gsolcm.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var jsondata = [];
diff --git a/openo-portal/portal-lifecyclemgr/js/gsolcm.js b/openo-portal/portal-lifecyclemgr/js/gsolcm.js index 5258d907..9655691d 100644 --- a/openo-portal/portal-lifecyclemgr/js/gsolcm.js +++ b/openo-portal/portal-lifecyclemgr/js/gsolcm.js @@ -37,7 +37,8 @@ lcmHandler.prototype = { serviceTemplateId: $('#svcTempl').val(), serviceName: $('#svcName').val(), serviceDescription: $('#svcDesc').val(), - serviceParameters: collectServiceParameters(templateParameters) + serviceParameters: collectServiceParameters(templateParameters), + vimLocation: $('#vim_location').val() } var gatewayService = '/openoapi/servicegateway/v1/services'; var serviceTemplate = fetchServiceTemplateBy(serviceInstance.serviceTemplateId); @@ -108,7 +109,8 @@ function fetchServiceTemplateBy(templateId) { function renderTemplateParametersTab() { templateParameters = fetchTemplateParameterDefinitions(templateParameters); - var components = transfromToComponents(templateParameters.parameters); + var vims = fetchVimInfo(); + var components = transfromToComponents(templateParameters.parameters, vims); document.getElementById("parameterTab").innerHTML = components; } @@ -149,7 +151,34 @@ function fetchTemplateParameterDefinitions(parameters) { return { name: currentServiceTemplate, parameters: inputParameters }; } -function transfromToComponents(parameters) { +function fetchVimInfo() { + var result = []; + var vimQueryUri = '/openoapi/extsys/v1/vims'; + $.ajax({ + type : "GET", + async: false, + url : vimQueryUri, + contentType : "application/json", + dataType : "json", + success : function(jsonResp) { + var vims = jsonResp; + var i; + for( i = 0; i < vims.length; i += 1) { + var option = '<option value="' + vims[i].vimId + '">'+vims[i].name+'</option>'; + result[i] = { + vimId: vims[i].vimId, + vimName: vims[i].name + } + } + }, + error : function(xhr, ajaxOptions, thrownError) { + alert("Error on page : " + xhr.responseText); + } + }); + return result; +} + +function transfromToComponents(parameters, vims) { var components = ''; var i; for( i = 0; i < parameters.length; i += 1) { @@ -163,6 +192,7 @@ function transfromToComponents(parameters) { '</div></div>'; components = components + component; } + components = components + generateLocationComponent(vims); return components; } @@ -174,7 +204,33 @@ function generateRequiredLabel(parameter) { return requiredLabel; } +function generateLocationComponent(vims) { + var component = '<div class="form-group">' + + '<label class="col-sm-3 control-label">' + + '<span>Location</span>' + + '<span class="required">*</span>' + + '</label>' + + '<div class="col-sm-7">' + + '<select class="form-control" style ="padding-top: 0px;padding-bottom: 0px;"' + + ' id="vim_location" name="vim_location">' + + transformToOptions(vims) + + // '<option value="vimid">vim1 name</option>' + + '</select></div></div>'; + return component; +} + +function transformToOptions(vims) { + var options = ''; + var i; + for( i = 0; i < vims.length; i += 1) { + var option = '<option value="' + vims[i].vimId + '">'+vims[i].vimName+'</option>'; + options = options + option; + } + return options; +} + function createGsoServiceInstance(gatewayService, serviceInstance) { + serviceInstance.serviceParameters.location = serviceInstance.vimLocation; var gsoLcmUri = '/openoapi/lifecyclemgr/v1/services'; var parameter = { 'name': serviceInstance.serviceName, @@ -209,6 +265,7 @@ function createGsoServiceInstance(gatewayService, serviceInstance) { function createNfvoServiceInstance(gatewayService, serviceInstance) { var nfvoLcmNsUrl = '/openoapi/nslcm/v1.0/ns'; + serviceInstance.serviceParameters.location = serviceInstance.vimLocation; createServiceInstance(gatewayService, nfvoLcmNsUrl, serviceInstance); } |