Browse Source

Update annotation pages to show progress

pull/1679/head
Hironsan 2 years ago
parent
commit
b8d7495e43
7 changed files with 72 additions and 11 deletions
  1. 9
      frontend/composables/useExampleItem.ts
  2. 14
      frontend/pages/projects/_id/image-classification/index.vue
  3. 12
      frontend/pages/projects/_id/intent-detection-and-slot-filling/index.vue
  4. 12
      frontend/pages/projects/_id/sequence-labeling/index.vue
  5. 14
      frontend/pages/projects/_id/sequence-to-sequence/index.vue
  6. 14
      frontend/pages/projects/_id/speech-to-text/index.vue
  7. 8
      frontend/pages/projects/_id/text-classification/index.vue

9
frontend/composables/useExampleItem.ts

@ -5,7 +5,8 @@ import { ExampleDTO } from '@/services/application/example/exampleData'
export const useExampleItem = () => { export const useExampleItem = () => {
const state = reactive({ const state = reactive({
example: {} as ExampleDTO, example: {} as ExampleDTO,
totalExample: 0
totalExample: 0,
progress: {}
}) })
const { app } = useContext() const { app } = useContext()
@ -28,16 +29,22 @@ export const useExampleItem = () => {
state.example = await exampleService.findById(projectId, state.example.id) state.example = await exampleService.findById(projectId, state.example.id)
} }
const updateProgress = async(projectId: string) => {
state.progress = await app.$services.metrics.fetchMyProgress(projectId)
}
const confirm = async( const confirm = async(
projectId: string, projectId: string,
) => { ) => {
await exampleService.confirm(projectId, state.example.id) await exampleService.confirm(projectId, state.example.id)
await getExampleById(projectId) await getExampleById(projectId)
updateProgress(projectId)
} }
return { return {
state, state,
confirm, confirm,
getExample, getExample,
updateProgress
} }
} }

14
frontend/pages/projects/_id/image-classification/index.vue

