Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal to execute the process in browser #416

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
</div>
</template>
<script>
import { MixinInfo } from '@/components/ADempiere/ContainerInfo/mixinInfo'
import { MixinInfo } from '@/components/ADempiere/ContainerInfo/components/mixinInfo'
import chatTextLong from '@/components/ADempiere/Field/chatTextLong'
export default {
name: 'ChatEntries',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</div>
</template>
<script>
import { MixinInfo } from '@/components/ADempiere/ContainerInfo/mixinInfo'
import { MixinInfo } from '@/components/ADempiere/ContainerInfo/components/mixinInfo'
export default {
name: 'RecordLogs',
mixins: [MixinInfo],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
</div>
</template>
<script>
import { MixinInfo } from '@/components/ADempiere/ContainerInfo/mixinInfo'
import { MixinInfo } from '@/components/ADempiere/ContainerInfo/components/mixinInfo'
export default {
name: 'WorkflowLogs',
mixins: [MixinInfo]
Expand Down
272 changes: 272 additions & 0 deletions src/components/ADempiere/ContainerInfo/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,272 @@
<template>
<el-tabs v-model="activeInfo" @tab-click="handleClick">
<el-tab-pane
v-if="!isEmptyValue(tabProcess)"
:name="$t('window.containerInfo.associatedProcesses')"
>
<span slot="label">
<svg-icon icon-class="component" />
{{ $t('window.containerInfo.associatedProcesses') }}
</span>
<div>
<el-collapse
v-for="(action, index) in tabProcess"
:key="index"
v-model="activeName"
accordion
@change="handleChangeProcess(action)"
>
<el-collapse-item
:title="action.name"
:name="index"
:disabled="isEmptyValue(record)"
>
<el-card>
<el-container style="max-height: 38vh;">
<el-main style="height: auto;">
<main-panel
v-if="!isEmptyValue(modalMetadata.fieldList)"
key="main-panel"
:parent-uuid="infoProcessUuid"
:container-uuid="modalMetadata.uuid"
:metadata="modalMetadata"
:panel-type="modalMetadata.panelType"
/>
<p v-else> {{ modalMetadata.description }} </p>
</el-main>
<el-footer>
<el-button
type="primary"
style="float: right;"
@click="runAction(action)"
>
{{ $t('components.RunProcess') }} <i class="el-icon-s-tools" />
</el-button>
</el-footer>
</el-container>
</el-card>
</el-collapse-item>
</el-collapse>
</div>
</el-tab-pane>
<el-tab-pane
v-if="panelType === 'window'"
name="listChatEntries"
>
<span slot="label">
<i class="el-icon-s-comment" />
{{ $t('window.containerInfo.notes') }}
</span>
<div>
<chat-entries />
</div>
</el-tab-pane>
<el-tab-pane
v-if="panelType === 'window'"
name="listRecordLogs"
>
<span slot="label">
<svg-icon icon-class="tree-table" />
{{ $t('window.containerInfo.changeLog') }}
</span>
<div
key="change-log-loaded"
>
<record-logs />
</div>
</el-tab-pane>
<el-tab-pane
v-if="isWorkflow"
name="listWorkflowLogs"
>
<span slot="label">
<i class="el-icon-s-help" />
{{ $t('window.containerInfo.workflowLog') }}
</span>
<div
v-if="getIsWorkflowLog"
key="workflow-log-loaded"
>
<workflow-logs />
</div>
</el-tab-pane>
</el-tabs>
</template>

<script>
// tab content/components/ADempiere/ContainerInfo/mixinInfo
import ChatEntries from '@/components/ADempiere/ContainerInfo/components/chatEntries'
import RecordLogs from '@/components/ADempiere/ContainerInfo/components/recordLogs'
import WorkflowLogs from '@/components/ADempiere/ContainerInfo/components/workflowLogs'
// Panel Process
import MainPanel from '@/components/ADempiere/Panel'
import { showNotification } from '@/utils/ADempiere/notification'
export default {
name: 'TabInfo',
components: {
ChatEntries,
RecordLogs,
WorkflowLogs,
MainPanel
},
props: {
infoProcessUuid: {
type: String,
default: ''
},
containerUuid: {
type: String,
default: ''
},
tableName: {
type: String,
default: ''
},
record: {
type: [Array, Object],
default: undefined
},
panelType: {
type: String,
default: ''
},
isWorkflow: {
type: Boolean,
default: false
},
isProcessBrowser: {
type: Boolean,
default: false
}
},
data() {
return {
activeName: '',
activeInfo: 'listChatEntries'
}
},
computed: {
getIsWorkflowLog() {
if (this.isEmptyValue(this.$store.getters.getWorkflow)) {
return false
}
return true
},
isWorkflowBarStatus() {
const panel = this.$store.getters.getPanel(
this.windowMetadata.currentTabUuid
)
if (!this.isEmptyValue(panel) && panel.isDocument && this.$route.meta.type === 'window' && this.$route.query.action !== 'create-new') {
return true
}
return false
},
getterWindow() {
return this.$store.getters.getWindow(this.infoProcessUuid)
},
getterContextMenu() {
if (!this.isEmptyValue(this.getterWindow)) {
const process = this.$store.getters.getContextMenu(this.getterWindow.currentTabUuid)
if (!this.isEmptyValue(process)) {
return process.actions.filter(menu => {
if (menu.type === 'process') {
return menu
}
})
}
}
return []
},
modalMetadata() {
return this.$store.state.processControl.metadata
},
listTab() {
var epale = []
if (!this.isEmptyValue(this.getterContextMenu)) {
epale = [this.$t('window.containerInfo.associatedProcesses'), 'listChatEntries', 'listRecordLogs', 'listWorkflowLogs']
return epale
}
epale = ['listChatEntries', 'listRecordLogs', 'listWorkflowLogs']
return epale
},
getterContextMenuBrowser() {
const process = this.$store.getters.getContextMenu(this.infoProcessUuid)
if (!this.isEmptyValue(process)) {
return process.actions.filter(menu => {
if (menu.type === 'process') {
return menu
}
})
}
return []
},
tabProcess() {
if (this.panelType === 'window') {
return this.getterContextMenu
}
return this.getterContextMenuBrowser
}
},
created() {
if (!this.isEmptyValue(this.tabProcess)) {
this.activeInfo = this.$t('window.containerInfo.associatedProcesses')
}
if (this.activeInfo !== this.$t('window.containerInfo.associatedProcesses')) {
this.$store.dispatch(this.activeInfo, {
tableName: this.tableName,
recordId: this.record[this.tableName + '_ID']
})
}
},
methods: {
showNotification,
handleChangeProcess(action) {
if (action.type === 'process') {
// open modal dialog with metadata
this.$store.dispatch('setShowDialog', {
type: action.type,
action: {
...action,
containerUuid: action.uuid
}
})
}
},
runAction(action) {
if (action !== undefined) {
const fieldNotReady = this.panelType === 'browser' ? this.isEmptyValue(this.record) : this.$store.getters.isNotReadyForSubmit(action.uuid)
if (!fieldNotReady) {
this.$store.dispatch('startProcess', {
action: action, // process metadata
parentUuid: this.infoProcessUuid,
isProcessTableSelection: false,
// containerUuid: this.$route.meta.tabUuid,
containerUuid: this.panelType === 'browser' ? this.panelUuid : this.containerUuid,
panelType: this.panelType, // determinate if get table name and record id (window) or selection (browser)
reportFormat: '',
routeToDelete: this.$route
})
.catch(error => {
console.warn(error)
})
} else {
this.showNotification({
type: 'warning',
title: this.$t('notifications.emptyValues'),
name: '<b>' + fieldNotReady.name + '.</b> ',
message: this.$t('notifications.fieldMandatory')
})
}
}
},
handleClick(tab, event) {
if (tab.name !== this.$t('window.containerInfo.associatedProcesses')) {
this.$store.dispatch(tab.name, {
tableName: this.tableName,
recordId: this.record[this.tableName + '_ID']
})
}
}
}
}
</script>
11 changes: 10 additions & 1 deletion src/components/ADempiere/ContextMenu/contextMenuMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,15 @@ export const contextMixin = {
}
})
}
this.actions = this.metadataMenu.actions
if (this.panelType === 'window') {
this.actions = this.metadataMenu.actions.filter(action => {
if (action.type !== 'process') {
return action
}
})
} else {
this.actions = this.metadataMenu.actions
}
if (this.panelType === 'window') {
const processAction = this.actions.find(item => {
if (item.name === 'Procesar Orden' || (item.name === 'Process Order')) {
Expand Down Expand Up @@ -380,6 +388,7 @@ export const contextMixin = {
},
showModal(action) {
// TODO: Refactor and remove redundant dispatchs
this.$store.dispatch('showProcess', true)
if (action.type === 'process') {
// Add context from view open in process to opening
if (action.parentUuidAssociated || action.containerUuidAssociated) {
Expand Down
2 changes: 2 additions & 0 deletions src/components/ADempiere/DataTable/menu/menuTableMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export const menuTableMixin = {
action: actionSequence,
parentRecordUuid: this.$route.query.action
})
this.$store.dispatch('showProcess', true)
},
closeMenu() {
// TODO: Validate to dispatch one action
Expand Down Expand Up @@ -216,6 +217,7 @@ export const menuTableMixin = {
action: processData
})
}
this.$store.dispatch('showProcess', true)
},
showTotals() {
this.$store.dispatch('changePanelAttributesBoolean', {
Expand Down
4 changes: 4 additions & 0 deletions src/components/ADempiere/Dialog/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ export default {
},
getDataSelection() {
return this.getterDataRecordsAndSelection.selection
},
isShowProcess() {
return this.$store.getters.getShowProcess
}
},
watch: {
Expand All @@ -124,6 +127,7 @@ export default {
type: this.modalMetadata.panelType,
action: undefined
})
this.$store.dispatch('showProcess', false)
},
runAction(action) {
if (action.isSortTab) {
Expand Down
3 changes: 2 additions & 1 deletion src/lang/ADempiere/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@ export default {
workflowName: 'Name of Workflow Status',
timeElapsed: 'Time Elapsed',
addNote: 'Add Note'
}
},
associatedProcesses: 'Associated processes'
},
callout: {
error: 'Error In Callout'
Expand Down
3 changes: 2 additions & 1 deletion src/lang/ADempiere/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ export default {
workflowName: 'Nombre de estado del flujo de trabajo',
timeElapsed: 'Tiempo transcurrido',
addNote: 'Agregar Nota'
}
},
associatedProcesses: 'Procesos Asociados'
},
callout: {
error: 'Error En Callout'
Expand Down
5 changes: 3 additions & 2 deletions src/store/modules/ADempiere/processControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,10 @@ const processControl = {
let tab, tableName, recordId
if (panelType) {
if (panelType === 'browser') {
allData = getters.getDataRecordAndSelection(containerUuid)
var uuid = isEmptyValue(containerUuid) ? parentUuid : containerUuid
allData = getters.getDataRecordAndSelection(uuid)
selection = rootGetters.getSelectionToServer({
containerUuid,
containerUuid: uuid,
selection: allData.selection
})
if (selection.length < 1) {
Expand Down
Loading