Test.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <div>
  3. <page-metadata title="Admin | Test" />
  4. <div class="admin-container">
  5. <advanced-table
  6. :column-default="columnDefault"
  7. :columns="columns"
  8. :filters="filters"
  9. data-action="songs.getData"
  10. >
  11. <template #column-thumbnailImage="slotProps">
  12. <img
  13. class="song-thumbnail"
  14. :src="slotProps.item.thumbnail"
  15. onerror="this.src='/assets/notes-transparent.png'"
  16. loading="lazy"
  17. />
  18. </template>
  19. <template #column-thumbnailUrl="slotProps">
  20. <a :href="slotProps.item.thumbnail" target="_blank">
  21. {{ slotProps.item.thumbnail }}
  22. </a>
  23. </template>
  24. <template #column-_id="slotProps">
  25. <span :title="slotProps.item._id">{{
  26. slotProps.item._id
  27. }}</span>
  28. </template>
  29. <template #column-youtubeId="slotProps">
  30. <a
  31. :href="
  32. 'https://www.youtube.com/watch?v=' +
  33. `${slotProps.item.youtubeId}`
  34. "
  35. target="_blank"
  36. >
  37. {{ slotProps.item.youtubeId }}
  38. </a>
  39. </template>
  40. <template #column-title="slotProps">
  41. <span :title="slotProps.item.title">{{
  42. slotProps.item.title
  43. }}</span>
  44. </template>
  45. <template #column-artists="slotProps">
  46. <span :title="slotProps.item.artists.join(', ')">{{
  47. slotProps.item.artists.join(", ")
  48. }}</span>
  49. </template>
  50. <template #column-genres="slotProps">
  51. <span :title="slotProps.item.genres.join(', ')">{{
  52. slotProps.item.genres.join(", ")
  53. }}</span>
  54. </template>
  55. <template #column-requestedBy="slotProps">
  56. <user-id-to-username
  57. :user-id="slotProps.item.requestedBy"
  58. :link="true"
  59. />
  60. </template>
  61. <!-- <template #bulk-actions="slotProps">
  62. A {{ slotProps.item.length }}
  63. </template>
  64. <template #bulk-actions-right="slotProps">
  65. B {{ slotProps.item.length }}
  66. </template> -->
  67. </advanced-table>
  68. </div>
  69. </div>
  70. </template>
  71. <script>
  72. import AdvancedTable from "@/components/AdvancedTable.vue";
  73. import UserIdToUsername from "@/components/UserIdToUsername.vue";
  74. export default {
  75. components: {
  76. AdvancedTable,
  77. UserIdToUsername
  78. },
  79. data() {
  80. return {
  81. columnDefault: {
  82. sortable: true,
  83. hidable: true,
  84. defaultVisibility: "shown",
  85. draggable: true,
  86. resizable: true,
  87. pinable: true,
  88. minWidth: 200,
  89. maxWidth: 600
  90. },
  91. columns: [
  92. {
  93. name: "thumbnailImage",
  94. displayName: "Thumb",
  95. properties: ["thumbnail"],
  96. minWidth: 120,
  97. width: 120,
  98. maxWidth: 120,
  99. resizable: false
  100. },
  101. {
  102. name: "_id",
  103. displayName: "Musare ID",
  104. properties: ["_id"],
  105. sortProperty: "_id",
  106. width: 220
  107. },
  108. {
  109. name: "youtubeId",
  110. displayName: "YouTube ID",
  111. properties: ["youtubeId"],
  112. sortProperty: "youtubeId",
  113. minWidth: 155,
  114. width: 155
  115. },
  116. {
  117. name: "title",
  118. displayName: "Title",
  119. properties: ["title"],
  120. sortProperty: "title"
  121. },
  122. {
  123. name: "artists",
  124. displayName: "Artists",
  125. properties: ["artists"],
  126. sortable: false
  127. },
  128. {
  129. name: "genres",
  130. displayName: "Genres",
  131. properties: ["genres"],
  132. sortable: false
  133. },
  134. {
  135. name: "thumbnailUrl",
  136. displayName: "Thumbnail (URL)",
  137. properties: ["thumbnail"],
  138. sortProperty: "thumbnail",
  139. defaultVisibility: "hidden"
  140. },
  141. {
  142. name: "requestedBy",
  143. displayName: "Requested By",
  144. properties: ["requestedBy"],
  145. sortProperty: "requestedBy",
  146. width: 200
  147. }
  148. ],
  149. filters: [
  150. {
  151. name: "_id",
  152. displayName: "Musare ID",
  153. property: "_id",
  154. filterTypes: ["exact"],
  155. defaultFilterType: "exact"
  156. },
  157. {
  158. name: "youtubeId",
  159. displayName: "YouTube ID",
  160. property: "youtubeId",
  161. filterTypes: ["contains", "exact", "regex"],
  162. defaultFilterType: "contains"
  163. },
  164. {
  165. name: "title",
  166. displayName: "Title",
  167. property: "title",
  168. filterTypes: ["contains", "exact", "regex"],
  169. defaultFilterType: "contains"
  170. },
  171. {
  172. name: "artists",
  173. displayName: "Artists",
  174. property: "artists",
  175. filterTypes: ["contains", "exact", "regex"],
  176. defaultFilterType: "contains"
  177. },
  178. {
  179. name: "genres",
  180. displayName: "Genres",
  181. property: "genres",
  182. filterTypes: ["contains", "exact", "regex"],
  183. defaultFilterType: "contains"
  184. },
  185. {
  186. name: "thumbnail",
  187. displayName: "Thumbnail",
  188. property: "thumbnail",
  189. filterTypes: ["contains", "exact", "regex"],
  190. defaultFilterType: "contains"
  191. },
  192. {
  193. name: "requestedBy",
  194. displayName: "Requested By",
  195. property: "requestedBy",
  196. filterTypes: ["contains", "exact", "regex"],
  197. defaultFilterType: "contains"
  198. }
  199. ]
  200. };
  201. },
  202. mounted() {},
  203. beforeUnmount() {},
  204. methods: {}
  205. };
  206. </script>
  207. <style lang="scss" scoped>
  208. .admin-container {
  209. max-width: 1900px;
  210. margin: 0 auto;
  211. padding: 0 10px;
  212. }
  213. .song-thumbnail {
  214. display: block;
  215. max-width: 50px;
  216. margin: 0 auto;
  217. }
  218. </style>