Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: search temperature_store_size in data_store and server #705

Merged
merged 1 commit into from
Mar 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/charts/TempChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export default class TempChart extends Mixins(BaseMixin) {
}

get maxHistory() {
return this.$store.getters['server/getConfig']('server', 'temperature_store_size') ?? 1200
return this.$store.getters['printer/tempHistory/getTemperatureStoreSize']
}

get series() {
Expand Down
4 changes: 2 additions & 2 deletions src/store/printer/tempHistory/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const actions: ActionTree<PrinterTempHistoryState, RootState> = {

const now = new Date()
const allSensors = rootGetters['printer/getAvailableSensors'] ?? []
const maxHistory = rootGetters['server/getConfig']('server', 'temperature_store_size') || 1200
const maxHistory = rootGetters['printer/tempHistory/getTemperatureStoreSize']

if (payload !== undefined) {
if ('requestParams' in payload) delete payload.requestParams
Expand Down Expand Up @@ -267,7 +267,7 @@ export const actions: ActionTree<PrinterTempHistoryState, RootState> = {

await commit('addToSource', {
data: data,
maxHistory: rootGetters['server/getConfig']('server', 'temperature_store_size') || 1200,
maxHistory: rootGetters['printer/tempHistory/getTemperatureStoreSize'],
})
}

Expand Down
7 changes: 7 additions & 0 deletions src/store/printer/tempHistory/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,11 @@ export const getters: GetterTree<PrinterTempHistoryState, RootState> = {

return selected
},

getTemperatureStoreSize: (state, getters, rootState, rootGetters) => {
const serverSize = rootGetters['server/getConfig']('server', 'temperature_store_size')
const dataStoreSize = rootGetters['server/getConfig']('data_store', 'temperature_store_size')

return dataStoreSize ?? serverSize ?? 1200
},
}
4 changes: 1 addition & 3 deletions src/store/server/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ export const mutations: MutationTree<ServerState> = {
},

setConfig(state, payload) {
Object.entries(payload.config).forEach(([key, value]) => {
Vue.set(state.config, key, value)
})
Vue.set(state, 'config', payload)
},

setConsoleClearedThisSession(state) {
Expand Down