From: lombardof Date: Sat, 26 May 2018 15:11:13 +0000 (+0200) Subject: VNF instances list, show X-Git-Tag: v4.0.1~1 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F24%2F6224%2F2;p=osm%2FLW-UI.git VNF instances list, show Change-Id: Ie7802c541f1d025047ee98780b1796957eb54a8c Signed-off-by: lombardof --- diff --git a/instancehandler/template/instance_list.html b/instancehandler/template/instance_list.html index 52b3da4..ff76215 100644 --- a/instancehandler/template/instance_list.html +++ b/instancehandler/template/instance_list.html @@ -13,6 +13,7 @@ + {% endblock %} {% block title_header_big %} {{ block.super }} @@ -24,7 +25,7 @@ {% block breadcrumb_body %} {{ block.super }} -
  • Instances
  • +
  • {{ type|upper }} Instances
  • {% endblock %} {% block content_body %} @@ -34,96 +35,12 @@
    -
    -
    -

    Instances

    + {% if type == 'ns' %} + {% include 'instance_list_ns.html' %} + {% elif type == 'vnf' %} + {% include 'instance_list_vnf.html' %} + {% endif %} -
    - - - -
    - -
    -
    - - - - - - - - - - - - - - {% for i in instances %} - - - - - - - {% if i|get:"operational-status" == 'failed' %} - - {% elif i|get:"operational-status" == 'init' %} - - {% elif i|get:"operational-status" == 'running' %} - - {% else %} - - {% endif %} - {% if i|get:"config-status" == 'failed' %} - - {% elif i|get:"config-status" == 'init' %} - - {% elif i|get:"config-status" == 'running' %} - - {% elif i|get:"config-status" == 'configured' %} - - {% else %} - - {% endif %} - - - - - - {% endfor %} - -
    IdNameNsd nameOperational StatusConfig StatusDetailed StatusActions
    {{ i|get:"_id" }}{{ i|get:"short-name" }}{{ i|get:"nsd-name-ref" }}{{ i|get:"operational-status" }} {{ i|get:"operational-status" }} {{ i|get:"operational-status" }} {{ i|get:"operational-status" }}{{ i|get:"config-status" }} {{ i|get:"config-status" }} {{ i|get:"config-status" }} {{ i|get:"config-status" }} {{ i|get:"config-status" }}{{ i|get:"detailed-status" }} -
    - - - - - - - - -
    - -
    -
    -
    diff --git a/instancehandler/template/instance_list_ns.html b/instancehandler/template/instance_list_ns.html new file mode 100644 index 0000000..d6a8dbe --- /dev/null +++ b/instancehandler/template/instance_list_ns.html @@ -0,0 +1,95 @@ +{% load get %} +
    +
    +

    {{ type|upper }} Instances

    + +
    + + + +
    + +
    +
    + + + + + + + + + + + + + + {% for i in instances %} + + + + + + + {% if i|get:"operational-status" == 'failed' %} + + {% elif i|get:"operational-status" == 'init' %} + + {% elif i|get:"operational-status" == 'running' %} + + {% else %} + + {% endif %} + {% if i|get:"config-status" == 'failed' %} + + {% elif i|get:"config-status" == 'init' %} + + {% elif i|get:"config-status" == 'running' %} + + {% elif i|get:"config-status" == 'configured' %} + + {% else %} + + {% endif %} + + + + + + {% endfor %} + +
    IdNameNsd nameOperational StatusConfig StatusDetailed StatusActions
    {{ i|get:"_id" }}{{ i|get:"short-name" }}{{ i|get:"nsd-name-ref" }}{{ i|get:"operational-status" }}{{ i|get:"operational-status" }}{{ i|get:"operational-status" }}{{ i|get:"operational-status" }}{{ i|get:"config-status" }}{{ i|get:"config-status" }}{{ i|get:"config-status" }}{{ i|get:"config-status" }}{{ i|get:"config-status" }}{{ i|get:"detailed-status" }} +
    + + + + + + + + +
    + +
    +
    +
    diff --git a/instancehandler/template/instance_list_vnf.html b/instancehandler/template/instance_list_vnf.html new file mode 100644 index 0000000..4aa084e --- /dev/null +++ b/instancehandler/template/instance_list_vnf.html @@ -0,0 +1,56 @@ +{% load get %} +{% load date_tag %} + +
    +
    +

    {{ type|upper }} Instances

    + +
    + + + +
    + +
    +
    + + + + + + + + + + + + + {% for i in instances %} + + + + + + + + + + + + + {% endfor %} + +
    IdVNFDMember IndexNSCreated AtActions
    {{ i|get:"_id" }} {{ i|get:"vnfd-ref" }}{{ i|get:"member-vnf-index-ref" }}{{ i|get:"nsr-id-ref" }}{{ i|get:"created-time"|get_date }} +
    + + + +
    + +
    +
    +
    diff --git a/instancehandler/views.py b/instancehandler/views.py index 9ace8ee..a5118f6 100644 --- a/instancehandler/views.py +++ b/instancehandler/views.py @@ -27,8 +27,10 @@ def list(request, project_id=None, type=None): client = Client() if type == 'ns': result = client.ns_list() + elif type == 'vnf': + result = client.vnf_list() - return __response_handler(request, {'instances': result, 'type': 'ns', 'project_id': project_id}, 'instance_list.html') + return __response_handler(request, {'instances': result, 'type': type, 'project_id': project_id}, 'instance_list.html') @login_required @@ -111,7 +113,10 @@ def delete(request, project_id=None, instance_id=None, type=None): def show(request, project_id=None, instance_id=None, type=None): # result = {} client = Client() - result = client.ns_get(instance_id) + if type == 'ns': + result = client.ns_get(instance_id) + elif type == 'vnf': + result = client.vnf_get(instance_id) print result return __response_handler(request, result) diff --git a/lib/osm/osmclient/client.py b/lib/osm/osmclient/client.py index 0d38955..7a2d908 100644 --- a/lib/osm/osmclient/client.py +++ b/lib/osm/osmclient/client.py @@ -325,6 +325,7 @@ class Client(object): return self._send_post(_url, headers=headers, data=open('/tmp/' + package.name, 'rb')) return None + def vnf_packages_artifacts(self, id): token = self.get_token() if token: @@ -334,6 +335,26 @@ class Client(object): return self._send_get(_url, headers=self._headers) return None + def vnf_list(self): + token = self.get_token() + if token: + self._headers['Authorization'] = 'Bearer {}'.format(token) + self._headers['Content-Type'] = 'application/yaml' + self._headers['accept'] = 'application/json' + _url = "{0}/nslcm/v1/vnfrs".format(self._base_path) + return self._send_get(_url, headers=self._headers) + return None + + def vnf_get(self, id): + token = self.get_token() + if token: + self._headers['Authorization'] = 'Bearer {}'.format(token) + self._headers['Content-Type'] = 'application/json' + self._headers['accept'] = 'application/json' + _url = "{0}/nslcm/v1/vnfrs/{1}".format(self._base_path, id) + return self._send_get(_url, headers=self._headers) + return None + def _upload_package(self, filename, package): token = self.get_token() headers = {} diff --git a/projecthandler/template/project/osm/osm_project_left_sidebar.html b/projecthandler/template/project/osm/osm_project_left_sidebar.html index ec0b0f3..808303e 100644 --- a/projecthandler/template/project/osm/osm_project_left_sidebar.html +++ b/projecthandler/template/project/osm/osm_project_left_sidebar.html @@ -42,6 +42,12 @@ NS Instances + {% url "projects:instances:list" project_id=project_id type='vnf' as instance_ns_list_url %} +
  • + + VNF Instances + +
  • CONFIG
  • {% url "vim:list" type='ns' as vim_list_url %}
  • diff --git a/static/css/lwuitable.css b/static/css/lwuitable.css new file mode 100644 index 0000000..163effe --- /dev/null +++ b/static/css/lwuitable.css @@ -0,0 +1,35 @@ +.ellipsis { + /*display: block;*/ + white-space: nowrap; + max-width: 180px; + overflow: hidden; + text-overflow: ellipsis; + /*transition: all .2s linear; + padding: .5rem 1rem;*/ +} +/*max-width:1px;overflow:hidden; white-space:nowrap; text-overflow:ellipsis;*/ +.ellipsis:focus, .ellipsis:hover { + color: transparent; +} + +.ellipsis:focus:after, .ellipsis:hover:after { + content: attr(data-text); + overflow: visible; + text-overflow: inherit; + background: #fff; + position: absolute; + left: auto; + top: auto; + width: auto; + max-width: 20rem; + border: 1px solid #eaebec; + padding: 0 .5rem; + box-shadow: 0 2px 4px 0 rgba(0, 0, 0, .28); + white-space: normal; + display: block; + color: black; + margin-top: -1.25rem; + z-index: 1; + user-select: text!important; +} + diff --git a/static/src/instancehandler/instance_list.js b/static/src/instancehandler/instance_list.js index a590fa3..af66f16 100644 --- a/static/src/instancehandler/instance_list.js +++ b/static/src/instancehandler/instance_list.js @@ -66,7 +66,7 @@ function showInstanceDetails(url_info) { }, error: function (result) { dialog.modal('hide'); - bootbox.alert("An error occurred while retrieving the information for the NS"); + bootbox.alert("An error occurred while retrieving the information."); } }); }