mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 20:39:48 +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:
parent
cfc03c6c9c
commit
8727beefdc
@ -44,11 +44,11 @@
|
||||
"url": "https://github.com/PanJiaChen/vue-element-admin/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"@adempiere/grpc-access-client": "^1.2.0",
|
||||
"@adempiere/grpc-data-client": "^2.3.2",
|
||||
"@adempiere/grpc-access-client": "^1.2.1",
|
||||
"@adempiere/grpc-data-client": "^2.3.4",
|
||||
"@adempiere/grpc-dictionary-client": "^1.4.1",
|
||||
"@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",
|
||||
"clipboard": "2.0.6",
|
||||
"codemirror": "5.53.2",
|
||||
@ -87,6 +87,7 @@
|
||||
"xlsx": "0.15.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@adempiere/grpc-core-client": "^1.0.3",
|
||||
"@babel/core": "7.9.0",
|
||||
"@babel/register": "7.9.0",
|
||||
"@vue/cli-plugin-babel": "4.3.1",
|
||||
|
@ -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
|
||||
function Instance() {
|
||||
return new BusinessData({
|
||||
host: BUSINESS_DATA_ADDRESS,
|
||||
sessionUuid: getToken(),
|
||||
organizationUuid: getCurrentOrganization(),
|
||||
warehouseUuid: getCurrentWarehouse(),
|
||||
language: getLanguage() || 'en_US'
|
||||
})
|
||||
}
|
||||
import { BusinessDataInstance as Instance } from '@/api/ADempiere/instances.js'
|
||||
|
||||
/**
|
||||
* Request a browser search
|
||||
|
@ -1,26 +1,8 @@
|
||||
// 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
|
||||
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
|
||||
function Instance() {
|
||||
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 })
|
||||
}
|
||||
import { BusinessDataInstance as Instance } from '@/api/ADempiere/instances.js'
|
||||
|
||||
// Get Recent Items based on selection option
|
||||
export function getRecentItems({ pageToken, pageSize }) {
|
||||
|
@ -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
|
||||
function Instance() {
|
||||
return new Dictionary(
|
||||
DICTIONARY_ADDRESS,
|
||||
getToken(),
|
||||
getLanguage() || 'en_US'
|
||||
)
|
||||
}
|
||||
import { DictionaryInstance as Instance } from '@/api/ADempiere/instances.js'
|
||||
|
||||
export function getWindow(uuid, isWithTabs = true) {
|
||||
return Instance.call(this).requestWindow({
|
||||
|
@ -1,14 +1,5 @@
|
||||
import Enrollment from '@adempiere/grpc-enrollment-client'
|
||||
import { ENROLLMENT_ADDRESS } from '@/api/ADempiere/constants'
|
||||
|
||||
// Get Instance for connection
|
||||
function Instance() {
|
||||
return new Enrollment(
|
||||
ENROLLMENT_ADDRESS,
|
||||
3.9,
|
||||
'ADempiere-Vue'
|
||||
)
|
||||
}
|
||||
import { EnrollmentInstance as Instance } from '@/api/ADempiere/instances.js'
|
||||
|
||||
/**
|
||||
* enroll User
|
||||
@ -18,10 +9,10 @@ function Instance() {
|
||||
*/
|
||||
export function enrollmentUser({ name, userName, password, eMail }) {
|
||||
return Instance.call(this).enrollUser({
|
||||
name: name,
|
||||
userName: userName,
|
||||
password: password,
|
||||
eMail: eMail
|
||||
name,
|
||||
userName,
|
||||
password,
|
||||
eMail
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { getEntitiesList } from '@/api/ADempiere/persistence'
|
||||
|
||||
export function getLocatorList({
|
||||
warehouseId
|
||||
}) {
|
||||
const { getEntitiesList } = require('@/api/ADempiere/persistence')
|
||||
|
||||
return getEntitiesList({
|
||||
tableName: 'M_Locator',
|
||||
whereClause: `M_Warehouse_ID = ${warehouseId}`
|
||||
|
@ -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
|
||||
function Instance() {
|
||||
return new POS({
|
||||
host: BUSINESS_DATA_ADDRESS,
|
||||
sessionUuid: getToken(),
|
||||
organizationUuid: getCurrentOrganization(),
|
||||
warehouseUuid: getCurrentWarehouse(),
|
||||
language: getLanguage() || 'en_US'
|
||||
})
|
||||
}
|
||||
import { POSInstance as Instance } from '@/api/ADempiere/instances.js'
|
||||
|
||||
export function getProductPrice({
|
||||
searchValue,
|
||||
|
69
src/api/ADempiere/instances.js
Normal file
69
src/api/ADempiere/instances.js
Normal 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'
|
||||
})
|
||||
}
|
@ -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
|
||||
function Instance() {
|
||||
return new BusinessData({
|
||||
host: BUSINESS_DATA_ADDRESS,
|
||||
sessionUuid: getToken(),
|
||||
organizationUuid: getCurrentOrganization(),
|
||||
warehouseUuid: getCurrentWarehouse(),
|
||||
language: getLanguage() || 'en_US'
|
||||
})
|
||||
}
|
||||
import { BusinessDataInstance as Instance } from '@/api/ADempiere/instances.js'
|
||||
|
||||
/**
|
||||
* Create entity
|
||||
* @param {string} parameters.tableName
|
||||
* @param {array} parameters.attributesList
|
||||
* @param {string} tableName
|
||||
* @param {array} attributesList
|
||||
*/
|
||||
export function createEntity({ tableName, attributesList }) {
|
||||
return Instance.call(this).requestCreateEntity({
|
||||
|
@ -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
|
||||
function Instance() {
|
||||
return new BusinessData({
|
||||
host: BUSINESS_DATA_ADDRESS,
|
||||
sessionUuid: getToken(),
|
||||
organizationUuid: getCurrentOrganization(),
|
||||
warehouseUuid: getCurrentWarehouse(),
|
||||
language: getLanguage() || 'en_US'
|
||||
})
|
||||
}
|
||||
import { BusinessDataInstance as Instance } from '@/api/ADempiere/instances.js'
|
||||
|
||||
// Get private access for a record
|
||||
export function getPrivateAccessFromServer({ tableName, recordId, userUuid }) {
|
||||
|
@ -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
|
||||
function Instance() {
|
||||
return new BusinessData({
|
||||
host: BUSINESS_DATA_ADDRESS,
|
||||
sessionUuid: getToken(),
|
||||
organizationUuid: getCurrentOrganization(),
|
||||
warehouseUuid: getCurrentWarehouse(),
|
||||
language: getLanguage() || 'en_US'
|
||||
})
|
||||
}
|
||||
import { BusinessDataInstance as Instance } from '@/api/ADempiere/instances.js'
|
||||
|
||||
/**
|
||||
* Request a process
|
||||
|
@ -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
|
||||
function Instance() {
|
||||
return new BusinessData({
|
||||
host: BUSINESS_DATA_ADDRESS,
|
||||
sessionUuid: getToken(),
|
||||
organizationUuid: getCurrentOrganization(),
|
||||
warehouseUuid: getCurrentWarehouse(),
|
||||
language: getLanguage() || 'en_US'
|
||||
})
|
||||
}
|
||||
import { BusinessDataInstance as Instance } from '@/api/ADempiere/instances.js'
|
||||
|
||||
/**
|
||||
* Request Pending Documents List
|
||||
|
@ -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
|
||||
function Instance() {
|
||||
return new BusinessData({
|
||||
host: BUSINESS_DATA_ADDRESS,
|
||||
sessionUuid: getToken(),
|
||||
organizationUuid: getCurrentOrganization(),
|
||||
warehouseUuid: getCurrentWarehouse(),
|
||||
language: getLanguage() || 'en_US'
|
||||
})
|
||||
}
|
||||
import { BusinessDataInstance as Instance } from '@/api/ADempiere/instances.js'
|
||||
|
||||
/**
|
||||
* Run callout request
|
||||
|
@ -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
|
||||
function Instance() {
|
||||
return new BusinessData({
|
||||
host: BUSINESS_DATA_ADDRESS,
|
||||
sessionUuid: getToken(),
|
||||
organizationUuid: getCurrentOrganization(),
|
||||
warehouseUuid: getCurrentWarehouse(),
|
||||
language: getLanguage() || 'en_US'
|
||||
})
|
||||
}
|
||||
import { BusinessDataInstance as Instance } from '@/api/ADempiere/instances.js'
|
||||
|
||||
// Get Organization list from role
|
||||
export function getOrganizationsList({
|
||||
|
@ -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
|
||||
function Instance() {
|
||||
return new BusinessData({
|
||||
host: BUSINESS_DATA_ADDRESS,
|
||||
sessionUuid: getToken(),
|
||||
organizationUuid: getCurrentOrganization(),
|
||||
warehouseUuid: getCurrentWarehouse(),
|
||||
language: getLanguage() || 'en_US'
|
||||
})
|
||||
}
|
||||
import { BusinessDataInstance as Instance } from '@/api/ADempiere/instances.js'
|
||||
|
||||
/**
|
||||
* Request a Lookup data from Reference
|
||||
|
@ -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
|
||||
function Instance() {
|
||||
return new BusinessData({
|
||||
host: BUSINESS_DATA_ADDRESS,
|
||||
sessionUuid: getToken(),
|
||||
organizationUuid: getCurrentOrganization(),
|
||||
warehouseUuid: getCurrentWarehouse(),
|
||||
language: getLanguage() || 'en_US'
|
||||
})
|
||||
}
|
||||
import { BusinessDataInstance as Instance } from '@/api/ADempiere/instances.js'
|
||||
|
||||
// Get list of log for a records
|
||||
export function requestListRecordsLogs({
|
||||
|
@ -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
|
||||
function Instance() {
|
||||
return new Access(
|
||||
ACCESS_ADDRESS,
|
||||
'Version Epale',
|
||||
getLanguage() || 'en_US'
|
||||
)
|
||||
}
|
||||
import { AccessInstance as Instance } from '@/api/ADempiere/instances.js'
|
||||
|
||||
// Make login by UserName and password, this function can return user data for show
|
||||
export function login(loginValues) {
|
||||
if (loginValues.role && loginValues.role.trim() !== '') {
|
||||
export function login({
|
||||
userName,
|
||||
password: userPass,
|
||||
role
|
||||
}) {
|
||||
if (role && role.trim() !== '') {
|
||||
return Instance.call(this).requestLogin({
|
||||
userName: loginValues.userName,
|
||||
userPass: loginValues.password,
|
||||
role: loginValues.role,
|
||||
language: getLanguage() || 'en_US'
|
||||
userName,
|
||||
userPass,
|
||||
role
|
||||
})
|
||||
} else {
|
||||
return Instance.call(this).requestLoginDefault({
|
||||
userName: loginValues.userName,
|
||||
userPass: loginValues.password,
|
||||
language: getLanguage() || 'en_US'
|
||||
userName,
|
||||
userPass
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -262,6 +262,9 @@ export const contextMixin = {
|
||||
isRefreshPanel: true,
|
||||
recordUuid: this.recordUuid
|
||||
})
|
||||
.catch(error => {
|
||||
console.warn(`Error getting data list tab. Message: ${error.message}, code ${error.code}.`)
|
||||
})
|
||||
} else if (this.panelType === 'browser') {
|
||||
const fieldsEmpty = this.$store.getters.getFieldListEmptyMandatory({
|
||||
containerUuid: this.containerUuid,
|
||||
@ -297,9 +300,6 @@ export const contextMixin = {
|
||||
.then(() => {
|
||||
this.references = this.getterReferences
|
||||
})
|
||||
.catch(error => {
|
||||
console.warn(`References Load Error ${error.code}: ${error.message}.`)
|
||||
})
|
||||
.finally(() => {
|
||||
this.isLoadedReferences = true
|
||||
})
|
||||
|
@ -112,6 +112,9 @@ export default {
|
||||
containerUuid: this.modalMetadata.containerUuid,
|
||||
isAddRecord: true
|
||||
})
|
||||
.catch(error => {
|
||||
console.warn(`Error getting data list tab. Message: ${error.message}, code ${error.code}.`)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -585,6 +585,9 @@ export default {
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.warn(`Error getting data list tab. Message: ${error.message}, code ${error.code}.`)
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
|
@ -35,6 +35,9 @@ export const tabMixin = {
|
||||
parentUuid: this.windowUuid,
|
||||
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
|
||||
|
@ -35,7 +35,7 @@ router.beforeEach(async(to, from, next) => {
|
||||
try {
|
||||
// note: roles must be a object array! such as: ['admin'] or ,['developer','editor']
|
||||
// get user info from server
|
||||
await store.dispatch('user/getInfo')
|
||||
await store.dispatch('user/getSessionInfo')
|
||||
|
||||
// generate accessible routes map based on roles
|
||||
const accessRoutes = await store.dispatch('permission/generateRoutes')
|
||||
|
@ -1,6 +1,5 @@
|
||||
// Default store for handle dashboard refresh and other functionalities
|
||||
import { requestLisDashboards, getRecentItems } from '@/api/ADempiere/dashboard/dashboard'
|
||||
import { convertAction } from '@/utils/ADempiere/dictionaryUtils'
|
||||
import { requestLisDashboards } from '@/api/ADempiere/dashboard/dashboard'
|
||||
import { isEmptyValue } from '@/utils/ADempiere/valueUtils'
|
||||
import { getCurrentRole } from '@/utils/auth'
|
||||
|
||||
@ -27,9 +26,11 @@ const dashboard = {
|
||||
listDashboard({ commit, rootGetters }, roleUuid) {
|
||||
if (isEmptyValue(roleUuid)) {
|
||||
roleUuid = rootGetters.getRoleUuid
|
||||
} else if (isEmptyValue(roleUuid)) {
|
||||
roleUuid = getCurrentRole()
|
||||
if (isEmptyValue(roleUuid)) {
|
||||
roleUuid = getCurrentRole()
|
||||
}
|
||||
}
|
||||
|
||||
return new Promise(resolve => {
|
||||
requestLisDashboards({ roleUuid })
|
||||
.then(dashboardResponse => {
|
||||
@ -44,27 +45,6 @@ const dashboard = {
|
||||
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: {
|
||||
@ -77,9 +57,6 @@ const dashboard = {
|
||||
return state.dashboard.find(
|
||||
item => item.roleUuid === roleUuid
|
||||
)
|
||||
},
|
||||
getRecentItems: (state) => {
|
||||
return state.recentItems
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -112,6 +112,9 @@ const data = {
|
||||
isAddRecord,
|
||||
isShowNotification
|
||||
})
|
||||
.catch(error => {
|
||||
console.warn(`Error getting data list tab. Message: ${error.message}, code ${error.code}.`)
|
||||
})
|
||||
} else if (panelType === 'browser') {
|
||||
if (!rootGetters.isNotReadyForSubmit(containerUuid)) {
|
||||
dispatch('getBrowserSearch', {
|
||||
@ -455,7 +458,7 @@ const data = {
|
||||
recordUuid,
|
||||
recordId
|
||||
}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise(resolve => {
|
||||
getEntity({
|
||||
tableName,
|
||||
recordUuid,
|
||||
@ -465,7 +468,7 @@ const data = {
|
||||
resolve(responseGetEntity.values)
|
||||
})
|
||||
.catch(error => {
|
||||
reject(error)
|
||||
console.warn(`Error Get Entity ${error.message}. Code: ${error.code}.`)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
@ -181,7 +181,6 @@ const languageControl = {
|
||||
if (translationRecord) {
|
||||
return translationRecord.values
|
||||
}
|
||||
return {}
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ const process = {
|
||||
}) {
|
||||
return new Promise(resolve => {
|
||||
const { processDefinition, actions } = generateProcess({
|
||||
processToGenerate: processToGenerate
|
||||
processToGenerate
|
||||
})
|
||||
|
||||
dispatch('addPanel', processDefinition)
|
||||
|
@ -148,8 +148,7 @@ const processControl = {
|
||||
message: `Required selection data record to run this process (${action.name})`
|
||||
})
|
||||
}
|
||||
}
|
||||
if (panelType === 'window') {
|
||||
} else if (panelType === 'window') {
|
||||
const contextMenu = getters.getRecordUuidMenu
|
||||
tab = rootGetters.getTab(parentUuid, containerUuid)
|
||||
if (isProcessTableSelection) {
|
||||
@ -322,7 +321,7 @@ const processControl = {
|
||||
processId: processDefinition.id,
|
||||
tableName: output.tableName,
|
||||
printFormatUuid: output.printFormatUuid,
|
||||
reportViewUuid: output.reportViewUuid
|
||||
reportViewUuid: output.reportViewUuid // TODO: Change to uuid
|
||||
})
|
||||
.then(responseReportView => {
|
||||
reportViewList.childs = responseReportView
|
||||
|
@ -260,6 +260,9 @@ const windowControl = {
|
||||
parentUuid,
|
||||
containerUuid
|
||||
})
|
||||
.catch(error => {
|
||||
console.warn(`Error getting data list tab. Message: ${error.message}, code ${error.code}.`)
|
||||
})
|
||||
}
|
||||
commit('deleteInCreate', {
|
||||
containerUuid,
|
||||
@ -473,6 +476,9 @@ const windowControl = {
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.warn(`Error getting data list tab. Message: ${error.message}, code ${error.code}.`)
|
||||
})
|
||||
showMessage({
|
||||
message: language.t('data.deleteRecordSuccessful'),
|
||||
type: 'success'
|
||||
@ -534,6 +540,9 @@ const windowControl = {
|
||||
parentUuid,
|
||||
containerUuid
|
||||
})
|
||||
.catch(error => {
|
||||
console.warn(`Error getting data list tab. Message: ${error.message}, code ${error.code}.`)
|
||||
})
|
||||
return
|
||||
}
|
||||
deleteEntity({
|
||||
@ -571,6 +580,9 @@ const windowControl = {
|
||||
parentUuid,
|
||||
containerUuid
|
||||
})
|
||||
.catch(error => {
|
||||
console.warn(`Error getting data list tab. Message: ${error.message}, code ${error.code}.`)
|
||||
})
|
||||
showMessage({
|
||||
message: language.t('data.deleteRecordSuccessful'),
|
||||
type: 'success'
|
||||
@ -779,7 +791,7 @@ const windowControl = {
|
||||
if (isEmptyValue(tableName)) {
|
||||
tableName = rootGetters.getTab(windowUuid, containerUuid).tableName
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise(resolve => {
|
||||
getReferencesList({
|
||||
windowUuid,
|
||||
tableName,
|
||||
@ -803,7 +815,7 @@ const windowControl = {
|
||||
resolve(referenceResponse)
|
||||
})
|
||||
.catch(error => {
|
||||
reject(error)
|
||||
console.warn(`References Load Error ${error.code}: ${error.message}.`)
|
||||
})
|
||||
})
|
||||
},
|
||||
@ -886,6 +898,9 @@ const windowControl = {
|
||||
parentUuid,
|
||||
containerUuid: tabAssociatedUuid
|
||||
})
|
||||
.catch(error => {
|
||||
console.warn(`Error getting data list tab. Message: ${error.message}, code ${error.code}.`)
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -123,16 +123,18 @@ const actions = {
|
||||
setToken(token)
|
||||
|
||||
resolve()
|
||||
}).catch(error => {
|
||||
})
|
||||
.catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
// session info
|
||||
getInfo({ commit, dispatch }, sessionUuid = null) {
|
||||
getSessionInfo({ commit, dispatch }, sessionUuid = null) {
|
||||
if (isEmptyValue(sessionUuid)) {
|
||||
sessionUuid = getToken()
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
getSessionInfo(sessionUuid)
|
||||
.then(responseGetInfo => {
|
||||
@ -166,47 +168,11 @@ const actions = {
|
||||
|
||||
commit('SET_ROLE', role)
|
||||
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)
|
||||
|
||||
dispatch('getOrganizationsList', role.uuid)
|
||||
|
||||
dispatch('getUserInfoFromSession', sessionUuid)
|
||||
.catch(error => {
|
||||
console.warn(`Error ${error.code} getting user info value: ${error.message}.`)
|
||||
@ -303,11 +269,43 @@ const actions = {
|
||||
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 }, {
|
||||
organizationUuid
|
||||
}) {
|
||||
setCurrentOrganization(organizationUuid)
|
||||
getWarehousesList({ organizationUuid: organizationUuid })
|
||||
dispatch('getWarehousesList', organizationUuid)
|
||||
},
|
||||
getWarehousesList({ commit }, organizationUuid) {
|
||||
if (isEmptyValue(organizationUuid)) {
|
||||
organizationUuid = getCurrentOrganization()
|
||||
}
|
||||
return getWarehousesList({ organizationUuid })
|
||||
.then(response => {
|
||||
commit('SET_WAREHOUSES_LIST', response.warehousesList)
|
||||
let warehouse = response.warehousesList.find(item => item.uuid === getCurrentWarehouse())
|
||||
@ -323,7 +321,7 @@ const actions = {
|
||||
}
|
||||
})
|
||||
.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 }, {
|
||||
@ -372,7 +370,7 @@ const actions = {
|
||||
setToken(changeRoleResponse.uuid)
|
||||
|
||||
// Update user info and context associated with session
|
||||
dispatch('getInfo', changeRoleResponse.uuid)
|
||||
dispatch('getSessionInfo', changeRoleResponse.uuid)
|
||||
|
||||
dispatch('resetStateBusinessData', null, {
|
||||
root: true
|
||||
|
@ -11,7 +11,6 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import Dashboard from '@/components/ADempiere/Dashboard'
|
||||
|
||||
export default {
|
||||
|
Loading…
x
Reference in New Issue
Block a user