Skip to content

Commit

Permalink
Fix: Dashboard Request Redundancy (adempiere#987)
Browse files Browse the repository at this point in the history
* Fix: Dashboard Request Redundancy

* minimal changes
  • Loading branch information
elsiosanchez authored May 2, 2023
1 parent 9131584 commit 5da3900
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/store/modules/ADempiere/panelWindows.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,25 @@
*/

// import lang from '@/lang'
import Vue from 'vue'

// API Request Methods
import {
existsCharts,
ListWindowCharts,
getWindowMetrics
} from '@/api/ADempiere/dashboard/panelWindows.js'
// import { isEmptyValue } from '@/utils/ADempiere'

// Utils and Helper Methods
// import { showMessage } from '@/utils/ADempiere/notification.js'
import { isEmptyValue } from '@/utils/ADempiere'
import { getContextAttributes } from '@/utils/ADempiere/contextUtils'

const panelWindows = {
dashboard: 0,
listDashboard: [],
metrics: []
metrics: [],
dashboardList: {}
}

export default {
Expand All @@ -47,6 +49,10 @@ export default {
},
setMetrics(state, metrics) {
state.metrics = metrics
},
setPanelDashboardTab(state, dashboard) {
const { tabId, list } = dashboard
Vue.set(state.dashboardList, tabId, list)
}
},
actions: {
Expand Down Expand Up @@ -114,11 +120,12 @@ export default {
}
})
commit('setListDashboard', list)
const dashboard = { tabId, recordId, list }
commit('setPanelDashboardTab', dashboard)
resolve(list)
})
.catch(error => {
resolve(0)
// commit('setListProduct', [])
console.warn(`Error getting List Product: ${error.message}. Code: ${error.code}.`)
})
})
Expand Down Expand Up @@ -156,6 +163,15 @@ export default {
},
getNumberDashboard(state) {
return state.dashboard
},
getPanelDashboard: (state) => ({ tabId, recordId }) => {
let dashboardList = []
if (!isEmptyValue(state.dashboardList)) {
if (!isEmptyValue(state.dashboardList[tabId])) {
dashboardList = state.dashboardList[tabId]
}
}
return dashboardList
}
}
}

0 comments on commit 5da3900

Please sign in to comment.