You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
2.7 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <v-stepper-content step="4">
  3. <v-card>
  4. <v-card-text class="pa-0">
  5. <h4 class="text-h6">Configure label mappings</h4>
  6. <p class="font-weight-regular body-1">
  7. Once you fetch the API response, you need to convert the label in the response into the one which you defined at the label page.
  8. </p>
  9. <h4 class="text-h6">
  10. Response
  11. </h4>
  12. <v-sheet
  13. :dark="!$vuetify.theme.dark"
  14. :light="$vuetify.theme.dark"
  15. class="mb-5 pa-5"
  16. >
  17. <pre>{{ JSON.stringify(response, null, 4) }}</pre>
  18. </v-sheet>
  19. <label-mapping v-model="mapping" />
  20. <v-alert
  21. v-for="(error, index) in errorMessages"
  22. :key="index"
  23. prominent
  24. type="error"
  25. >
  26. <v-row align="center">
  27. <v-col class="grow">
  28. {{ error }}
  29. </v-col>
  30. </v-row>
  31. </v-alert>
  32. <h4 class="text-h6">
  33. Result
  34. </h4>
  35. <v-sheet
  36. :dark="!$vuetify.theme.dark"
  37. :light="$vuetify.theme.dark"
  38. class="mb-5 pa-5"
  39. >
  40. <pre>{{ JSON.stringify(result, null, 4) }}</pre>
  41. </v-sheet>
  42. </v-card-text>
  43. <v-card-actions class="pa-0">
  44. <v-spacer />
  45. <v-btn
  46. text
  47. class="text-capitalize"
  48. @click="$emit('prev')"
  49. >
  50. Prev
  51. </v-btn>
  52. <v-btn
  53. v-show="!isPassed"
  54. color="primary"
  55. class="text-capitalize"
  56. @click="$emit('onTest')"
  57. >
  58. Test
  59. </v-btn>
  60. <v-btn
  61. v-show="isPassed"
  62. color="success"
  63. class="text-capitalize"
  64. @click="$emit('next')"
  65. >
  66. Finish
  67. </v-btn>
  68. </v-card-actions>
  69. </v-card>
  70. </v-stepper-content>
  71. </template>
  72. <script lang="ts">
  73. import Vue from 'vue'
  74. import LabelMapping from './LabelMapping.vue'
  75. export default Vue.extend({
  76. components: {
  77. LabelMapping
  78. },
  79. props: {
  80. value: {
  81. type: Array,
  82. default: () => [],
  83. required: true
  84. },
  85. errorMessages: {
  86. type: Array,
  87. default: () => [],
  88. required: true
  89. },
  90. isPassed: {
  91. type: Boolean,
  92. default: false,
  93. required: true
  94. },
  95. response: {
  96. type: [String, Object, Array],
  97. default: () => [],
  98. required: true
  99. },
  100. result: {
  101. type: Array,
  102. default: () => [],
  103. required: true
  104. }
  105. },
  106. computed: {
  107. mapping: {
  108. get() {
  109. // @ts-ignore
  110. return this.value
  111. },
  112. set(newVal) {
  113. // @ts-ignore
  114. this.$emit('input', newVal)
  115. }
  116. }
  117. }
  118. })
  119. </script>