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.

93 lines
1.8 KiB

  1. <template lang='pug'>
  2. v-container(fluid, grid-list-lg)
  3. v-layout(row, wrap)
  4. v-flex(xs12)
  5. .admin-header
  6. img(src='/svg/icon-console.svg', alt='Developer Tools', style='width: 80px;')
  7. .admin-header-title
  8. .headline.primary--text Developer Tools
  9. .subtitle-1.grey--text Voyager
  10. v-card.mt-3.white.grey--text.text--darken-3
  11. #voyager
  12. </template>
  13. <script>
  14. import _ from 'lodash'
  15. import React from 'react'
  16. import ReactDOM from 'react-dom'
  17. import { Voyager } from 'graphql-voyager'
  18. import 'graphql-voyager/dist/voyager.css'
  19. const fetcher = (qry, respType) => {
  20. return fetch('/graphql', {
  21. method: 'post',
  22. headers: {
  23. 'Accept': 'application/json',
  24. 'Content-Type': 'application/json'
  25. },
  26. body: JSON.stringify(qry),
  27. credentials: 'include'
  28. }).then(response => {
  29. if (respType === 'json') {
  30. return response.json()
  31. } else {
  32. return response.text()
  33. }
  34. }).then(responseBody => {
  35. try {
  36. return JSON.parse(responseBody)
  37. } catch (error) {
  38. return responseBody
  39. }
  40. })
  41. }
  42. export default {
  43. data() {
  44. return {}
  45. },
  46. mounted() {
  47. _.delay(() => {
  48. ReactDOM.render(
  49. React.createElement(Voyager, {
  50. introspection: qry => fetcher({ query: qry }, 'json'),
  51. workerURI: '/js/voyager.worker.js'
  52. }),
  53. document.getElementById('voyager')
  54. )
  55. }, 500)
  56. }
  57. }
  58. </script>
  59. <style lang='scss'>
  60. #voyager {
  61. height: calc(100vh - 270px);
  62. .title-area {
  63. display: none;
  64. }
  65. .type-doc {
  66. margin-top: 5px;
  67. }
  68. .doc-navigation {
  69. > span {
  70. overflow-y: hidden;
  71. display: block;
  72. }
  73. min-height: 40px;
  74. }
  75. .contents {
  76. padding-bottom: 0;
  77. color: #666;
  78. }
  79. .type-info-popover {
  80. display: none;
  81. }
  82. }
  83. </style>