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.

208 lines
4.5 KiB

  1. <template>
  2. <v-navigation-drawer
  3. :value="drawer"
  4. app
  5. clipped
  6. right
  7. >
  8. <v-list dense>
  9. <v-list-group
  10. sub-group
  11. value="true"
  12. >
  13. <template v-slot:activator>
  14. <v-list-item>
  15. <v-list-item-content>
  16. <v-list-item-title>
  17. Progress
  18. </v-list-item-title>
  19. </v-list-item-content>
  20. </v-list-item>
  21. </template>
  22. <v-list-item class="pl-4">
  23. <v-list-item-content>
  24. <v-list-item-title>
  25. <v-progress-linear
  26. :value="progress"
  27. height="25"
  28. rounded
  29. >
  30. <strong>{{ Math.ceil(progress) }}%</strong>
  31. </v-progress-linear>
  32. </v-list-item-title>
  33. </v-list-item-content>
  34. </v-list-item>
  35. </v-list-group>
  36. <v-list-group
  37. sub-group
  38. value="true"
  39. >
  40. <template v-slot:activator>
  41. <v-list-item>
  42. <v-list-item-content>
  43. <v-list-item-title>
  44. Labels
  45. </v-list-item-title>
  46. </v-list-item-content>
  47. </v-list-item>
  48. </template>
  49. <v-list-item
  50. v-for="(label, i) in labels"
  51. :key="i"
  52. class="pl-4"
  53. >
  54. <v-list-item-content>
  55. <v-list-item-title>
  56. <v-chip
  57. :color="label.color"
  58. text-color="white"
  59. >
  60. <v-avatar left>
  61. <span class="white--text">{{ label.shortcut }}</span>
  62. </v-avatar>
  63. {{ label.name }}
  64. </v-chip>
  65. </v-list-item-title>
  66. </v-list-item-content>
  67. </v-list-item>
  68. </v-list-group>
  69. <v-list-item @click="showMetadata = true">
  70. <v-list-item-action>
  71. <v-icon>mdi-file-document-box</v-icon>
  72. </v-list-item-action>
  73. <v-list-item-content>
  74. <v-list-item-title>
  75. Show metadata
  76. </v-list-item-title>
  77. </v-list-item-content>
  78. </v-list-item>
  79. <v-list-item @click="showGuideline = true">
  80. <v-list-item-action>
  81. <v-icon>mdi-text-subject</v-icon>
  82. </v-list-item-action>
  83. <v-list-item-content>
  84. <v-list-item-title>
  85. Show guideline
  86. </v-list-item-title>
  87. </v-list-item-content>
  88. </v-list-item>
  89. </v-list>
  90. <v-dialog
  91. v-model="showMetadata"
  92. width="800"
  93. >
  94. <v-card>
  95. <v-card-title
  96. class="headline grey lighten-2"
  97. primary-title
  98. >
  99. Metadata
  100. </v-card-title>
  101. <v-card-text>
  102. <v-sheet>
  103. <pre>{{ prettyJson }}</pre>
  104. </v-sheet>
  105. </v-card-text>
  106. <v-divider />
  107. <v-card-actions>
  108. <v-spacer />
  109. <v-btn
  110. color="primary"
  111. text
  112. @click="showMetadata = false"
  113. >
  114. Close
  115. </v-btn>
  116. </v-card-actions>
  117. </v-card>
  118. </v-dialog>
  119. <v-dialog
  120. v-model="showGuideline"
  121. width="800"
  122. >
  123. <v-card>
  124. <v-card-title
  125. class="headline grey lighten-2"
  126. primary-title
  127. >
  128. Annotation Guideline
  129. </v-card-title>
  130. <v-card-text>
  131. <viewer
  132. :value="guidelineText"
  133. />
  134. </v-card-text>
  135. <v-divider />
  136. <v-card-actions>
  137. <v-spacer />
  138. <v-btn
  139. color="primary"
  140. text
  141. @click="showGuideline = false"
  142. >
  143. Close
  144. </v-btn>
  145. </v-card-actions>
  146. </v-card>
  147. </v-dialog>
  148. </v-navigation-drawer>
  149. </template>
  150. <script>
  151. import 'tui-editor/dist/tui-editor-contents.css'
  152. import 'highlight.js/styles/github.css'
  153. import { Viewer } from '@toast-ui/vue-editor'
  154. export default {
  155. components: {
  156. Viewer
  157. },
  158. props: {
  159. labels: {
  160. type: Array,
  161. default: () => ([]),
  162. required: true
  163. },
  164. progress: {
  165. type: Number,
  166. default: 0,
  167. required: true
  168. },
  169. metadata: {
  170. type: String,
  171. default: '{}',
  172. required: true
  173. },
  174. guidelineText: {
  175. type: String,
  176. default: '# This is Viewer.\n Hello World.'
  177. }
  178. },
  179. data: () => ({
  180. showMetadata: false,
  181. showGuideline: false
  182. }),
  183. computed: {
  184. drawer() {
  185. return this.$store.state.sidebar.drawer
  186. },
  187. prettyJson() {
  188. const data = JSON.parse(this.metadata)
  189. const pretty = JSON.stringify(data, null, 4)
  190. return pretty
  191. }
  192. }
  193. }
  194. </script>