1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-13 23:20:12 +08:00

feat: Add grpc core client support. (#495)

* feat: Add grpc core client support.

* export instances and catching error.
This commit is contained in:
Edwin Betancourt 2020-05-15 10:57:53 -04:00 committed by GitHub
parent cfc03c6c9c
commit 8727beefdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 191 additions and 298 deletions

View File

@ -44,11 +44,11 @@
"url": "https://github.com/PanJiaChen/vue-element-admin/issues" "url": "https://github.com/PanJiaChen/vue-element-admin/issues"
}, },
"dependencies": { "dependencies": {
"@adempiere/grpc-access-client": "^1.2.0", "@adempiere/grpc-access-client": "^1.2.1",
"@adempiere/grpc-data-client": "^2.3.2", "@adempiere/grpc-data-client": "^2.3.4",
"@adempiere/grpc-dictionary-client": "^1.4.1", "@adempiere/grpc-dictionary-client": "^1.4.1",
"@adempiere/grpc-enrollment-client": "^1.1.0", "@adempiere/grpc-enrollment-client": "^1.1.0",
"@adempiere/grpc-pos-client": "^1.1.0", "@adempiere/grpc-pos-client": "^1.2.0",
"axios": "0.19.2", "axios": "0.19.2",
"clipboard": "2.0.6", "clipboard": "2.0.6",
"codemirror": "5.53.2", "codemirror": "5.53.2",
@ -87,6 +87,7 @@
"xlsx": "0.15.6" "xlsx": "0.15.6"
}, },
"devDependencies": { "devDependencies": {
"@adempiere/grpc-core-client": "^1.0.3",
"@babel/core": "7.9.0", "@babel/core": "7.9.0",
"@babel/register": "7.9.0", "@babel/register": "7.9.0",
"@vue/cli-plugin-babel": "4.3.1", "@vue/cli-plugin-babel": "4.3.1",

View File

@ -1,18 +1,5 @@
import { getLanguage } from '@/lang/index'
import BusinessData from '@adempiere/grpc-data-client'
import { BUSINESS_DATA_ADDRESS } from '@/api/ADempiere/constants'
import { getToken, getCurrentOrganization, getCurrentWarehouse } from '@/utils/auth'
// Get Instance for connection // Get Instance for connection
function Instance() { import { BusinessDataInstance as Instance } from '@/api/ADempiere/instances.js'
return new BusinessData({
host: BUSINESS_DATA_ADDRESS,
sessionUuid: getToken(),
organizationUuid: getCurrentOrganization(),
warehouseUuid: getCurrentWarehouse(),
language: getLanguage() || 'en_US'
})
}
/** /**
* Request a browser search * Request a browser search

View File

@ -1,26 +1,8 @@
// This file is for get all information for dashboard of ADempiere client, // This file is for get all information for dashboard of ADempiere client,
// please if you want to implement a custom dashboard create a new fielwith api definition // please if you want to implement a custom dashboard create a new fielwith api definition
import { getLanguage } from '@/lang/index'
import BusinessData from '@adempiere/grpc-data-client'
import { BUSINESS_DATA_ADDRESS } from '@/api/ADempiere/constants'
import { getToken, getCurrentOrganization, getCurrentWarehouse } from '@/utils/auth'
// Get Instance for connection // Get Instance for connection
function Instance() { import { BusinessDataInstance as Instance } from '@/api/ADempiere/instances.js'
return new BusinessData({
host: BUSINESS_DATA_ADDRESS,
sessionUuid: getToken(),
organizationUuid: getCurrentOrganization(),
warehouseUuid: getCurrentWarehouse(),
language: getLanguage() || 'en_US'
})
}
// Request a Process Activity list
export function requestListProcessesLogs({ pageToken, pageSize }) {
// Get Process Activity
return Instance.call(this).requestListProcessesLogs({ pageToken, pageSize })
}
// Get Recent Items based on selection option // Get Recent Items based on selection option
export function getRecentItems({ pageToken, pageSize }) { export function getRecentItems({ pageToken, pageSize }) {

View File

@ -1,16 +1,5 @@
import { getLanguage } from '@/lang/index'
import { getToken } from '@/utils/auth'
import Dictionary from '@adempiere/grpc-dictionary-client'
import { DICTIONARY_ADDRESS } from '@/api/ADempiere/constants'
// Get Instance for connection // Get Instance for connection
function Instance() { import { DictionaryInstance as Instance } from '@/api/ADempiere/instances.js'
return new Dictionary(
DICTIONARY_ADDRESS,
getToken(),
getLanguage() || 'en_US'
)
}
export function getWindow(uuid, isWithTabs = true) { export function getWindow(uuid, isWithTabs = true) {
return Instance.call(this).requestWindow({ return Instance.call(this).requestWindow({

View File

@ -1,14 +1,5 @@
import Enrollment from '@adempiere/grpc-enrollment-client'
import { ENROLLMENT_ADDRESS } from '@/api/ADempiere/constants'
// Get Instance for connection // Get Instance for connection
function Instance() { import { EnrollmentInstance as Instance } from '@/api/ADempiere/instances.js'
return new Enrollment(
ENROLLMENT_ADDRESS,
3.9,
'ADempiere-Vue'
)
}
/** /**
* enroll User * enroll User
@ -18,10 +9,10 @@ function Instance() {
*/ */
export function enrollmentUser({ name, userName, password, eMail }) { export function enrollmentUser({ name, userName, password, eMail }) {
return Instance.call(this).enrollUser({ return Instance.call(this).enrollUser({
name: name, name,
userName: userName, userName,
password: password, password,
eMail: eMail eMail
}) })
} }

View File

@ -1,8 +1,8 @@
import { getEntitiesList } from '@/api/ADempiere/persistence'
export function getLocatorList({ export function getLocatorList({
warehouseId warehouseId
}) { }) {
const { getEntitiesList } = require('@/api/ADempiere/persistence')
return getEntitiesList({ return getEntitiesList({
tableName: 'M_Locator', tableName: 'M_Locator',
whereClause: `M_Warehouse_ID = ${warehouseId}` whereClause: `M_Warehouse_ID = ${warehouseId}`

View File

@ -1,18 +1,5 @@
import { getLanguage } from '@/lang/index'
import POS from '@adempiere/grpc-pos-client'
import { BUSINESS_DATA_ADDRESS } from '@/api/ADempiere/constants'
import { getToken, getCurrentOrganization, getCurrentWarehouse } from '@/utils/auth'
// Get Instance for connection // Get Instance for connection
function Instance() { import { POSInstance as Instance } from '@/api/ADempiere/instances.js'
return new POS({
host: BUSINESS_DATA_ADDRESS,
sessionUuid: getToken(),
organizationUuid: getCurrentOrganization(),
warehouseUuid: getCurrentWarehouse(),
language: getLanguage() || 'en_US'
})
}
export function getProductPrice({ export function getProductPrice({
searchValue, searchValue,

View File

@ -0,0 +1,69 @@
// Instance for connection Access (or Security)
export const AccessInstance = () => {
const Access = require('@adempiere/grpc-access-client')
const { ACCESS_ADDRESS } = require('@/api/ADempiere/constants')
const { getLanguage } = require('@/lang/index')
return new Access({
host: ACCESS_ADDRESS,
version: 'Version Epale',
language: getLanguage() || 'en_US'
})
}
// Instance for connection Business Data
export const BusinessDataInstance = () => {
const BusinessData = require('@adempiere/grpc-data-client')
const { BUSINESS_DATA_ADDRESS } = require('@/api/ADempiere/constants')
const { getLanguage } = require('@/lang/index')
const { getToken, getCurrentOrganization, getCurrentWarehouse } = require('@/utils/auth')
return new BusinessData({
host: BUSINESS_DATA_ADDRESS,
sessionUuid: getToken(),
organizationUuid: getCurrentOrganization(),
warehouseUuid: getCurrentWarehouse(),
language: getLanguage() || 'en_US'
})
}
// Get Instance for connection
export const DictionaryInstance = () => {
const Dictionary = require('@adempiere/grpc-dictionary-client')
const { DICTIONARY_ADDRESS } = require('@/api/ADempiere/constants')
const { getLanguage } = require('@/lang/index')
const { getToken } = require('@/utils/auth')
return new Dictionary(
DICTIONARY_ADDRESS,
getToken(),
getLanguage() || 'en_US'
)
}
// Instance for connection Enrollment
export const EnrollmentInstance = () => {
const Enrollment = require('@adempiere/grpc-enrollment-client')
const { ENROLLMENT_ADDRESS } = require('@/api/ADempiere/constants')
return new Enrollment(
ENROLLMENT_ADDRESS,
3.9,
'ADempiere-Vue'
)
}
export const POSInstance = () => {
const POS = require('@adempiere/grpc-pos-client')
const { BUSINESS_DATA_ADDRESS } = require('@/api/ADempiere/constants')
const { getLanguage } = require('@/lang/index')
const { getToken, getCurrentOrganization, getCurrentWarehouse } = require('@/utils/auth')
return new POS({
host: BUSINESS_DATA_ADDRESS,
sessionUuid: getToken(),
organizationUuid: getCurrentOrganization(),
warehouseUuid: getCurrentWarehouse(),
language: getLanguage() || 'en_US'
})
}

View File

@ -1,23 +1,10 @@
import { getLanguage } from '@/lang/index'
import { getToken, getCurrentOrganization, getCurrentWarehouse } from '@/utils/auth'
import BusinessData from '@adempiere/grpc-data-client'
import { BUSINESS_DATA_ADDRESS } from '@/api/ADempiere/constants'
// Get Instance for connection // Get Instance for connection
function Instance() { import { BusinessDataInstance as Instance } from '@/api/ADempiere/instances.js'
return new BusinessData({
host: BUSINESS_DATA_ADDRESS,
sessionUuid: getToken(),
organizationUuid: getCurrentOrganization(),
warehouseUuid: getCurrentWarehouse(),
language: getLanguage() || 'en_US'
})
}
/** /**
* Create entity * Create entity
* @param {string} parameters.tableName * @param {string} tableName
* @param {array} parameters.attributesList * @param {array} attributesList
*/ */
export function createEntity({ tableName, attributesList }) { export function createEntity({ tableName, attributesList }) {
return Instance.call(this).requestCreateEntity({ return Instance.call(this).requestCreateEntity({

View File

@ -1,18 +1,5 @@
import { getLanguage } from '@/lang/index'
import BusinessData from '@adempiere/grpc-data-client'
import { BUSINESS_DATA_ADDRESS } from '@/api/ADempiere/constants'
import { getToken, getCurrentOrganization, getCurrentWarehouse } from '@/utils/auth'
// Get Instance for connection // Get Instance for connection
function Instance() { import { BusinessDataInstance as Instance } from '@/api/ADempiere/instances.js'
return new BusinessData({
host: BUSINESS_DATA_ADDRESS,
sessionUuid: getToken(),
organizationUuid: getCurrentOrganization(),
warehouseUuid: getCurrentWarehouse(),
language: getLanguage() || 'en_US'
})
}
// Get private access for a record // Get private access for a record
export function getPrivateAccessFromServer({ tableName, recordId, userUuid }) { export function getPrivateAccessFromServer({ tableName, recordId, userUuid }) {

View File

@ -1,18 +1,5 @@
import { getLanguage } from '@/lang/index'
import BusinessData from '@adempiere/grpc-data-client'
import { BUSINESS_DATA_ADDRESS } from '@/api/ADempiere/constants'
import { getToken, getCurrentOrganization, getCurrentWarehouse } from '@/utils/auth'
// Get Instance for connection // Get Instance for connection
function Instance() { import { BusinessDataInstance as Instance } from '@/api/ADempiere/instances.js'
return new BusinessData({
host: BUSINESS_DATA_ADDRESS,
sessionUuid: getToken(),
organizationUuid: getCurrentOrganization(),
warehouseUuid: getCurrentWarehouse(),
language: getLanguage() || 'en_US'
})
}
/** /**
* Request a process * Request a process

View File

@ -1,18 +1,5 @@
import { getLanguage } from '@/lang/index'
import BusinessData from '@adempiere/grpc-data-client'
import { BUSINESS_DATA_ADDRESS } from '@/api/ADempiere/constants'
import { getToken, getCurrentOrganization, getCurrentWarehouse } from '@/utils/auth'
// Get Instance for connection // Get Instance for connection
function Instance() { import { BusinessDataInstance as Instance } from '@/api/ADempiere/instances.js'
return new BusinessData({
host: BUSINESS_DATA_ADDRESS,
sessionUuid: getToken(),
organizationUuid: getCurrentOrganization(),
warehouseUuid: getCurrentWarehouse(),
language: getLanguage() || 'en_US'
})
}
/** /**
* Request Pending Documents List * Request Pending Documents List

View File

@ -1,18 +1,5 @@
import { getLanguage } from '@/lang/index'
import BusinessData from '@adempiere/grpc-data-client'
import { BUSINESS_DATA_ADDRESS } from '@/api/ADempiere/constants'
import { getToken, getCurrentOrganization, getCurrentWarehouse } from '@/utils/auth'
// Get Instance for connection // Get Instance for connection
function Instance() { import { BusinessDataInstance as Instance } from '@/api/ADempiere/instances.js'
return new BusinessData({
host: BUSINESS_DATA_ADDRESS,
sessionUuid: getToken(),
organizationUuid: getCurrentOrganization(),
warehouseUuid: getCurrentWarehouse(),
language: getLanguage() || 'en_US'
})
}
/** /**
* Run callout request * Run callout request

View File

@ -1,18 +1,5 @@
import { getLanguage } from '@/lang/index'
import { getToken, getCurrentOrganization, getCurrentWarehouse } from '@/utils/auth'
import BusinessData from '@adempiere/grpc-data-client'
import { BUSINESS_DATA_ADDRESS } from '@/api/ADempiere/constants'
// Get Instance for connection // Get Instance for connection
function Instance() { import { BusinessDataInstance as Instance } from '@/api/ADempiere/instances.js'
return new BusinessData({
host: BUSINESS_DATA_ADDRESS,
sessionUuid: getToken(),
organizationUuid: getCurrentOrganization(),
warehouseUuid: getCurrentWarehouse(),
language: getLanguage() || 'en_US'
})
}
// Get Organization list from role // Get Organization list from role
export function getOrganizationsList({ export function getOrganizationsList({

View File

@ -1,18 +1,5 @@
import { getLanguage } from '@/lang/index'
import { getToken, getCurrentOrganization, getCurrentWarehouse } from '@/utils/auth'
import BusinessData from '@adempiere/grpc-data-client'
import { BUSINESS_DATA_ADDRESS } from '@/api/ADempiere/constants'
// Get Instance for connection // Get Instance for connection
function Instance() { import { BusinessDataInstance as Instance } from '@/api/ADempiere/instances.js'
return new BusinessData({
host: BUSINESS_DATA_ADDRESS,
sessionUuid: getToken(),
organizationUuid: getCurrentOrganization(),
warehouseUuid: getCurrentWarehouse(),
language: getLanguage() || 'en_US'
})
}
/** /**
* Request a Lookup data from Reference * Request a Lookup data from Reference

View File

@ -1,18 +1,5 @@
import { getLanguage } from '@/lang/index'
import BusinessData from '@adempiere/grpc-data-client'
import { BUSINESS_DATA_ADDRESS } from '@/api/ADempiere/constants'
import { getToken, getCurrentOrganization, getCurrentWarehouse } from '@/utils/auth'
// Get Instance for connection // Get Instance for connection
function Instance() { import { BusinessDataInstance as Instance } from '@/api/ADempiere/instances.js'
return new BusinessData({
host: BUSINESS_DATA_ADDRESS,
sessionUuid: getToken(),
organizationUuid: getCurrentOrganization(),
warehouseUuid: getCurrentWarehouse(),
language: getLanguage() || 'en_US'
})
}
// Get list of log for a records // Get list of log for a records
export function requestListRecordsLogs({ export function requestListRecordsLogs({

View File

@ -1,30 +1,22 @@
import { getLanguage } from '@/lang/index'
import Access from '@adempiere/grpc-access-client'
import { ACCESS_ADDRESS } from '@/api/ADempiere/constants'
// Instance for connection // Instance for connection
function Instance() { import { AccessInstance as Instance } from '@/api/ADempiere/instances.js'
return new Access(
ACCESS_ADDRESS,
'Version Epale',
getLanguage() || 'en_US'
)
}
// Make login by UserName and password, this function can return user data for show // Make login by UserName and password, this function can return user data for show
export function login(loginValues) { export function login({
if (loginValues.role && loginValues.role.trim() !== '') { userName,
password: userPass,
role
}) {
if (role && role.trim() !== '') {
return Instance.call(this).requestLogin({ return Instance.call(this).requestLogin({
userName: loginValues.userName, userName,
userPass: loginValues.password, userPass,
role: loginValues.role, role
language: getLanguage() || 'en_US'
}) })
} else { } else {
return Instance.call(this).requestLoginDefault({ return Instance.call(this).requestLoginDefault({
userName: loginValues.userName, userName,
userPass: loginValues.password, userPass
language: getLanguage() || 'en_US'
}) })
} }
} }

View File

@ -262,6 +262,9 @@ export const contextMixin = {
isRefreshPanel: true, isRefreshPanel: true,
recordUuid: this.recordUuid recordUuid: this.recordUuid
}) })
.catch(error => {
console.warn(`Error getting data list tab. Message: ${error.message}, code ${error.code}.`)
})
} else if (this.panelType === 'browser') { } else if (this.panelType === 'browser') {
const fieldsEmpty = this.$store.getters.getFieldListEmptyMandatory({ const fieldsEmpty = this.$store.getters.getFieldListEmptyMandatory({
containerUuid: this.containerUuid, containerUuid: this.containerUuid,
@ -297,9 +300,6 @@ export const contextMixin = {
.then(() => { .then(() => {
this.references = this.getterReferences this.references = this.getterReferences
}) })
.catch(error => {
console.warn(`References Load Error ${error.code}: ${error.message}.`)
})
.finally(() => { .finally(() => {
this.isLoadedReferences = true this.isLoadedReferences = true
}) })

View File

@ -112,6 +112,9 @@ export default {
containerUuid: this.modalMetadata.containerUuid, containerUuid: this.modalMetadata.containerUuid,
isAddRecord: true isAddRecord: true
}) })
.catch(error => {
console.warn(`Error getting data list tab. Message: ${error.message}, code ${error.code}.`)
})
} }
} }
} }

View File

@ -585,6 +585,9 @@ export default {
}) })
} }
}) })
.catch(error => {
console.warn(`Error getting data list tab. Message: ${error.message}, code ${error.code}.`)
})
} }
}, },
/** /**

View File

@ -35,6 +35,9 @@ export const tabMixin = {
parentUuid: this.windowUuid, parentUuid: this.windowUuid,
containerUuid: this.tabUuid containerUuid: this.tabUuid
}) })
.catch(error => {
console.warn(`Error getting data list tab. Message: ${error.message}, code ${error.code}.`)
})
}, },
/** /**
* @param {object} tabHTML DOM HTML the tab clicked * @param {object} tabHTML DOM HTML the tab clicked

View File

@ -35,7 +35,7 @@ router.beforeEach(async(to, from, next) => {
try { try {
// note: roles must be a object array! such as: ['admin'] or ,['developer','editor'] // note: roles must be a object array! such as: ['admin'] or ,['developer','editor']
// get user info from server // get user info from server
await store.dispatch('user/getInfo') await store.dispatch('user/getSessionInfo')
// generate accessible routes map based on roles // generate accessible routes map based on roles
const accessRoutes = await store.dispatch('permission/generateRoutes') const accessRoutes = await store.dispatch('permission/generateRoutes')

View File

@ -1,6 +1,5 @@
// Default store for handle dashboard refresh and other functionalities // Default store for handle dashboard refresh and other functionalities
import { requestLisDashboards, getRecentItems } from '@/api/ADempiere/dashboard/dashboard' import { requestLisDashboards } from '@/api/ADempiere/dashboard/dashboard'
import { convertAction } from '@/utils/ADempiere/dictionaryUtils'
import { isEmptyValue } from '@/utils/ADempiere/valueUtils' import { isEmptyValue } from '@/utils/ADempiere/valueUtils'
import { getCurrentRole } from '@/utils/auth' import { getCurrentRole } from '@/utils/auth'
@ -27,9 +26,11 @@ const dashboard = {
listDashboard({ commit, rootGetters }, roleUuid) { listDashboard({ commit, rootGetters }, roleUuid) {
if (isEmptyValue(roleUuid)) { if (isEmptyValue(roleUuid)) {
roleUuid = rootGetters.getRoleUuid roleUuid = rootGetters.getRoleUuid
} else if (isEmptyValue(roleUuid)) { if (isEmptyValue(roleUuid)) {
roleUuid = getCurrentRole() roleUuid = getCurrentRole()
} }
}
return new Promise(resolve => { return new Promise(resolve => {
requestLisDashboards({ roleUuid }) requestLisDashboards({ roleUuid })
.then(dashboardResponse => { .then(dashboardResponse => {
@ -44,27 +45,6 @@ const dashboard = {
console.warn(`Error getting List Dashboards: ${error.message}. Code: ${error.code}.`) console.warn(`Error getting List Dashboards: ${error.message}. Code: ${error.code}.`)
}) })
}) })
},
getRecentItemsFromServer({ commit }) {
return new Promise(resolve => {
getRecentItems({ pageToken: undefined, pageSize: undefined })
.then(recentItemsResponse => {
const recentItems = recentItemsResponse.recentItemsList.map(item => {
const actionConverted = convertAction(item.action)
return {
...item,
originalAction: item.action,
action: actionConverted.name,
icon: actionConverted.icon
}
})
commit('setRecentItems', recentItems)
resolve(recentItems)
})
.catch(error => {
console.warn(`Error getting recent items: ${error.message}. Code: ${error.code}.`)
})
})
} }
}, },
getters: { getters: {
@ -77,9 +57,6 @@ const dashboard = {
return state.dashboard.find( return state.dashboard.find(
item => item.roleUuid === roleUuid item => item.roleUuid === roleUuid
) )
},
getRecentItems: (state) => {
return state.recentItems
} }
} }
} }

View File

@ -112,6 +112,9 @@ const data = {
isAddRecord, isAddRecord,
isShowNotification isShowNotification
}) })
.catch(error => {
console.warn(`Error getting data list tab. Message: ${error.message}, code ${error.code}.`)
})
} else if (panelType === 'browser') { } else if (panelType === 'browser') {
if (!rootGetters.isNotReadyForSubmit(containerUuid)) { if (!rootGetters.isNotReadyForSubmit(containerUuid)) {
dispatch('getBrowserSearch', { dispatch('getBrowserSearch', {
@ -455,7 +458,7 @@ const data = {
recordUuid, recordUuid,
recordId recordId
}) { }) {
return new Promise((resolve, reject) => { return new Promise(resolve => {
getEntity({ getEntity({
tableName, tableName,
recordUuid, recordUuid,
@ -465,7 +468,7 @@ const data = {
resolve(responseGetEntity.values) resolve(responseGetEntity.values)
}) })
.catch(error => { .catch(error => {
reject(error) console.warn(`Error Get Entity ${error.message}. Code: ${error.code}.`)
}) })
}) })
}, },

View File

@ -181,7 +181,6 @@ const languageControl = {
if (translationRecord) { if (translationRecord) {
return translationRecord.values return translationRecord.values
} }
return {}
} }
return {} return {}
} }

View File

@ -75,7 +75,7 @@ const process = {
}) { }) {
return new Promise(resolve => { return new Promise(resolve => {
const { processDefinition, actions } = generateProcess({ const { processDefinition, actions } = generateProcess({
processToGenerate: processToGenerate processToGenerate
}) })
dispatch('addPanel', processDefinition) dispatch('addPanel', processDefinition)

View File

@ -148,8 +148,7 @@ const processControl = {
message: `Required selection data record to run this process (${action.name})` message: `Required selection data record to run this process (${action.name})`
}) })
} }
} } else if (panelType === 'window') {
if (panelType === 'window') {
const contextMenu = getters.getRecordUuidMenu const contextMenu = getters.getRecordUuidMenu
tab = rootGetters.getTab(parentUuid, containerUuid) tab = rootGetters.getTab(parentUuid, containerUuid)
if (isProcessTableSelection) { if (isProcessTableSelection) {
@ -322,7 +321,7 @@ const processControl = {
processId: processDefinition.id, processId: processDefinition.id,
tableName: output.tableName, tableName: output.tableName,
printFormatUuid: output.printFormatUuid, printFormatUuid: output.printFormatUuid,
reportViewUuid: output.reportViewUuid reportViewUuid: output.reportViewUuid // TODO: Change to uuid
}) })
.then(responseReportView => { .then(responseReportView => {
reportViewList.childs = responseReportView reportViewList.childs = responseReportView

View File

@ -260,6 +260,9 @@ const windowControl = {
parentUuid, parentUuid,
containerUuid containerUuid
}) })
.catch(error => {
console.warn(`Error getting data list tab. Message: ${error.message}, code ${error.code}.`)
})
} }
commit('deleteInCreate', { commit('deleteInCreate', {
containerUuid, containerUuid,
@ -473,6 +476,9 @@ const windowControl = {
} }
} }
}) })
.catch(error => {
console.warn(`Error getting data list tab. Message: ${error.message}, code ${error.code}.`)
})
showMessage({ showMessage({
message: language.t('data.deleteRecordSuccessful'), message: language.t('data.deleteRecordSuccessful'),
type: 'success' type: 'success'
@ -534,6 +540,9 @@ const windowControl = {
parentUuid, parentUuid,
containerUuid containerUuid
}) })
.catch(error => {
console.warn(`Error getting data list tab. Message: ${error.message}, code ${error.code}.`)
})
return return
} }
deleteEntity({ deleteEntity({
@ -571,6 +580,9 @@ const windowControl = {
parentUuid, parentUuid,
containerUuid containerUuid
}) })
.catch(error => {
console.warn(`Error getting data list tab. Message: ${error.message}, code ${error.code}.`)
})
showMessage({ showMessage({
message: language.t('data.deleteRecordSuccessful'), message: language.t('data.deleteRecordSuccessful'),
type: 'success' type: 'success'
@ -779,7 +791,7 @@ const windowControl = {
if (isEmptyValue(tableName)) { if (isEmptyValue(tableName)) {
tableName = rootGetters.getTab(windowUuid, containerUuid).tableName tableName = rootGetters.getTab(windowUuid, containerUuid).tableName
} }
return new Promise((resolve, reject) => { return new Promise(resolve => {
getReferencesList({ getReferencesList({
windowUuid, windowUuid,
tableName, tableName,
@ -803,7 +815,7 @@ const windowControl = {
resolve(referenceResponse) resolve(referenceResponse)
}) })
.catch(error => { .catch(error => {
reject(error) console.warn(`References Load Error ${error.code}: ${error.message}.`)
}) })
}) })
}, },
@ -886,6 +898,9 @@ const windowControl = {
parentUuid, parentUuid,
containerUuid: tabAssociatedUuid containerUuid: tabAssociatedUuid
}) })
.catch(error => {
console.warn(`Error getting data list tab. Message: ${error.message}, code ${error.code}.`)
})
} }
}) })
}) })

View File

@ -123,16 +123,18 @@ const actions = {
setToken(token) setToken(token)
resolve() resolve()
}).catch(error => { })
.catch(error => {
reject(error) reject(error)
}) })
}) })
}, },
// session info // session info
getInfo({ commit, dispatch }, sessionUuid = null) { getSessionInfo({ commit, dispatch }, sessionUuid = null) {
if (isEmptyValue(sessionUuid)) { if (isEmptyValue(sessionUuid)) {
sessionUuid = getToken() sessionUuid = getToken()
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getSessionInfo(sessionUuid) getSessionInfo(sessionUuid)
.then(responseGetInfo => { .then(responseGetInfo => {
@ -166,47 +168,11 @@ const actions = {
commit('SET_ROLE', role) commit('SET_ROLE', role)
setCurrentRole(role.uuid) setCurrentRole(role.uuid)
getOrganizationsList({ roleUuid: role.uuid })
.then(response => {
commit('SET_ORGANIZATIONS_LIST', response.organizationsList)
let organization = response.organizationsList.find(item => item.uuid === getCurrentOrganization())
if (isEmptyValue(organization)) {
organization = response.organizationsList[0]
}
if (isEmptyValue(organization)) {
removeCurrentOrganization()
commit('SET_ORGANIZATION', undefined)
} else {
setCurrentOrganization(organization.uuid)
commit('SET_ORGANIZATION', organization)
}
getWarehousesList({ organizationUuid: getCurrentOrganization() })
.then(response => {
commit('SET_WAREHOUSES_LIST', response.warehousesList)
let warehouse = response.warehousesList.find(item => item.uuid === getCurrentWarehouse())
if (isEmptyValue(warehouse)) {
warehouse = response.warehousesList[0]
}
if (isEmptyValue(warehouse)) {
removeCurrentWarehouse()
commit('SET_WAREHOUSE', undefined)
} else {
setCurrentWarehouse(warehouse.uuid)
commit('SET_WAREHOUSE', warehouse)
}
})
.catch(error => {
console.warn(`Error ${error.code} getting user info value: ${error.message}.`)
reject(error)
})
})
.catch(error => {
console.warn(`Error ${error.code} getting user info value: ${error.message}.`)
reject(error)
})
//
resolve(sessionResponse) resolve(sessionResponse)
dispatch('getOrganizationsList', role.uuid)
dispatch('getUserInfoFromSession', sessionUuid) dispatch('getUserInfoFromSession', sessionUuid)
.catch(error => { .catch(error => {
console.warn(`Error ${error.code} getting user info value: ${error.message}.`) console.warn(`Error ${error.code} getting user info value: ${error.message}.`)
@ -303,11 +269,43 @@ const actions = {
resolve() resolve()
}) })
}, },
getOrganizationsList({ commit, dispatch }, roleUuid) {
if (isEmptyValue(roleUuid)) {
roleUuid = getCurrentRole()
}
return getOrganizationsList({ roleUuid })
.then(response => {
commit('SET_ORGANIZATIONS_LIST', response.organizationsList)
let organization = response.organizationsList.find(item => item.uuid === getCurrentOrganization())
if (isEmptyValue(organization)) {
organization = response.organizationsList[0]
}
if (isEmptyValue(organization)) {
removeCurrentOrganization()
organization = undefined
} else {
setCurrentOrganization(organization.uuid)
}
commit('SET_ORGANIZATION', organization)
dispatch('getWarehousesList', organization.uuid)
})
.catch(error => {
console.warn(`Error ${error.code} getting Organizations list: ${error.message}.`)
})
},
changeOrganization({ commit, dispatch }, { changeOrganization({ commit, dispatch }, {
organizationUuid organizationUuid
}) { }) {
setCurrentOrganization(organizationUuid) setCurrentOrganization(organizationUuid)
getWarehousesList({ organizationUuid: organizationUuid }) dispatch('getWarehousesList', organizationUuid)
},
getWarehousesList({ commit }, organizationUuid) {
if (isEmptyValue(organizationUuid)) {
organizationUuid = getCurrentOrganization()
}
return getWarehousesList({ organizationUuid })
.then(response => { .then(response => {
commit('SET_WAREHOUSES_LIST', response.warehousesList) commit('SET_WAREHOUSES_LIST', response.warehousesList)
let warehouse = response.warehousesList.find(item => item.uuid === getCurrentWarehouse()) let warehouse = response.warehousesList.find(item => item.uuid === getCurrentWarehouse())
@ -323,7 +321,7 @@ const actions = {
} }
}) })
.catch(error => { .catch(error => {
console.warn(`Error ${error.code} getting user info value: ${error.message}.`) console.warn(`Error ${error.code} getting Warehouses list: ${error.message}.`)
}) })
}, },
changeWarehouse({ commit, state }, { changeWarehouse({ commit, state }, {
@ -372,7 +370,7 @@ const actions = {
setToken(changeRoleResponse.uuid) setToken(changeRoleResponse.uuid)
// Update user info and context associated with session // Update user info and context associated with session
dispatch('getInfo', changeRoleResponse.uuid) dispatch('getSessionInfo', changeRoleResponse.uuid)
dispatch('resetStateBusinessData', null, { dispatch('resetStateBusinessData', null, {
root: true root: true

View File

@ -11,7 +11,6 @@
</template> </template>
<script> <script>
import Dashboard from '@/components/ADempiere/Dashboard' import Dashboard from '@/components/ADempiere/Dashboard'
export default { export default {