Skip to content
This repository was archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
Add support to chart service for dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
yamelsenih committed Jun 22, 2021
1 parent 8f38409 commit 5598e05
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 5 deletions.
1 change: 1 addition & 0 deletions config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@
"adempiere/dashboard",
"adempiere/dashboard/addons/user",
"adempiere/dashboard/addons/tasks",
"adempiere/dashboard/addons/charts",
"adempiere/user",
"adempiere/user/enrollment",
"adempiere/user/log",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@storefront-api/platform-abstract": "1.0.0-rc.3",
"@storefront-api/platform-magento1": "1.0.0-rc.3",
"@storefront-api/platform-magento2": "1.0.0-rc.3",
"@adempiere/grpc-api": "1.5.9",
"@adempiere/grpc-api": "1.6.0",
"@adempiere/grpc-web-store-api": "1.4.1",
"ajv": "^6.4.0",
"ajv-keywords": "^3.4.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { Router } from 'express';
import {
convertChartFromGRPC
} from '@adempiere/grpc-api/lib/convertBusinessData';

module.exports = ({ config, db }) => {
let api = Router();
const ServiceApi = require('@adempiere/grpc-api')
let service = new ServiceApi(config)
service.initService()

/**
* GET Chart Data
*
* req.query.token - user token
* req.query.language - login language
* req.query.uuid - uuid of chart
* req.query.id - id of chart
* Details:
*/
api.get('/metrics', (req, res) => {
if (req.query) {
service.getChart({
token: req.query.token,
language: req.query.language,
uuid: req.query.uuid,
id: req.query.id
}, function (err, response) {
if (response) {
res.json({
code: 200,
result: convertChartFromGRPC(response)
})
} else if (err) {
res.json({
code: 500,
result: err.details
})
}
})
}
});

return api
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
striptags "^3.0.1"
word-wrap "^1.2.1"

"@adempiere/grpc-api@1.5.0":
version "1.5.0"
resolved "https://registry.yarnpkg.com/@adempiere/grpc-api/-/grpc-api-1.5.0.tgz#0e7f9f17893250fea58caad38bdf02f181fb9e27"
integrity sha512-6MlWTp3Wbn27fG5AOtq9t3wDfZaHuj1rXl8hfuedlr+vT+zLe3xVsHhNWwQLwgDoFKwcE/XZXum4hcV2PjJmnw==
"@adempiere/grpc-api@1.6.0":
version "1.6.0"
resolved "https://registry.yarnpkg.com/@adempiere/grpc-api/-/grpc-api-1.6.0.tgz#98742d5e71856868fb909f1a67ebba6febb04789"
integrity sha512-v/Eq7hP+fhZlurVBegHcg1kIpnZOaoHhBvHthUsDnqtVTgqL3AiZbbEOpK0z7wFoy8joggFD6u3Ayp/Dy7VWyg==
dependencies:
"@grpc/grpc-js" "^1.2.12"
google-protobuf "^3.15.6"
Expand Down

0 comments on commit 5598e05

Please sign in to comment.