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.

102 lines
2.9 KiB

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="icon" href="http://7viirv.com1.z0.glb.clouddn.com/seaweed_favicon.png" sizes="32x32" />
  10. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
  11. </head>
  12. <body>
  13. <div class="container">
  14. <div class="page-header">
  15. <h1>
  16. <img src="http://7viirv.com1.z0.glb.clouddn.com/seaweed50x50.png"></img>
  17. SeaweedFS <small>{{ .Version }}</small>
  18. </h1>
  19. </div>
  20. <div class="row">
  21. <div class="col-sm-6">
  22. <h2>Cluster status</h2>
  23. <table class="table">
  24. <tbody>
  25. <tr>
  26. <th>Free</th>
  27. <td>{{ .Topology.Free }}</td>
  28. </tr>
  29. <tr>
  30. <th>Max</th>
  31. <td>{{ .Topology.Max }}</td>
  32. </tr>
  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>Peers:</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. </tbody>
  46. </table>
  47. </div>
  48. <div class="col-sm-6">
  49. <h2>System Stats</h2>
  50. <table class="table table-condensed table-striped">
  51. <tr>
  52. <th>Concurrent Connections</th>
  53. <td>{{ .Counters.Connections.WeekCounter.Sum }}</td>
  54. </tr>
  55. {{ range $key, $val := .Stats }}
  56. <tr>
  57. <th>{{ $key }}</th>
  58. <td>{{ $val }}</td>
  59. </tr>
  60. {{ end }}
  61. </table>
  62. </div>
  63. </div>
  64. <div class="row">
  65. <h2>Topology</h2>
  66. <table class="table table-striped">
  67. <thead>
  68. <tr>
  69. <th>Data Center</th>
  70. <th>Rack</th>
  71. <th>RemoteAddr</th>
  72. <th>#Volumes</th>
  73. <th>Max</th>
  74. </tr>
  75. </thead>
  76. <tbody>
  77. {{ range $dc_index, $dc := .Topology.DataCenters }}
  78. {{ range $rack_index, $rack := $dc.Racks }}
  79. {{ range $dn_index, $dn := $rack.DataNodes }}
  80. <tr>
  81. <td><code>{{ $dc.Id }}</code></td>
  82. <td>{{ $rack.Id }}</td>
  83. <td><a href="http://{{ $dn.Url }}/ui/index.html">{{ $dn.Url }}</a></td>
  84. <td>{{ $dn.Volumes }}</td>
  85. <td>{{ $dn.Max }}</td>
  86. </tr>
  87. {{ end }}
  88. {{ end }}
  89. {{ end }}
  90. </tbody>
  91. </table>
  92. </div>
  93. </div>
  94. </body>
  95. </html>
  96. `))