mirror of https://github.com/doccano/doccano.git
pythondatasetsactive-learningtext-annotationdatasetnatural-language-processingdata-labelingmachine-learningannotation-tool
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
47 lines
1.1 KiB
import ProjectService from '@/services/project.service'
|
|
|
|
export const state = () => ({
|
|
current: {},
|
|
})
|
|
|
|
export const getters = {
|
|
currentProject(state) {
|
|
return state.current
|
|
},
|
|
getCurrentUserRole(state) {
|
|
return state.current.current_users_role || {}
|
|
},
|
|
canViewApproveButton(state) {
|
|
const role = state.current.current_users_role
|
|
return role && !role.is_annotator
|
|
},
|
|
getLink(state) {
|
|
if (state.current.project_type === 'DocumentClassification') {
|
|
return 'text-classification'
|
|
} else if (state.current.project_type === 'SequenceLabeling') {
|
|
return 'sequence-labeling'
|
|
} else if (state.current.project_type === 'Seq2seq') {
|
|
return 'sequence-to-sequence'
|
|
} else {
|
|
return ''
|
|
}
|
|
},
|
|
}
|
|
|
|
export const mutations = {
|
|
setCurrent(state, payload) {
|
|
state.current = payload
|
|
}
|
|
}
|
|
|
|
export const actions = {
|
|
setCurrentProject({ commit }, projectId) {
|
|
return ProjectService.fetchProjectById(projectId)
|
|
.then((response) => {
|
|
commit('setCurrent', response.data)
|
|
})
|
|
.catch((error) => {
|
|
throw new Error(error)
|
|
})
|
|
}
|
|
}
|