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.
39 lines
901 B
39 lines
901 B
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
|
|
}
|
|
}
|
|
|
|
export const mutations = {
|
|
setCurrent(state, payload) {
|
|
state.current = {
|
|
...payload,
|
|
canDefineCategory: payload.canDefineCategory,
|
|
canDefineLabel: payload.canDefineLabel,
|
|
canDefineRelation: payload.canDefineRelation,
|
|
canDefineSpan: payload.canDefineSpan
|
|
}
|
|
}
|
|
}
|
|
|
|
export const actions = {
|
|
async setCurrentProject({ commit }, projectId) {
|
|
try {
|
|
const project = await this.$services.project.findById(projectId)
|
|
commit('setCurrent', project)
|
|
} catch (error) {
|
|
throw new Error(error)
|
|
}
|
|
}
|
|
}
|