Skip to content

Commit

Permalink
fix: Refresh records on tab child.
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwinBetanc0urt committed Apr 2, 2024
1 parent b0db848 commit 6f54a03
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 38 deletions.
42 changes: 21 additions & 21 deletions src/components/ADempiere/ActionMenu/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -191,17 +191,6 @@ export default defineComponent({
},

setup(props, { root }) {
const currentTab = computed(() => {
const currentRoute = router.app._route
if (currentRoute.meta.type !== 'window') return props.actionsManager
return store.getters.getContainerInfo.currentTab
})

const {
containerUuid,
tableName
} = currentTab.value

const isMobile = computed(() => {
return store.getters.device === 'mobile'
})
Expand All @@ -213,7 +202,12 @@ export default defineComponent({
return 'small'
})

const instanceUuid = root.$route.params.instanceUuid
const currentRoute = router.app._route
let instanceUuid
if (currentRoute.params && currentRoute.params.instanceUuid) {
instanceUuid = currentRoute.params.instanceUuid
}

// set initial value
const actionsList = computed(() => {
if (props.actionsManager && props.actionsManager.getActionList) {
Expand All @@ -227,15 +221,23 @@ export default defineComponent({
})

const recordUuid = computed(() => {
return store.getters.getUuidOfContainer(containerUuid)
return store.getters.getUuidOfContainer(props.containerUuid)
})

const isWithRecord = computed(() => {
return !isEmptyValue(recordUuid.value) && recordUuid.value !== 'create-new'
})

const isUndoAction = computed(() => {
if (!isEmptyValue(tableName)) {
if (isEmptyValue(recordUuid.value)) {
return false
}
const storedTab = store.getters.getStordTab(props.parentUuid, props.containerUuid)
if (isEmptyValue(storedTab)) {
return false
}
const { table_name } = storedTab
if (!isEmptyValue(table_name)) {
if (!isWithRecord.value) {
return true
}
Expand Down Expand Up @@ -315,23 +317,21 @@ export default defineComponent({
if (actionName === 'Moreoptions') return store.commit('setShowMenuMobile', true)
action[actionName]({
root,
parentUuid: currentTab.value.parentUuid,
containerUuid: containerUuid, // currentTab.value.uuid,
parentUuid: props.parentUuid,
containerUuid: props.containerUuid, // currentTab.value.uuid,
containerId: action.containerId, // currentTab.value.uuid,
tableName: currentTab.value.tableName,
tabId: currentTab.value.id,
// : currentTab.value.tableName,
// tabId: currentTab.value.id,
instanceUuid,
containerManager: props.containerManager,
recordUuid: recordUuid.value,
uuid: action.uuid,
currentTab: currentTab.value
uuid: action.uuid
})
}

/**
* Index Space
*/

function indexSpace(index, menuList) {
return index === (menuList - 1)
}
Expand Down
1 change: 1 addition & 0 deletions src/components/ADempiere/TabManager/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ export default defineComponent({
}, () => {})
})
}

if (
isReadyFromGetData.value || (!isReadyFromGetData.value &&
(
Expand Down
2 changes: 1 addition & 1 deletion src/components/ADempiere/TabManager/tabChild.vue
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ export default defineComponent({
const currentContextAttributes = computed(() => {
const contextAttributesList = getContextAttributes({
parentUuid: props.parentUuid,
contextColumnNames: currentTabMetadata.value.contextColumnNames,
contextColumnNames: currentTabMetadata.value.context_column_names,
keyName: 'key'
})
return generateContextKey(contextAttributesList, 'key')
Expand Down
12 changes: 6 additions & 6 deletions src/store/modules/ADempiere/dictionary/window/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ export default {
description: sequenceTab.description
})

const relatedColumns = sequenceTab.contextColumnNames
const relatedColumns = sequenceTab.context_column_names

dispatch('setModalDialog', {
containerUuid: sequenceTab.uuid,
Expand Down Expand Up @@ -553,7 +553,7 @@ export default {
parentUuid: windowUuid,
containerUuid: tabUuid,
tabUuid: sequenceTab.uuid,
contextColumnNames: sequenceTab.contextColumnNames
contextColumnNames: sequenceTab.context_column_names
})
if (!isEmptyValue(recordsListSortTab)) {
resolve(recordsListSortTab)
Expand All @@ -562,7 +562,7 @@ export default {
dispatch('listTabSequences', {
parentUuid: windowUuid,
containerUuid: tabUuid,
contextColumnNames: sequenceTab.contextColumnNames,
contextColumnNames: sequenceTab.context_column_names,
tabUuid: sequenceTab.uuid
})
resolve([])
Expand Down Expand Up @@ -590,15 +590,15 @@ export default {
return !rootGetters.getTabSequenceIsChanged({
parentUuid: windowUuid,
containerUuid: tabAssociatedUuid,
contextColumnNames: sequenceTab.contextColumnNames,
contextColumnNames: sequenceTab.context_column_names,
tabUuid: sequenceTab.uuid
})
},
cancelMethod: () => {
dispatch('discardTabSequenceChanges', {
parentUuid: windowUuid,
containerUuid: tabUuid,
contextColumnNames: sequenceTab.contextColumnNames,
contextColumnNames: sequenceTab.context_column_names,
tabUuid: sequenceTab.uuid
})
}
Expand Down Expand Up @@ -846,7 +846,7 @@ export default {
containerManager.getDefaultValue({
parentUuid: fieldDocumentStatus.parentUuid,
containerUuid: fieldDocumentStatus.containerUuid,
contextColumnNames: fieldDocumentStatus.contextColumnNames,
contextColumnNames: fieldDocumentStatus.context_column_names,
//
uuid: fieldDocumentStatus.uuid,
id: fieldDocumentStatus.id,
Expand Down
5 changes: 2 additions & 3 deletions src/store/modules/ADempiere/dictionary/window/getters.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export default {
const attributesObject = {}
let attributesList = fieldsList
.map(fieldItem => {
const { uuid, id, columnName, default_value, contextColumnNames } = fieldItem
const { uuid, id, columnName, default_value, context_column_names } = fieldItem
const isSQL = String(default_value).startsWith('@SQL=') && isGetServer
const isLinkColumn = !isEmptyValue(link_column_name) && columnName === link_column_name
const isParentColumn = fieldItem.isParent || (!isEmptyValue(parent_column_name) && columnName === parent_column_name)
Expand All @@ -232,7 +232,6 @@ export default {
parsedDefaultValue = getContextDefaultValue({
...fieldItem,
parentUuid,
contextColumnNames,
isSOTrxDictionary
})
}
Expand Down Expand Up @@ -281,7 +280,7 @@ export default {
const storedDefaultValue = rootGetters.getStoredDefaultValue({
parentUuid,
containerUuid,
contextColumnNames: contextColumnNames,
contextColumnNames: context_column_names,
uuid,
value: parsedDefaultValue
})
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/ADempiere/persistence.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ const persistence = {
const parentValues = getContextAttributes({
parentUuid,
containerUuid,
contextColumnNames: tabItem.contextColumnNames
contextColumnNames: tabItem.context_column_names
})
dispatch('updateValuesOfContainer', {
containerUuid: tabItem.uuid,
Expand Down
17 changes: 11 additions & 6 deletions src/store/modules/ADempiere/windowManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ const initState = {
recordCount: 0, // total number of all records
isLoaded: false, // has not been charged the first time
isLoading: false, // request currently in progress
pageNumber: 1 // page number of records
pageNumber: 1, // page number of records
pageSize: 15

}
}

Expand Down Expand Up @@ -228,6 +230,9 @@ const windowManager = {
containerUuid,
selectionsList
}) {
// if (isEmptyValue(state.tabData[containerUuid])) {
// Vue.set(state.tabData, containerUuid, state.emtpyTabData)
// }
Vue.set(state.tabData[containerUuid], 'selectionsList', selectionsList)
},

Expand Down Expand Up @@ -293,7 +298,7 @@ const windowManager = {
table_name,
link_column_name,
parent_column_name,
contextColumnNames
context_column_names
} = rootGetters.getStoredTab(parentUuid, containerUuid)

if (!isEmptyValue(filters) && typeof filters !== 'object') {
Expand All @@ -304,7 +309,7 @@ const windowManager = {
// add filters with link column name and parent column name
if (
!isEmptyValue(link_column_name) &&
!contextColumnNames.includes(link_column_name) &&
!context_column_names.includes(link_column_name) &&
!filters.some(filter => filter.columnName === link_column_name)
) {
const value = rootGetters.getValueOfField({
Expand All @@ -323,7 +328,7 @@ const windowManager = {
}
if (
!isEmptyValue(parent_column_name) &&
!contextColumnNames.includes(parent_column_name &&
!context_column_names.includes(parent_column_name &&
!filters.some(filter => filter.columnName === parent_column_name))
) {
const value = rootGetters.getValueOfField({
Expand All @@ -344,12 +349,12 @@ const windowManager = {
// get context values
const contextAttributesList = getContextAttributes({
parentUuid,
contextColumnNames,
contextColumnNames: context_column_names,
keyName: 'key',
format: 'object'
})

// const isWithoutValues = contextColumnNames.find(columnName =>
// const isWithoutValues = context_column_names.find(columnName =>
// isEmptyValue(columnName) ||
// isEmptyValue(contextAttributesList[columnName])
// )
Expand Down

0 comments on commit 6f54a03

Please sign in to comment.