Browse Source

Add page link method

pull/1242/head
Hironsan 4 years ago
parent
commit
8afc817237
2 changed files with 15 additions and 0 deletions
  1. 10
      frontend/models/project.ts
  2. 5
      frontend/services/application/project.service.ts

10
frontend/models/project.ts

@ -69,6 +69,16 @@ export class ProjectReadItem {
) )
} }
get annotationPageLink(): string {
const mapping = {
DocumentClassification: 'text-classification',
SequenceLabeling : 'sequence-labeling',
Seq2seq : 'sequence-to-sequence'
}
const url = `/projects/${this.id}/${mapping[this.project_type]}`
return url
}
toObject(): Object { toObject(): Object {
return { return {
id: this.id, id: this.id,

5
frontend/services/application/project.service.ts

@ -71,6 +71,11 @@ export class ProjectApplicationService {
return this.repository.bulkDelete(ids) return this.repository.bulkDelete(ids)
} }
public async getPageLink(id: string) {
const item = await this.repository.findById(id)
return item.annotationPageLink
}
private toWriteModel(item: ProjectWriteDTO): ProjectWriteItem { private toWriteModel(item: ProjectWriteDTO): ProjectWriteItem {
return new ProjectWriteItem( return new ProjectWriteItem(
item.id, item.id,

Loading…
Cancel
Save