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

Commit

Permalink
feat: Get menu multitenant. (#2450)
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwinBetanc0urt authored Jul 16, 2024
1 parent 00ffb44 commit 74997aa
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 78 deletions.
10 changes: 2 additions & 8 deletions src/api/ADempiere/dictionary/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,14 @@ export function requestForm({
id: uuid,
// mandatory to open search
language,
dictionaryCode,
clientId,
roleId,
userId
dictionaryCode
}) {
return request({
url: `/dictionary/forms/${uuid}`,
method: 'get',
params: {
language,
dictionary_code: dictionaryCode,
client_id: clientId,
role_id: roleId,
user_id: userId
dictionary_code: dictionaryCode
}
})
}
10 changes: 2 additions & 8 deletions src/api/ADempiere/dictionary/process.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,14 @@ export function requestProcessMetadata({
id: uuid,
// mandatory to open search
language,
dictionaryCode,
clientId,
roleId,
userId
dictionaryCode
}) {
return request({
url: `/dictionary/processes/${uuid}`,
method: 'get',
params: {
language,
dictionary_code: dictionaryCode,
client_id: clientId,
role_id: roleId,
user_id: userId
dictionary_code: dictionaryCode
}
})
}
10 changes: 2 additions & 8 deletions src/api/ADempiere/dictionary/smart-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,14 @@ import { request } from '@/utils/ADempiere/request'
export function requestBrowserMetadata({
id: uuid,
language,
dictionaryCode,
clientId,
roleId,
userId
dictionaryCode
}) {
return request({
url: `/dictionary/browsers/${uuid}`,
method: 'get',
params: {
language,
dictionary_code: dictionaryCode,
client_id: clientId,
role_id: roleId,
user_id: userId
dictionary_code: dictionaryCode
}
})
}
2 changes: 2 additions & 0 deletions src/api/ADempiere/dictionary/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ export function requestWindowMetadata({
export function requestTabMetadata({
id: uuid,
windowId,
language,
dictionaryCode
}) {
return request({
url: `/dictionary/windows/${windowId}/tabs/${uuid}`,
method: 'get',
params: {
language,
dictionary_code: dictionaryCode
}
})
Expand Down
2 changes: 2 additions & 0 deletions src/api/ADempiere/security/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export function requestChangeRole({
*/
export function requestMenu({
language,
dictionaryCode,
clientId,
roleId,
userUuid
Expand All @@ -155,6 +156,7 @@ export function requestMenu({
method: 'get',
params: {
language,
dictionary_code: dictionaryCode,
role_id: roleId,
client_id: clientId,
user_id: userUuid,
Expand Down
15 changes: 8 additions & 7 deletions src/router/modules/ADempiere/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,19 @@ export function loadMainMenu({
role
}) {
const language = store.getters['getCurrentLanguage']
// const { uuid, client } = store.getters['user/getRole']
const clientId = store.getters['user/getRole'].client.uuid
const roleId = store.getters['user/getRole'].uuid
const userId = store.getters['user/getUserId']
const dictionaryCode = store.getters['user/getDictionaryCode']
const { id: roleId, uuid: roleUuid, client } = store.getters['user/getRole']
const { id: clientId, uuid: clientUuid } = client
const organizationId = getCurrentOrganization()
const { uuid: userUuid } = store.getters['user/userInfo']

return new Promise(resolve => {
requestMenu({
roleId,
language,
clientId,
userId
dictionaryCode,
clientId: clientUuid,
roleId: roleUuid,
userUuid: userUuid
}).then(menuResponse => {
const { menus } = menuResponse
const asyncRoutesMap = []
Expand Down
9 changes: 1 addition & 8 deletions src/store/modules/ADempiere/dictionary/browser/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import {
} from '@/utils/ADempiere/dictionary/browser/actionsMenu'
import { showMessage, showNotification } from '@/utils/ADempiere/notification.js'
import { isLookup } from '@/utils/ADempiere/references'
import { getCurrentClient, getCurrentRole } from '@/utils/ADempiere/auth'
import { templateBrowser } from '@/utils/ADempiere/dictionary/browser/templateBrowser.js'

export default {
Expand All @@ -60,17 +59,11 @@ export default {
return new Promise(resolve => {
const language = rootGetters['getCurrentLanguage']
const dictionaryCode = rootGetters['user/getDictionaryCode']
const clientId = getCurrentClient()
const roleId = getCurrentRole()
const userId = rootGetters['user/getUserId']

requestBrowserMetadata({
id,
language,
dictionaryCode,
clientId,
roleId,
userId
dictionaryCode
})
.then(browserResponse => {
const browser = templateBrowser(browserResponse)
Expand Down
11 changes: 1 addition & 10 deletions src/store/modules/ADempiere/dictionary/process/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ import {
import {
clearParameters, runProcess
} from '@/utils/ADempiere/dictionary/process/actionsMenu.ts'
import {
getCurrentClient, getCurrentRole
} from '@/utils/ADempiere/auth'

export default {
addProcessToList({ commit, dispatch }, processResponse) {
Expand Down Expand Up @@ -65,18 +62,12 @@ export default {
}) {
const language = rootGetters['getCurrentLanguage']
const dictionaryCode = rootGetters['user/getDictionaryCode']
const clientId = getCurrentClient()
const roleId = getCurrentRole()
const userId = rootGetters['user/getUserId']

return new Promise((resolve, reject) => {
requestProcessMetadata({
id,
language,
dictionaryCode,
clientId,
roleId,
userId
dictionaryCode
})
.then(processResponse => {
const { processDefinition } = generateProcess({
Expand Down
11 changes: 1 addition & 10 deletions src/store/modules/ADempiere/dictionary/report/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ import {
import { generateProcess as generateReport, isDisplayedField } from '@/utils/ADempiere/dictionary/process.js'
import { isSalesTransaction } from '@/utils/ADempiere/contextUtils'
import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js'
import {
getCurrentClient, getCurrentRole
} from '@/utils/ADempiere/auth'

export default {
addReportToList({ commit, dispatch }, reportResponse) {
Expand Down Expand Up @@ -74,17 +71,11 @@ export default {
return new Promise((resolve, reject) => {
const language = rootGetters['getCurrentLanguage']
const dictionaryCode = rootGetters['user/getDictionaryCode']
const clientId = getCurrentClient()
const roleId = getCurrentRole()
const userId = rootGetters['user/getUserId']

requestReportMetadata({
id,
language,
dictionaryCode,
clientId,
roleId,
userId
dictionaryCode
})
.then(async reportResponse => {
const { uuid } = reportResponse
Expand Down
11 changes: 1 addition & 10 deletions src/store/modules/ADempiere/dictionary/window/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ import {
openBrowserAssociated,
openSequenceTab
} from '@/utils/ADempiere/dictionary/window/actionsMenu'
import {
getCurrentClient, getCurrentRole
} from '@/utils/ADempiere/auth'
import { panelAdvanceQuery } from '@/utils/ADempiere/dictionary/panel.js'
import {
exportRecordsSelected,
Expand Down Expand Up @@ -99,18 +96,12 @@ export default {
}) {
const language = rootGetters['getCurrentLanguage']
const dictionaryCode = rootGetters['user/getDictionaryCode']
const clientId = getCurrentClient()
const roleId = getCurrentRole()
const userId = rootGetters['user/getUserId']

return new Promise(resolve => {
requestWindowMetadata({
id,
language,
dictionaryCode,
clientId,
roleId,
userId
dictionaryCode
})
.then(async windowResponse => {
const window = generateWindow(windowResponse)
Expand Down
11 changes: 2 additions & 9 deletions src/store/modules/ADempiere/formDefinition.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ import { requestForm } from '@/api/ADempiere/dictionary/form'
// Utils and Helper Methods
import { showMessage } from '@/utils/ADempiere/notification'
import { isEmptyValue } from '@/utils/ADempiere/valueUtils'
import {
getCurrentClient, getCurrentRole
} from '@/utils/ADempiere/auth'

const form = {
state: {
Expand Down Expand Up @@ -73,16 +70,12 @@ const form = {
}) {
return new Promise(resolve => {
const language = rootGetters['getCurrentLanguage']
const clientId = getCurrentClient()
const roleId = getCurrentRole()
const userId = rootGetters['user/getUserId']
const dictionaryCode = rootGetters['user/getDictionaryCode']

requestForm({
id,
language,
clientId,
roleId,
userId
dictionaryCode
})
.then(formResponse => {
// Panel for save on store
Expand Down

0 comments on commit 74997aa

Please sign in to comment.