AccessKeyList.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <div>
  3. <page-list
  4. :list="list"
  5. :columns="columns"
  6. :singleActions="singleActions"
  7. :group-actions="groupActions"
  8. :export-data-options="exportDataOptions" />
  9. </div>
  10. </template>
  11. <script>
  12. import * as R from 'ramda'
  13. import { mapGetters } from 'vuex'
  14. import windows from '@/mixins/windows'
  15. import ListMixin from '@/mixins/list'
  16. import ColumnsMixin from '../mixins/columns'
  17. import SingleActionsMixin from '../mixins/singleActions'
  18. export default {
  19. name: 'CredentialList',
  20. mixins: [windows, ListMixin, ColumnsMixin, SingleActionsMixin],
  21. props: {
  22. id: String,
  23. getParams: {
  24. type: [Function, Object],
  25. },
  26. },
  27. data () {
  28. return {
  29. dialog: {
  30. visible: false,
  31. },
  32. list: this.$list.createList(this, {
  33. id: this.id,
  34. resource: 'credentials',
  35. apiVersion: 'v1',
  36. getParams: this.getParam,
  37. filterOptions: {
  38. id: {
  39. label: 'ID',
  40. filter: true,
  41. formatter: val => {
  42. return `id.contains("${val}")`
  43. },
  44. },
  45. },
  46. }),
  47. exportDataOptions: {
  48. items: [
  49. { label: 'ID', key: 'id' },
  50. { label: this.$t('scope.text_15'), key: 'enabled' },
  51. { label: this.$t('dictionary.domain'), key: 'domain' },
  52. { label: this.$t('scope.text_16'), key: 'created_at' },
  53. ],
  54. },
  55. groupActions: [
  56. {
  57. label: this.$t('scope.text_17'),
  58. action: () => {
  59. this.createDialog('CredentialAccessKeyCreate', {
  60. title: this.$t('scope.text_13'),
  61. refresh: this.refresh,
  62. })
  63. },
  64. meta: () => {
  65. return {
  66. buttonType: 'primary',
  67. }
  68. },
  69. },
  70. {
  71. label: this.$t('scope.text_18'),
  72. action: () => {
  73. this.createDialog('DeleteResDialog', {
  74. vm: this,
  75. data: this.list.selectedItems,
  76. columns: this.columns,
  77. title: this.$t('scope.text_18'),
  78. name: this.$t('common_631'),
  79. onManager: this.onManager,
  80. })
  81. },
  82. meta: () => {
  83. return {
  84. validate: this.list.allowDelete(),
  85. }
  86. },
  87. },
  88. ],
  89. }
  90. },
  91. computed: mapGetters(['userInfo']),
  92. created () {
  93. this.list.fetchData()
  94. },
  95. methods: {
  96. refresh () {
  97. this.list.refresh()
  98. },
  99. getParam () {
  100. const ret = {
  101. ...(R.is(Function, this.getParams) ? this.getParams() : this.getParams),
  102. type: 'aksk',
  103. project_id: this.userInfo.projectId,
  104. scope: undefined,
  105. }
  106. return ret
  107. },
  108. },
  109. }
  110. </script>