Request.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <template>
  2. <div class="request">
  3. <h4 class="heading">
  4. <SmartIcon name="file" class="svg-icons" />
  5. {{ request.name || $t("state.none") }}
  6. </h4>
  7. <p v-if="request.url" class="doc-desc">
  8. <span>
  9. {{ $t("request.url") }}:
  10. <code>{{ request.url || $t("state.none") }}</code>
  11. </span>
  12. </p>
  13. <p v-if="request.path" class="doc-desc">
  14. <span>
  15. {{ $t("request.path") }}:
  16. <code>{{ request.path || $t("state.none") }}</code>
  17. </span>
  18. </p>
  19. <p v-if="request.method" class="doc-desc">
  20. <span>
  21. {{ $t("request.method") }}:
  22. <code>{{ request.method || $t("state.none") }}</code>
  23. </span>
  24. </p>
  25. <p v-if="request.auth" class="doc-desc">
  26. <span>
  27. {{ $t("request.authorization") }}:
  28. <code>{{ request.auth.authType || $t("state.none") }}</code>
  29. </span>
  30. </p>
  31. <p v-if="request.httpUser" class="doc-desc">
  32. <span>
  33. {{ $t("authorization.username") }}:
  34. <code>{{ request.httpUser || $t("state.none") }}</code>
  35. </span>
  36. </p>
  37. <p v-if="request.httpPassword" class="doc-desc">
  38. <span>
  39. {{ $t("authorization.password") }}:
  40. <code>{{ request.httpPassword || $t("state.none") }}</code>
  41. </span>
  42. </p>
  43. <p v-if="request.bearerToken" class="doc-desc">
  44. <span>
  45. {{ $t("authorization.token") }}:
  46. <code>{{ request.bearerToken || $t("state.none") }}</code>
  47. </span>
  48. </p>
  49. <h4 v-if="request.headers" class="heading">{{ $t("tab.headers") }}</h4>
  50. <span v-if="request.headers">
  51. <p
  52. v-for="(header, index) in request.headers"
  53. :key="`header-${index}`"
  54. class="doc-desc"
  55. >
  56. <span>
  57. {{ header.key || $t("state.none") }}:
  58. <code>{{ header.value || $t("state.none") }}</code>
  59. </span>
  60. </p>
  61. </span>
  62. <h4 v-if="request.params" class="heading">
  63. {{ $t("request.parameters") }}
  64. </h4>
  65. <span v-if="request.params">
  66. <p
  67. v-for="(parameter, index) in request.params"
  68. :key="`parameter-${index}`"
  69. class="doc-desc"
  70. >
  71. <span>
  72. {{ parameter.key || $t("state.none") }}:
  73. <code>{{ parameter.value || $t("state.none") }}</code>
  74. </span>
  75. </p>
  76. </span>
  77. <h4 v-if="request.bodyParams" class="heading">
  78. {{ $t("request.payload") }}
  79. </h4>
  80. <span v-if="request.bodyParams">
  81. <p
  82. v-for="(payload, index) in request.bodyParams"
  83. :key="`payload-${index}`"
  84. class="doc-desc"
  85. >
  86. <span>
  87. {{ payload.key || $t("state.none") }}:
  88. <code>{{ payload.value || $t("state.none") }}</code>
  89. </span>
  90. </p>
  91. </span>
  92. <p v-if="request.rawParams" class="doc-desc">
  93. <span>
  94. {{ $t("request.parameters") }}:
  95. <code>{{ request.rawParams || $t("state.none") }}</code>
  96. </span>
  97. </p>
  98. <p v-if="request.contentType" class="doc-desc">
  99. <span>
  100. {{ $t("request.content_type") }}:
  101. <code>{{ request.contentType || $t("state.none") }}</code>
  102. </span>
  103. </p>
  104. <p v-if="request.requestType" class="doc-desc">
  105. <span>
  106. {{ $t("request.type") }}:
  107. <code>{{ request.requestType || $t("state.none") }}</code>
  108. </span>
  109. </p>
  110. </div>
  111. </template>
  112. <script>
  113. import { defineComponent } from "@nuxtjs/composition-api"
  114. export default defineComponent({
  115. props: {
  116. request: { type: Object, default: () => {} },
  117. },
  118. })
  119. </script>
  120. <style scoped lang="scss">
  121. .request {
  122. @apply flex flex-col flex-1;
  123. @apply justify-center;
  124. @apply p-4;
  125. @apply mt-4;
  126. @apply border border-divider;
  127. @apply rounded;
  128. h4 {
  129. @apply mt-4;
  130. }
  131. .material-icons {
  132. @apply mr-4;
  133. }
  134. }
  135. .doc-desc {
  136. @apply flex flex-col flex-1;
  137. @apply justify-center;
  138. @apply p-4;
  139. @apply m-0;
  140. @apply text-secondaryLight;
  141. @apply border-b border-divider;
  142. &:last-child {
  143. @apply border-b-0;
  144. }
  145. .material-icons {
  146. @apply mr-4;
  147. }
  148. }
  149. </style>