@ -62,7 +62,8 @@
</v-card> </v-card>
</template> </template>
<template #sidebar> <template #sidebar>
<list-metadata :metadata="image.meta" />
<annotation-progress :progress="progress" />
<list-metadata :metadata="image.meta" class="mt-4" />
</template> </template>
</layout-text> </layout-text>
</template> </template>
@ -78,10 +79,12 @@ import ListMetadata from '@/components/tasks/metadata/ListMetadata'
import ToolbarLaptop from '@/components/tasks/toolbar/ToolbarLaptop' import ToolbarLaptop from '@/components/tasks/toolbar/ToolbarLaptop'
import ToolbarMobile from '@/components/tasks/toolbar/ToolbarMobile' import ToolbarMobile from '@/components/tasks/toolbar/ToolbarMobile'
import { useLabelList } from '@/composables/useLabelList' import { useLabelList } from '@/composables/useLabelList'
import AnnotationProgress from '@/components/tasks/sidebar/AnnotationProgress.vue'
export default { export default {
components: { components: {
AnnotationProgress,
LabelGroup, LabelGroup,
LabelSelect, LabelSelect,
LayoutText, LayoutText,
@ -118,7 +121,8 @@ export default {
width: 0 width: 0
}, },
mdiText, mdiText,
mdiFormatListBulleted
mdiFormatListBulleted,
progress: {}
} }
}, },
@ -162,6 +166,7 @@ export default {
async created() { async created() {
this.getLabelList(this.projectId) this.getLabelList(this.projectId)
this.project = await this.$services.project.findById(this.projectId) this.project = await this.$services.project.findById(this.projectId)
this.progress = await this.$services.metrics.fetchMyProgress(this.projectId)
}, },
methods: { methods: {
@ -202,9 +207,14 @@ export default {
} }
}, },
async updateProgress() {
this.progress = await this.$services.metrics.fetchMyProgress(this.projectId)
},
async confirm() { async confirm() {
await this.$services.example.confirm(this.projectId, this.image.id) await this.$services.example.confirm(this.projectId, this.image.id)
await this.$fetch() await this.$fetch()
this.updateProgress()
}, },
setImageSize(val) { setImageSize(val) {

12
frontend/pages/projects/_id/intent-detection-and-slot-filling/index.vue

@ -44,7 +44,8 @@
</v-card> </v-card>
</template> </template>
<template #sidebar> <template #sidebar>
<list-metadata :metadata="doc.meta" />
<annotation-progress :progress="progress" />
<list-metadata :metadata="doc.meta" class="mt-4" />
</template> </template>
</layout-text> </layout-text>
</template> </template>
@ -56,9 +57,11 @@ import ListMetadata from '@/components/tasks/metadata/ListMetadata'
import ToolbarLaptop from '@/components/tasks/toolbar/ToolbarLaptop' import ToolbarLaptop from '@/components/tasks/toolbar/ToolbarLaptop'
import ToolbarMobile from '@/components/tasks/toolbar/ToolbarMobile' import ToolbarMobile from '@/components/tasks/toolbar/ToolbarMobile'
import LabelGroup from '@/components/tasks/textClassification/LabelGroup' import LabelGroup from '@/components/tasks/textClassification/LabelGroup'
import AnnotationProgress from '@/components/tasks/sidebar/AnnotationProgress.vue'
export default { export default {
components: { components: {
AnnotationProgress,
EntityEditor, EntityEditor,
LayoutText, LayoutText,
ListMetadata, ListMetadata,
@ -83,6 +86,7 @@ export default {
project: {}, project: {},
exclusive: false, exclusive: false,
enableAutoLabeling: false, enableAutoLabeling: false,
progress: {}
} }
}, },
@ -123,6 +127,7 @@ export default {
this.spanTypes = await this.$services.spanType.list(this.projectId) this.spanTypes = await this.$services.spanType.list(this.projectId)
this.categoryTypes = await this.$services.categoryType.list(this.projectId) this.categoryTypes = await this.$services.categoryType.list(this.projectId)
this.project = await this.$services.project.findById(this.projectId) this.project = await this.$services.project.findById(this.projectId)
this.progress = await this.$services.metrics.fetchMyProgress(this.projectId)
}, },
methods: { methods: {
@ -165,9 +170,14 @@ export default {
await this.listSpan(this.doc.id) await this.listSpan(this.doc.id)
}, },
async updateProgress() {
this.progress = await this.$services.metrics.fetchMyProgress(this.projectId)
},
async confirm() { async confirm() {
await this.$services.example.confirm(this.projectId, this.doc.id) await this.$services.example.confirm(this.projectId, this.doc.id)
await this.$fetch() await this.$fetch()
this.updateProgress()
} }
} }
} }

12
frontend/pages/projects/_id/sequence-labeling/index.vue

