You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.4 KiB

3 years ago
  1. <template>
  2. <v-data-table
  3. :headers="headers"
  4. :items="metaArray"
  5. item-key="key"
  6. hide-default-footer
  7. :no-data-text="$t('vuetify.noDataAvailable')"
  8. disable-pagination
  9. class="elevation-1"
  10. >
  11. <template #[`item.value`]="{ item }">
  12. <template v-if="item.key.indexOf('im_url') > -1">
  13. <a :href="item.value" target="_blank"><img :src="item.value" style="height: 250px" /></a>
  14. </template>
  15. <template v-else-if="item.key.indexOf('url') > -1">
  16. <a :href="item.value" target="_blank">{{ item.value }}</a>
  17. </template>
  18. <template v-else>
  19. {{ item.value }}
  20. </template>
  21. </template>
  22. </v-data-table>
  23. </template>
  24. <script lang="ts">
  25. import Vue from 'vue'
  26. export default Vue.extend({
  27. props: {
  28. metadata: {
  29. type: Object,
  30. default: () => ({}),
  31. required: true
  32. }
  33. },
  34. data() {
  35. return {
  36. headers: [
  37. {
  38. text: this.$t('annotation.key'),
  39. align: 'left',
  40. value: 'key',
  41. sortable: false
  42. },
  43. {
  44. text: this.$t('annotation.value'),
  45. align: 'left',
  46. value: 'value',
  47. sortable: false
  48. }
  49. ]
  50. }
  51. },
  52. computed: {
  53. metaArray() {
  54. const items = []
  55. for (const [key, value] of Object.entries(this.metadata)) {
  56. items.push({
  57. key,
  58. value
  59. })
  60. }
  61. return items
  62. }
  63. }
  64. })
  65. </script>