Skip to content

Commit

Permalink
feat: (Transcoding) Open Report (adempiere#1513)
Browse files Browse the repository at this point in the history
  • Loading branch information
elsiosanchez authored Oct 9, 2023
1 parent dc55175 commit bb14b91
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
20 changes: 10 additions & 10 deletions src/store/modules/ADempiere/dictionary/report/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ export default {
* @param {string} uuid of dictionary
*/
getReportDefinitionFromServer({ dispatch, getters, rootGetters }, {
uuid
id
}) {
return new Promise((resolve, reject) => {
requestReportMetadata({
uuid
id
})
.then(async reportResponse => {
const { processDefinition: reportDefinition } = generateReport({
Expand All @@ -76,22 +76,22 @@ export default {

dispatch('addReportToList', reportDefinition)

await dispatch('getListPrintFormats', {
uuid,
id: reportDefinition.id
})
// await dispatch('getListPrintFormats', {
// uuid,
// id: reportDefinition.id
// })

resolve(reportDefinition)

// exist dialog if is process associated
const storedModalDialog = getters.getModalDialogManager({ containerUuid: uuid })
const storedModalDialog = getters.getModalDialogManager({ containerUuid: id })
if (isEmptyValue(storedModalDialog)) {
dispatch('setModalDialog', {
containerUuid: uuid,
containerUuid: id,
title: reportDefinition.name,
doneMethod: () => {
dispatch('startReport', {
containerUuid: uuid
containerUuid: id
})
},
loadData: ({ containerUuid }) => {
Expand All @@ -100,7 +100,7 @@ export default {
return Promise.resolve(reportDefinition)
}
return dispatch('getReportDefinitionFromServer', {
uuid: uuid
id
})
},
// TODO: Change to string and import dynamic in component
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/ADempiere/dictionary/report/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import Vue from 'vue'
*/
export default {
addReportToList(state, report) {
Vue.set(state.storedReports, report.uuid, report)
Vue.set(state.storedReports, report.id, report)
},

/**
Expand Down
28 changes: 14 additions & 14 deletions src/views/ADempiere/Report/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@
<div id="report-view">
<action-menu
:container-manager="containerManager"
:parent-uuid="reportUuid"
:container-uuid="reportUuid"
:parent-uuid="reportId"
:container-uuid="reportId"
:actions-manager="actionsManager"
style="float: right;padding-left: 1%;"
/>
<br><br>

<panel-definition
:container-uuid="reportUuid"
:container-uuid="reportId"
:panel-metadata="reportMetadata"
:container-manager="containerManager"
:is-tab-panel="true"
Expand All @@ -61,7 +61,7 @@
:size="isMobile ? '100%' : '50%'"
>
<options-report
:container-uuid="reportUuid"
:container-uuid="reportId"
:container-manager="containerManager"
:is-show-title="false"
/>
Expand All @@ -75,7 +75,7 @@
@click="handleOpem()"
/>
<panel-footer
:container-uuid="reportUuid"
:container-uuid="reportId"
:is-button-run="true"
:is-button-clear="true"
:is-button-close="true"
Expand Down Expand Up @@ -134,13 +134,13 @@ export default defineComponent({
const isLoadedMetadata = ref(false)
const reportMetadata = ref({})

let reportUuid = root.$route.meta.uuid
let reportId = root.$route.meta.id.toString()
// set uuid from test
if (!isEmptyValue(props.uuid)) {
reportUuid = props.uuid
reportId = props.uuid
}

const { containerManager, actionsManager, storedReportDefinition } = mixinReport(reportUuid)
const { containerManager, actionsManager, storedReportDefinition } = mixinReport(reportId)

const showContextMenu = computed(() => {
return store.state.settings.showContextMenu
Expand All @@ -152,13 +152,13 @@ export default defineComponent({

const isShowPanelConfig = computed(() => {
return store.getters.getShowPanelConfig({
containerUuid: reportUuid
containerUuid: reportId
})
})

function showPanelConfigReport(value) {
store.commit('setShowPanelConfig', {
containerUuid: reportUuid,
containerUuid: reportId,
value
})
}
Expand Down Expand Up @@ -195,7 +195,7 @@ export default defineComponent({
}

store.dispatch('getReportDefinitionFromServer', {
uuid: reportUuid
id: reportId
})
.then(reportResponse => {
reportMetadata.value = reportResponse
Expand All @@ -221,21 +221,21 @@ export default defineComponent({

function runReport(params) {
store.dispatch('buildReport', {
containerUuid: reportUuid,
containerUuid: reportId,
isSummary: true
})
}

function clearParameters() {
store.dispatch('setReportDefaultValues', {
containerUuid: reportUuid
containerUuid: reportId
})
}

getReport()

return {
reportUuid,
reportId,
isLoadedMetadata,
reportMetadata,
containerManager,
Expand Down
10 changes: 5 additions & 5 deletions src/views/ADempiere/Report/mixinReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@ import { DEFAULT_REPORT_TYPE } from '@/utils/ADempiere/dictionary/report'
import { containerManager } from '@/utils/ADempiere/dictionary/report'
import { isEmptyValue } from '@/utils/ADempiere'

export default (reportUuid) => {
export default (reportId) => {
const storedReportDefinition = computed(() => {
return store.getters.getStoredReport(reportUuid)
return store.getters.getStoredReport(reportId)
})

const actionsList = computed(() => {
return store.getters.getStoredActionsMenu({
containerUuid: reportUuid
containerUuid: reportId
})
})

const actionsManager = ref({
containerUuid: reportUuid,
containerUuid: reportId,

defaultActionName() {
let reportType = DEFAULT_REPORT_TYPE
const storedReportGenerated = store.getters.getReportGenerated(reportUuid)
const storedReportGenerated = store.getters.getReportGenerated(reportId)
if (!isEmptyValue(storedReportGenerated)) {
if (!isEmptyValue(storedReportGenerated.reportType)) {
reportType = storedReportGenerated.reportType
Expand Down

0 comments on commit bb14b91

Please sign in to comment.