@@ -147,25 +150,53 @@
@dragover="dragOverFilelist($event, item)" @dragleave="dragLeaveFilelist" @drop.prevent.stop="dragDropFilelist($event, item)"
:data-name="item.filename"
>
-
- mdi-folder
- mdi-file
-
-
-
+
+
+ mdi-folder
+
+
+
+
+
+
+
+
+ mdi-file
+
+
+
+
-
-
-
+
+
+
+
+ mdi-file
+
+
+
+ mdi-file
+
+
|
{{ item.filename }} |
- {{ item.isDirectory ? '--' : formatFilesize(item.size) }} |
- {{ formatDate(item.modified) }} |
- {{ item.object_height ? item.object_height.toFixed(2)+' mm' : '--' }} |
- {{ item.layer_height ? item.layer_height.toFixed(2)+' mm' : '--' }} |
- {{ item.filament_total ? item.filament_total.toFixed()+' mm' : '--' }} |
- {{ formatPrintTime(item.estimated_time) }} |
- {{ item.slicer ? item.slicer : '--' }} {{ item.slicer_version}} |
+
+
+
+
+ {{ getStatusIcon(getJobStatus(item)) }}
+
+
+ {{ getJobStatus(item).replaceAll("_", " ") }}
+
+ |
+ {{ item.isDirectory ? '--' : formatFilesize(item.size) }} |
+ {{ formatDate(item.modified) }} |
+ {{ item.object_height ? item.object_height.toFixed(2)+' mm' : '--' }} |
+ {{ item.layer_height ? item.layer_height.toFixed(2)+' mm' : '--' }} |
+ {{ item.filament_total ? item.filament_total.toFixed()+' mm' : '--' }} |
+ {{ formatPrintTime(item.estimated_time) }} |
+ {{ item.slicer ? item.slicer : '--' }} {{ item.slicer_version}} |
{{ $t('Files.blabla')}}
@@ -295,8 +326,12 @@
import axios from 'axios'
import { findDirectory } from "@/plugins/helpers"
import { validGcodeExtensions } from "@/store/variables"
+ import VueLoadImage from "vue-load-image"
export default {
+ components: {
+ 'vue-load-image': VueLoadImage
+ },
data () {
return {
search: '',
@@ -332,6 +367,16 @@
{ text: this.$t('Files.FilamentUsage'), value: 'filament_total', align: 'right', configable: true, visible: true },
{ text: this.$t('Files.PrintTime'), value: 'estimated_time', align: 'right', configable: true, visible: true },
{ text: this.$t('Files.Slicer'), value: 'slicer', align: 'right', configable: true, visible: true },
+ { text: '', value: '', align: 'left', configable: false, visible: true, filterable: false },
+ { text: 'Name', value: 'filename', align: 'left', configable: false, visible: true },
+ { text: '', value: 'status', align: 'left', configable: false, visible: true },
+ { text: 'Filesize', value: 'size', align: 'right', configable: true, visible: true },
+ { text: 'Last modified', value: 'modified', align: 'right', configable: true, visible: true },
+ { text: 'Object Height', value: 'object_height', align: 'right', configable: true, visible: true },
+ { text: 'Layer Height', value: 'layer_height', align: 'right', configable: true, visible: true },
+ { text: 'Filament Usage', value: 'filament_total', align: 'right', configable: true, visible: true },
+ { text: 'Print Time', value: 'estimated_time', align: 'right', configable: true, visible: true },
+ { text: 'Slicer', value: 'slicer', align: 'right', configable: true, visible: true },
],
options: {
@@ -384,9 +429,11 @@
displayMetadata: state => state.gui.gcodefiles.showMetadata,
}),
- ...mapGetters([
- 'is_printing'
- ]),
+ ...mapGetters( {
+ is_printing: "is_printing",
+ getStatusIcon: "server/history/getPrintStatusChipIcon",
+ getStatusColor: "server/history/getPrintStatusChipColor",
+ }),
configHeaders() {
return this.headers.filter(header => header.configable === true)
},
@@ -401,6 +448,14 @@
return this.$store.dispatch("gui/setSettings", { gcodefiles: { showHiddenFiles: newVal } })
}
},
+ showPrintedFiles: {
+ get: function() {
+ return this.$store.state.gui.gcodefiles.showPrintedFiles
+ },
+ set: function(newVal) {
+ return this.$store.dispatch("gui/setSettings", { gcodefiles: { showPrintedFiles: newVal } })
+ }
+ },
countPerPage: {
get: function() {
return this.$store.state.gui.gcodefiles.countPerPage
@@ -657,6 +712,12 @@
if (!this.showHiddenFiles) {
this.files = this.files.filter(file => file.filename !== "thumbs" && file.filename.substr(0, 1) !== ".");
}
+ if (!this.showPrintedFiles) {
+ this.files = this.files.filter(file => this.$store.getters["server/history/getPrintStatus"]({
+ filename: (this.currentPath+"/"+file.filename).substr(7),
+ modified: new Date(file.modified).getTime()
+ }) !== 'completed')
+ }
},
startPrint(filename = "") {
filename = (this.currentPath+"/"+filename).substring(7)
@@ -831,7 +892,13 @@
}
return 400
- }
+ },
+ getJobStatus(item) {
+ return this.$store.getters["server/history/getPrintStatus"]({
+ filename: (this.currentPath+"/"+item.filename).substr(7),
+ modified: new Date(item.modified).getTime()
+ })
+ },
},
watch: {
filetree: {
@@ -843,6 +910,13 @@
if (!this.showHiddenFiles) {
this.files = this.files.filter(file => file.filename !== "thumbs" && file.filename.substr(0, 1) !== ".");
}
+
+ if (!this.showPrintedFiles) {
+ this.files = this.files.filter(file => this.$store.getters["server/history/getPrintStatus"]({
+ filename: (this.currentPath+"/"+file.filename).substr(7),
+ modified: new Date(file.modified).getTime()
+ }) !== 'completed')
+ }
}
},
currentPath: {
@@ -853,6 +927,13 @@
if (!this.showHiddenFiles) {
this.files = this.files.filter(file => file.filename !== "thumbs" && file.filename.substr(0, 1) !== ".");
}
+
+ if (!this.showPrintedFiles) {
+ this.files = this.files.filter(file => this.$store.getters["server/history/getPrintStatus"]({
+ filename: (this.currentPath+"/"+file.filename).substr(7),
+ modified: new Date(file.modified).getTime()
+ }) !== 'completed')
+ }
}
},
displayMetadata: {
@@ -870,6 +951,9 @@
showHiddenFiles: function() {
this.loadPath();
},
+ showPrintedFiles: function() {
+ this.loadPath();
+ },
hideMetadataColums: function(newVal) {
newVal.forEach((key) => {
let headerElement = this.headers.find(element => element.value === key)
diff --git a/src/pages/History.vue b/src/pages/History.vue
new file mode 100644
index 00000000..8e69b54b
--- /dev/null
+++ b/src/pages/History.vue
@@ -0,0 +1,158 @@
+
+
+
+
+
+
+
+
+
+ mdi-chart-areaspline{{ $t('History.Statistics') }}
+
+
+
+
+
+
+
+
+ | {{ $t('History.TotalPrinttime') }} |
+ {{ formatPrintTime(totalPrintTime) }} |
+
+
+ | {{ $t('History.LongestPrinttime') }} |
+ {{ formatPrintTime(longestPrintTime) }} |
+
+
+ | {{ $t('History.AvgPrinttime') }} |
+ {{ formatPrintTime(avgPrintTime) }} |
+
+
+ | {{ $t('History.TotalFilamentUsed') }} |
+ {{ Math.round(totalFilamentUsed / 100) / 10 }} m |
+
+
+ | {{ $t('History.TotalJobs') }} |
+ {{ totalJobsCount }} |
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('History.FilamentUsage') }}
+
+
+ {{ $t('History.PrinttimeAvg') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/plugins/vuetify.js b/src/plugins/vuetify.js
index 4d27f5a5..282bbf60 100644
--- a/src/plugins/vuetify.js
+++ b/src/plugins/vuetify.js
@@ -11,22 +11,25 @@ Vue.use(VueToast, {
})
Vue.use(Vuetify,{
- components: {
- VSnackbar,
- VBtn,
- VIcon,
- }
+ options: {
+ customProperties: true
+ },
+ components: {
+ VSnackbar,
+ VBtn,
+ VIcon,
+ }
})
export default new Vuetify({
- theme: {
- themes: {
- dark: {
+ theme: {
+ themes: {
+ dark: {
- }
- }
- },
- icons: {
- iconfont: 'mdi',
- },
+ }
+ }
+ },
+ icons: {
+ iconfont: 'mdi',
+ },
})
diff --git a/src/routes/index.js b/src/routes/index.js
index 64361a58..3b4e0802 100644
--- a/src/routes/index.js
+++ b/src/routes/index.js
@@ -4,6 +4,7 @@ import Farm from '../pages/Farm.vue'
import Console from '../pages/Console.vue'
import Heightmap from '../pages/Heightmap.vue'
import Files from '../pages/Files.vue'
+import History from '../pages/History.vue'
import Settings from '../pages/Settings.vue'
import SettingsInterface from '../pages/settings/interface.vue'
import SettingsMachine from '../pages/settings/machine.vue'
@@ -56,6 +57,13 @@ const routes = [
component: Files,
alwaysShow: false,
},
+ {
+ title: "History",
+ path: '/history',
+ icon: 'history',
+ component: History,
+ alwaysShow: false,
+ },
{
title: "Settings",
path: '/settings',
diff --git a/src/store/files/getters.js b/src/store/files/getters.js
index 0bcca7f9..72224e17 100644
--- a/src/store/files/getters.js
+++ b/src/store/files/getters.js
@@ -5,14 +5,13 @@ export default {
getSidebarLogo: (state, getters, rootState, rootGetters) => {
let configDir = findDirectory(state.filetree, ['config', themeDir])
+ const acceptName = "sidebar-logo"
+ const acceptExtensions = ['svg', 'jpg', 'jpeg', 'png', 'gif']
let file = configDir.find(element =>
element.filename !== undefined && (
- element.filename === 'sidebar-logo.svg' ||
- element.filename === 'sidebar-logo.jpg' ||
- element.filename === 'sidebar-logo.jpeg' ||
- element.filename === 'sidebar-logo.png' ||
- element.filename === 'sidebar-logo.gif'
+ element.filename.substr(0, element.filename.lastIndexOf('.')) === acceptName &&
+ acceptExtensions.includes(element.filename.substr(element.filename.lastIndexOf('.')+1))
)
)
if (file) return rootGetters["socket/getUrl"]+'/server/files/config/'+themeDir+'/'+file.filename
@@ -22,13 +21,13 @@ export default {
getSidebarBackground: (state, getters, rootState, rootGetters) => {
let configDir = findDirectory(state.filetree, ['config', themeDir])
+ const acceptName = "sidebar-background"
+ const acceptExtensions = ['jpg', 'jpeg', 'png', 'gif']
let file = configDir.find(element =>
element.filename !== undefined && (
- element.filename === 'sidebar-background.jpg' ||
- element.filename === 'sidebar-background.jpeg' ||
- element.filename === 'sidebar-background.png' ||
- element.filename === 'sidebar-background.gif'
+ element.filename.substr(0, element.filename.lastIndexOf('.')) === acceptName &&
+ acceptExtensions.includes(element.filename.substr(element.filename.lastIndexOf('.')+1))
)
)
if (file) return rootGetters["socket/getUrl"]+'/server/files/config/'+themeDir+'/'+file.filename
@@ -38,13 +37,13 @@ export default {
getMainBackground: (state, getters, rootState, rootGetters) => {
let configDir = findDirectory(state.filetree, ['config', themeDir])
+ const acceptName = "main-background"
+ const acceptExtensions = ['jpg', 'jpeg', 'png', 'gif']
let file = configDir.find(element =>
element.filename !== undefined && (
- element.filename === 'main-background.jpg' ||
- element.filename === 'main-background.jpeg' ||
- element.filename === 'main-background.png' ||
- element.filename === 'main-background.gif'
+ element.filename.substr(0, element.filename.lastIndexOf('.')) === acceptName &&
+ acceptExtensions.includes(element.filename.substr(element.filename.lastIndexOf('.')+1))
)
)
if (file) return 'url('+rootGetters["socket/getUrl"]+'/server/files/config/'+themeDir+'/'+file.filename+')'
diff --git a/src/store/files/mutations.js b/src/store/files/mutations.js
index 39efb346..e5daaedd 100644
--- a/src/store/files/mutations.js
+++ b/src/store/files/mutations.js
@@ -22,6 +22,7 @@ export default {
item.isDirectory &&
'filename' in item &&
'dirs' in payload &&
+ payload.dirs !== undefined &&
payload.dirs.length > 0 &&
payload.dirs.findIndex(element => element.dirname === item.filename) < 0
) parent.splice(key, 1)
diff --git a/src/store/gui/actions.js b/src/store/gui/actions.js
index 7e4ebbff..512eee58 100644
--- a/src/store/gui/actions.js
+++ b/src/store/gui/actions.js
@@ -149,5 +149,13 @@ export default {
dispatch('farm/readStoredPrinters', {}, { root: true })
}
dispatch('printer/init', null, { root: true })
- }
+ },
+
+ setHistoryColumns({ commit, dispatch, state }, data) {
+ commit('setHistoryColumns', data)
+ dispatch('updateSettings', {
+ keyName: 'history',
+ newVal: state.history
+ })
+ },
}
\ No newline at end of file
diff --git a/src/store/gui/index.js b/src/store/gui/index.js
index c80e662a..ecebc37b 100644
--- a/src/store/gui/index.js
+++ b/src/store/gui/index.js
@@ -61,8 +61,14 @@ export function getDefaultState() {
gcodefiles: {
countPerPage: 10,
showHiddenFiles: false,
+ showPrintedFiles: true,
hideMetadataColums: []
},
+ history: {
+ countPerPage: 10,
+ toggleChartCol3: 'filament_usage',
+ hideColums: []
+ },
settings: {
configfiles: {
countPerPage: 10,
diff --git a/src/store/gui/mutations.js b/src/store/gui/mutations.js
index caa030f4..0e2e6fb4 100644
--- a/src/store/gui/mutations.js
+++ b/src/store/gui/mutations.js
@@ -88,6 +88,13 @@ export default {
Vue.set(state.tempchart.datasetSettings[payload.name]['additionalSensors'], payload.sensor, {})
Vue.set(state.tempchart.datasetSettings[payload.name]['additionalSensors'][payload.sensor], 'boolList', payload.value)
+ },
- }
+ setHistoryColumns(state, data) {
+ if (data.value && state.history.hideColums.includes(data.name)) {
+ state.history.hideColums.splice(state.history.hideColums.indexOf(data.name), 1)
+ } else if (!data.value && !state.history.hideColums.includes(data.name)) {
+ state.history.hideColums.push(data.name)
+ }
+ },
}
\ No newline at end of file
diff --git a/src/store/printer/getters.js b/src/store/printer/getters.js
index 76858f35..efb1afc1 100644
--- a/src/store/printer/getters.js
+++ b/src/store/printer/getters.js
@@ -330,7 +330,7 @@ export default {
return additionValues
},
-
+
getTempListAdditionSensors: (state, getters, rootState, rootGetters) => (name) => {
let additionValues = {}
additionalSensors.forEach(sensorName => {
@@ -578,7 +578,7 @@ export default {
return 0
},
- getEstimatedTimeETA: (getters) => {
+ getEstimatedTimeETA: (state, getters) => {
let time = 0
let timeCount = 0
diff --git a/src/store/server/actions.js b/src/store/server/actions.js
index cdd6a63e..8370a31e 100644
--- a/src/store/server/actions.js
+++ b/src/store/server/actions.js
@@ -57,6 +57,11 @@ export default {
if (components.includes("update_manager") !== false)
Vue.prototype.$socket.sendObj('machine.update.status', {}, 'server/updateManager/getStatus')
+
+ if (payload.plugins.includes("history") !== false) {
+ Vue.prototype.$socket.sendObj('server.history.list', {}, 'server/history/getHistory')
+ Vue.prototype.$socket.sendObj('server.history.totals', {}, 'server/history/getTotals')
+ }
}
if (state.registered_directories.length === 0 && 'registered_directories' in payload) {
diff --git a/src/store/server/history/actions.js b/src/store/server/history/actions.js
new file mode 100644
index 00000000..e1e24ea1
--- /dev/null
+++ b/src/store/server/history/actions.js
@@ -0,0 +1,35 @@
+import Vue from "vue";
+
+export default {
+ reset({ commit }) {
+ commit('reset')
+ },
+
+ getTotals({ commit }, payload) {
+ commit('setTotals', payload.job_totals)
+ },
+
+ getHistory({ commit }, payload) {
+ commit('reset')
+
+ payload.jobs.forEach(job => {
+ commit('addJob', job)
+ })
+ },
+
+ getChanged({ commit }, payload) {
+ if (payload.action === 'added') commit('addJob', payload.job)
+ else if (payload.action === 'finished') commit('updateJob', payload.job)
+
+ Vue.prototype.$socket.sendObj('server.history.totals', {}, 'server/history/getTotals')
+ },
+
+ getDeletedJobs({ commit }, payload) {
+ if ('deleted_jobs' in payload && Array.isArray(payload.deleted_jobs)) {
+ payload.deleted_jobs.forEach(jobId => {
+ commit('destroyJob', jobId)
+ })
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/src/store/server/history/getters.js b/src/store/server/history/getters.js
new file mode 100644
index 00000000..e0d23e29
--- /dev/null
+++ b/src/store/server/history/getters.js
@@ -0,0 +1,190 @@
+export default {
+
+ getTotalPrintTime(state) {
+ let output = 0
+
+ state.jobs.forEach(current => {
+ output += current.print_duration
+ })
+
+ return output
+ },
+
+ getTotalCompletedPrintTime(state) {
+ let output = 0
+
+ state.jobs.forEach(current => {
+ if (current.status === "completed") output += current.print_duration
+ })
+
+ return output
+ },
+
+ getLongestPrintTime(state) {
+ let output = 0
+
+ state.jobs.forEach(current => {
+ if (current.print_duration > output) output = current.print_duration
+ })
+
+ return output
+ },
+
+ getTotalFilamentUsed(state) {
+ let output = 0
+
+ state.jobs.forEach(current => {
+ output += current.filament_used
+ })
+
+ return output
+ },
+
+ getTotalJobsCount(state) {
+ return state.jobs.length
+ },
+
+ getTotalCompletedJobsCount(state) {
+ return state.jobs.filter(job => job.status === "completed").length
+ },
+
+ getAvgPrintTime(state, getters) {
+ const totalCompletedPrintTime = getters.getTotalCompletedPrintTime
+ const totalCompletedJobsCount = getters.getTotalCompletedJobsCount
+
+ return totalCompletedPrintTime > 0 && totalCompletedJobsCount > 0 ? Math.round(totalCompletedPrintTime / totalCompletedJobsCount) : 0
+ },
+
+ getAllPrintStatusArray(state) {
+ let output = []
+
+ state.jobs.forEach(current => {
+ const index = output.findIndex(element => element.name === current.status)
+ if (index !== -1) output[index].value +=1
+ else {
+ let itemStyle = {
+ opacity: 0.9,
+ color: '#424242'
+ }
+
+ switch (current.status) {
+ case 'completed':
+ itemStyle['color'] = '#BDBDBD'
+ break
+
+ case 'in_progress':
+ itemStyle['color'] = '#EEEEEE'
+ break
+
+ case 'cancelled':
+ itemStyle['color'] = '#616161'
+ break
+ }
+
+ output.push({
+ name: current.status,
+ value: 1,
+ itemStyle: itemStyle,
+ label: {
+ color: '#fff'
+ }
+ })
+ }
+ })
+
+ return output
+ },
+
+ getFilamentUsageArray(state) {
+ let output = []
+ const startDate = new Date()
+ startDate.setDate(startDate.getDate() - 14)
+ startDate.setHours(0,0,0,0)
+ const jobsFiltered = state.jobs.filter(job => job.start_time * 1000 >= startDate && job.filament_used > 0)
+
+ for (let i = 0; i <= 14; i++) {
+ const tmpDate = new Date()
+ tmpDate.setDate(startDate.getDate() + i)
+
+ output.push([
+ new Date(tmpDate).setHours(0,0,0,0),
+ 0
+ ])
+ }
+
+ if (jobsFiltered.length) {
+ jobsFiltered.forEach(current => {
+ const currentStartDate = new Date(current.start_time * 1000).setHours(0,0,0,0)
+ const index = output.findIndex(element => element[0] === currentStartDate)
+ if (index !== -1) output[index][1] += Math.round(current.filament_used) / 1000
+ })
+ }
+
+ return output.sort((a,b) => {
+ return b[0] - a[0]
+ })
+ },
+
+ getPrinttimeAvgArray(state) {
+ let output = [0,0,0,0,0]
+ const startDate = new Date(new Date().getDate() - 14)
+ const jobsFiltered = state.jobs.filter(job => job.start_time * 1000 >= startDate && job.status === 'completed')
+
+ if (jobsFiltered.length) {
+ jobsFiltered.forEach(current => {
+ if (current.print_duration > 0 && current.print_duration <= 60*60*2) output[0]++
+ else if (current.print_duration > 60*60*2 && current.print_duration <= 60*60*6) output[1]++
+ else if (current.print_duration > 60*60*6 && current.print_duration <= 60*60*12) output[2]++
+ else if (current.print_duration > 60*60*12 && current.print_duration <= 60*60*24) output[3]++
+ else if (current.print_duration > 60*60*24) output[4]++
+ })
+ }
+
+ return output
+ },
+
+ getPrintStatus: (state) => (file) => {
+ if (state.jobs.length) {
+ const jobs = state.jobs.filter(job =>
+ 'filename' in job &&
+ job.filename === file.filename &&
+ 'status' in job &&
+ 'metadata' in job &&
+ 'modified' in job.metadata &&
+ parseInt(job.metadata.modified * 1000) === file.modified
+ )
+
+ if (jobs.length > 1) {
+ jobs.sort((a,b) => {
+ return b.start_time - a.start_time
+ })
+
+ return jobs[0].status
+ } else if (jobs.length === 1) {
+ return jobs[0].status
+ }
+ }
+
+ return ""
+ },
+
+ getPrintStatusChipColor: () => (status) => {
+ switch(status) {
+ case 'in_progress': return 'blue accent-3' //'blue-grey darken-1'
+ case 'completed': return 'green' //'green'
+ case 'cancelled': return 'red'
+
+ default: return 'orange'
+ }
+ },
+
+ getPrintStatusChipIcon: () => (status) => {
+ switch(status) {
+ case 'in_progress': return 'mdi-progress-clock'
+ case 'completed': return 'mdi-checkbox-marked-circle-outline'
+ case 'cancelled': return 'mdi-close-circle-outline'
+
+ default: return 'mdi-alert-outline'
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/store/server/history/index.js b/src/store/server/history/index.js
new file mode 100644
index 00000000..4d36b9e2
--- /dev/null
+++ b/src/store/server/history/index.js
@@ -0,0 +1,21 @@
+import actions from './actions'
+import mutations from './mutations'
+import getters from './getters'
+
+export function getDefaultState() {
+ return {
+ jobs: [],
+ job_totals: {}
+ }
+}
+
+// initial state
+const state = getDefaultState()
+
+export default {
+ namespaced: true,
+ state,
+ getters,
+ actions,
+ mutations
+}
\ No newline at end of file
diff --git a/src/store/server/history/mutations.js b/src/store/server/history/mutations.js
new file mode 100644
index 00000000..1fc73259
--- /dev/null
+++ b/src/store/server/history/mutations.js
@@ -0,0 +1,30 @@
+import { getDefaultState } from './index'
+import Vue from "vue";
+
+export default {
+ reset(state) {
+ Object.assign(state, getDefaultState())
+ },
+
+ setTotals(state, payload) {
+ Vue.set(state, 'job_totals', payload)
+ },
+
+ addJob(state, payload) {
+ state.jobs.push(payload)
+ },
+
+ updateJob(state, payload) {
+ const index = state.jobs.findIndex(job => job.job_id === payload.job_id)
+ if (index !== -1) {
+ Vue.set(state.jobs, index, payload)
+ }
+ },
+
+ destroyJob(state, payload) {
+ const index = state.jobs.findIndex(job => job.job_id === payload)
+ if (index !== -1) {
+ state.jobs.splice(index,1)
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/store/server/index.js b/src/store/server/index.js
index fe774464..e3bd4eef 100644
--- a/src/store/server/index.js
+++ b/src/store/server/index.js
@@ -5,6 +5,7 @@ import getters from './getters'
// import modules
import power from './power'
import updateManager from './updateManager'
+import history from './history'
// create getDefaultState
export function getDefaultState() {
@@ -32,5 +33,6 @@ export default {
modules: {
power,
updateManager,
+ history,
}
}
\ No newline at end of file
diff --git a/src/store/socket/actions.js b/src/store/socket/actions.js
index a8f9b7e8..12ca2ce0 100644
--- a/src/store/socket/actions.js
+++ b/src/store/socket/actions.js
@@ -31,7 +31,7 @@ export default {
if (event.wasClean) window.console.log('Socket closed clear')
},
- onMessage ({ commit, state }, payload) {
+ onMessage ({ commit, state, dispatch }, payload) {
if (!state.isConnected) commit('setConnected')
switch(payload.method) {
@@ -99,6 +99,10 @@ export default {
commit('server/updateManager/setStatus', payload.params[0], { root: true })
break
+ case 'notify_history_changed':
+ dispatch('server/history/getChanged', payload.params[0], { root: true })
+ break
+
default:
if (payload.result !== "ok") {
if (
|