Test.vue 4.2 KB

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