Test.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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. minWidth: 200,
  88. maxWidth: 600
  89. },
  90. columns: [
  91. {
  92. name: "thumbnailImage",
  93. displayName: "Thumb",
  94. properties: ["thumbnail"],
  95. minWidth: 120,
  96. width: 120,
  97. maxWidth: 120,
  98. resizable: false
  99. },
  100. {
  101. name: "_id",
  102. displayName: "Musare ID",
  103. properties: ["_id"],
  104. sortProperty: "_id",
  105. width: 220
  106. },
  107. {
  108. name: "youtubeId",
  109. displayName: "YouTube ID",
  110. properties: ["youtubeId"],
  111. sortProperty: "youtubeId",
  112. minWidth: 155,
  113. width: 155
  114. },
  115. {
  116. name: "title",
  117. displayName: "Title",
  118. properties: ["title"],
  119. sortProperty: "title"
  120. },
  121. {
  122. name: "artists",
  123. displayName: "Artists",
  124. properties: ["artists"],
  125. sortable: false
  126. },
  127. {
  128. name: "genres",
  129. displayName: "Genres",
  130. properties: ["genres"],
  131. sortable: false
  132. },
  133. {
  134. name: "thumbnailUrl",
  135. displayName: "Thumbnail (URL)",
  136. properties: ["thumbnail"],
  137. sortProperty: "thumbnail",
  138. defaultVisibility: "hidden"
  139. },
  140. {
  141. name: "requestedBy",
  142. displayName: "Requested By",
  143. properties: ["requestedBy"],
  144. sortProperty: "requestedBy",
  145. width: 200
  146. }
  147. ],
  148. filters: [
  149. {
  150. name: "_id",
  151. displayName: "Musare ID",
  152. property: "_id",
  153. filterTypes: ["exact"],
  154. defaultFilterType: "exact"
  155. },
  156. {
  157. name: "youtubeId",
  158. displayName: "YouTube ID",
  159. property: "youtubeId",
  160. filterTypes: ["contains", "exact", "regex"],
  161. defaultFilterType: "contains"
  162. },
  163. {
  164. name: "title",
  165. displayName: "Title",
  166. property: "title",
  167. filterTypes: ["contains", "exact", "regex"],
  168. defaultFilterType: "contains"
  169. },
  170. {
  171. name: "artists",
  172. displayName: "Artists",
  173. property: "artists",
  174. filterTypes: ["contains", "exact", "regex"],
  175. defaultFilterType: "contains"
  176. },
  177. {
  178. name: "genres",
  179. displayName: "Genres",
  180. property: "genres",
  181. filterTypes: ["contains", "exact", "regex"],
  182. defaultFilterType: "contains"
  183. },
  184. {
  185. name: "thumbnail",
  186. displayName: "Thumbnail",
  187. property: "thumbnail",
  188. filterTypes: ["contains", "exact", "regex"],
  189. defaultFilterType: "contains"
  190. },
  191. {
  192. name: "requestedBy",
  193. displayName: "Requested By",
  194. property: "requestedBy",
  195. filterTypes: ["contains", "exact", "regex"],
  196. defaultFilterType: "contains"
  197. }
  198. ]
  199. };
  200. },
  201. mounted() {},
  202. beforeUnmount() {},
  203. methods: {}
  204. };
  205. </script>
  206. <style lang="scss" scoped>
  207. .admin-container {
  208. max-width: 1900px;
  209. margin: 0 auto;
  210. padding: 0 10px;
  211. }
  212. .song-thumbnail {
  213. display: block;
  214. max-width: 50px;
  215. margin: 0 auto;
  216. }
  217. </style>