X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=static%2Fsrc%2Finstancehandler%2Finstance_topology_view.js;h=99bb9867c8f46556fb013f1650d9b5ae1f806ac5;hb=1e3200610a98085cb6a2529e7d728927ca2813ca;hp=1193b18f750eec6b6b710ec0a1d444ec53e2ec3c;hpb=3218b2b802b040b6110780eb95cf84a9f3101505;p=osm%2FLW-UI.git diff --git a/static/src/instancehandler/instance_topology_view.js b/static/src/instancehandler/instance_topology_view.js index 1193b18..99bb986 100644 --- a/static/src/instancehandler/instance_topology_view.js +++ b/static/src/instancehandler/instance_topology_view.js @@ -1,6 +1,44 @@ +/* + Copyright 2018 EveryUP srl + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + //GraphEditor instance var graph_editor = new TCD3.ModelGraphEditor(); +var layer_map = { + 'nsr': { + 'id': 'NS instance id', + 'nsdId': 'NSD id', + 'name-ref': 'NSD name', + 'operational-status': 'Operational status', + 'config-status': 'Config status', + 'detailed-status': 'Detailed status', + 'create-time': 'Creation date', + 'instantiate_params' :'Instantiation parameters' + }, + 'vnfr': { + 'id': 'VNF instance id', + 'vnfd-id': 'NSD id', + 'vnfd-ref': 'NSD name', + 'member-vnf-index': 'Constituent VNF in the NS', + 'ip-address': 'Mgmt IP address', + 'vim-account-id': 'VIM id', + 'create-time': 'Creation date' + } +}; + var type_view = { "nsr": ["vnfr", "ns_vl"], "vnfr": ["vdur", "cp", "vnf_vl"] @@ -41,7 +79,6 @@ $(document).ready(function () { }); - function handleForce(el) { graph_editor.handleForce((el.getAttribute('aria-pressed') === "true")); } @@ -119,6 +156,7 @@ function refreshElementInfo(event, element) { } } + function layerDetails(filters) { var side = $('#side'); var graph_parameters = graph_editor.getGraphParams(); @@ -126,12 +164,35 @@ function layerDetails(filters) { if(graph_parameters['view'] && filters.link.view.length >0 && filters.link.view[0]){ if(filters.link.view[0] === 'nsr') { layer_template = getMainSection('NS View'); - layer_template += getChildrenTable(graph_parameters['view']['nsr']); + layer_template+= ''; + for (var key in layer_map['nsr']) { + if ( graph_parameters['view']['nsr'][key] ) { + var field_value = graph_parameters['view']['nsr'][key]; + if(key === 'create-time'){ + field_value = moment.unix(field_value).toISOString(); + } + layer_template += ''; + } + } + layer_template += '
' + layer_map['nsr'][key] + '' + field_value + '
'; + //layer_template += getChildrenTable(graph_parameters['view']['nsr']); } else if(filters.link.view[0] === 'vnfr') { layer_template = getMainSection('VNF View'); var vnfr_id = filters.link.group[0]; - layer_template += getChildrenTable(graph_parameters['view']['vnfr'][vnfr_id]); + + layer_template+= ''; + var vnfr_data = graph_parameters['view']['vnfr'][vnfr_id]; + for (var key in layer_map['vnfr']) { + if ( vnfr_data[key] ) { + var field_value = vnfr_data[key]; + if(key === 'create-time'){ + field_value = moment.unix(field_value).toISOString(); + } + layer_template += ''; + } + } + layer_template += '
' + layer_map['vnfr'][key] + '' + field_value + '
'; } } @@ -159,10 +220,10 @@ function updateLegend(view) { } var map = { - 'ip-address': 'IP', 'vnfd-id': 'Vnfd Id', 'vnfd-ref': 'Vnfd Ref', 'vim-account-id': 'Vim Id', + 'ip-address': 'IP', 'vnfd-id': 'Vnfd Id', 'vnfd-ref': 'Vnfd Ref', 'vim-account-id': 'VIM Id', 'member-vnf-index-ref': 'Member index', 'created-time': 'Created', 'id': 'Id', 'mgmt-network': 'Mgmt network', 'name': 'Name', 'type': 'Type', 'vim-network-name': 'Vim network name', 'connection-point-id': 'Cp Id', - 'vdu-id-ref': 'Vdu Id', 'nsr-id-ref': 'Nsr Id' + 'vdu-id-ref': 'Vdu Id', 'nsr-id-ref': 'Nsr Id', 'vim-id': 'VIM id' }; function vnfrDetails(vnfr) {