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.

98 lines
2.8 KiB

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>Seaweed File System {{ .Version }}</title>
  9. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
  10. </head>
  11. <body>
  12. <div class="container">
  13. <div class="page-header">
  14. <h1>Seaweed File System <small>{{ .Version }}</small></h1>
  15. </div>
  16. <div class="row">
  17. <div class="col-sm-6">
  18. <h2>Cluster status</h2>
  19. <table class="table">
  20. <tbody>
  21. <tr>
  22. <th>Free</th>
  23. <td>{{ .Topology.Free }}</td>
  24. </tr>
  25. <tr>
  26. <th>Max</th>
  27. <td>{{ .Topology.Max }}</td>
  28. </tr>
  29. <tr>
  30. <th>Leader</th>
  31. <td><a href="http://{{ .Leader }}">{{ .Leader }}</a></td>
  32. </tr>
  33. <tr>
  34. <td class="col-sm-2 field-label"><label>Peers:</label></td>
  35. <td class="col-sm-10"><ul class="list-unstyled">
  36. {{ range $k, $p := .Peers }}
  37. <li><a href="{{ $p.ConnectionString }}">{{ $p.Name }}</a></li>
  38. {{ end }}
  39. </ul></td>
  40. </tr>
  41. </tbody>
  42. </table>
  43. </div>
  44. <div class="col-sm-6">
  45. <h2>System Stats</h2>
  46. <table class="table table-condensed table-striped">
  47. <tr>
  48. <th>Concurrent Connections</th>
  49. <td>{{ .Counters.Connections.WeekCounter.Count }}</td>
  50. </tr>
  51. {{ range $key, $val := .Stats }}
  52. <tr>
  53. <th>{{ $key }}</th>
  54. <td>{{ $val }}</td>
  55. </tr>
  56. {{ end }}
  57. </table>
  58. </div>
  59. </div>
  60. <div class="row">
  61. <h2>Topology</h2>
  62. <table class="table table-striped">
  63. <thead>
  64. <tr>
  65. <th>Data Center</th>
  66. <th>Rack</th>
  67. <th>RemoteAddr</th>
  68. <th>#Volumes</th>
  69. <th>Max</th>
  70. </tr>
  71. </thead>
  72. <tbody>
  73. {{ range $dc_index, $dc := .Topology.DataCenters }}
  74. {{ range $rack_index, $rack := $dc.Racks }}
  75. {{ range $dn_index, $dn := $rack.DataNodes }}
  76. <tr>
  77. <td><code>{{ $dc.Id }}</code></td>
  78. <td>{{ $rack.Id }}</td>
  79. <td><a href="http://{{ $dn.Url }}/ui/index.html">{{ $dn.Url }}</a></td>
  80. <td>{{ $dn.Volumes }}</td>
  81. <td>{{ $dn.Max }}</td>
  82. </tr>
  83. {{ end }}
  84. {{ end }}
  85. {{ end }}
  86. </tbody>
  87. </table>
  88. </div>
  89. </div>
  90. </body>
  91. </html>
  92. `))