Browse Source

Enable to order examples by score in frontend

pull/2028/head
Hironsan 2 years ago
parent
commit
15928aa0a6
12 changed files with 50 additions and 14 deletions
  1. 21
      frontend/components/tasks/toolbar/ToolbarLaptop.vue
  2. 9
      frontend/composables/useExampleItem.ts
  3. 3
      frontend/pages/projects/_id/image-captioning/index.vue
  4. 3
      frontend/pages/projects/_id/image-classification/index.vue
  5. 3
      frontend/pages/projects/_id/intent-detection-and-slot-filling/index.vue
  6. 3
      frontend/pages/projects/_id/object-detection/index.vue
  7. 3
      frontend/pages/projects/_id/segmentation/index.vue
  8. 3
      frontend/pages/projects/_id/sequence-labeling/index.vue
  9. 3
      frontend/pages/projects/_id/sequence-to-sequence/index.vue
  10. 3
      frontend/pages/projects/_id/speech-to-text/index.vue
  11. 4
      frontend/repositories/example/apiDocumentRepository.ts
  12. 6
      frontend/services/application/example/exampleApplicationService.ts

21
frontend/components/tasks/toolbar/ToolbarLaptop.vue

@ -6,6 +6,8 @@
<button-filter :value="filterOption" @click:filter="changeFilter" /> <button-filter :value="filterOption" @click:filter="changeFilter" />
<button-order :value="orderOption" @click:order="changeOrder" />
<button-guideline @click:guideline="dialogGuideline = true" /> <button-guideline @click:guideline="dialogGuideline = true" />
<v-dialog v-model="dialogGuideline"> <v-dialog v-model="dialogGuideline">
<form-guideline :guideline-text="guidelineText" @click:close="dialogGuideline = false" /> <form-guideline :guideline-text="guidelineText" @click:close="dialogGuideline = false" />
@ -64,6 +66,7 @@ import ButtonClear from './buttons/ButtonClear.vue'
import ButtonComment from './buttons/ButtonComment.vue' import ButtonComment from './buttons/ButtonComment.vue'
import ButtonFilter from './buttons/ButtonFilter.vue' import ButtonFilter from './buttons/ButtonFilter.vue'
import ButtonGuideline from './buttons/ButtonGuideline.vue' import ButtonGuideline from './buttons/ButtonGuideline.vue'
import ButtonOrder from './buttons/ButtonOrder.vue'
import ButtonPagination from './buttons/ButtonPagination.vue' import ButtonPagination from './buttons/ButtonPagination.vue'
import ButtonReview from './buttons/ButtonReview.vue' import ButtonReview from './buttons/ButtonReview.vue'
import ButtonKeyboardShortcut from './buttons/ButtonKeyboardShortcut.vue' import ButtonKeyboardShortcut from './buttons/ButtonKeyboardShortcut.vue'
@ -80,6 +83,7 @@ export default Vue.extend({
ButtonComment, ButtonComment,
ButtonFilter, ButtonFilter,
ButtonGuideline, ButtonGuideline,
ButtonOrder,
ButtonKeyboardShortcut, ButtonKeyboardShortcut,
ButtonPagination, ButtonPagination,
ButtonReview, ButtonReview,
@ -134,6 +138,10 @@ export default Vue.extend({
filterOption(): string { filterOption(): string {
// @ts-ignore // @ts-ignore
return this.$route.query.isChecked return this.$route.query.isChecked
},
orderOption(): string {
// @ts-ignore
return this.$route.query.ordering
} }
}, },
@ -143,6 +151,7 @@ export default Vue.extend({
query: { query: {
page: page.toString(), page: page.toString(),
isChecked: this.filterOption, isChecked: this.filterOption,
ordering: this.$route.query.ordering,
q: this.$route.query.q q: this.$route.query.q
} }
}) })
@ -153,11 +162,23 @@ export default Vue.extend({
query: { query: {
page: '1', page: '1',
isChecked, isChecked,
ordering: this.$route.query.ordering,
q: this.$route.query.q q: this.$route.query.q
} }
}) })
}, },
changeOrder(ordering: string) {
this.$router.push({
query: {
page: '1',
isChecked: this.filterOption,
q: this.$route.query.q,
ordering
}
})
},
updateAutoLabeling(isEnable: boolean) { updateAutoLabeling(isEnable: boolean) {
if (isEnable) { if (isEnable) {
this.$emit('update:enable-auto-labeling', true) this.$emit('update:enable-auto-labeling', true)

9
frontend/composables/useExampleItem.ts

@ -14,9 +14,14 @@ export const useExampleItem = () => {
const getExample = async ( const getExample = async (
projectId: string, projectId: string,
{ page, q, isChecked }: { page: string; q: string; isChecked: string }
{
page,
q,
isChecked,
ordering
}: { page: string; q: string; isChecked: string; ordering: string }
) => { ) => {
const examples = await exampleService.fetchOne(projectId, page, q, isChecked)
const examples = await exampleService.fetchOne(projectId, page, q, isChecked, ordering)
state.totalExample = examples.count state.totalExample = examples.count
if (!_.isEmpty(examples) && examples.items.length !== 0) { if (!_.isEmpty(examples) && examples.items.length !== 0) {
state.example = examples.items[0] state.example = examples.items[0]

3
frontend/pages/projects/_id/image-captioning/index.vue

@ -112,7 +112,8 @@ export default {
this.projectId, this.projectId,
this.$route.query.page, this.$route.query.page,
this.$route.query.q, this.$route.query.q,
this.$route.query.isChecked
this.$route.query.isChecked,
this.$route.query.ordering
) )
const image = this.images.items[0] const image = this.images.items[0]
this.setImageSize(image) this.setImageSize(image)

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

@ -115,7 +115,8 @@ export default {
this.projectId, this.projectId,
this.$route.query.page, this.$route.query.page,
this.$route.query.q, this.$route.query.q,
this.$route.query.isChecked
this.$route.query.isChecked,
this.$route.query.ordering
) )
const image = this.images.items[0] const image = this.images.items[0]
this.setImageSize(image) this.setImageSize(image)

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

@ -91,7 +91,8 @@ export default {
this.projectId, this.projectId,
this.$route.query.page, this.$route.query.page,
this.$route.query.q, this.$route.query.q,
this.$route.query.isChecked
this.$route.query.isChecked,
this.$route.query.ordering
) )
const doc = this.docs.items[0] const doc = this.docs.items[0]
await this.listSpan(doc.id) await this.listSpan(doc.id)

3
frontend/pages/projects/_id/object-detection/index.vue

@ -134,7 +134,8 @@ export default {
this.projectId, this.projectId,
this.$route.query.page, this.$route.query.page,
this.$route.query.q, this.$route.query.q,
this.$route.query.isChecked
this.$route.query.isChecked,
this.$route.query.ordering
) )
const image = this.images.items[0] const image = this.images.items[0]
if (this.enableAutoLabeling) { if (this.enableAutoLabeling) {

3
frontend/pages/projects/_id/segmentation/index.vue

@ -135,7 +135,8 @@ export default {
this.projectId, this.projectId,
this.$route.query.page, this.$route.query.page,
this.$route.query.q, this.$route.query.q,
this.$route.query.isChecked
this.$route.query.isChecked,
this.$route.query.ordering
) )
const image = this.images.items[0] const image = this.images.items[0]
if (this.enableAutoLabeling) { if (this.enableAutoLabeling) {

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

@ -124,7 +124,8 @@ export default {
this.projectId, this.projectId,
this.$route.query.page, this.$route.query.page,
this.$route.query.q, this.$route.query.q,
this.$route.query.isChecked
this.$route.query.isChecked,
this.$route.query.ordering
) )
const doc = this.docs.items[0] const doc = this.docs.items[0]
if (this.enableAutoLabeling && !doc.isConfirmed) { if (this.enableAutoLabeling && !doc.isConfirmed) {

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

@ -71,7 +71,8 @@ export default {
this.projectId, this.projectId,
this.$route.query.page, this.$route.query.page,
this.$route.query.q, this.$route.query.q,
this.$route.query.isChecked
this.$route.query.isChecked,
this.$route.query.ordering
) )
const doc = this.docs.items[0] const doc = this.docs.items[0]
if (this.enableAutoLabeling) { if (this.enableAutoLabeling) {

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

@ -76,7 +76,8 @@ export default {
this.projectId, this.projectId,
this.$route.query.page, this.$route.query.page,
this.$route.query.q, this.$route.query.q,
this.$route.query.isChecked
this.$route.query.isChecked,
this.$route.query.ordering
) )
const item = this.items.items[0] const item = this.items.items[0]
if (this.enableAutoLabeling) { if (this.enableAutoLabeling) {

4
frontend/repositories/example/apiDocumentRepository.ts

@ -30,9 +30,9 @@ export class APIExampleRepository implements ExampleRepository {
async list( async list(
projectId: string, projectId: string,
{ limit = '10', offset = '0', q = '', isChecked = '' }: SearchOption
{ limit = '10', offset = '0', q = '', isChecked = '', ordering = '' }: SearchOption
): Promise<ExampleItemList> { ): Promise<ExampleItemList> {
const url = `/projects/${projectId}/examples?limit=${limit}&offset=${offset}&q=${q}&confirmed=${isChecked}`
const url = `/projects/${projectId}/examples?limit=${limit}&offset=${offset}&q=${q}&confirmed=${isChecked}&ordering=${ordering}`
const response = await this.request.get(url) const response = await this.request.get(url)
return new ExampleItemList( return new ExampleItemList(
response.data.count, response.data.count,

6
frontend/services/application/example/exampleApplicationService.ts

@ -19,14 +19,16 @@ export class ExampleApplicationService {
projectId: string, projectId: string,
page: string, page: string,
q: string, q: string,
isChecked: string
isChecked: string,
ordering: string
): Promise<ExampleListDTO> { ): Promise<ExampleListDTO> {
const offset = (parseInt(page, 10) - 1).toString() const offset = (parseInt(page, 10) - 1).toString()
const options: SearchOption = { const options: SearchOption = {
limit: '1', limit: '1',
offset, offset,
q, q,
isChecked
isChecked,
ordering
} }
return await this.list(projectId, options) return await this.list(projectId, options)
} }

Loading…
Cancel
Save