Feat: Add summarize box
This commit is contained in:
@@ -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 })
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import Vue from 'vue'
|
||||
import { readdir, readFile } from 'fs'
|
||||
import path from 'path'
|
||||
import Papa from 'papaparse'
|
||||
|
||||
Reference in New Issue
Block a user