Test.vue 4.2 KB

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