Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Commit

Permalink
feat: Refresh records after run process on window. (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwinBetanc0urt authored Jun 27, 2022
1 parent 1c5c291 commit 787a88c
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 68 deletions.
25 changes: 25 additions & 0 deletions src/store/modules/ADempiere/dictionary/window/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,31 @@ export default {
containerUuid: process.uuid,
tableName,
recordUuid
}).then(async processResponse => {
if (processResponse.isError) {
return
}

// update records
await dispatch('getEntities', {
parentUuid,
containerUuid
})
// update records and logics on child tabs
tabDefinition.childTabs.filter(tabItem => {
// get loaded tabs with records
return store.getters.getIsLoadedTabRecord({
containerUuid: tabItem.uuid
})
}).forEach(tabItem => {
// if loaded data refresh this data
// TODO: Verify with get one entity, not get all list
store.dispatch('getEntities', {
parentUuid,
containerUuid: tabItem.uuid,
pageNumber: 1 // reload with first page
})
})
})
},
beforeOpen: () => {
Expand Down
15 changes: 15 additions & 0 deletions src/store/modules/ADempiere/windowManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const windowManager = {
setTabData(state, {
parentUuid,
containerUuid,
searchValue = '',
recordsList = [],
selectionsList = [],
nextPageToken,
Expand All @@ -62,6 +63,7 @@ const windowManager = {
const dataTab = {
parentUuid,
containerUuid,
searchValue,
recordsList,
selectionsList,
nextPageToken,
Expand Down Expand Up @@ -126,6 +128,12 @@ const windowManager = {
const currentPageNumber = pageNumber
const pageToken = generatePageToken({ pageNumber })

if (isEmptyValue(searchValue)) {
searchValue = getters.getSearchValueTabRecordsList({
containerUuid
})
}

const {
contextColumnNames, name, linkColumnName,
parentColumnName, fieldsList
Expand Down Expand Up @@ -254,6 +262,7 @@ const windowManager = {
commit('setTabData', {
parentUuid,
containerUuid,
searchValue,
recordsList: dataToStored,
nextPageToken: dataResponse.nextPageToken,
pageNumber: currentPageNumber,
Expand Down Expand Up @@ -383,6 +392,7 @@ const windowManager = {
return state.tabData[containerUuid] || {
parentUuid: undefined,
containerUuid,
searchValue: '',
recordsList: [],
selectionsList: [],
nextPageToken: undefined,
Expand All @@ -397,6 +407,11 @@ const windowManager = {
containerUuid
}).isLoaded || false
},
getSearchValueTabRecordsList: (state, getters) => ({ containerUuid }) => {
return getters.getTabData({
containerUuid
}).searchValue || ''
},
getTabRecordCount: (state, getters) => ({ containerUuid }) => {
return getters.getTabData({ containerUuid }).recordCount
},
Expand Down
69 changes: 1 addition & 68 deletions src/views/ADempiere/Process/mixinProcess.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,80 +20,13 @@ import store from '@/store'
import lang from '@/lang'

// utils and helper methods
import {
isDisplayedField,
isMandatoryField,
isReadOnlyField
} from '@/utils/ADempiere/dictionary/process.js'
import { containerManager } from '@/utils/ADempiere/dictionary/process.js'

export default (processUuid) => {
const storedProcessDefinition = computed(() => {
return store.getters.getStoredProcess(processUuid)
})

const containerManager = {
getPanel({ containerUuid }) {
return store.getters.getStoredProcess(containerUuid)
},
getFieldsList({ containerUuid }) {
return store.getters.getStoredFieldsFromProcess(containerUuid)
},

actionPerformed: ({ field, value }) => {
// store.dispatch('processActionPerformed', {
// field,
// value
// })
},

setDefaultValues: ({ containerUuid }) => {
store.dispatch('setProcessDefaultValues', {
containerUuid
})
},

isDisplayedField,

isReadOnlyField,

isMandatoryField,

changeFieldShowedFromUser({ containerUuid, fieldsShowed }) {
store.dispatch('changeProcessFieldShowedFromUser', {
containerUuid,
fieldsShowed
})
},

/**
* @returns Promisse with value and displayedValue
*/
getDefaultValue({ parentUuid, containerUuid, uuid, id, contextColumnNames, columnName, value }) {
return store.dispatch('getDefaultValueFromServer', {
parentUuid,
containerUuid,
contextColumnNames,
processParameterUuid: uuid,
id,
//
columnName,
value
})
},
getLookupList({ parentUuid, containerUuid, contextColumnNames, uuid, searchValue, isAddBlankValue = false, blankValue }) {
return store.dispatch('getLookupListFromServer', {
parentUuid,
containerUuid,
contextColumnNames,
processParameterUuid: uuid,
searchValue,
// app attributes
isAddBlankValue,
blankValue
})
}
}

const actionsList = computed(() => {
return store.getters.getStoredActionsMenu({
containerUuid: processUuid
Expand Down

0 comments on commit 787a88c

Please sign in to comment.