You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
3.4 KiB

6 years ago
10 years ago
10 years ago
10 years ago
  1. package master_ui
  2. import (
  3. "html/template"
  4. )
  5. var StatusTpl = template.Must(template.New("status").Parse(`<!DOCTYPE html>
  6. <html>
  7. <head>
  8. <title>SeaweedFS {{ .Version }}</title>
  9. <link rel="stylesheet" href="/seaweedfsstatic/bootstrap/3.3.1/css/bootstrap.min.css">
  10. </head>
  11. <body>
  12. <div class="container">
  13. <div class="page-header">
  14. <h1>
  15. <a href="https://github.com/chrislusf/seaweedfs"><img src="/seaweedfsstatic/seaweed50x50.png"></img></a>
  16. SeaweedFS <small>{{ .Version }}</small>
  17. </h1>
  18. </div>
  19. <div class="row">
  20. <div class="col-sm-6">
  21. <h2>Cluster status</h2>
  22. <table class="table table-condensed table-striped">
  23. <tbody>
  24. <tr>
  25. <th>Volume Size Limit</th>
  26. <td>{{ .VolumeSizeLimitMB }}MB</td>
  27. </tr>
  28. <tr>
  29. <th>Free</th>
  30. <td>{{ .Topology.Free }}</td>
  31. </tr>
  32. <tr>
  33. <th>Max</th>
  34. <td>{{ .Topology.Max }}</td>
  35. </tr>
  36. {{ with .RaftServer }}
  37. <tr>
  38. <th>Leader</th>
  39. <td><a href="http://{{ .Leader }}">{{ .Leader }}</a></td>
  40. </tr>
  41. <tr>
  42. <th>Other Masters</th>
  43. <td class="col-sm-5"><ul class="list-unstyled">
  44. {{ range $k, $p := .Peers }}
  45. <li><a href="http://{{ $p.Name }}/ui/index.html">{{ $p.Name }}</a></li>
  46. {{ end }}
  47. </ul></td>
  48. </tr>
  49. {{ end }}
  50. </tbody>
  51. </table>
  52. </div>
  53. <div class="col-sm-6">
  54. <h2>System Stats</h2>
  55. <table class="table table-condensed table-striped">
  56. <tr>
  57. <th>Concurrent Connections</th>
  58. <td>{{ .Counters.Connections.WeekCounter.Sum }}</td>
  59. </tr>
  60. {{ range $key, $val := .Stats }}
  61. <tr>
  62. <th>{{ $key }}</th>
  63. <td>{{ $val }}</td>
  64. </tr>
  65. {{ end }}
  66. </table>
  67. </div>
  68. </div>
  69. <div class="row">
  70. <h2>Topology</h2>
  71. <table class="table table-striped">
  72. <thead>
  73. <tr>
  74. <th>Data Center</th>
  75. <th>Rack</th>
  76. <th>RemoteAddr</th>
  77. <th>#Volumes</th>
  78. <th>Volume Ids</th>
  79. <th>#ErasureCodingShards</th>
  80. <th>Max</th>
  81. </tr>
  82. </thead>
  83. <tbody>
  84. {{ range $dc_index, $dc := .Topology.DataCenters }}
  85. {{ range $rack_index, $rack := $dc.Racks }}
  86. {{ range $dn_index, $dn := $rack.DataNodes }}
  87. <tr>
  88. <td><code>{{ $dc.Id }}</code></td>
  89. <td>{{ $rack.Id }}</td>
  90. <td><a href="http://{{ $dn.Url }}/ui/index.html">{{ $dn.Url }}</a>
  91. {{ if ne $dn.PublicUrl $dn.Url }}
  92. / <a href="http://{{ $dn.PublicUrl }}/ui/index.html">{{ $dn.PublicUrl }}</a>
  93. {{ end }}
  94. </td>
  95. <td>{{ $dn.Volumes }}</td>
  96. <td>{{ $dn.VolumeIds}}</td>
  97. <td>{{ $dn.EcShards }}</td>
  98. <td>{{ $dn.Max }}</td>
  99. </tr>
  100. {{ end }}
  101. {{ end }}
  102. {{ end }}
  103. </tbody>
  104. </table>
  105. </div>
  106. </div>
  107. </body>
  108. </html>
  109. `))