index.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. import validateForm from '@/utils/validate'
  2. import i18n from '@/locales'
  3. export const DECORATORS = {
  4. duration: {
  5. durationStandard: [
  6. 'durationStandard',
  7. {
  8. initialValue: 'none',
  9. },
  10. ],
  11. duration: [
  12. 'duration',
  13. {
  14. initialValue: '1h',
  15. },
  16. ],
  17. },
  18. projectDomain: {
  19. project: [
  20. 'project',
  21. {
  22. initialValue: undefined,
  23. rules: [
  24. { required: true, message: i18n.t('db.text_134'), trigger: 'change' },
  25. ],
  26. },
  27. ],
  28. domain: [
  29. 'domain',
  30. {
  31. initialValue: undefined,
  32. rules: [
  33. { required: true, message: i18n.t('db.text_135'), trigger: 'change' },
  34. ],
  35. },
  36. ],
  37. },
  38. generate_name: [
  39. 'generate_name',
  40. {
  41. initialValue: '',
  42. validateTrigger: ['change', 'blur'],
  43. validateFirst: true,
  44. rules: [
  45. { required: true, message: i18n.t('db.text_136') },
  46. { validator: validateForm('resourceCreateName') },
  47. ],
  48. },
  49. ],
  50. description: ['description'],
  51. loginConfig: {
  52. loginType: [
  53. 'loginType',
  54. {
  55. initialValue: 'random',
  56. },
  57. ],
  58. keypair: [
  59. 'loginKeypair',
  60. {
  61. initialValue: undefined, // { key: '', label: '' }
  62. rules: [
  63. { validator: true, message: i18n.t('db.text_137') },
  64. ],
  65. },
  66. ],
  67. },
  68. secgroup: {
  69. type: [
  70. 'secgroup_type',
  71. {
  72. initialValue: 'default',
  73. },
  74. ],
  75. secgroup: [
  76. 'secgroup',
  77. {
  78. rules: [
  79. { required: true, message: i18n.t('db.text_138') },
  80. ],
  81. },
  82. ],
  83. },
  84. __count__: [
  85. '__count__',
  86. {
  87. initialValue: 1,
  88. },
  89. ],
  90. __meta__: [
  91. '__meta__',
  92. {
  93. rules: [
  94. { validator: validateForm('tagName') },
  95. ],
  96. },
  97. ],
  98. }