Detail.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <detail
  3. :on-manager="onManager"
  4. :data="detailData"
  5. :extra-info="extraInfo"
  6. :base-info="baseInfo"
  7. :name-rules="[{ required: true, message: $t('compute.text_210') }]"
  8. status-module="container"
  9. resource="containers" />
  10. </template>
  11. <script>
  12. import jsYaml from 'js-yaml'
  13. import WindowsMixin from '@/mixins/windows'
  14. import {
  15. getImageTableColumn,
  16. getEnvTableColumn,
  17. getCommandTableColumn,
  18. getArgsTableColumn,
  19. } from '../utils/columns'
  20. export default {
  21. name: 'VmPodContainerDetail',
  22. mixins: [WindowsMixin],
  23. props: {
  24. onManager: {
  25. type: Function,
  26. required: true,
  27. },
  28. data: {
  29. type: Object,
  30. required: true,
  31. },
  32. },
  33. data () {
  34. return {
  35. baseInfo: [
  36. getImageTableColumn(),
  37. getEnvTableColumn(),
  38. getCommandTableColumn(),
  39. getArgsTableColumn(),
  40. ],
  41. cmOptions: {
  42. tabSize: 2,
  43. styleActiveLine: true,
  44. lineNumbers: true,
  45. line: true,
  46. mode: 'text/x-yaml',
  47. theme: 'material',
  48. readOnly: true,
  49. },
  50. }
  51. },
  52. computed: {
  53. detailData () {
  54. return {
  55. ...this.data,
  56. }
  57. },
  58. extraInfo () {
  59. return [
  60. {
  61. field: 'info',
  62. title: this.$t('compute.source_data'),
  63. slots: {
  64. default: ({ row }) => {
  65. const yamlInfo = jsYaml.safeDump(row)
  66. return [<div class="pod-container-yaml"><code-mirror value={yamlInfo} options={this.cmOptions} /></div>]
  67. },
  68. },
  69. },
  70. ]
  71. },
  72. },
  73. created () { },
  74. methods: {},
  75. }
  76. </script>
  77. <style lang="less">
  78. .pod-container-yaml {
  79. .CodeMirror {
  80. height: calc(100vh - 310px);
  81. min-height: calc(100vh - 310px);
  82. max-height: 80vh;
  83. }
  84. }
  85. </style>