Browse Source

Add annotation start button to the side bar

pull/341/head
Hironsan 5 years ago
parent
commit
19703fff36
4 changed files with 69 additions and 5 deletions
  1. 24
      frontend/components/organisms/layout/TheSideBar.vue
  2. 15
      frontend/layouts/annotation.vue
  3. 24
      frontend/layouts/project.vue
  4. 11
      frontend/store/projects.js

24
frontend/components/organisms/layout/TheSideBar.vue

@ -1,5 +1,15 @@
<template> <template>
<v-list dense> <v-list dense>
<v-btn
color="ms-4 my-1 mb-2 primary text-capitalize"
:to="to"
nuxt
>
<v-icon left>
mdi-play-circle-outline
</v-icon>
Start annotation
</v-btn>
<template v-for="(item, i) in items"> <template v-for="(item, i) in items">
<v-divider <v-divider
v-if="item.divider" v-if="item.divider"
@ -29,6 +39,14 @@
<script> <script>
export default { export default {
props: {
link: {
type: String,
default: '',
required: true
}
},
data() { data() {
return { return {
items: [ items: [
@ -40,6 +58,12 @@ export default {
{ icon: 'mdi-chart-bar', text: 'Statistics', link: 'statistics' } { icon: 'mdi-chart-bar', text: 'Statistics', link: 'statistics' }
] ]
} }
},
computed: {
to() {
return `/projects/${this.$route.params.id}/${this.link}`
}
} }
} }
</script> </script>

15
frontend/layouts/annotation.vue

@ -12,7 +12,7 @@
clipped clipped
color="" color=""
> >
<the-side-bar />
<the-side-bar :link="getLink" />
</v-navigation-drawer> </v-navigation-drawer>
<nuxt /> <nuxt />
@ -20,6 +20,7 @@
</template> </template>
<script> <script>
import { mapActions, mapGetters } from 'vuex'
import TheSideBar from '~/components/organisms/layout/TheSideBar' import TheSideBar from '~/components/organisms/layout/TheSideBar'
import TheHeader from '~/components/organisms/layout/TheHeader' import TheHeader from '~/components/organisms/layout/TheHeader'
@ -32,6 +33,18 @@ export default {
return { return {
drawerLeft: false drawerLeft: false
} }
},
computed: {
...mapGetters('projects', ['getLink'])
},
created() {
this.setCurrentProject(this.$route.params.id)
},
methods: {
...mapActions('projects', ['setCurrentProject'])
} }
} }
</script> </script>

24
frontend/layouts/project.vue

@ -12,7 +12,7 @@
clipped clipped
color="" color=""
> >
<the-side-bar />
<the-side-bar :link="getLink" />
</v-navigation-drawer> </v-navigation-drawer>
<v-content> <v-content>
@ -33,6 +33,7 @@
</template> </template>
<script> <script>
import { mapActions, mapGetters } from 'vuex'
import TheSideBar from '~/components/organisms/layout/TheSideBar' import TheSideBar from '~/components/organisms/layout/TheSideBar'
import TheHeader from '~/components/organisms/layout/TheHeader' import TheHeader from '~/components/organisms/layout/TheHeader'
@ -41,8 +42,23 @@ export default {
TheSideBar, TheSideBar,
TheHeader TheHeader
}, },
data: () => ({
drawerLeft: false
})
data() {
return {
drawerLeft: false
}
},
computed: {
...mapGetters('projects', ['getLink'])
},
created() {
this.setCurrentProject(this.$route.params.id)
},
methods: {
...mapActions('projects', ['setCurrentProject'])
}
} }
</script> </script>

11
frontend/store/projects.js

@ -31,6 +31,17 @@ export const getters = {
} }
] ]
}, },
getLink(state) {
if (state.current.project_type === 'DocumentClassification') {
return 'text-classification'
} else if (state.current.project_type === 'SequenceLabeling') {
return 'sequence-labeling'
} else if (state.current.project_type === 'Seq2seq') {
return 'sequence-to-sequence'
} else {
return ''
}
},
getImportFormat(state) { getImportFormat(state) {
const plain = { const plain = {
type: 'plain', type: 'plain',

Loading…
Cancel
Save