Browse Source

Remove filterOption

pull/1402/head
Hironsan 3 years ago
parent
commit
97ffea353c
12 changed files with 12 additions and 37 deletions
  1. 4
      frontend/components/tasks/toolbar/buttons/ButtonFilter.vue
  2. 3
      frontend/composables/useExampleItem.ts
  3. 2
      frontend/domain/models/example/exampleRepository.ts
  4. 16
      frontend/domain/models/project/project.ts
  5. 3
      frontend/pages/projects/_id/image-classification/index.vue
  6. 3
      frontend/pages/projects/_id/sequence-labeling/index.vue
  7. 3
      frontend/pages/projects/_id/sequence-to-sequence/index.vue
  8. 3
      frontend/pages/projects/_id/speech-to-text/index.vue
  9. 1
      frontend/pages/projects/_id/text-classification/index.vue
  10. 6
      frontend/repositories/example/apiDocumentRepository.ts
  11. 3
      frontend/services/application/example/exampleApplicationService.ts
  12. 2
      frontend/services/application/project/projectData.ts

4
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' }
]
}
},

3
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]

2
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<ExampleItemList>
list(projectId: string, { limit, offset, q, isChecked }: SearchOption): Promise<ExampleItemList>
create(projectId: string, item: ExampleItem): Promise<ExampleItem>

16
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,

3
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)

3
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) {

3
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) {

3
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) {

1
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) {

6
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<ExampleItemList> {
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<ExampleItemList> {
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<void> {
const url = `/projects/${projectId}/examples/${exampleId}/states`
await this.request.post(url)
await this.request.post(url, {})
}
}

3
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<ExampleListDTO> {
public async fetchOne(projectId: string, page: string, q: string, isChecked: string): Promise<ExampleListDTO> {
const offset = (parseInt(page, 10) - 1).toString()
const options: SearchOption = {
limit: '1',
offset,
q,
isChecked,
filterName
}
return await this.list(projectId, options)
}

2
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

Loading…
Cancel
Save