Browse Source

Remove pageLink from project model

pull/2093/head
Hironsan 2 years ago
parent
commit
567ec86faa
10 changed files with 56 additions and 51 deletions
  1. 19
      frontend/components/layout/TheSideBar.vue
  2. 16
      frontend/domain/models/project/project.ts
  3. 6
      frontend/layouts/project.vue
  4. 4
      frontend/layouts/workspace.vue
  5. 12
      frontend/pages/projects/_id/comments/index.vue
  6. 14
      frontend/pages/projects/_id/dataset/index.vue
  7. 20
      frontend/presenter/linkToAnnotationPage.ts
  8. 9
      frontend/services/application/project/projectApplicationService.ts
  9. 4
      frontend/services/application/project/projectData.ts
  10. 3
      frontend/store/projects.js

19
frontend/components/layout/TheSideBar.vue

@ -29,24 +29,20 @@
<script>
import {
mdiHome,
mdiDatabase,
mdiCog,
mdiChartBar,
mdiAccount,
mdiBookOpenOutline,
mdiChartBar,
mdiCog,
mdiCommentAccountOutline,
mdiDatabase,
mdiHome,
mdiLabel,
mdiAccount,
mdiPlayCircleOutline
} from '@mdi/js'
import { getLinkToAnnotationPage } from '~/presenter/linkToAnnotationPage'
export default {
props: {
link: {
type: String,
default: '',
required: true
},
isProjectAdmin: {
type: Boolean,
default: false,
@ -131,8 +127,9 @@ export default {
methods: {
toLabeling() {
const query = this.$services.option.findOption(this.$route.params.id)
const link = getLinkToAnnotationPage(this.$route.params.id, this.project.projectType)
this.$router.push({
path: this.localePath(this.link),
path: this.localePath(link),
query
})
}

16
frontend/domain/models/project/project.ts

@ -35,22 +35,6 @@ export class ProjectReadItem {
readonly canDefineCategory: boolean
) {}
get annotationPageLink(): string {
const mapping = {
DocumentClassification: 'text-classification',
SequenceLabeling: 'sequence-labeling',
Seq2seq: 'sequence-to-sequence',
IntentDetectionAndSlotFilling: 'intent-detection-and-slot-filling',
ImageClassification: 'image-classification',
ImageCaptioning: 'image-captioning',
BoundingBox: 'object-detection',
Segmentation: 'segmentation',
Speech2text: 'speech-to-text'
}
const url = `/projects/${this.id}/${mapping[this.projectType]}`
return url
}
get taskNames(): string[] {
if (this.projectType === 'IntentDetectionAndSlotFilling') {
return ['DocumentClassification', 'SequenceLabeling']

6
frontend/layouts/project.vue

@ -7,7 +7,7 @@
</the-header>
<v-navigation-drawer v-model="drawerLeft" app clipped color="">
<the-side-bar :link="getLink" :is-project-admin="isProjectAdmin" :project="currentProject" />
<the-side-bar :is-project-admin="isProjectAdmin" :project="currentProject" />
</v-navigation-drawer>
<v-main>
@ -24,8 +24,8 @@
<script>
import { mapGetters } from 'vuex'
import TheSideBar from '~/components/layout/TheSideBar'
import TheHeader from '~/components/layout/TheHeader'
import TheSideBar from '~/components/layout/TheSideBar'
export default {
components: {
@ -42,7 +42,7 @@ export default {
},
computed: {
...mapGetters('projects', ['getLink', 'currentProject'])
...mapGetters('projects', ['currentProject'])
},
async created() {

4
frontend/layouts/workspace.vue

@ -7,7 +7,7 @@
</the-header>
<v-navigation-drawer v-model="drawerLeft" app clipped>
<the-side-bar :link="getLink" :is-project-admin="isProjectAdmin" :project="currentProject" />
<the-side-bar :is-project-admin="isProjectAdmin" :project="currentProject" />
</v-navigation-drawer>
<v-main class="pb-0">
@ -36,7 +36,7 @@ export default {
},
computed: {
...mapGetters('projects', ['getLink', 'currentProject'])
...mapGetters('projects', ['currentProject'])
},
watch: {

12
frontend/pages/projects/_id/comments/index.vue

@ -25,12 +25,13 @@
</template>
<script lang="ts">
import Vue from 'vue'
import _ from 'lodash'
import CommentList from '@/components/comment/CommentList.vue'
import { CommentReadDTO, CommentListDTO } from '~/services/application/comment/commentData'
import { ProjectDTO } from '~/services/application/project/projectData'
import _ from 'lodash'
import Vue from 'vue'
import FormDelete from '~/components/comment/FormDelete.vue'
import { getLinkToAnnotationPage } from '~/presenter/linkToAnnotationPage'
import { CommentListDTO, CommentReadDTO } from '~/services/application/comment/commentData'
import { ProjectDTO } from '~/services/application/project/projectData'
export default Vue.extend({
components: {
@ -87,8 +88,9 @@ export default Vue.extend({
this.$router.push(query)
},
movePage(query: object) {
const link = getLinkToAnnotationPage(this.projectId, this.project.projectType)
this.updateQuery({
path: this.localePath(this.project.pageLink),
path: this.localePath(link),
query
})
}

14
frontend/pages/projects/_id/dataset/index.vue

@ -65,15 +65,16 @@
</template>
<script lang="ts">
import Vue from 'vue'
import _ from 'lodash'
import DocumentList from '@/components/example/DocumentList.vue'
import FormDelete from '@/components/example/FormDelete.vue'
import FormDeleteBulk from '@/components/example/FormDeleteBulk.vue'
import ImageList from '~/components/example/ImageList.vue'
import AudioList from '~/components/example/AudioList.vue'
import { ExampleListDTO, ExampleDTO } from '~/services/application/example/exampleData'
import _ from 'lodash'
import Vue from 'vue'
import ActionMenu from '~/components/example/ActionMenu.vue'
import AudioList from '~/components/example/AudioList.vue'
import ImageList from '~/components/example/ImageList.vue'
import { getLinkToAnnotationPage } from '~/presenter/linkToAnnotationPage'
import { ExampleDTO, ExampleListDTO } from '~/services/application/example/exampleData'
import { ProjectDTO } from '~/services/application/project/projectData'
export default Vue.extend({
@ -163,8 +164,9 @@ export default Vue.extend({
this.$router.push(query)
},
movePage(query: object) {
const link = getLinkToAnnotationPage(this.projectId, this.project.projectType)
this.updateQuery({
path: this.localePath(this.project.pageLink),
path: this.localePath(link),
query
})
}

20
frontend/presenter/linkToAnnotationPage.ts

@ -0,0 +1,20 @@
import { ProjectType } from '@/domain/models/project/project'
export const getLinkToAnnotationPage = (
projectId: number | string,
projectType: ProjectType
): string => {
const mapping = {
DocumentClassification: 'text-classification',
SequenceLabeling: 'sequence-labeling',
Seq2seq: 'sequence-to-sequence',
IntentDetectionAndSlotFilling: 'intent-detection-and-slot-filling',
ImageClassification: 'image-classification',
ImageCaptioning: 'image-captioning',
BoundingBox: 'object-detection',
Segmentation: 'segmentation',
Speech2text: 'speech-to-text'
}
const link = `/projects/${projectId}/${mapping[projectType]}`
return link
}

9
frontend/services/application/project/projectApplicationService.ts

@ -1,6 +1,11 @@
import { ProjectDTO, ProjectWriteDTO, ProjectListDTO, SearchQueryData } from './projectData'
import { ProjectRepository, SearchQuery } from '~/domain/models/project/projectRepository'
import { ProjectWriteItem } from '~/domain/models/project/project'
import { ProjectRepository, SearchQuery } from '~/domain/models/project/projectRepository'
import {
ProjectDTO,
ProjectListDTO,
ProjectWriteDTO,
SearchQueryData
} from '~/services/application/project/projectData'
export class ProjectApplicationService {
constructor(private readonly repository: ProjectRepository) {}

4
frontend/services/application/project/projectData.ts

@ -1,4 +1,4 @@
import { ProjectReadItem, ProjectType, ProjectItemList } from '~/domain/models/project/project'
import { ProjectItemList, ProjectReadItem, ProjectType } from '~/domain/models/project/project'
export class ProjectDTO {
id: number
@ -12,7 +12,6 @@ export class ProjectDTO {
enableRandomOrder: boolean
enableShareAnnotation: boolean
singleClassClassification: boolean
pageLink: string
tags: Object[] | string[]
canDefineLabel: boolean
canDefineRelation: boolean
@ -37,7 +36,6 @@ export class ProjectDTO {
this.enableRandomOrder = item.randomOrder
this.enableShareAnnotation = item.collaborativeAnnotation
this.singleClassClassification = item.exclusiveCategories
this.pageLink = item.annotationPageLink
this.tags = item.tags
this.canDefineLabel = item.canDefineLabel
this.canDefineRelation = item.canDefineRelation

3
frontend/store/projects.js

@ -12,9 +12,6 @@ export const getters = {
canViewApproveButton(state) {
const role = state.current.current_users_role
return role && !role.is_annotator
},
getLink(state) {
return state.current.pageLink
}
}

Loading…
Cancel
Save