Skip to content

Commit

Permalink
Improve request util (#712)
Browse files Browse the repository at this point in the history
* Improve request util
- Improve request util based on basic and generic request
- Add ADempiere request layer (use it as template for others)
- Add Release information from github
- Chamge ADempiere request API fos a custom request

* Add release version

* Add rt-3.2 version

* Minmor change

* Add default action for release

* Add echo

* just a test

* Test release

* Add Release no version for test

* Add test for publish

* Add release no from tag
  • Loading branch information
yamelsenih authored Apr 4, 2021
1 parent e2d23df commit 2b1d8f7
Show file tree
Hide file tree
Showing 26 changed files with 108 additions and 153 deletions.
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: npm i
- run: sed -i "s|releaseNoForDocumentation|${{ github.event.release.tag_name }}|g" config/default.json
- run: npm run build:prod --if-present
- uses: TheDoctor0/[email protected]
with:
Expand Down
4 changes: 4 additions & 0 deletions config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@
"images": {
"url": "https://api.erpya.com/adempiere-api/img"
}
},
"repository": {
"url": "https://api.github.com",
"releaseNo": "releaseNoForDocumentation"
}
}
4 changes: 1 addition & 3 deletions src/api/ADempiere/browser.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Get Instance for connection
import request from '@/utils/request'
import { config } from '@/utils/ADempiere/config'
import { request } from '@/utils/ADempiere/request'

/**
* Request a browser search
Expand Down Expand Up @@ -39,7 +38,6 @@ export function requestBrowserSearch({
})

return request({
baseURL: config.adempiere.api.url,
url: '/ui/list-browser-items',
data: {
// Running Parameters
Expand Down
7 changes: 1 addition & 6 deletions src/api/ADempiere/dashboard/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
// please if you want to implement a custom dashboard create a new fielwith api definition

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

// Get Recent Items based on selection option
export function requestListRecentItems({
Expand All @@ -13,7 +12,6 @@ export function requestListRecentItems({
pageSize
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/logs/list-recent-items',
method: 'post',
data: {
Expand Down Expand Up @@ -45,7 +43,6 @@ export function getFavoritesFromServer({
pageSize
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/dashboard/list-favorites',
method: 'post',
data: {
Expand Down Expand Up @@ -81,7 +78,6 @@ export function getPendingDocumentsFromServer({
pageSize
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/dashboard/list-pending-documents',
method: 'post',
data: {
Expand Down Expand Up @@ -117,7 +113,6 @@ export function requestLisDashboards({
pageSize
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/dashboard/list-dashboards',
method: 'post',
data: {
Expand Down
9 changes: 1 addition & 8 deletions src/api/ADempiere/dictionary.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Get Instance for connection
import request from '@/utils/request'
import { config } from '@/utils/ADempiere/config'
import { request } from '@/utils/ADempiere/request'

/**
* Request dictionary Window metadata
Expand All @@ -12,7 +11,6 @@ export function requestWindowMetadata({
id
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/dictionary/window',
method: 'get',
params: {
Expand All @@ -37,7 +35,6 @@ export function requestProcessMetadata({
id
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/dictionary/process',
method: 'get',
params: {
Expand All @@ -62,7 +59,6 @@ export function requestBrowserMetadata({
id
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/dictionary/browser',
method: 'get',
params: {
Expand All @@ -87,7 +83,6 @@ export function requestForm({
id
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/dictionary/form',
method: 'get',
params: {
Expand All @@ -113,7 +108,6 @@ export function requestFieldMetadata({
elementColumnName
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/dictionary/field',
method: 'get',
params: {
Expand Down Expand Up @@ -158,7 +152,6 @@ export function requestValidationRule({
id
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/dictionary/validation',
method: 'get',
params: {
Expand Down
7 changes: 1 addition & 6 deletions src/api/ADempiere/enrollment.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Get Instance for connection
import request from '@/utils/request'
import { config } from '@/utils/ADempiere/config'
import { request } from '@/utils/ADempiere/request'

const clientVersion = '1.0.0'
const applicationType = 'ADempiere-Vue'
Expand All @@ -18,7 +17,6 @@ export function requestEnrollUser({
eMail
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/enrollment/enroll',
data: {
user_name: userName,
Expand Down Expand Up @@ -51,7 +49,6 @@ export function requestForgotPassword(eMailOrUserName) {
}

return request({
baseURL: config.adempiere.api.url,
url: '/enrollment/reset-password',
data: {
user_name: userName,
Expand All @@ -78,7 +75,6 @@ export function requestChangePassword({
password
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/enrollment/change-password',
data: {
token,
Expand All @@ -104,7 +100,6 @@ export function requestActivateUser({
token
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/enrollment/activate-user',
data: {
token,
Expand Down
5 changes: 1 addition & 4 deletions src/api/ADempiere/field/preference.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Service for backend based on API
// use this service for consume all related to preference of field
import request from '@/utils/request'
import { config } from '@/utils/ADempiere/config'
import { request } from '@/utils/ADempiere/request'

// Update preference from API using criteria
export function setPreference({
Expand All @@ -15,7 +14,6 @@ export function setPreference({
isForCurrentContainer
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/ui/set-preference',
method: 'post',
data: {
Expand All @@ -41,7 +39,6 @@ export function deletePreference({
isForCurrentContainer
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/ui/delete-preference',
method: 'post',
data: {
Expand Down
21 changes: 1 addition & 20 deletions src/api/ADempiere/form/point-of-sales.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Get Instance for connection
import request from '@/utils/request'
import { config } from '@/utils/ADempiere/config'
import { request } from '@/utils/ADempiere/request'

import { isEmptyValue } from '@/utils/ADempiere'

Expand All @@ -16,7 +15,6 @@ export function requestGetPointOfSales({
posUuid
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/pos/get-point-of-sales',
method: 'post',
data: {
Expand All @@ -37,7 +35,6 @@ export function requestListPointOfSales({
pageToken
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/pos/list-point-of-sales',
method: 'post',
data: {
Expand Down Expand Up @@ -69,7 +66,6 @@ export function requestCreateOrder({
salesRepresentativeUuid
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/pos/create-order',
method: 'post',
data: {
Expand All @@ -94,7 +90,6 @@ export function requestUpdateOrder({
description
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/pos/update-order',
method: 'post',
data: {
Expand All @@ -114,7 +109,6 @@ export function requestUpdateOrder({
// Get order from uuid
export function requestGetOrder(orderUuid) {
return request({
baseURL: config.adempiere.api.url,
url: '/pos/get-order',
method: 'post',
data: {
Expand All @@ -137,7 +131,6 @@ export function requestDeleteOrder({
// salesRepresentativeUuid
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/pos/delete-order',
method: 'post',
data: {
Expand Down Expand Up @@ -213,7 +206,6 @@ export function requestListOrders({
*/

