Feat: Add summarize box

This commit is contained in:
2018-11-30 18:36:30 +01:00
parent 84512969ad
commit e7d792e7ef
7 changed files with 198 additions and 14 deletions

View File

@@ -1,15 +1,43 @@
import { readFile } from 'fs'
import path from 'path'
import yaml from 'js-yaml'
export default {
namespaced: true,
state: {
data_dir: '/home/lafrite/scripts/comptes/data/'
data_dir: '/home/lafrite/scripts/comptes/data/',
postes_filename: 'postes.yml',
postes: {}
},
getters: {
data_dir: (state) => {
return state.data_dir
},
postes_filename: (state) => {
return state.postes_filename
},
postes: (state) => {
return state.postes
}
},
mutations: {
SET_POSTES: (state, { postes }) => {
state.postes = postes
}
},
actions: {
async load_postes (context) {
readFile(path.join(context.getters.data_dir, context.getters.postes_filename), 'utf8', (err, content) => {
if (err) {
console.log(err)
} else {
var parseConfig = {
header: true
}
var parsed = yaml.safeLoad(content, parseConfig)
context.commit('SET_POSTES', { postes: parsed.postes })
}
})
}
}
}

View File

@@ -1,4 +1,3 @@
import Vue from 'vue'
import { readdir, readFile } from 'fs'
import path from 'path'
import Papa from 'papaparse'