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

Commit

Permalink
Fix DUplicate Actions Process (#2654)
Browse files Browse the repository at this point in the history
* Fix DUplicate Actions Process

* Minimal changes
  • Loading branch information
elsiosanchez authored Sep 19, 2024
1 parent 58dc6de commit f835585
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 15 deletions.
2 changes: 2 additions & 0 deletions src/components/ADempiere/ModalDialog/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
icon="el-icon-check"
class="button-base-icon"
:disabled="isDisabledDone"
:loading="isDisabledDone"
@click="doneButton"
/>
</span>
Expand Down Expand Up @@ -101,6 +102,7 @@
icon="el-icon-check"
class="button-base-icon"
:disabled="isDisabledDone"
:loading="isDisabledDone"
@click="doneButton"
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
type="info"
size="small"
style="margin-left: 5px;padding-top: 1px;padding-right: 5px;padding-bottom: 8px;padding-left: 5px;"
:disabled="isLoading"
:loading="isLoading"
@click="printProcess()"
>
<svg-icon
Expand All @@ -33,7 +35,7 @@
</template>

<script>
import { defineComponent } from '@vue/composition-api'
import { defineComponent, ref } from '@vue/composition-api'

import store from '@/store'

Expand All @@ -56,6 +58,10 @@ export default defineComponent({
},

setup(props) {
/**
* Ref
*/
const isLoading = ref(false)
/**
* Const
*/
Expand All @@ -69,15 +75,21 @@ export default defineComponent({
function printProcess() {
const { uuid } = process
store.commit('setSelectProcessWindows', uuid)
isLoading.value = true

store.commit('setShowedModalDialog', {
parentUuid: containerUuid,
containerUuid: uuid,
isShowed: true
})
.then(() => {
isLoading.value = false
})
}

return {
// Ref
isLoading,
// Const
process,
is_document,
Expand Down
42 changes: 30 additions & 12 deletions src/store/modules/ADempiere/dictionary/browser/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ export default {
resolve(browserDefinition)
const { process } = browserDefinition
if (!isEmptyValue(process)) {
store.commit('setIsloadingProcessOfBrowser', {
isLoading: false,
parentUuid: process.id,
containerUuid: browserDefinition.containerUuid
})
dispatch('setModalDialog', {
containerUuid: process.uuid,
title: process.name,
Expand All @@ -152,23 +157,36 @@ export default {

const isAllSelection = rootGetters.getStoredBrowserProcessAll(browserDefinition.uuid)

store.commit('setIsloadingProcessOfBrowser', {
isLoading: true,
parentUuid: process.id,
containerUuid: browserDefinition.containerUuid
})

store.dispatch('startProcessOfBrowser', {
parentUuid: browserDefinition.uuid,
containerUuid: process.uuid,
isAllSelection
}).then(processOutputResponse => {
// close current page
if (!isEmptyValue(parentUuid)) {
const currentRoute = router.app._route
const tabViewsVisited = rootGetters.visitedViews
dispatch('tagsView/delView', currentRoute)
// go to back page
const oldRouter = tabViewsVisited[tabViewsVisited.length - 1]
router.push({
path: oldRouter.path
}, () => {})
}
})
.then(processOutputResponse => {
// close current page
if (!isEmptyValue(parentUuid)) {
const currentRoute = router.app._route
const tabViewsVisited = rootGetters.visitedViews
dispatch('tagsView/delView', currentRoute)
// go to back page
const oldRouter = tabViewsVisited[tabViewsVisited.length - 1]
router.push({
path: oldRouter.path
}, () => {})
}
}).finally(() => {
store.commit('setIsloadingProcessOfBrowser', {
isLoading: false,
parentUuid: process.id,
containerUuid: browserDefinition.containerUuid
})
})
},
beforeOpen: ({ parentUuid: browserUuid, containerUuid }) => {
// set context values
Expand Down
22 changes: 20 additions & 2 deletions src/store/modules/ADempiere/processManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

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

Expand All @@ -39,9 +40,20 @@ import {
} from '@/utils/ADempiere/dictionary/process.js'

const processManager = {
state: {},
state: {
isLoadingProcessOfBrowser: {}
},

mutations: {},
mutations: {
setIsloadingProcessOfBrowser(state, {
containerUuid,
isLoading
}) {
Vue.set(state.isLoadingProcessOfBrowser, containerUuid, {
isLoading
})
}
},

actions: {
processActionPerformed({ dispatch, getters }, {
Expand Down Expand Up @@ -451,6 +463,12 @@ const processManager = {
},

getters: {
getIsloadingProcessOfBrowser: (state) => ({
containerUuid
}) => {
if (isEmptyValue(containerUuid)) return false
return state.isLoadingProcessOfBrowser[containerUuid].isLoading
}
}
}

Expand Down

0 comments on commit f835585

Please sign in to comment.