return request({
baseURL: config.adempiere.api.url,
url: '/pos/list-orders',
method: 'post',
data: {
Expand Down Expand Up @@ -260,7 +252,6 @@ export function requestCreateOrderLine({
discountRate
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/pos/create-order-line',
method: 'post',
data: {
Expand Down Expand Up @@ -290,7 +281,6 @@ export function requestUpdateOrderLine({
discountRate
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/pos/update-order-line',
method: 'post',
data: {
Expand All @@ -314,7 +304,6 @@ export function requestDeleteOrderLine({
orderLineUuid
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/pos/delete-order-line',
method: 'post',
data: {
Expand All @@ -332,7 +321,6 @@ export function requestListOrderLines({
pageToken
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/pos/list-order-lines',
method: 'post',
data: {
Expand All @@ -358,7 +346,6 @@ export function requestListOrderLines({

export function getKeyLayout({ keyLayoutUuid }) {
return request({
baseURL: config.adempiere.api.url,
url: '/pos/get-key-layout',
method: 'post',
data: {
Expand All @@ -385,7 +372,6 @@ export function getProductPriceList({
pageToken
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/pos/list-product-prices',
method: 'post',
data: {
Expand Down Expand Up @@ -473,7 +459,6 @@ export function createPayment({
currencyUuid
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/pos/create-payment',
method: 'post',
data: {
Expand Down Expand Up @@ -506,7 +491,6 @@ export function updatePayment({
tenderTypeCode
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/pos/update-payment',
method: 'post',
data: {
Expand All @@ -530,7 +514,6 @@ export function deletePayment({
paymentUuid
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/pos/delete-payment',
method: 'post',
data: {
Expand All @@ -549,7 +532,6 @@ export function getPaymentsList({
orderUuid
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/pos/list-payments',
method: 'post',
data: {
Expand Down Expand Up @@ -611,7 +593,6 @@ export function processOrder({
})
}
return request({
baseURL: config.adempiere.api.url,
url: '/pos/process-order',
method: 'post',
data: {
Expand Down
4 changes: 1 addition & 3 deletions src/api/ADempiere/form/price-checking.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Get Instance for connectionimport {
import request from '@/utils/request'
import { config } from '@/utils/ADempiere/config'
import { request } from '@/utils/ADempiere/request'

// List Point of sales
export function requestGetProductPrice({
Expand All @@ -14,7 +13,6 @@ export function requestGetProductPrice({
validFrom
}) {
return request({
baseURL: config.adempiere.api.url,
url: '/pos/get-product-price',
method: 'post',
data: {
Expand Down
Loading

0 comments on commit 2b1d8f7

Please sign in to comment.