diff options
author | talasila <talasila@research.att.com> | 2017-02-08 10:13:29 -0500 |
---|---|---|
committer | talasila <talasila@research.att.com> | 2017-02-08 10:15:00 -0500 |
commit | f8a8d5192b1e5013d9e2f699be54b072ef39d5f0 (patch) | |
tree | b7a65bb0a7d70a9dc24c064113868e5f3b8e6a09 /dcae_dmaapbc_webapp/src/main/webapp/app/fusion/ase/scripts/services.js | |
parent | 72a80fbff7120630576ccd5aa67c20818c2943c7 (diff) |
Initial OpenECOMP UI/DMaapBC commit
Change-Id: Ia492e1b88311b9bed4c31f593b28deaaad73b7e4
Signed-off-by: talasila <talasila@research.att.com>
Diffstat (limited to 'dcae_dmaapbc_webapp/src/main/webapp/app/fusion/ase/scripts/services.js')
-rw-r--r-- | dcae_dmaapbc_webapp/src/main/webapp/app/fusion/ase/scripts/services.js | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/fusion/ase/scripts/services.js b/dcae_dmaapbc_webapp/src/main/webapp/app/fusion/ase/scripts/services.js new file mode 100644 index 0000000..6abcc98 --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/fusion/ase/scripts/services.js @@ -0,0 +1,86 @@ +/* ---------------------------------------------------------------------------------------------- */ +/* +* This file is a work in progress, update this section when complete to give a better description. +* Currently the functions here work with the services and will work with getting the information +* from the AJAX Call which will provide JSON/YMAL object of the information required to build the service +* selection. +* +* +*/ + +/* +* This Function currently builds the table for the accordian. +* when complete this will create the complete section of how +* a Domain, Serrvice and UE are selected from the ASE tool. +* +*/ +var domains = []; +var elements = []; +var networkMap =[]; +var isFirstRun = true; +var defaultDomain = "RAN"; +var defaultElement = "com.ecomp.trinity.ran.enodeb"; + + +function buildNetworkMap() { + + + $.get(ase.elementsFile, { + //$.post('http://demeter.homer.ecomp.com:50180/d2sim/ase.htm?action=element', { + //$.post('ase.htm?action=element', { + }, function(data) { + var yamlObject = jsyaml.load(data); + networkMap = yamlObject.elementsList; + buildDomain(networkMap); + }); + + +} + + +function buildDomain(networkMap){ + if ( domains.length == 0 ) { + for ( var i = 0; i < networkMap.length; i++ ) { + if ( domains.indexOf(networkMap[i].enclosingDomain) < 0 ) { + domains.push(networkMap[i].enclosingDomain); + } + } + } + for ( var d = 0; d < domains.length; d++ ) { + $('#domains').append('<option value="' + domains[d] +'">' + domains[d] + '</option>'); + } + $("#elements").prop('disabled', true); + $('#domains').change(function(){ + if ( $('#domains').val() == 'na' ) { return false; } + buildElements($('#domains').val()); + }); + $('#domains option[value|="'+ defaultDomain +'"]').prop("selected",true).change(); + +} + +function buildElements(domain){ + elements = []; + $('#elements').html('<option value="na">-- Select Element --</option>'); + for ( var i = 0; i < networkMap.length; i++ ) { + if ( networkMap[i].enclosingDomain == domain ) { + $('#elements').append('<option value="' + networkMap[i].tosca_id +'">' + networkMap[i].displayShortname + '</option>'); + elements.push(networkMap[i].displayShortname); + } + } + $("#elements").prop('disabled', false); + $('#elements').change(function(){ + if ( $('#elements').val() == 'na' ) { return false; } + buildNode($('#elements').val(),$('#elements option:selected').text()); + }); + if ( isFirstRun ) { + $('#elements option[value|="'+ defaultElement +'"]').prop("selected",true); + isFirstRun = false; + } + +} + +function buildNode(tosca_id,name){ + $('#element').attr('taska_id',tosca_id); + $('#shortName').html(name); +} + |