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.

85 lines
1.8 KiB

  1. package master_ui
  2. import (
  3. "github.com/dustin/go-humanize"
  4. "html/template"
  5. )
  6. var funcMap = template.FuncMap{
  7. "humanizeBytes": humanize.Bytes,
  8. }
  9. var StatusTpl = template.Must(template.New("status").Funcs(funcMap).Parse(`<!DOCTYPE html>
  10. <html>
  11. <head>
  12. <title>SeaweedFS Filer</title>
  13. <link rel="icon" href="http://7viirv.com1.z0.glb.clouddn.com/seaweed_favicon.png" sizes="32x32" />
  14. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
  15. </head>
  16. <body>
  17. <div class="container">
  18. <div class="page-header">
  19. <h1>
  20. <img src="http://7viirv.com1.z0.glb.clouddn.com/seaweed50x50.png"></img>
  21. SeaweedFS Filer
  22. </h1>
  23. </div>
  24. <div class="row">
  25. {{ range $entry := .Breadcrumbs }}
  26. <a href={{ $entry.Link }} >
  27. {{ $entry.Name }}
  28. </a>
  29. {{ end }}
  30. </div>
  31. <div class="row">
  32. <table width="90%">
  33. {{$path := .Path }}
  34. {{ range $entry_index, $entry := .Entries }}
  35. <tr>
  36. <td>
  37. {{if $entry.IsDirectory}}
  38. <img src="https://www.w3.org/TR/WWWicn/folder.gif" width="20" height="23">
  39. <a href={{ print $path "/" $entry.Name "/"}} >
  40. {{ $entry.Name }}
  41. </a>
  42. {{else}}
  43. <a href={{ print $path "/" $entry.Name }} >
  44. {{ $entry.Name }}
  45. </a>
  46. {{end}}
  47. </td>
  48. <td align="right">
  49. {{if $entry.IsDirectory}}
  50. {{else}}
  51. {{ $entry.Mime }}
  52. {{end}}
  53. </td>
  54. <td align="right">
  55. {{if $entry.IsDirectory}}
  56. {{else}}
  57. {{ $entry.Size | humanizeBytes }}
  58. &nbsp;&nbsp;&nbsp;
  59. {{end}}
  60. </td>
  61. <td>
  62. {{ $entry.Timestamp.Format "2006-01-02 15:04" }}
  63. </td>
  64. </tr>
  65. {{ end }}
  66. </table>
  67. </div>
  68. {{if .ShouldDisplayLoadMore}}
  69. <div class="row">
  70. <a href={{ print .Path "?limit=" .Limit "&lastFileName=" .LastFileName}} >
  71. Load more
  72. </a>
  73. </div>
  74. {{end}}
  75. </div>
  76. </body>
  77. </html>
  78. `))