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.

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