templates.go 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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">
  23. <tbody>
  24. <tr>
  25. <th>Free</th>
  26. <td>{{ .Topology.Free }}</td>
  27. </tr>
  28. <tr>
  29. <th>Max</th>
  30. <td>{{ .Topology.Max }}</td>
  31. </tr>
  32. {{ with .RaftServer }}
  33. <tr>
  34. <th>Leader</th>
  35. <td><a href="http://{{ .Leader }}">{{ .Leader }}</a></td>
  36. </tr>
  37. <tr>
  38. <td class="col-sm-2 field-label"><label>Other Masters:</label></td>
  39. <td class="col-sm-10"><ul class="list-unstyled">
  40. {{ range $k, $p := .Peers }}
  41. <li><a href="http://{{ $p.Name }}/ui/index.html">{{ $p.Name }}</a></li>
  42. {{ end }}
  43. </ul></td>
  44. </tr>
  45. {{ end }}
  46. </tbody>
  47. </table>
  48. </div>
  49. <div class="col-sm-6">
  50. <h2>System Stats</h2>
  51. <table class="table table-condensed table-striped">
  52. <tr>
  53. <th>Concurrent Connections</th>
  54. <td>{{ .Counters.Connections.WeekCounter.Sum }}</td>
  55. </tr>
  56. {{ range $key, $val := .Stats }}
  57. <tr>
  58. <th>{{ $key }}</th>
  59. <td>{{ $val }}</td>
  60. </tr>
  61. {{ end }}
  62. </table>
  63. </div>
  64. </div>
  65. <div class="row">
  66. <h2>Topology</h2>
  67. <table class="table table-striped">
  68. <thead>
  69. <tr>
  70. <th>Data Center</th>
  71. <th>Rack</th>
  72. <th>RemoteAddr</th>
  73. <th>#Volumes</th>
  74. <th>#ErasureCodingShards</th>
  75. <th>Max</th>
  76. </tr>
  77. </thead>
  78. <tbody>
  79. {{ range $dc_index, $dc := .Topology.DataCenters }}
  80. {{ range $rack_index, $rack := $dc.Racks }}
  81. {{ range $dn_index, $dn := $rack.DataNodes }}
  82. <tr>
  83. <td><code>{{ $dc.Id }}</code></td>
  84. <td>{{ $rack.Id }}</td>
  85. <td><a href="http://{{ $dn.Url }}/ui/index.html">{{ $dn.Url }}</a></td>
  86. <td>{{ $dn.Volumes }}</td>
  87. <td>{{ $dn.EcShards }}</td>
  88. <td>{{ $dn.Max }}</td>
  89. </tr>
  90. {{ end }}
  91. {{ end }}
  92. {{ end }}
  93. </tbody>
  94. </table>
  95. </div>
  96. </div>
  97. </body>
  98. </html>
  99. `))