templates.go 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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>Volume Ids</th>
  75. <th>#ErasureCodingShards</th>
  76. <th>Max</th>
  77. </tr>
  78. </thead>
  79. <tbody>
  80. {{ range $dc_index, $dc := .Topology.DataCenters }}
  81. {{ range $rack_index, $rack := $dc.Racks }}
  82. {{ range $dn_index, $dn := $rack.DataNodes }}
  83. <tr>
  84. <td><code>{{ $dc.Id }}</code></td>
  85. <td>{{ $rack.Id }}</td>
  86. <td><a href="http://{{ $dn.Url }}/ui/index.html">{{ $dn.Url }}</a></td>
  87. <td>{{ $dn.Volumes }}</td>
  88. <td>{{ $dn.VolumeIds}}</td>
  89. <td>{{ $dn.EcShards }}</td>
  90. <td>{{ $dn.Max }}</td>
  91. </tr>
  92. {{ end }}
  93. {{ end }}
  94. {{ end }}
  95. </tbody>
  96. </table>
  97. </div>
  98. </div>
  99. </body>
  100. </html>
  101. `))