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

Commit

Permalink
Action Process DUPLICATES if double Click is made (#2633)
Browse files Browse the repository at this point in the history
  • Loading branch information
elsiosanchez authored Sep 14, 2024
1 parent 4e40c92 commit 43678e4
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 5 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 @@ -30,9 +30,15 @@
@command="handleCommandActions"
>
<svg-icon
v-if="!isLoading"
style="font-size: 23px;"
icon-class="print"
/>
<i
v-else
style="font-size: 21px;"
class="el-icon-loading"
/>

<el-dropdown-menu slot="dropdown">
<el-dropdown-item
Expand All @@ -50,18 +56,26 @@
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
v-if="!isLoading"
style="font-size: 21px;"
icon-class="print"
/>
<i
v-else
style="font-size: 21px;"
class="el-icon-loading"
/>
</el-button>
</span>
</template>

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

import language from '@/lang'
import store from '@/store'
Expand Down Expand Up @@ -89,6 +103,10 @@ export default defineComponent({
},

setup(props) {
/**
* Ref
*/
const isLoading = ref(false)
/**
* Const
*/
Expand Down Expand Up @@ -134,13 +152,16 @@ export default defineComponent({
})
return
}

isLoading.value = true
store.dispatch('runReport', {
containerUuid: process.uuid,
recordId: recordId.value,
reportId: process.internal_id,
tableName: table_name
})
.finally(() => {
isLoading.value = false
})
}

function handleCommandActions(command) {
Expand Down Expand Up @@ -178,6 +199,8 @@ export default defineComponent({
loadProcessData()

return {
// Ref
isLoading,
// Const
process,
is_document,
Expand Down
24 changes: 24 additions & 0 deletions src/store/modules/ADempiere/dictionary/browser/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,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 @@ -148,6 +153,12 @@ 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,
Expand All @@ -164,6 +175,12 @@ export default {
path: oldRouter.path
}, () => {})
}
}).finally(() => {
store.commit('setIsloadingProcessOfBrowser', {
isLoading: false,
parentUuid: process.id,
containerUuid: browserDefinition.containerUuid
})
})
},
beforeOpen: ({ parentUuid: browserUuid, containerUuid }) => {
Expand All @@ -187,6 +204,13 @@ export default {
containerUuidAssociated: browserDefinition.uuid
})
},
isDisabledDone() {
// validate document status and Processing flag
return store.getters.getIsloadingProcessOfBrowser({
parentUuid: process.id,
containerUuid: browserDefinition.containerUuid
})
},
...process,
// TODO: Change to string and import dynamic in component
componentPath: () => import('@/components/ADempiere/PanelDefinition/index.vue'),
Expand Down
23 changes: 20 additions & 3 deletions src/store/modules/ADempiere/processManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import lang from '@/lang'
import router from '@/router'

import Vue from 'vue'
// API Request Methods
import {
requestRunBusinessProcess,
Expand All @@ -39,9 +39,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 +462,12 @@ const processManager = {
},

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

Expand Down

0 comments on commit 43678e4

Please sign in to comment.