Port.vue 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <div class="d-flex">
  3. <a-form-item>
  4. <a-input v-decorator="decorators.port" type="number" style="width: 200px;">
  5. <template slot="addonBefore">
  6. <span>{{$t('k8s.service_port')}}</span>
  7. <a-tooltip :title="$t('k8s.service_port.desc')">
  8. <a-icon type="info-circle" />
  9. </a-tooltip>
  10. </template>
  11. </a-input>
  12. </a-form-item>
  13. <a-form-item>
  14. <a-input v-decorator="decorators.targetPort" type="number" style="width: 200px;">
  15. <template slot="addonBefore">
  16. <span>{{$t('k8s.target_port')}}</span>
  17. <a-tooltip :title="$t('k8s.target_port.desc')">
  18. <a-icon type="info-circle" />
  19. </a-tooltip>
  20. </template>
  21. </a-input>
  22. </a-form-item>
  23. <a-form-item v-if="isNodePort">
  24. <a-input :min="30000" :max="32767" v-decorator="decorators.nodePort" type="number" style="width: 200px;">
  25. <template slot="addonBefore">
  26. <span>{{$t('k8s.node_port')}}</span>
  27. <a-tooltip :title="$t('k8s.node_port.desc')">
  28. <a-icon type="info-circle" />
  29. </a-tooltip>
  30. </template>
  31. </a-input>
  32. </a-form-item>
  33. <a-form-item>
  34. <a-input-group compact>
  35. <div class="d-flex">
  36. <a-input class="oc-addonBefore ant-input-group-addon" style="width: 60px;" :defaultValue="$t('k8s.text_90')" readonly />
  37. <a-select style="width: 100px;" v-decorator="decorators.protocol" :disabled="protocolDisabled" @change="protocolChange">
  38. <a-select-option value="TCP">TCP</a-select-option>
  39. <a-select-option value="UDP">UDP</a-select-option>
  40. </a-select>
  41. </div>
  42. </a-input-group>
  43. </a-form-item>
  44. </div>
  45. </template>
  46. <script>
  47. export default {
  48. name: 'K8SPortMappingPort',
  49. props: {
  50. decorators: {
  51. type: Object,
  52. required: true,
  53. validator: val => val.port && val.targetPort && val.nodePort && val.protocol,
  54. },
  55. protocolDisabled: {
  56. type: Boolean,
  57. default: false,
  58. },
  59. serviceType: {
  60. type: String,
  61. required: true,
  62. },
  63. },
  64. computed: {
  65. isNodePort () {
  66. return this.serviceType === 'nodePort'
  67. },
  68. },
  69. methods: {
  70. protocolChange (val) {
  71. this.$emit('protocolChange', val)
  72. },
  73. },
  74. }
  75. </script>