add feature report view selection in report viewer (#165)

* add feature report view selection in report viewer

* add report view list service implementation
pull/3759/head
Leonel Matos 2019-11-25 16:36:21 -04:00 committed by Yamel Senih
parent 2564ce307f
commit dbaf0ec966
5 changed files with 65 additions and 9 deletions

View File

@ -319,6 +319,10 @@ export function getContextInfoValueFromServer({ uuid, query }) {
return Instance.call(this).getContextInfoValue({ uuid: uuid, query: query })
}
export function requestReportViews({ tableName, processUuid }) {
return Instance.call(this).requestReportViews({ tableName: tableName, processUuid: processUuid })
}
export function requestPrintFormats({ tableName, reportViewUuid, processUuid }) {
return Instance.call(this).requestPrintFormats({ tableName: tableName, reportViewUuid: reportViewUuid, processUuid: processUuid })
}

View File

@ -155,8 +155,8 @@ export default {
unsupportedHeadline: 'This view is currently unavailable',
unsupportedInfo: 'Please check that the view is supported in this version, or click the button below to return to the homepage.',
unsupportedButton: 'Back to dashboard',
printFormat: 'Print Format',
changePrintFormat: 'Change Print Format'
reportView: 'Report Views',
printFormat: 'Print Formats'
},
table: {
ProcessActivity: {

View File

@ -155,8 +155,8 @@ export default {
unsupportedHeadline: 'Esta vista no está disponible actualmente',
unsupportedInfo: 'Verifique que la vista sea compatible con esta versión, o haga clic en el botón a continuación para volver a la página de inicio.',
unsupportedButton: 'Volver al Panel de control',
printFormat: 'Formato de Impresión',
changePrintFormat: 'Cambiar Formato de Impresión'
reportView: 'Vistas de Reporte',
printFormat: 'Formatos de Impresión'
},
table: {
ProcessActivity: {

View File

@ -1,4 +1,4 @@
import { runProcess, requestProcessActivity } from '@/api/ADempiere'
import { runProcess, requestProcessActivity, requestReportViews } from '@/api/ADempiere'
import { showNotification } from '@/utils/ADempiere/notification'
import { isEmptyValue, convertMapToArrayPairs } from '@/utils/ADempiere'
import language from '@/lang'
@ -14,7 +14,8 @@ const processControl = {
process: [], // process to run finish
sessionProcess: [],
notificationProcess: [],
inRequestMetadata: []
inRequestMetadata: [],
reportViewList: []
},
mutations: {
// Add process in execution
@ -73,6 +74,9 @@ const processControl = {
state.sessionProcess = []
state.notificationProcess = []
state.inRequestMetadata = []
},
setReportViewsList(state, payload) {
state.reportViewList.push(payload)
}
},
actions: {
@ -239,6 +243,28 @@ const processControl = {
if (reportType !== 'pdf' && reportType !== 'html') {
link.click()
}
// Report views List to context menu
var reportViewList = {
name: language.t('views.reportView'),
type: 'summary',
action: '',
childs: [],
option: 'reportView'
}
reportViewList.childs = getters.getReportViewList(processResult.processUuid)
if (!reportViewList.childs.length) {
dispatch('requestReportViews', {
processUuid: processResult.processUuid
})
.then(response => {
reportViewList.childs = response
// Get contextMenu metadata and concat print report views with contextMenu actions
var contextMenuMetadata = rootGetters.getContextMenu(processResult.processUuid)
contextMenuMetadata.actions.push(reportViewList)
})
}
// Print formats to context menu
var printFormatList = {
name: language.t('views.printFormat'),
@ -443,6 +469,27 @@ const processControl = {
},
clearProcessControl({ commit }) {
commit('clearProcessControl')
},
requestReportViews({ commit }, parameters) {
return requestReportViews({ processUuid: parameters.processUuid })
.then(response => {
const reportViewList = response.getReportviewsList().map(reportView => {
return {
uuid: reportView.getUuid(),
name: reportView.getName(),
tableName: reportView.getTablename(),
description: reportView.getDescription()
}
})
commit('setReportViewsList', {
containerUuid: parameters.processUuid,
viewList: reportViewList
})
return reportViewList
})
.catch(error => {
console.error(error)
})
}
},
getters: {
@ -487,6 +534,13 @@ const processControl = {
return state.reportList.find(
item => item.instanceUuid === instanceUuid
)
},
getReportViewList: (state) => (containerUuid) => {
var reportViewList = state.reportViewList.find(list => list.containerUuid === containerUuid)
if (reportViewList) {
return reportViewList.viewList
}
return []
}
}
}

View File

@ -86,9 +86,7 @@ export default {
reportContent: '',
reportHeader: '',
isLoading: false,
reportResult: {},
printFormatList: [],
printFormat: null
reportResult: {}
}
},
computed: {