@adempiere/grpc-api
Advanced tools
Comparing version 4.2.5 to 4.2.6
{ | ||
"name": "@adempiere/grpc-api", | ||
"version": "4.2.5", | ||
"version": "4.2.6", | ||
"description": "ADempiere Web write in Javascript for a node service", | ||
@@ -5,0 +5,0 @@ "author": "Yamel Senih", |
@@ -5,3 +5,3 @@ // GENERATED CODE -- DO NOT EDIT! | ||
// *********************************************************************************** | ||
// Copyright (C) 2012-2022 E.R.P. Consultores y Asociados, C.A. * | ||
// Copyright (C) 2012-2023 E.R.P. Consultores y Asociados, C.A. * | ||
// Contributor(s): Edwin Betancourt EdwinBetanc0urt@outlook.com * | ||
@@ -46,2 +46,13 @@ // This program is free software: you can redistribute it and/or modify * | ||
function serialize_dashboarding_GetWindowMetricsRequest(arg) { | ||
if (!(arg instanceof proto_dashboarding_pb.GetWindowMetricsRequest)) { | ||
throw new Error('Expected argument of type dashboarding.GetWindowMetricsRequest'); | ||
} | ||
return Buffer.from(arg.serializeBinary()); | ||
} | ||
function deserialize_dashboarding_GetWindowMetricsRequest(buffer_arg) { | ||
return proto_dashboarding_pb.GetWindowMetricsRequest.deserializeBinary(new Uint8Array(buffer_arg)); | ||
} | ||
function serialize_dashboarding_ListDashboardsRequest(arg) { | ||
@@ -135,3 +146,36 @@ if (!(arg instanceof proto_dashboarding_pb.ListDashboardsRequest)) { | ||
function serialize_dashboarding_ListWindowChartsRequest(arg) { | ||
if (!(arg instanceof proto_dashboarding_pb.ListWindowChartsRequest)) { | ||
throw new Error('Expected argument of type dashboarding.ListWindowChartsRequest'); | ||
} | ||
return Buffer.from(arg.serializeBinary()); | ||
} | ||
function deserialize_dashboarding_ListWindowChartsRequest(buffer_arg) { | ||
return proto_dashboarding_pb.ListWindowChartsRequest.deserializeBinary(new Uint8Array(buffer_arg)); | ||
} | ||
function serialize_dashboarding_ListWindowChartsResponse(arg) { | ||
if (!(arg instanceof proto_dashboarding_pb.ListWindowChartsResponse)) { | ||
throw new Error('Expected argument of type dashboarding.ListWindowChartsResponse'); | ||
} | ||
return Buffer.from(arg.serializeBinary()); | ||
} | ||
function deserialize_dashboarding_ListWindowChartsResponse(buffer_arg) { | ||
return proto_dashboarding_pb.ListWindowChartsResponse.deserializeBinary(new Uint8Array(buffer_arg)); | ||
} | ||
function serialize_dashboarding_WindowMetrics(arg) { | ||
if (!(arg instanceof proto_dashboarding_pb.WindowMetrics)) { | ||
throw new Error('Expected argument of type dashboarding.WindowMetrics'); | ||
} | ||
return Buffer.from(arg.serializeBinary()); | ||
} | ||
function deserialize_dashboarding_WindowMetrics(buffer_arg) { | ||
return proto_dashboarding_pb.WindowMetrics.deserializeBinary(new Uint8Array(buffer_arg)); | ||
} | ||
// All related to Dashboarding | ||
@@ -199,4 +243,27 @@ var DashboardingService = exports.DashboardingService = { | ||
}, | ||
// Custom Window Charts | ||
listWindowCharts: { | ||
path: '/dashboarding.Dashboarding/ListWindowCharts', | ||
requestStream: false, | ||
responseStream: false, | ||
requestType: proto_dashboarding_pb.ListWindowChartsRequest, | ||
responseType: proto_dashboarding_pb.ListWindowChartsResponse, | ||
requestSerialize: serialize_dashboarding_ListWindowChartsRequest, | ||
requestDeserialize: deserialize_dashboarding_ListWindowChartsRequest, | ||
responseSerialize: serialize_dashboarding_ListWindowChartsResponse, | ||
responseDeserialize: deserialize_dashboarding_ListWindowChartsResponse, | ||
}, | ||
getWindowMetrics: { | ||
path: '/dashboarding.Dashboarding/GetWindowMetrics', | ||
requestStream: false, | ||
responseStream: false, | ||
requestType: proto_dashboarding_pb.GetWindowMetricsRequest, | ||
responseType: proto_dashboarding_pb.WindowMetrics, | ||
requestSerialize: serialize_dashboarding_GetWindowMetricsRequest, | ||
requestDeserialize: deserialize_dashboarding_GetWindowMetricsRequest, | ||
responseSerialize: serialize_dashboarding_WindowMetrics, | ||
responseDeserialize: deserialize_dashboarding_WindowMetrics, | ||
}, | ||
}; | ||
exports.DashboardingClient = grpc.makeGenericClientConstructor(DashboardingService); |
@@ -18,2 +18,3 @@ /************************************************************************************* | ||
const { getMetadata } = require('@adempiere/grpc-api/src/utils/metadata.js'); | ||
const { isEmptyValue, getValidInteger } = require('@adempiere/grpc-api/src/utils/valueUtils.js'); | ||
@@ -201,5 +202,116 @@ class Dashboarding { | ||
} | ||
/** | ||
* List Window Charts | ||
* @param {string} token Json Web Token | ||
* @param {number} windowId window identifier | ||
* @param {string} windowUuid window uuid | ||
* @param {number} tabId tab identifier | ||
* @param {string} token window uuid | ||
*/ | ||
listWindowCharts({ | ||
token, | ||
windowId, | ||
windowUuid, | ||
tabId, | ||
tabUuid, | ||
searchValue, | ||
pageSize, | ||
pageToken | ||
}, callback) { | ||
const { ListWindowChartsRequest } = this.stubFile; | ||
const request = new ListWindowChartsRequest(); | ||
request.setWindowId( | ||
getValidInteger(windowId) | ||
); | ||
request.setWindowUuid(windowUuid); | ||
request.setTabId( | ||
getValidInteger(tabId) | ||
); | ||
request.setTabUuid(tabUuid); | ||
request.setSearchValue(searchValue); | ||
request.setPageSize(pageSize); | ||
request.setPageToken(pageToken); | ||
const metadata = getMetadata({ | ||
token | ||
}); | ||
this.getDashboardingService().listWindowCharts( | ||
request, | ||
metadata, | ||
callback | ||
); | ||
} | ||
/** | ||
* List Window Charts | ||
* @param {string} token Json Web Token | ||
* @param {number} id chart id | ||
* @param {string} uuid chart uuid | ||
* @param {string} tableName table name | ||
* @param {number} recordId record id | ||
* @param {string} recordUuid record uuid | ||
* @param {Array} contextAttributes context attributes to set | ||
*/ | ||
getWindowMetrics({ | ||
token, | ||
uuid, | ||
id, | ||
tableName, | ||
recordId, | ||
recordUuid, | ||
contextAttributes | ||
}, callback) { | ||
const { GetWindowMetricsRequest } = this.stubFile; | ||
const request = new GetWindowMetricsRequest(); | ||
request.setUuid(uuid); | ||
request.setId( | ||
getValidInteger(id) | ||
); | ||
request.setTableName(tableName); | ||
request.setRecordId( | ||
getValidInteger(recordId) | ||
); | ||
request.setRecordUuid(recordUuid); | ||
if (!isEmptyValue(contextAttributes)) { | ||
const { getTypeOfValue } = require('@adempiere/grpc-api/src/utils/valueUtils.js'); | ||
const { getKeyValueToGRPC } = require('@adempiere/grpc-api/src/utils/baseDataTypeToGRPC.js'); | ||
if (getTypeOfValue(contextAttributes) === 'String') { | ||
contextAttributes = JSON.parse(contextAttributes); | ||
} | ||
contextAttributes.forEach(attribute => { | ||
let parsedAttribute = attribute; | ||
if (getTypeOfValue(attribute) === 'String') { | ||
parsedAttribute = JSON.parse(attribute); | ||
} | ||
request.addContextAttributes( | ||
getKeyValueToGRPC({ | ||
columnName: parsedAttribute.key, | ||
value: parsedAttribute.value | ||
}) | ||
); | ||
}); | ||
} | ||
const metadata = getMetadata({ | ||
token | ||
}); | ||
this.getDashboardingService().getWindowMetrics( | ||
request, | ||
metadata, | ||
callback | ||
); | ||
} | ||
} | ||
module.exports = Dashboarding; |
/************************************************************************************* | ||
* Product: ADempiere gRPC Dashboarding Client Convert Utils * | ||
* Copyright (C) 2012-2020 E.R.P. Consultores y Asociados, C.A. * | ||
* Copyright (C) 2012-2023 E.R.P. Consultores y Asociados, C.A. * | ||
* Contributor(s): Edwin Betancourt EdwinBetanc0urt@outlook.com * | ||
@@ -84,3 +84,3 @@ * This program is free software: you can redistribute it and/or modify * | ||
return { | ||
name: undefined, | ||
name: colorSchema.getName(), | ||
color: colorSchema.getColor(), | ||
@@ -169,2 +169,55 @@ percent: getDecimalFromGRPC( | ||
function getWindowChartFromGRPC(windowChartToConvert) { | ||
if (!windowChartToConvert) { | ||
return undefined; | ||
} | ||
return { | ||
id: windowChartToConvert.getId(), | ||
uuid: windowChartToConvert.getUuid(), | ||
name: windowChartToConvert.getName(), | ||
description: windowChartToConvert.getDescription(), | ||
sequence: windowChartToConvert.getSequence(), | ||
is_collapsible: windowChartToConvert.getIsCollapsible(), | ||
is_open_by_default: windowChartToConvert.getIsOpenByDefault(), | ||
dashboard_type: windowChartToConvert.getDashboardType(), | ||
chart_type: windowChartToConvert.getChartType(), | ||
context_column_names: windowChartToConvert.getContextColumnNamesList().map(columnName => { | ||
return columnName; | ||
}) | ||
}; | ||
} | ||
function getWindowMetricsFromGRPC(windowMetricsToConvert) { | ||
if (!windowMetricsToConvert) { | ||
return undefined; | ||
} | ||
const { | ||
getDecimalFromGRPC | ||
} = require('@adempiere/grpc-api/src/utils/baseDataTypeFromGRPC.js'); | ||
return { | ||
id: windowMetricsToConvert.getId(), | ||
uuid: windowMetricsToConvert.getUuid(), | ||
name: windowMetricsToConvert.getName(), | ||
description: windowMetricsToConvert.getDescription(), | ||
x_axis_label: windowMetricsToConvert.getXAxisLabel(), | ||
y_axis_label: windowMetricsToConvert.getYAxisLabel(), | ||
measure_target: getDecimalFromGRPC( | ||
windowMetricsToConvert.getMeasureTarget() | ||
), | ||
series: windowMetricsToConvert.getSeriesList().map(serie => { | ||
return getChartSerieFromGRPC(serie); | ||
}), | ||
color_schemas: windowMetricsToConvert.getColorSchemasList().map(colorSchema => { | ||
return { | ||
name: colorSchema.getName(), | ||
color: colorSchema.getColor(), | ||
percent: getDecimalFromGRPC( | ||
colorSchema.getPercent() | ||
) | ||
}; | ||
}) | ||
}; | ||
} | ||
module.exports = { | ||
@@ -177,3 +230,5 @@ getAction, | ||
getFavoriteFromGRPC, | ||
getNotificationFromGRPC | ||
getNotificationFromGRPC, | ||
getWindowChartFromGRPC, | ||
getWindowMetricsFromGRPC | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
6100902
173713