@ -38,7 +38,8 @@
</v-card> </v-card>
</template> </template>
<template #sidebar> <template #sidebar>
<list-metadata :metadata="doc.meta" />
<annotation-progress :progress="progress" />
<list-metadata :metadata="doc.meta" class="mt-4" />
<v-card class="mt-4"> <v-card class="mt-4">
<v-card-title>Label Types</v-card-title> <v-card-title>Label Types</v-card-title>
<v-card-text> <v-card-text>
@ -80,10 +81,12 @@ import ListMetadata from '@/components/tasks/metadata/ListMetadata'
import ToolbarLaptop from '@/components/tasks/toolbar/ToolbarLaptop' import ToolbarLaptop from '@/components/tasks/toolbar/ToolbarLaptop'
import ToolbarMobile from '@/components/tasks/toolbar/ToolbarMobile' import ToolbarMobile from '@/components/tasks/toolbar/ToolbarMobile'
import EntityEditor from '@/components/tasks/sequenceLabeling/EntityEditor.vue' import EntityEditor from '@/components/tasks/sequenceLabeling/EntityEditor.vue'
import AnnotationProgress from '@/components/tasks/sidebar/AnnotationProgress.vue'
export default { export default {
components: { components: {
AnnotationProgress,
EntityEditor, EntityEditor,
LayoutText, LayoutText,
ListMetadata, ListMetadata,
@ -108,6 +111,7 @@ export default {
enableAutoLabeling: false, enableAutoLabeling: false,
rtl: false, rtl: false,
selectedLabelIndex: null, selectedLabelIndex: null,
progress: {},
} }
}, },
@ -167,6 +171,7 @@ export default {
this.labels = await this.$services.spanType.list(this.projectId) this.labels = await this.$services.spanType.list(this.projectId)
this.linkTypes = await this.$services.linkTypes.list(this.projectId) this.linkTypes = await this.$services.linkTypes.list(this.projectId)
this.project = await this.$services.project.findById(this.projectId) this.project = await this.$services.project.findById(this.projectId)
this.progress = await this.$services.metrics.fetchMyProgress(this.projectId)
}, },
methods: { methods: {
@ -215,9 +220,14 @@ export default {
} }
}, },
async updateProgress() {
this.progress = await this.$services.metrics.fetchMyProgress(this.projectId)
},
async confirm() { async confirm() {
await this.$services.example.confirm(this.projectId, this.doc.id) await this.$services.example.confirm(this.projectId, this.doc.id)
await this.$fetch() await this.$fetch()
this.updateProgress()
}, },
changeSelectedLabel(event) { changeSelectedLabel(event) {

14
frontend/pages/projects/_id/sequence-to-sequence/index.vue

@ -29,7 +29,8 @@
/> />
</template> </template>
<template #sidebar> <template #sidebar>
<list-metadata :metadata="doc.meta" />
<annotation-progress :progress="progress" />
<list-metadata :metadata="doc.meta" class="mt-4" />
</template> </template>
</layout-text> </layout-text>
</template> </template>
@ -40,11 +41,13 @@ import LayoutText from '@/components/tasks/layout/LayoutText'
import ListMetadata from '@/components/tasks/metadata/ListMetadata' import ListMetadata from '@/components/tasks/metadata/ListMetadata'
import ToolbarLaptop from '@/components/tasks/toolbar/ToolbarLaptop' import ToolbarLaptop from '@/components/tasks/toolbar/ToolbarLaptop'
import ToolbarMobile from '@/components/tasks/toolbar/ToolbarMobile' import ToolbarMobile from '@/components/tasks/toolbar/ToolbarMobile'
import AnnotationProgress from '@/components/tasks/sidebar/AnnotationProgress.vue'
import Seq2seqBox from '~/components/tasks/seq2seq/Seq2seqBox' import Seq2seqBox from '~/components/tasks/seq2seq/Seq2seqBox'
export default { export default {
components: { components: {
AnnotationProgress,
LayoutText, LayoutText,
ListMetadata, ListMetadata,
Seq2seqBox, Seq2seqBox,
@ -62,7 +65,8 @@ export default {
annotations: [], annotations: [],
docs: [], docs: [],
project: {}, project: {},
enableAutoLabeling: false
enableAutoLabeling: false,
progress: {}
} }
}, },
@ -104,6 +108,7 @@ export default {
async created() { async created() {
this.project = await this.$services.project.findById(this.projectId) this.project = await this.$services.project.findById(this.projectId)
this.progress = await this.$services.metrics.fetchMyProgress(this.projectId)
}, },
methods: { methods: {
@ -139,9 +144,14 @@ export default {
} }
}, },
async updateProgress() {
this.progress = await this.$services.metrics.fetchMyProgress(this.projectId)
},
async confirm() { async confirm() {
await this.$services.example.confirm(this.projectId, this.doc.id) await this.$services.example.confirm(this.projectId, this.doc.id)
await this.$fetch() await this.$fetch()
this.updateProgress()
} }
} }
} }

14
frontend/pages/projects/_id/speech-to-text/index.vue

