ViewContent.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <template>
  2. <base-dialog @cancel="cancelDialog">
  3. <div slot="header">{{ params.title }}</div>
  4. <div slot="body">
  5. <a-empty v-if="isEmpty" />
  6. <a-tag
  7. v-for="(item, idx) in params.data"
  8. :key="idx"
  9. :color="colors[idx % 7]"
  10. class="mb-2"
  11. style="width: '250px'">
  12. <template v-if="isNetwork">
  13. {{ item.ip_addr }}
  14. </template>
  15. <template v-else-if="isPort">
  16. {{$t('compute.port_mappings.port.title')}}: {{item.port}} = {{$t('compute.port_mappings.host_port.title')}}: {{item.host_port}} ({{item.protocol.toUpperCase()}})
  17. </template>
  18. </a-tag>
  19. </div>
  20. <div slot="footer">
  21. <a-button type="primary" @click="cancelDialog">{{ $t('dialog.ok') }}</a-button>
  22. </div>
  23. </base-dialog>
  24. </template>
  25. <script>
  26. import DialogMixin from '@/mixins/dialog'
  27. import WindowsMixin from '@/mixins/windows'
  28. export default {
  29. name: 'ViewContentDialog',
  30. mixins: [DialogMixin, WindowsMixin],
  31. data () {
  32. return {
  33. colors: ['pink', 'red', 'orange', 'green', 'cyan', 'blue', 'purple'],
  34. }
  35. },
  36. computed: {
  37. isEmpty () {
  38. return !this.params.data?.length > 0
  39. },
  40. isNetwork () {
  41. return this.params.type === 'network'
  42. },
  43. isPort () {
  44. return this.params.type === 'port'
  45. },
  46. },
  47. methods: {},
  48. }
  49. </script>