Skip to content

Commit

Permalink
Bugfix/#692 context menu butons (#700)
Browse files Browse the repository at this point in the history
* fix: Context menu, change text by button.

* fix default action window as New Record.

* Add default action to run switch new and undo.

* Add colot button to undo action.

* change to plain and warning undo button.

* modifit contextmenu mobile

* remove console

* minimal change

* validate is LIstrecord

* modifit contextmenu mobile (#9)

* modifit contextmenu mobile

* remove console

* minimal change

* validate is LIstrecord

Co-authored-by: Elsio Sanchez <elsiosanche@gmail.com>

* add  description

* Bugfix/#692 context menu butons (#10)

* modifit contextmenu mobile

* remove console

* minimal change

* validate is LIstrecord

* add  description

Co-authored-by: Elsio Sanchez <elsiosanche@gmail.com>

* add icon

* Bugfix/#692 context menu butons (#11)

* modifit contextmenu mobile

* remove console

* minimal change

* validate is LIstrecord

* add  description

* add icon

Co-authored-by: Elsio Sanchez <elsiosanche@gmail.com>

* change size the label

* Bugfix/#692 context menu butons (#12)

* modifit contextmenu mobile

* remove console

* minimal change

* validate is LIstrecord

* add  description

* add icon

* change size the label

Co-authored-by: Elsio Sanchez <elsiosanche@gmail.com>

* changa size label

* add style reference

* add translations

* add icon default

* fixed position

Co-authored-by: EdwinBetanc0urt <EdwinBetanco0urt@outlook.com>
Co-authored-by: Elsio Sanchez <elsiosanche@gmail.com>
  • Loading branch information
3 people authored Mar 30, 2021
1 parent 2e39e18 commit b4a3ec0
Show file tree
Hide file tree
Showing 9 changed files with 343 additions and 169 deletions.
30 changes: 15 additions & 15 deletions src/components/ADempiere/ContextMenu/contextMenuDesktop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,13 @@
<el-menu
ref="contextMenu"
v-shortkey="shorcutKey"
:default-active="activeMenu"
:router="false"
class="el-menu-demo"
mode="horizontal"
menu-trigger="hover"
unique-opened
@shortkey.native="actionContextMenu"
>
<!-- menu relations -->
<el-submenu v-if="!isEmptyChilds" class="el-menu-item" index="1">
<template slot="title">
{{ $t('components.contextMenuRelations') }}
</template>
<el-scrollbar wrap-class="scroll">
<items-relations v-for="(relation, index) in relationsList" :key="index" :item="relation" />
</el-scrollbar>
</el-submenu>
<el-menu-item v-else disabled index="relations">
{{ $t('components.contextMenuRelations') }}
</el-menu-item>

<!-- actions or process on container -->
<el-submenu v-if="!isEmptyValue(actions)" class="el-menu-item" index="actions" @click.native="runAction(actions[0])">
<template slot="title">
Expand Down Expand Up @@ -102,6 +88,18 @@
{{ $t('components.contextMenuActions') }}
</el-menu-item>

<!-- menu relations -->
<el-submenu v-if="!isEmptyChilds" class="el-menu-item" index="1">
<template slot="title">
{{ $t('components.contextMenuRelations') }}
</template>
<el-scrollbar wrap-class="scroll">
<items-relations v-for="(relation, index) in relationsList" :key="index" :item="relation" />
</el-scrollbar>
</el-submenu>
<el-menu-item v-else disabled index="relations">
{{ $t('components.contextMenuRelations') }}
</el-menu-item>
<!-- references of record -->
<el-submenu
:disabled="!(isReferecesContent && isLoadedReferences)"
Expand Down Expand Up @@ -136,6 +134,8 @@ import contextMixin from './contextMenuMixin.js'
export default {
name: 'ContextMenuDesktop',
mixins: [contextMixin]
mixins: [
contextMixin
]
}
</script>
40 changes: 21 additions & 19 deletions src/components/ADempiere/ContextMenu/contextMenuMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ export default {
isDisplayed: {
type: Boolean,
default: false
},
isListRecord: {
type: Boolean,
default: false
}
},
data() {
Expand All @@ -75,19 +79,17 @@ export default {
}
},
computed: {
activeMenu() {
const { meta, path } = this.$route
// if set path, the sidebar will highlight the path you set
if (meta.activeMenu) {
return meta.activeMenu
}
return path
},
getterContextMenu() {
return this.$store.getters.getContextMenu(this.containerUuid)
},
isWindow() {
return this.panelType === 'window'
},
isWithRecord() {
return !this.isEmptyValue(this.recordUuid) && this.recordUuid !== 'create-new'
},
isReferecesContent() {
if (this.panelType === 'window' && !this.isEmptyValue(this.recordUuid) && this.recordUuid !== 'create-new') {
if (this.isWindow && this.isWithRecord) {
return true
}
return false
Expand Down Expand Up @@ -160,7 +162,7 @@ export default {
})
},
getDataLog() {
if (this.panelType === 'window') {
if (this.isWindow) {
return this.$store.getters.getDataLog(this.containerUuid, this.recordUuid)
}
return undefined
Expand All @@ -169,7 +171,7 @@ export default {
return this.$store.getters.getCachedReport(this.$route.params.instanceUuid).parameters
},
getOldRouteOfWindow() {
if (this.panelType === 'window') {
if (this.isWindow) {
const oldRoute = this.$store.state['windowControl/index'].windowOldRoute
if (!this.isEmptyValue(oldRoute.query.action) && oldRoute.query.action !== 'create-new' && this.$route.query.action === 'create-new') {
return oldRoute
Expand Down Expand Up @@ -234,18 +236,18 @@ export default {
'$route.query.action'(actionValue) {
this.recordUuid = actionValue
// only requires updating the context menu if it is Window
if (this.panelType === 'window') {
if (this.isWindow) {
this.generateContextMenu()
this.getReferences()
}
},
isInsertRecord(newValue, oldValue) {
if (this.panelType === 'window' && newValue !== oldValue) {
if (this.isWindow && newValue !== oldValue) {
this.generateContextMenu()
}
},
getDataLog(newValue, oldValue) {
if (this.panelType === 'window' && newValue !== oldValue) {
if (this.isWindow && newValue !== oldValue) {
this.generateContextMenu()
}
},
Expand Down Expand Up @@ -291,7 +293,7 @@ export default {
}
},
refreshData() {
if (this.panelType === 'window') {
if (this.isWindow) {
this.$store.dispatch('getDataListTab', {
parentUuid: this.parentUuid,
containerUuid: this.containerUuid,
Expand Down Expand Up @@ -350,7 +352,7 @@ export default {
const tHeader = this.getterFieldsListHeader
const filterVal = this.getterFieldsListValue
let list = []
if (this.panelType === 'window') {
if (this.isWindow) {
list = this.getDataRecord
} else if (this.panelType === 'browser') {
// TODO: Check usage as the selection is exported with the table menu
Expand Down Expand Up @@ -411,7 +413,7 @@ export default {
})
this.$store.dispatch('setOrder', processAction)
}
if (this.panelType === 'window' && this.isEmptyValue(this.actions.find(element => element.action === 'recordAccess'))) {
if (this.isWindow && this.isEmptyValue(this.actions.find(element => element.action === 'recordAccess'))) {
this.$store.dispatch('addAttribute', {
tableName: this.tableNameCurrentTab,
recordId: this.getCurrentRecord[this.tableNameCurrentTab + '_ID'],
Expand Down Expand Up @@ -446,7 +448,7 @@ export default {
// rollback
if (itemAction.action === 'undoModifyData') {
itemAction.disabled = Boolean(!this.getDataLog && !this.getOldRouteOfWindow)
} else if (this.recordUuid === 'create-new' || !this.isInsertRecord) {
} else if (!this.isWithRecord || !this.isInsertRecord) {
itemAction.disabled = true
}
}
Expand Down Expand Up @@ -670,7 +672,7 @@ export default {
}
},
setShareLink() {
let shareLink = this.panelType === 'window' || window.location.href.includes('?') ? `${window.location.href}&` : `${window.location.href}?`
let shareLink = this.isWindow || window.location.href.includes('?') ? `${window.location.href}&` : `${window.location.href}?`
if (this.$route.name === 'Report Viewer') {
const processParameters = convertFieldsListToShareLink(this.processParametersExecuted)
const reportFormat = this.$store.getters.getReportType
Expand Down
Loading

0 comments on commit b4a3ec0

Please sign in to comment.