container.htm 1.3 KB

12345678910111213141516171819202122232425262728
  1. <br />
  2. <ul class="cbi-tabmenu">
  3. <li id="cbi-tab-container_info"><a id="a-cbi-tab-container_info" href=""><%:Info%></a></li>
  4. <li id="cbi-tab-container_resources"><a id="a-cbi-tab-container_resources" href=""><%:Resources%></a></li>
  5. <li id="cbi-tab-container_stats"><a id="a-cbi-tab-container_stats" href=""><%:Stats%></a></li>
  6. <li id="cbi-tab-container_file"><a id="a-cbi-tab-container_file" href=""><%:File%></a></li>
  7. <li id="cbi-tab-container_console"><a id="a-cbi-tab-container_console" href=""><%:Console%></a></li>
  8. <li id="cbi-tab-container_inspect"><a id="a-cbi-tab-container_inspect" href=""><%:Inspect%></a></li>
  9. <li id="cbi-tab-container_logs"><a id="a-cbi-tab-container_logs" href=""><%:Logs%></a></li>
  10. </ul>
  11. <script>
  12. let re = /\/admin\/docker\/container\//
  13. let p = window.location.href
  14. let path = p.split(re)
  15. let container_id = path[1].split('/')[0] || path[1]
  16. let action = path[1].split('/')[1] || "info"
  17. let actions=["info","resources","stats","file","console","logs","inspect"]
  18. actions.forEach(function(item) {
  19. document.getElementById("a-cbi-tab-container_" + item).href= path[0]+"/admin/docker/container/"+container_id+'/'+item
  20. if (action === item) {
  21. document.getElementById("cbi-tab-container_" + item).className="cbi-tab"
  22. }
  23. else {
  24. document.getElementById("cbi-tab-container_" + item).className="cbi-tab-disabled"
  25. }
  26. })
  27. </script>