From 97ffea353ce15a944f2d89a2f0f35d44a45e7cdb Mon Sep 17 00:00:00 2001 From: Hironsan Date: Mon, 7 Jun 2021 15:05:05 +0900 Subject: [PATCH] Remove filterOption --- .../tasks/toolbar/buttons/ButtonFilter.vue | 4 ++-- frontend/composables/useExampleItem.ts | 3 +-- .../domain/models/example/exampleRepository.ts | 2 +- frontend/domain/models/project/project.ts | 16 ---------------- .../projects/_id/image-classification/index.vue | 3 +-- .../projects/_id/sequence-labeling/index.vue | 3 +-- .../projects/_id/sequence-to-sequence/index.vue | 3 +-- .../pages/projects/_id/speech-to-text/index.vue | 3 +-- .../projects/_id/text-classification/index.vue | 1 - .../example/apiDocumentRepository.ts | 6 +++--- .../example/exampleApplicationService.ts | 3 +-- .../services/application/project/projectData.ts | 2 -- 12 files changed, 12 insertions(+), 37 deletions(-) diff --git a/frontend/components/tasks/toolbar/buttons/ButtonFilter.vue b/frontend/components/tasks/toolbar/buttons/ButtonFilter.vue index a161d11b..053bebf9 100644 --- a/frontend/components/tasks/toolbar/buttons/ButtonFilter.vue +++ b/frontend/components/tasks/toolbar/buttons/ButtonFilter.vue @@ -51,8 +51,8 @@ export default { return { items: [ { title: this.$t('annotation.filterOption1'), param: '' }, - { title: this.$t('annotation.filterOption2'), param: 'false' }, - { title: this.$t('annotation.filterOption3'), param: 'true' } + { title: this.$t('annotation.filterOption2'), param: 'true' }, + { title: this.$t('annotation.filterOption3'), param: 'false' } ] } }, diff --git a/frontend/composables/useExampleItem.ts b/frontend/composables/useExampleItem.ts index b814bfd3..b6e4faab 100644 --- a/frontend/composables/useExampleItem.ts +++ b/frontend/composables/useExampleItem.ts @@ -13,10 +13,9 @@ export const useExampleItem = () => { const getExample = async( projectId: string, - filterOption: string, { page, q, isChecked }: { page: string, q: string, isChecked: string} ) => { - const examples = await exampleService.fetchOne(projectId, page, q, isChecked, filterOption) + const examples = await exampleService.fetchOne(projectId, page, q, isChecked) state.totalExample = examples.count if (!_.isEmpty(examples) && examples.items.length !== 0) { state.example = examples.items[0] diff --git a/frontend/domain/models/example/exampleRepository.ts b/frontend/domain/models/example/exampleRepository.ts index 37512d08..c4d564ee 100644 --- a/frontend/domain/models/example/exampleRepository.ts +++ b/frontend/domain/models/example/exampleRepository.ts @@ -3,7 +3,7 @@ import { ExampleItem, ExampleItemList } from '~/domain/models/example/example' export type SearchOption = {[key: string]: string | (string | null)[]} export interface ExampleRepository { - list(projectId: string, { limit, offset, q, isChecked, filterName }: SearchOption): Promise + list(projectId: string, { limit, offset, q, isChecked }: SearchOption): Promise create(projectId: string, item: ExampleItem): Promise diff --git a/frontend/domain/models/project/project.ts b/frontend/domain/models/project/project.ts index a37c5eba..d8c6f628 100644 --- a/frontend/domain/models/project/project.ts +++ b/frontend/domain/models/project/project.ts @@ -106,22 +106,6 @@ export class ProjectReadItem { return allowedProjectTypes.includes(this.project_type) } - get filterOption() { - if (this.project_type === 'DocumentClassification') { - return 'categories__isnull' - } else if (this.project_type === 'SequenceLabeling') { - return 'spans__isnull' - } else if (this.project_type === 'Seq2seq') { - return 'texts__isnull' - } else if (this.project_type === 'ImageClassification') { - return 'categories__isnull' - } else if (this.project_type === 'Speech2text') { - return 'texts__isnull' - } else { - return '' - } - } - toObject(): Object { return { id: this.id, diff --git a/frontend/pages/projects/_id/image-classification/index.vue b/frontend/pages/projects/_id/image-classification/index.vue index a6e194b8..31352d2d 100644 --- a/frontend/pages/projects/_id/image-classification/index.vue +++ b/frontend/pages/projects/_id/image-classification/index.vue @@ -106,8 +106,7 @@ export default { this.projectId, this.$route.query.page, this.$route.query.q, - this.$route.query.isChecked, - this.project.filterOption + this.$route.query.isChecked ) const image = this.images.items[0] this.setImageSize(image) diff --git a/frontend/pages/projects/_id/sequence-labeling/index.vue b/frontend/pages/projects/_id/sequence-labeling/index.vue index 89db52e6..ecf0e6ce 100644 --- a/frontend/pages/projects/_id/sequence-labeling/index.vue +++ b/frontend/pages/projects/_id/sequence-labeling/index.vue @@ -75,8 +75,7 @@ export default { this.projectId, this.$route.query.page, this.$route.query.q, - this.$route.query.isChecked, - this.project.filterOption + this.$route.query.isChecked ) const doc = this.docs.items[0] if (this.enableAutoLabeling) { diff --git a/frontend/pages/projects/_id/sequence-to-sequence/index.vue b/frontend/pages/projects/_id/sequence-to-sequence/index.vue index 4789a89e..117b894b 100644 --- a/frontend/pages/projects/_id/sequence-to-sequence/index.vue +++ b/frontend/pages/projects/_id/sequence-to-sequence/index.vue @@ -59,8 +59,7 @@ export default { this.projectId, this.$route.query.page, this.$route.query.q, - this.$route.query.isChecked, - this.project.filterOption + this.$route.query.isChecked ) const doc = this.docs.items[0] if (this.enableAutoLabeling) { diff --git a/frontend/pages/projects/_id/speech-to-text/index.vue b/frontend/pages/projects/_id/speech-to-text/index.vue index 238fb66c..90169b36 100644 --- a/frontend/pages/projects/_id/speech-to-text/index.vue +++ b/frontend/pages/projects/_id/speech-to-text/index.vue @@ -62,8 +62,7 @@ export default { this.projectId, this.$route.query.page, this.$route.query.q, - this.$route.query.isChecked, - this.project.filterOption + this.$route.query.isChecked ) const item = this.items.items[0] if (this.enableAutoLabeling) { diff --git a/frontend/pages/projects/_id/text-classification/index.vue b/frontend/pages/projects/_id/text-classification/index.vue index 81979cbf..84c515f3 100644 --- a/frontend/pages/projects/_id/text-classification/index.vue +++ b/frontend/pages/projects/_id/text-classification/index.vue @@ -102,7 +102,6 @@ export default { const { fetch } = useFetch(async() => { await getExample( projectId, - projectState.project.filterOption, query.value ) if (enableAutoLabeling.value) { diff --git a/frontend/repositories/example/apiDocumentRepository.ts b/frontend/repositories/example/apiDocumentRepository.ts index 5f5f8eb7..3596c66b 100644 --- a/frontend/repositories/example/apiDocumentRepository.ts +++ b/frontend/repositories/example/apiDocumentRepository.ts @@ -8,8 +8,8 @@ export class APIExampleRepository implements ExampleRepository { private readonly request = ApiService ) {} - async list(projectId: string, { limit = '10', offset = '0', q = '', isChecked = '', filterName = '' }: SearchOption): Promise { - const url = `/projects/${projectId}/examples?limit=${limit}&offset=${offset}&q=${q}&${filterName}=${isChecked}` + async list(projectId: string, { limit = '10', offset = '0', q = '', isChecked = '' }: SearchOption): Promise { + const url = `/projects/${projectId}/examples?limit=${limit}&offset=${offset}&q=${q}&confirmed=${isChecked}` const response = await this.request.get(url) return ExampleItemList.valueOf(response.data) } @@ -49,6 +49,6 @@ export class APIExampleRepository implements ExampleRepository { async confirm(projectId: string, exampleId: number): Promise { const url = `/projects/${projectId}/examples/${exampleId}/states` - await this.request.post(url) + await this.request.post(url, {}) } } diff --git a/frontend/services/application/example/exampleApplicationService.ts b/frontend/services/application/example/exampleApplicationService.ts index d57f1296..1959fec5 100644 --- a/frontend/services/application/example/exampleApplicationService.ts +++ b/frontend/services/application/example/exampleApplicationService.ts @@ -17,14 +17,13 @@ export class ExampleApplicationService { } } - public async fetchOne(projectId: string, page: string, q: string, isChecked: string, filterName: string): Promise { + public async fetchOne(projectId: string, page: string, q: string, isChecked: string): Promise { const offset = (parseInt(page, 10) - 1).toString() const options: SearchOption = { limit: '1', offset, q, isChecked, - filterName } return await this.list(projectId, options) } diff --git a/frontend/services/application/project/projectData.ts b/frontend/services/application/project/projectData.ts index d9e8ccab..b60658ea 100644 --- a/frontend/services/application/project/projectData.ts +++ b/frontend/services/application/project/projectData.ts @@ -13,7 +13,6 @@ export class ProjectDTO { singleClassClassification: boolean pageLink: string permitApprove: Boolean - filterOption: String tags: Object[] canDefineLabel: Boolean canDefineRelation: Boolean @@ -31,7 +30,6 @@ export class ProjectDTO { this.singleClassClassification = item.single_class_classification this.pageLink = item.annotationPageLink this.permitApprove = item.permitApprove - this.filterOption = item.filterOption this.tags = item.tags this.canDefineLabel = item.canDefineLabel this.canDefineRelation = item.canDefineRelation