Fix 1025. Do not remove last project reference if it will be deleted
[osm/NBI.git] / osm_nbi / html_out.py
index 1883a96..5fd12ce 100644 (file)
@@ -46,6 +46,8 @@ html_start = """
       <a href="/osm/admin/v1/vim_accounts">VIMs </a>
       <a href="/osm/admin/v1/wim_accounts">WIMs </a>
       <a href="/osm/admin/v1/sdns">SDNs </a>
+      <a href="/osm/admin/v1/k8sclusters">K8s_clusters </a>
+      <a href="/osm/admin/v1/k8srepos">K8s_repos </a>
       <a href="/osm/admin/v1/tokens?METHOD=DELETE">logout </a>
     </div>
   </div>
@@ -143,12 +145,14 @@ def format(data, request, response, toke_info):
             return
         else:
             return html_auth2.format(error=data)
+    if request.path_info in ("/version", "/system"):
+        return "<pre>" + yaml.safe_dump(data, explicit_start=False, indent=4, default_flow_style=False) + "</pre>"
     body = html_body.format(item=request.path_info)
     if response.status and response.status > 202:
         body += html_body_error.format(yaml.safe_dump(data, explicit_start=True, indent=4, default_flow_style=False))
     elif isinstance(data, (list, tuple)):
         if request.path_info == "/vnfpkgm/v1/vnf_packages":
-            body += html_upload_body.format(request.path_info, "VNFD")
+            body += html_upload_body.format(request.path_info + "_content", "VNFD")
         elif request.path_info == "/nsd/v1/ns_descriptors":
             body += html_upload_body.format(request.path_info + "_content", "NSD")
         elif request.path_info == "/nst/v1/nst_templates":
@@ -186,7 +190,7 @@ def format(data, request, response, toke_info):
         if toke_info.get("username"):
             user_text += "user: {}".format(toke_info.get("username"))
         if toke_info.get("project_id"):
-            user_text += ", project: {}".format(toke_info.get("project_id"))
+            user_text += ", project: {}".format(toke_info.get("project_name"))
     return html_start.format(user_text) + body + html_end
     # yaml.safe_dump(data, explicit_start=True, indent=4, default_flow_style=False)
     # tags=False,