@ -36,7 +36,8 @@
/> />
</template> </template>
<template #sidebar> <template #sidebar>
<list-metadata :metadata="item.meta" />
<annotation-progress :progress="progress" />
<list-metadata :metadata="item.meta" class="mt-4" />
</template> </template>
</layout-text> </layout-text>
</template> </template>
@ -47,12 +48,14 @@ import LayoutText from '@/components/tasks/layout/LayoutText'
import ListMetadata from '@/components/tasks/metadata/ListMetadata' import ListMetadata from '@/components/tasks/metadata/ListMetadata'
import ToolbarLaptop from '@/components/tasks/toolbar/ToolbarLaptop' import ToolbarLaptop from '@/components/tasks/toolbar/ToolbarLaptop'
import ToolbarMobile from '@/components/tasks/toolbar/ToolbarMobile' import ToolbarMobile from '@/components/tasks/toolbar/ToolbarMobile'
import AnnotationProgress from '@/components/tasks/sidebar/AnnotationProgress.vue'
import Seq2seqBox from '~/components/tasks/seq2seq/Seq2seqBox' import Seq2seqBox from '~/components/tasks/seq2seq/Seq2seqBox'
import AudioViewer from '~/components/tasks/audio/AudioViewer' import AudioViewer from '~/components/tasks/audio/AudioViewer'
export default { export default {
components: { components: {
AnnotationProgress,
AudioViewer, AudioViewer,
LayoutText, LayoutText,
ListMetadata, ListMetadata,
@ -72,7 +75,8 @@ export default {
items: [], items: [],
project: {}, project: {},
enableAutoLabeling: false, enableAutoLabeling: false,
isLoading: false
isLoading: false,
progress: {}
} }
}, },
@ -116,6 +120,7 @@ export default {
async created() { async created() {
this.project = await this.$services.project.findById(this.projectId) this.project = await this.$services.project.findById(this.projectId)
this.progress = await this.$services.metrics.fetchMyProgress(this.projectId)
}, },
methods: { methods: {
@ -151,9 +156,14 @@ export default {
} }
}, },
async updateProgress() {
this.progress = await this.$services.metrics.fetchMyProgress(this.projectId)
},
async confirm() { async confirm() {
await this.$services.example.confirm(this.projectId, this.item.id) await this.$services.example.confirm(this.projectId, this.item.id)
await this.$fetch() await this.$fetch()
this.updateProgress()
} }
} }
} }

8
frontend/pages/projects/_id/text-classification/index.vue

@ -45,7 +45,8 @@
</v-card> </v-card>
</template> </template>
<template #sidebar> <template #sidebar>
<list-metadata :metadata="example.meta" />
<annotation-progress :progress="progress" />
<list-metadata :metadata="example.meta" class="mt-4" />
</template> </template>
</layout-text> </layout-text>
</template> </template>
@ -63,10 +64,12 @@ import { useExampleItem } from '@/composables/useExampleItem'
import { useLabelList } from '@/composables/useLabelList' import { useLabelList } from '@/composables/useLabelList'
import { useProjectItem } from '@/composables/useProjectItem' import { useProjectItem } from '@/composables/useProjectItem'
import { useTeacherList } from '@/composables/useTeacherList' import { useTeacherList } from '@/composables/useTeacherList'
import AnnotationProgress from '@/components/tasks/sidebar/AnnotationProgress.vue'
export default { export default {
components: { components: {
AnnotationProgress,
ButtonLabelSwitch, ButtonLabelSwitch,
LabelGroup, LabelGroup,
LabelSelect, LabelSelect,
@ -85,7 +88,7 @@ export default {
const { app, params, query } = useContext() const { app, params, query } = useContext()
const projectId = params.value.id const projectId = params.value.id
const { state: projectState, getProjectById } = useProjectItem() const { state: projectState, getProjectById } = useProjectItem()
const { state: exampleState, confirm, getExample } = useExampleItem()
const { state: exampleState, confirm, getExample, updateProgress } = useExampleItem()
const { const {
state: teacherState, state: teacherState,
annotateLabel, annotateLabel,
@ -101,6 +104,7 @@ export default {
getLabelList(projectId) getLabelList(projectId)
getProjectById(projectId) getProjectById(projectId)
updateProgress(projectId)
const { fetch } = useFetch(async() => { const { fetch } = useFetch(async() => {
await getExample( await getExample(

Loading…
Cancel
Save