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

bugfix/error-message #2050

Draft
wants to merge 2 commits into
base: feature/legacy-support
Choose a base branch
from
Draft
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
8 changes: 8 additions & 0 deletions src/api/ADempiere/dictionary/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

// Get Instance for connection
import { isEmptyValue } from '@/utils/ADempiere'
import { request } from '@/utils/ADempiere/request'

/**
Expand All @@ -41,4 +42,11 @@ export function requestWindowMetadata({
user_id: userId
}
})
.then(windowResponse => {
const { convertWindow } = require('@/utils/ADempiere/apiConverts/dictionary.js')
if (isEmptyValue(windowResponse.tabs)) {
return 'error'
}
return convertWindow(windowResponse)
})
}
1 change: 1 addition & 0 deletions src/lang/ADempiere/en/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ export default {
notice: 'Notice',
request: 'Request',
workflowActivities: 'Workflow Activities',
roleMessage: 'You cannot see this information with your current role',
systemInformation: {
tabLabel: 'System Information',
releaseNumber: 'Release',
Expand Down
1 change: 1 addition & 0 deletions src/lang/ADempiere/es/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ export default {
notice: 'Avisos',
request: 'Solicitudes',
workflowActivities: 'Flujos de Trabajo',
roleMessage: 'No se puede ver esta información con su rol actual',
systemInformation: {
tabLabel: 'Información de Sistema',
releaseNumber: 'Número de versión',
Expand Down
36 changes: 23 additions & 13 deletions src/store/modules/ADempiere/dictionary/window/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,29 +109,39 @@ export default {
userId
})
.then(async windowResponse => {
if (windowResponse === 'error') {
// show the error message
showMessage({
type: 'error',
message: language.t('profile.roleMessage')
})
navigateBack()
return
}
const window = generateWindow(windowResponse)
dispatch('addWindow', window)

resolve(window)
})
.catch(error => {
showMessage({
type: 'error',
message: error.message
})

// close current page
const currentRoute = router.app._route
const tabViewsVisited = rootGetters.visitedViews
dispatch('tagsView/delView', currentRoute)
// go to back page
const oldRouter = tabViewsVisited[tabViewsVisited.length - 1]
if (!isEmptyValue(oldRouter)) {
router.push({
path: oldRouter.path
}, () => {})
}
navigateBack()
return
})
function navigateBack() {
const currentRoute = router.app._route
const tabViewsVisited = rootGetters.visitedViews
dispatch('tagsView/delView', currentRoute)
// go to back page
const oldRouter = tabViewsVisited[tabViewsVisited.length - 1]
if (!isEmptyValue(oldRouter)) {
router.push({
path: oldRouter.path
}, () => {})
}
}
})
},

Expand Down
Loading