collection_details_templ.go 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  1. // Code generated by templ - DO NOT EDIT.
  2. // templ: version: v0.3.906
  3. package app
  4. //lint:file-ignore SA4006 This context is only used if a nested component is present.
  5. import "github.com/a-h/templ"
  6. import templruntime "github.com/a-h/templ/runtime"
  7. import (
  8. "fmt"
  9. "github.com/seaweedfs/seaweedfs/weed/admin/dash"
  10. "github.com/seaweedfs/seaweedfs/weed/util"
  11. )
  12. func CollectionDetails(data dash.CollectionDetailsData) templ.Component {
  13. return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
  14. templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
  15. if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
  16. return templ_7745c5c3_CtxErr
  17. }
  18. templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
  19. if !templ_7745c5c3_IsBuffer {
  20. defer func() {
  21. templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
  22. if templ_7745c5c3_Err == nil {
  23. templ_7745c5c3_Err = templ_7745c5c3_BufErr
  24. }
  25. }()
  26. }
  27. ctx = templ.InitializeContext(ctx)
  28. templ_7745c5c3_Var1 := templ.GetChildren(ctx)
  29. if templ_7745c5c3_Var1 == nil {
  30. templ_7745c5c3_Var1 = templ.NopComponent
  31. }
  32. ctx = templ.ClearChildren(ctx)
  33. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom\"><div><h1 class=\"h2\"><i class=\"fas fa-layer-group me-2\"></i>Collection Details: ")
  34. if templ_7745c5c3_Err != nil {
  35. return templ_7745c5c3_Err
  36. }
  37. var templ_7745c5c3_Var2 string
  38. templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(data.CollectionName)
  39. if templ_7745c5c3_Err != nil {
  40. return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/collection_details.templ`, Line: 13, Col: 83}
  41. }
  42. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
  43. if templ_7745c5c3_Err != nil {
  44. return templ_7745c5c3_Err
  45. }
  46. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "</h1><nav aria-label=\"breadcrumb\"><ol class=\"breadcrumb\"><li class=\"breadcrumb-item\"><a href=\"/admin\" class=\"text-decoration-none\">Dashboard</a></li><li class=\"breadcrumb-item\"><a href=\"/cluster/collections\" class=\"text-decoration-none\">Collections</a></li><li class=\"breadcrumb-item active\" aria-current=\"page\">")
  47. if templ_7745c5c3_Err != nil {
  48. return templ_7745c5c3_Err
  49. }
  50. var templ_7745c5c3_Var3 string
  51. templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(data.CollectionName)
  52. if templ_7745c5c3_Err != nil {
  53. return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/collection_details.templ`, Line: 19, Col: 80}
  54. }
  55. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
  56. if templ_7745c5c3_Err != nil {
  57. return templ_7745c5c3_Err
  58. }
  59. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "</li></ol></nav></div><div class=\"btn-toolbar mb-2 mb-md-0\"><div class=\"btn-group me-2\"><button type=\"button\" class=\"btn btn-sm btn-outline-secondary\" onclick=\"history.back()\"><i class=\"fas fa-arrow-left me-1\"></i>Back</button> <button type=\"button\" class=\"btn btn-sm btn-outline-primary\" onclick=\"window.location.reload()\"><i class=\"fas fa-refresh me-1\"></i>Refresh</button></div></div></div><!-- Collection Summary --><div class=\"row mb-4\"><div class=\"col-md-3\"><div class=\"card text-bg-primary\"><div class=\"card-body\"><div class=\"d-flex justify-content-between\"><div><h6 class=\"card-title\">Regular Volumes</h6><h4 class=\"mb-0\">")
  60. if templ_7745c5c3_Err != nil {
  61. return templ_7745c5c3_Err
  62. }
  63. var templ_7745c5c3_Var4 string
  64. templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", data.TotalVolumes))
  65. if templ_7745c5c3_Err != nil {
  66. return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/collection_details.templ`, Line: 43, Col: 61}
  67. }
  68. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
  69. if templ_7745c5c3_Err != nil {
  70. return templ_7745c5c3_Err
  71. }
  72. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "</h4><small>Traditional volumes</small></div><div class=\"align-self-center\"><i class=\"fas fa-database fa-2x\"></i></div></div></div></div></div><div class=\"col-md-3\"><div class=\"card text-bg-info\"><div class=\"card-body\"><div class=\"d-flex justify-content-between\"><div><h6 class=\"card-title\">EC Volumes</h6><h4 class=\"mb-0\">")
  73. if templ_7745c5c3_Err != nil {
  74. return templ_7745c5c3_Err
  75. }
  76. var templ_7745c5c3_Var5 string
  77. templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", data.TotalEcVolumes))
  78. if templ_7745c5c3_Err != nil {
  79. return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/collection_details.templ`, Line: 59, Col: 63}
  80. }
  81. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
  82. if templ_7745c5c3_Err != nil {
  83. return templ_7745c5c3_Err
  84. }
  85. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "</h4><small>Erasure coded volumes</small></div><div class=\"align-self-center\"><i class=\"fas fa-th-large fa-2x\"></i></div></div></div></div></div><div class=\"col-md-3\"><div class=\"card text-bg-success\"><div class=\"card-body\"><div class=\"d-flex justify-content-between\"><div><h6 class=\"card-title\">Total Files</h6><h4 class=\"mb-0\">")
  86. if templ_7745c5c3_Err != nil {
  87. return templ_7745c5c3_Err
  88. }
  89. var templ_7745c5c3_Var6 string
  90. templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", data.TotalFiles))
  91. if templ_7745c5c3_Err != nil {
  92. return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/collection_details.templ`, Line: 75, Col: 59}
  93. }
  94. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
  95. if templ_7745c5c3_Err != nil {
  96. return templ_7745c5c3_Err
  97. }
  98. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "</h4><small>Files stored</small></div><div class=\"align-self-center\"><i class=\"fas fa-file fa-2x\"></i></div></div></div></div></div><div class=\"col-md-3\"><div class=\"card text-bg-warning\"><div class=\"card-body\"><div class=\"d-flex justify-content-between\"><div><h6 class=\"card-title\">Total Size (Logical)</h6><h4 class=\"mb-0\">")
  99. if templ_7745c5c3_Err != nil {
  100. return templ_7745c5c3_Err
  101. }
  102. var templ_7745c5c3_Var7 string
  103. templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(util.BytesToHumanReadable(uint64(data.TotalSize)))
  104. if templ_7745c5c3_Err != nil {
  105. return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/collection_details.templ`, Line: 91, Col: 74}
  106. }
  107. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
  108. if templ_7745c5c3_Err != nil {
  109. return templ_7745c5c3_Err
  110. }
  111. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "</h4><small>Data stored (regular volumes only)</small></div><div class=\"align-self-center\"><i class=\"fas fa-hdd fa-2x\"></i></div></div></div></div></div></div><!-- Size Information Note --><div class=\"alert alert-info\" role=\"alert\"><i class=\"fas fa-info-circle me-2\"></i> <strong>Size Information:</strong> Logical size represents the actual data stored (regular volumes only). EC volumes show shard counts instead of size - physical storage for EC volumes is approximately 1.4x the original data due to erasure coding redundancy.</div><!-- Pagination Info --><div class=\"d-flex justify-content-between align-items-center mb-3\"><div class=\"d-flex align-items-center\"><span class=\"me-3\">Showing ")
  112. if templ_7745c5c3_Err != nil {
  113. return templ_7745c5c3_Err
  114. }
  115. var templ_7745c5c3_Var8 string
  116. templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", (data.Page-1)*data.PageSize+1))
  117. if templ_7745c5c3_Err != nil {
  118. return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/collection_details.templ`, Line: 115, Col: 63}
  119. }
  120. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
  121. if templ_7745c5c3_Err != nil {
  122. return templ_7745c5c3_Err
  123. }
  124. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, " to ")
  125. if templ_7745c5c3_Err != nil {
  126. return templ_7745c5c3_Err
  127. }
  128. var templ_7745c5c3_Var9 string
  129. templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", func() int {
  130. end := data.Page * data.PageSize
  131. totalItems := data.TotalVolumes + data.TotalEcVolumes
  132. if end > totalItems {
  133. return totalItems
  134. }
  135. return end
  136. }()))
  137. if templ_7745c5c3_Err != nil {
  138. return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/collection_details.templ`, Line: 122, Col: 8}
  139. }
  140. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
  141. if templ_7745c5c3_Err != nil {
  142. return templ_7745c5c3_Err
  143. }
  144. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, " of ")
  145. if templ_7745c5c3_Err != nil {
  146. return templ_7745c5c3_Err
  147. }
  148. var templ_7745c5c3_Var10 string
  149. templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", data.TotalVolumes+data.TotalEcVolumes))
  150. if templ_7745c5c3_Err != nil {
  151. return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/collection_details.templ`, Line: 122, Col: 72}
  152. }
  153. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
  154. if templ_7745c5c3_Err != nil {
  155. return templ_7745c5c3_Err
  156. }
  157. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, " items</span><div class=\"d-flex align-items-center\"><label for=\"pageSize\" class=\"form-label me-2 mb-0\">Show:</label> <select id=\"pageSize\" class=\"form-select form-select-sm\" style=\"width: auto;\" onchange=\"changePageSize(this.value)\"><option value=\"10\"")
  158. if templ_7745c5c3_Err != nil {
  159. return templ_7745c5c3_Err
  160. }
  161. if data.PageSize == 10 {
  162. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, " selected")
  163. if templ_7745c5c3_Err != nil {
  164. return templ_7745c5c3_Err
  165. }
  166. }
  167. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, ">10</option> <option value=\"25\"")
  168. if templ_7745c5c3_Err != nil {
  169. return templ_7745c5c3_Err
  170. }
  171. if data.PageSize == 25 {
  172. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, " selected")
  173. if templ_7745c5c3_Err != nil {
  174. return templ_7745c5c3_Err
  175. }
  176. }
  177. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, ">25</option> <option value=\"50\"")
  178. if templ_7745c5c3_Err != nil {
  179. return templ_7745c5c3_Err
  180. }
  181. if data.PageSize == 50 {
  182. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, " selected")
  183. if templ_7745c5c3_Err != nil {
  184. return templ_7745c5c3_Err
  185. }
  186. }
  187. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, ">50</option> <option value=\"100\"")
  188. if templ_7745c5c3_Err != nil {
  189. return templ_7745c5c3_Err
  190. }
  191. if data.PageSize == 100 {
  192. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, " selected")
  193. if templ_7745c5c3_Err != nil {
  194. return templ_7745c5c3_Err
  195. }
  196. }
  197. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, ">100</option></select> <span class=\"ms-2\">per page</span></div></div></div><!-- Volumes Table --><div class=\"table-responsive\"><table class=\"table table-striped table-hover\" id=\"volumesTable\"><thead><tr><th><a href=\"#\" onclick=\"sortBy('volume_id')\" class=\"text-dark text-decoration-none\">Volume ID ")
  198. if templ_7745c5c3_Err != nil {
  199. return templ_7745c5c3_Err
  200. }
  201. if data.SortBy == "volume_id" {
  202. if data.SortOrder == "asc" {
  203. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "<i class=\"fas fa-sort-up ms-1\"></i>")
  204. if templ_7745c5c3_Err != nil {
  205. return templ_7745c5c3_Err
  206. }
  207. } else {
  208. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "<i class=\"fas fa-sort-down ms-1\"></i>")
  209. if templ_7745c5c3_Err != nil {
  210. return templ_7745c5c3_Err
  211. }
  212. }
  213. } else {
  214. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "<i class=\"fas fa-sort ms-1 text-muted\"></i>")
  215. if templ_7745c5c3_Err != nil {
  216. return templ_7745c5c3_Err
  217. }
  218. }
  219. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "</a></th><th><a href=\"#\" onclick=\"sortBy('type')\" class=\"text-dark text-decoration-none\">Type ")
  220. if templ_7745c5c3_Err != nil {
  221. return templ_7745c5c3_Err
  222. }
  223. if data.SortBy == "type" {
  224. if data.SortOrder == "asc" {
  225. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "<i class=\"fas fa-sort-up ms-1\"></i>")
  226. if templ_7745c5c3_Err != nil {
  227. return templ_7745c5c3_Err
  228. }
  229. } else {
  230. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "<i class=\"fas fa-sort-down ms-1\"></i>")
  231. if templ_7745c5c3_Err != nil {
  232. return templ_7745c5c3_Err
  233. }
  234. }
  235. } else {
  236. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "<i class=\"fas fa-sort ms-1 text-muted\"></i>")
  237. if templ_7745c5c3_Err != nil {
  238. return templ_7745c5c3_Err
  239. }
  240. }
  241. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "</a></th><th class=\"text-dark\">Logical Size / Shard Count</th><th class=\"text-dark\">Files</th><th class=\"text-dark\">Status</th><th class=\"text-dark\">Actions</th></tr></thead> <tbody>")
  242. if templ_7745c5c3_Err != nil {
  243. return templ_7745c5c3_Err
  244. }
  245. for _, volume := range data.RegularVolumes {
  246. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "<tr><td><strong>")
  247. if templ_7745c5c3_Err != nil {
  248. return templ_7745c5c3_Err
  249. }
  250. var templ_7745c5c3_Var11 string
  251. templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", volume.Id))
  252. if templ_7745c5c3_Err != nil {
  253. return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/collection_details.templ`, Line: 182, Col: 44}
  254. }
  255. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
  256. if templ_7745c5c3_Err != nil {
  257. return templ_7745c5c3_Err
  258. }
  259. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "</strong></td><td><span class=\"badge bg-primary\"><i class=\"fas fa-database me-1\"></i>Regular</span></td><td>")
  260. if templ_7745c5c3_Err != nil {
  261. return templ_7745c5c3_Err
  262. }
  263. var templ_7745c5c3_Var12 string
  264. templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(util.BytesToHumanReadable(volume.Size))
  265. if templ_7745c5c3_Err != nil {
  266. return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/collection_details.templ`, Line: 190, Col: 46}
  267. }
  268. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
  269. if templ_7745c5c3_Err != nil {
  270. return templ_7745c5c3_Err
  271. }
  272. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "</td><td>")
  273. if templ_7745c5c3_Err != nil {
  274. return templ_7745c5c3_Err
  275. }
  276. var templ_7745c5c3_Var13 string
  277. templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", volume.FileCount))
  278. if templ_7745c5c3_Err != nil {
  279. return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/collection_details.templ`, Line: 193, Col: 43}
  280. }
  281. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
  282. if templ_7745c5c3_Err != nil {
  283. return templ_7745c5c3_Err
  284. }
  285. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "</td><td>")
  286. if templ_7745c5c3_Err != nil {
  287. return templ_7745c5c3_Err
  288. }
  289. if volume.ReadOnly {
  290. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "<span class=\"badge bg-warning\">Read Only</span>")
  291. if templ_7745c5c3_Err != nil {
  292. return templ_7745c5c3_Err
  293. }
  294. } else {
  295. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "<span class=\"badge bg-success\">Read/Write</span>")
  296. if templ_7745c5c3_Err != nil {
  297. return templ_7745c5c3_Err
  298. }
  299. }
  300. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "</td><td><div class=\"btn-group\" role=\"group\"><button type=\"button\" class=\"btn btn-sm btn-outline-primary\" onclick=\"showVolumeDetails(event)\" data-volume-id=\"")
  301. if templ_7745c5c3_Err != nil {
  302. return templ_7745c5c3_Err
  303. }
  304. var templ_7745c5c3_Var14 string
  305. templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", volume.Id))
  306. if templ_7745c5c3_Err != nil {
  307. return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/collection_details.templ`, Line: 206, Col: 55}
  308. }
  309. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
  310. if templ_7745c5c3_Err != nil {
  311. return templ_7745c5c3_Err
  312. }
  313. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "\" data-server=\"")
  314. if templ_7745c5c3_Err != nil {
  315. return templ_7745c5c3_Err
  316. }
  317. var templ_7745c5c3_Var15 string
  318. templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(volume.Server)
  319. if templ_7745c5c3_Err != nil {
  320. return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/collection_details.templ`, Line: 207, Col: 37}
  321. }
  322. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
  323. if templ_7745c5c3_Err != nil {
  324. return templ_7745c5c3_Err
  325. }
  326. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "\" title=\"View volume details\"><i class=\"fas fa-info-circle\"></i></button></div></td></tr>")
  327. if templ_7745c5c3_Err != nil {
  328. return templ_7745c5c3_Err
  329. }
  330. }
  331. for _, ecVolume := range data.EcVolumes {
  332. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "<tr><td><strong>")
  333. if templ_7745c5c3_Err != nil {
  334. return templ_7745c5c3_Err
  335. }
  336. var templ_7745c5c3_Var16 string
  337. templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", ecVolume.VolumeID))
  338. if templ_7745c5c3_Err != nil {
  339. return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/collection_details.templ`, Line: 220, Col: 52}
  340. }
  341. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
  342. if templ_7745c5c3_Err != nil {
  343. return templ_7745c5c3_Err
  344. }
  345. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "</strong></td><td><span class=\"badge bg-info\"><i class=\"fas fa-th-large me-1\"></i>EC</span></td><td><span class=\"badge bg-primary\">")
  346. if templ_7745c5c3_Err != nil {
  347. return templ_7745c5c3_Err
  348. }
  349. var templ_7745c5c3_Var17 string
  350. templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d/14", ecVolume.TotalShards))
  351. if templ_7745c5c3_Err != nil {
  352. return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/collection_details.templ`, Line: 228, Col: 81}
  353. }
  354. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
  355. if templ_7745c5c3_Err != nil {
  356. return templ_7745c5c3_Err
  357. }
  358. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "</span></td><td><span class=\"text-muted\">-</span></td><td>")
  359. if templ_7745c5c3_Err != nil {
  360. return templ_7745c5c3_Err
  361. }
  362. if ecVolume.IsComplete {
  363. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "<span class=\"badge bg-success\"><i class=\"fas fa-check me-1\"></i>Complete</span>")
  364. if templ_7745c5c3_Err != nil {
  365. return templ_7745c5c3_Err
  366. }
  367. } else {
  368. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "<span class=\"badge bg-warning\"><i class=\"fas fa-exclamation-triangle me-1\"></i> Missing ")
  369. if templ_7745c5c3_Err != nil {
  370. return templ_7745c5c3_Err
  371. }
  372. var templ_7745c5c3_Var18 string
  373. templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", len(ecVolume.MissingShards)))
  374. if templ_7745c5c3_Err != nil {
  375. return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/collection_details.templ`, Line: 241, Col: 64}
  376. }
  377. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
  378. if templ_7745c5c3_Err != nil {
  379. return templ_7745c5c3_Err
  380. }
  381. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, " shards</span>")
  382. if templ_7745c5c3_Err != nil {
  383. return templ_7745c5c3_Err
  384. }
  385. }
  386. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "</td><td><div class=\"btn-group\" role=\"group\"><button type=\"button\" class=\"btn btn-sm btn-outline-info\" onclick=\"showEcVolumeDetails(event)\" data-volume-id=\"")
  387. if templ_7745c5c3_Err != nil {
  388. return templ_7745c5c3_Err
  389. }
  390. var templ_7745c5c3_Var19 string
  391. templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", ecVolume.VolumeID))
  392. if templ_7745c5c3_Err != nil {
  393. return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/collection_details.templ`, Line: 249, Col: 63}
  394. }
  395. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
  396. if templ_7745c5c3_Err != nil {
  397. return templ_7745c5c3_Err
  398. }
  399. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, "\" title=\"View EC volume details\"><i class=\"fas fa-info-circle\"></i></button> ")
  400. if templ_7745c5c3_Err != nil {
  401. return templ_7745c5c3_Err
  402. }
  403. if !ecVolume.IsComplete {
  404. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "<button type=\"button\" class=\"btn btn-sm btn-outline-warning\" onclick=\"repairEcVolume(event)\" data-volume-id=\"")
  405. if templ_7745c5c3_Err != nil {
  406. return templ_7745c5c3_Err
  407. }
  408. var templ_7745c5c3_Var20 string
  409. templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", ecVolume.VolumeID))
  410. if templ_7745c5c3_Err != nil {
  411. return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/collection_details.templ`, Line: 256, Col: 64}
  412. }
  413. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20))
  414. if templ_7745c5c3_Err != nil {
  415. return templ_7745c5c3_Err
  416. }
  417. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "\" title=\"Repair missing shards\"><i class=\"fas fa-wrench\"></i></button>")
  418. if templ_7745c5c3_Err != nil {
  419. return templ_7745c5c3_Err
  420. }
  421. }
  422. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "</div></td></tr>")
  423. if templ_7745c5c3_Err != nil {
  424. return templ_7745c5c3_Err
  425. }
  426. }
  427. if len(data.RegularVolumes) == 0 && len(data.EcVolumes) == 0 {
  428. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "<tr><td colspan=\"6\" class=\"text-center text-muted py-4\"><i class=\"fas fa-info-circle me-2\"></i> No volumes found for collection \"")
  429. if templ_7745c5c3_Err != nil {
  430. return templ_7745c5c3_Err
  431. }
  432. var templ_7745c5c3_Var21 string
  433. templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(data.CollectionName)
  434. if templ_7745c5c3_Err != nil {
  435. return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/collection_details.templ`, Line: 271, Col: 60}
  436. }
  437. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21))
  438. if templ_7745c5c3_Err != nil {
  439. return templ_7745c5c3_Err
  440. }
  441. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, "\"</td></tr>")
  442. if templ_7745c5c3_Err != nil {
  443. return templ_7745c5c3_Err
  444. }
  445. }
  446. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "</tbody></table></div><!-- Pagination -->")
  447. if templ_7745c5c3_Err != nil {
  448. return templ_7745c5c3_Err
  449. }
  450. if data.TotalPages > 1 {
  451. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "<nav aria-label=\"Collection volumes pagination\"><ul class=\"pagination justify-content-center\">")
  452. if templ_7745c5c3_Err != nil {
  453. return templ_7745c5c3_Err
  454. }
  455. if data.Page > 1 {
  456. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "<li class=\"page-item\"><a class=\"page-link\" href=\"#\" onclick=\"goToPage(event)\" data-page=\"1\">First</a></li><li class=\"page-item\"><a class=\"page-link\" href=\"#\" onclick=\"goToPage(event)\" data-page=\"")
  457. if templ_7745c5c3_Err != nil {
  458. return templ_7745c5c3_Err
  459. }
  460. var templ_7745c5c3_Var22 string
  461. templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", data.Page-1))
  462. if templ_7745c5c3_Err != nil {
  463. return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/collection_details.templ`, Line: 288, Col: 104}
  464. }
  465. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22))
  466. if templ_7745c5c3_Err != nil {
  467. return templ_7745c5c3_Err
  468. }
  469. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, "\">Previous</a></li>")
  470. if templ_7745c5c3_Err != nil {
  471. return templ_7745c5c3_Err
  472. }
  473. }
  474. for i := 1; i <= data.TotalPages; i++ {
  475. if i == data.Page {
  476. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "<li class=\"page-item active\"><span class=\"page-link\">")
  477. if templ_7745c5c3_Err != nil {
  478. return templ_7745c5c3_Err
  479. }
  480. var templ_7745c5c3_Var23 string
  481. templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", i))
  482. if templ_7745c5c3_Err != nil {
  483. return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/collection_details.templ`, Line: 295, Col: 52}
  484. }
  485. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
  486. if templ_7745c5c3_Err != nil {
  487. return templ_7745c5c3_Err
  488. }
  489. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 54, "</span></li>")
  490. if templ_7745c5c3_Err != nil {
  491. return templ_7745c5c3_Err
  492. }
  493. } else if i <= 3 || i > data.TotalPages-3 || (i >= data.Page-2 && i <= data.Page+2) {
  494. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 55, "<li class=\"page-item\"><a class=\"page-link\" href=\"#\" onclick=\"goToPage(event)\" data-page=\"")
  495. if templ_7745c5c3_Err != nil {
  496. return templ_7745c5c3_Err
  497. }
  498. var templ_7745c5c3_Var24 string
  499. templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", i))
  500. if templ_7745c5c3_Err != nil {
  501. return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/collection_details.templ`, Line: 299, Col: 95}
  502. }
  503. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24))
  504. if templ_7745c5c3_Err != nil {
  505. return templ_7745c5c3_Err
  506. }
  507. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 56, "\">")
  508. if templ_7745c5c3_Err != nil {
  509. return templ_7745c5c3_Err
  510. }
  511. var templ_7745c5c3_Var25 string
  512. templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", i))
  513. if templ_7745c5c3_Err != nil {
  514. return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/collection_details.templ`, Line: 299, Col: 119}
  515. }
  516. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25))
  517. if templ_7745c5c3_Err != nil {
  518. return templ_7745c5c3_Err
  519. }
  520. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, "</a></li>")
  521. if templ_7745c5c3_Err != nil {
  522. return templ_7745c5c3_Err
  523. }
  524. } else if i == 4 && data.Page > 6 {
  525. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 58, "<li class=\"page-item disabled\"><span class=\"page-link\">...</span></li>")
  526. if templ_7745c5c3_Err != nil {
  527. return templ_7745c5c3_Err
  528. }
  529. } else if i == data.TotalPages-3 && data.Page < data.TotalPages-5 {
  530. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 59, "<li class=\"page-item disabled\"><span class=\"page-link\">...</span></li>")
  531. if templ_7745c5c3_Err != nil {
  532. return templ_7745c5c3_Err
  533. }
  534. }
  535. }
  536. if data.Page < data.TotalPages {
  537. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, "<li class=\"page-item\"><a class=\"page-link\" href=\"#\" onclick=\"goToPage(event)\" data-page=\"")
  538. if templ_7745c5c3_Err != nil {
  539. return templ_7745c5c3_Err
  540. }
  541. var templ_7745c5c3_Var26 string
  542. templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", data.Page+1))
  543. if templ_7745c5c3_Err != nil {
  544. return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/collection_details.templ`, Line: 314, Col: 104}
  545. }
  546. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26))
  547. if templ_7745c5c3_Err != nil {
  548. return templ_7745c5c3_Err
  549. }
  550. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 61, "\">Next</a></li><li class=\"page-item\"><a class=\"page-link\" href=\"#\" onclick=\"goToPage(event)\" data-page=\"")
  551. if templ_7745c5c3_Err != nil {
  552. return templ_7745c5c3_Err
  553. }
  554. var templ_7745c5c3_Var27 string
  555. templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", data.TotalPages))
  556. if templ_7745c5c3_Err != nil {
  557. return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/collection_details.templ`, Line: 317, Col: 108}
  558. }
  559. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27))
  560. if templ_7745c5c3_Err != nil {
  561. return templ_7745c5c3_Err
  562. }
  563. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 62, "\">Last</a></li>")
  564. if templ_7745c5c3_Err != nil {
  565. return templ_7745c5c3_Err
  566. }
  567. }
  568. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 63, "</ul></nav>")
  569. if templ_7745c5c3_Err != nil {
  570. return templ_7745c5c3_Err
  571. }
  572. }
  573. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 64, "<script>\n\t\t// Sorting functionality\n\t\tfunction sortBy(field) {\n\t\t\tconst currentSort = new URLSearchParams(window.location.search).get('sort_by');\n\t\t\tconst currentOrder = new URLSearchParams(window.location.search).get('sort_order') || 'asc';\n\t\t\t\n\t\t\tlet newOrder = 'asc';\n\t\t\tif (currentSort === field && currentOrder === 'asc') {\n\t\t\t\tnewOrder = 'desc';\n\t\t\t}\n\t\t\t\n\t\t\tconst url = new URL(window.location);\n\t\t\turl.searchParams.set('sort_by', field);\n\t\t\turl.searchParams.set('sort_order', newOrder);\n\t\t\turl.searchParams.set('page', '1'); // Reset to first page\n\t\t\twindow.location.href = url.toString();\n\t\t}\n\n\t\t// Pagination functionality\n\t\tfunction goToPage(event) {\n\t\t\tevent.preventDefault();\n\t\t\tconst page = event.target.closest('a').getAttribute('data-page');\n\t\t\tconst url = new URL(window.location);\n\t\t\turl.searchParams.set('page', page);\n\t\t\twindow.location.href = url.toString();\n\t\t}\n\n\t\t// Page size functionality\n\t\tfunction changePageSize(newPageSize) {\n\t\t\tconst url = new URL(window.location);\n\t\t\turl.searchParams.set('page_size', newPageSize);\n\t\t\turl.searchParams.set('page', '1'); // Reset to first page when changing page size\n\t\t\twindow.location.href = url.toString();\n\t\t}\n\n\t\t// Volume details\n\t\tfunction showVolumeDetails(event) {\n\t\t\tconst volumeId = event.target.closest('button').getAttribute('data-volume-id');\n\t\t\tconst server = event.target.closest('button').getAttribute('data-server');\n\t\t\twindow.location.href = `/cluster/volumes/${volumeId}/${server}`;\n\t\t}\n\n\t\t// EC Volume details\n\t\tfunction showEcVolumeDetails(event) {\n\t\t\tconst volumeId = event.target.closest('button').getAttribute('data-volume-id');\n\t\t\twindow.location.href = `/cluster/ec-volumes/${volumeId}`;\n\t\t}\n\n\t\t// Repair EC Volume\n\t\tfunction repairEcVolume(event) {\n\t\t\tconst volumeId = event.target.closest('button').getAttribute('data-volume-id');\n\t\t\tif (confirm(`Are you sure you want to repair missing shards for EC volume ${volumeId}?`)) {\n\t\t\t\t// TODO: Implement repair functionality\n\t\t\t\talert('Repair functionality will be implemented soon.');\n\t\t\t}\n\t\t}\n\t</script>")
  574. if templ_7745c5c3_Err != nil {
  575. return templ_7745c5c3_Err
  576. }
  577. return nil
  578. })
  579. }
  580. var _ = templruntime.GeneratedTemplate