Redis.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <page-list
  3. show-tag-columns
  4. show-tag-columns2
  5. show-tag-filter
  6. show-tag-config
  7. :columns="columns"
  8. :list="list"
  9. :showSearchbox="showSearchbox"
  10. :export-data-options="exportDataOptions"
  11. :tag-config-params="tagConfigParams" />
  12. </template>
  13. <script>
  14. import ListMixin from '@/mixins/list'
  15. import {
  16. getNameFilter,
  17. getStatusFilter,
  18. getTenantFilter,
  19. getFilter,
  20. getDomainFilter,
  21. getBrandFilter,
  22. getCloudProviderFilter,
  23. getAccountFilter,
  24. getDescriptionFilter,
  25. getCreatedAtFilter,
  26. } from '@/utils/common/tableFilter'
  27. import expectStatus from '@/constants/expectStatus'
  28. import WindowsMixin from '@/mixins/windows'
  29. import ColumnsMixin from '@DB/views/redis/mixins/columns'
  30. import { ENGINE_ARCH } from '@DB/views/redis/constants'
  31. export default {
  32. name: 'RedisList',
  33. mixins: [WindowsMixin, ListMixin, ColumnsMixin],
  34. props: {
  35. id: String,
  36. getParams: {
  37. type: Object,
  38. },
  39. },
  40. data () {
  41. return {
  42. list: this.$list.createList(this, {
  43. ctx: this,
  44. id: this.id,
  45. resource: 'elasticcaches',
  46. getParams: this.getParam,
  47. steadyStatus: Object.values(expectStatus.redis).flat(),
  48. filterOptions: {
  49. external_id: {
  50. label: this.$t('table.title.external_id'),
  51. },
  52. id: {
  53. label: this.$t('table.title.id'),
  54. },
  55. name: getNameFilter(),
  56. description: getDescriptionFilter(),
  57. status: getStatusFilter('redis'),
  58. brand: getBrandFilter('redis_engine_brands'),
  59. account: getAccountFilter(),
  60. manager: getCloudProviderFilter(),
  61. projects: getTenantFilter(),
  62. project_domains: getDomainFilter(),
  63. billing_type: getFilter({
  64. field: 'billing_type',
  65. title: this.$t('db.text_54'),
  66. items: [
  67. { label: this.$t('db.text_55'), key: 'postpaid' },
  68. { label: this.$t('db.text_56'), key: 'prepaid' },
  69. ],
  70. }),
  71. engine_version: {
  72. label: this.$t('db.text_236'),
  73. dropdown: true,
  74. multiple: true,
  75. hiddenField: 'engine',
  76. distinctField: {
  77. type: 'field',
  78. key: 'engine_version',
  79. },
  80. },
  81. local_category: {
  82. label: this.$t('db.text_119'),
  83. hiddenField: 'instance_type',
  84. dropdown: true,
  85. multiple: true,
  86. items: Object.keys(ENGINE_ARCH).map(key => {
  87. return { label: ENGINE_ARCH[key], key }
  88. }),
  89. },
  90. private_dns: getFilter({
  91. field: 'private_dns',
  92. title: this.$t('db.text_58'),
  93. }),
  94. public_dns: getFilter({
  95. field: 'public_dns',
  96. hiddenField: 'private_dns',
  97. title: this.$t('db.text_59'),
  98. }),
  99. region: {
  100. label: this.$t('db.text_40'),
  101. },
  102. created_at: getCreatedAtFilter(),
  103. },
  104. responseData: this.responseData,
  105. hiddenColumns: ['metadata', 'instance_type', 'created_at'],
  106. autoHiddenFilterKey: 'redis_hidden_columns',
  107. }),
  108. tagConfigParams: {
  109. resource: 'elasticcaches',
  110. queryTreeId: 'project-tag-value-tree',
  111. },
  112. }
  113. },
  114. computed: {
  115. exportDataOptions () {
  116. return {
  117. items: [
  118. { label: 'ID', key: 'id' },
  119. ...this.columns,
  120. ],
  121. title: this.$t('dictionary.elasticcache'),
  122. downloadType: 'local',
  123. }
  124. },
  125. },
  126. created () {
  127. this.list.fetchData()
  128. this.initSidePageTab('redis-detail')
  129. },
  130. methods: {
  131. getParam () {
  132. const ret = {
  133. ...this.getParams,
  134. details: true,
  135. }
  136. return ret
  137. },
  138. handleOpenSidepage (row, tab) {
  139. this.sidePageTriggerHandle(this, 'RedisSidePage', {
  140. id: row.id,
  141. resource: 'elasticcaches',
  142. getParams: {
  143. details: true,
  144. },
  145. steadyStatus: Object.values(expectStatus.redis).flat(),
  146. }, {
  147. list: this.list,
  148. tab,
  149. })
  150. },
  151. },
  152. }
  153. </script>
  154. <style lang="less">
  155. .td-ellipsis{
  156. width: 150px;
  157. word-break: keep-all;
  158. white-space: nowrap;
  159. overflow: hidden;
  160. text-overflow: ellipsis;
  161. }
  162. </style>