Refact: rename poste to tag

This commit is contained in:
2018-12-03 12:00:41 +01:00
parent bb46323d7b
commit 9d9f511f2c
8 changed files with 37 additions and 72 deletions

View File

@@ -8,7 +8,7 @@ export default {
data_dir: '/home/lafrite/scripts/comptes/data/',
config_dir: '/home/lafrite/scripts/comptes/config/',
config_filename: 'config.yml',
postes: {}
tags: {}
},
getters: {
data_dir: (state) => {
@@ -20,13 +20,13 @@ export default {
config_filename: (state) => {
return state.config_filename
},
postes: (state) => {
return state.postes
tags: (state) => {
return state.tags
}
},
mutations: {
SET_POSTES: (state, { postes }) => {
state.postes = postes
SET_TAGS: (state, { tags }) => {
state.tags = tags
}
},
actions: {
@@ -39,7 +39,7 @@ export default {
header: true
}
var parsed = yaml.safeLoad(content, parseConfig)
context.commit('SET_POSTES', { postes: parsed.postes })
context.commit('SET_TAGS', { tags: parsed.tags })
}
})
}

View File

@@ -136,10 +136,10 @@ export default {
})
},
clean_store_data (context, parsed) {
var postes = Object.values(context.rootGetters['config/postes'])
var tags = Object.values(context.rootGetters['config/tags'])
parsed.data = parsed.data.filter(x => x.Libellé !== undefined)
parsed.data.forEach(row => {
appendTag(row, postes, 'Libellé')
appendTag(row, tags, 'Libellé')
})
context.commit('SET_DATA', { data: parsed })