admin-rendering.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template lang='pug'>
  2. v-container(fluid, fill-height, grid-list-lg)
  3. v-layout(row wrap)
  4. v-flex(xs12)
  5. .headline.primary--text Rendering
  6. .subheading.grey--text Configure how content is rendered
  7. v-layout.mt-3(row wrap)
  8. v-flex(lg3 xs12)
  9. v-toolbar(
  10. color='primary'
  11. dense
  12. flat
  13. dark
  14. )
  15. v-icon.mr-2 line_weight
  16. .subheading Pipeline
  17. v-expansion-panel.adm-rendering-pipeline(v-model='selectedCore')
  18. v-expansion-panel-content(
  19. hide-actions
  20. v-for='core in cores'
  21. :key='core.key'
  22. )
  23. v-toolbar(
  24. slot='header'
  25. color='blue'
  26. dense
  27. dark
  28. flat
  29. )
  30. .body-2 {{core.input}}
  31. v-icon.mx-2 arrow_forward
  32. .caption {{core.output}}
  33. v-list(two-line, dense)
  34. template(v-for='(rdr, n) in core.children')
  35. v-list-tile(
  36. avatar
  37. :key='rdr.key'
  38. @click=''
  39. )
  40. v-list-tile-avatar
  41. v-icon(color='grey') {{rdr.icon}}
  42. v-list-tile-content
  43. v-list-tile-title {{rdr.title}}
  44. v-list-tile-sub-title {{rdr.description}}
  45. v-list-tile-avatar
  46. v-icon(color='green', small, v-if='rdr.isEnabled') lens
  47. v-icon(color='red', small, v-else) trip_origin
  48. v-divider.my-0(v-if='n < core.children.length - 1')
  49. v-flex(lg9 xs12)
  50. v-card
  51. v-toolbar(
  52. color='grey darken-1'
  53. dark
  54. flat
  55. dense
  56. )
  57. v-icon.mr-2 settings_applications
  58. .subheading Markdown
  59. v-icon chevron_right
  60. .subheading Core
  61. v-spacer
  62. v-btn(flat, disabled)
  63. v-icon(left) wrap_text
  64. span Bypass
  65. v-btn(flat, disabled)
  66. v-icon(left) clear
  67. span Remove
  68. v-card-text
  69. v-switch(
  70. v-model='linkify'
  71. label='Automatically convert links'
  72. color='primary'
  73. persistent-hint
  74. hint='Links will automatically be converted to clickable links.'
  75. )
  76. v-divider.mt-3
  77. v-switch(
  78. v-model='linkify'
  79. label='Automatically convert line breaks'
  80. color='primary'
  81. persistent-hint
  82. hint='Add linebreaks within paragraphs.'
  83. )
  84. v-divider.mt-3
  85. v-switch(
  86. v-model='linkify'
  87. label='Highlight code blocks'
  88. color='primary'
  89. persistent-hint
  90. hint='Add syntax coloring to code blocks.'
  91. )
  92. v-select.mt-3(
  93. :items='["Light", "Dark"]'
  94. v-model='codeTheme'
  95. label='Code Color Theme'
  96. outline
  97. background-color='grey lighten-2'
  98. )
  99. v-card-chin
  100. v-btn(
  101. color='primary'
  102. )
  103. v-icon(left) check
  104. span Apply Configuration
  105. </template>
  106. <script>
  107. import _ from 'lodash'
  108. import renderersQuery from 'gql/admin/rendering/rendering-query-renderers.gql'
  109. export default {
  110. data() {
  111. return {
  112. selectedCore: 0,
  113. linkify: true,
  114. codeTheme: 'Light',
  115. renderers: []
  116. }
  117. },
  118. computed: {
  119. cores() {
  120. return _.filter(this.renderers, ['dependsOn', null]).map(core => {
  121. core.children = _.concat([_.cloneDeep(core)], _.filter(this.renderers, ['dependsOn', core.key]))
  122. return core
  123. })
  124. }
  125. },
  126. watch: {
  127. renderers(newValue, oldValue) {
  128. _.delay(() => {
  129. this.selectedCore = _.findIndex(this.cores, ['key', 'markdownCore'])
  130. }, 500)
  131. }
  132. },
  133. apollo: {
  134. renderers: {
  135. query: renderersQuery,
  136. fetchPolicy: 'network-only',
  137. update: (data) => _.cloneDeep(data.rendering.renderers).map(str => ({...str, config: str.config.map(cfg => ({...cfg, value: JSON.parse(cfg.value)}))})),
  138. watchLoading (isLoading) {
  139. this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-rendering-refresh')
  140. }
  141. }
  142. }
  143. }
  144. </script>
  145. <style lang='scss'>
  146. .adm-rendering-pipeline {
  147. border-top: 1px solid #FFF;
  148. .v-expansion-panel__header {
  149. padding: 0 0;
  150. }
  151. }
  152. </style>