Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

Commit

Permalink
feat: Persistent front show/hidden fields. (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwinBetanc0urt authored Aug 29, 2023
1 parent 042507b commit 1f7c62a
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 25 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"license": "MIT",
"dependencies": {
"@2fd/graphdoc": "^2.4.0",
"@adempiere/grpc-api": "4.9.6",
"@adempiere/grpc-api": "4.9.7",
"@adempiere/grpc-web-store-api": "1.5.7",
"@elastic/elasticsearch": "7.14.0",
"@google-cloud/storage": "^3.0.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/************************************************************************************
* Copyright (C) 2012-2023 E.R.P. Consultores y Asociados, C.A. *
* Copyright (C) 2018-present E.R.P. Consultores y Asociados, C.A. *
* Contributor(s): Edwin Betancourt EdwinBetanc0urt@outlook.com *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
Expand All @@ -14,8 +14,9 @@
************************************************************************************/

import { Router } from 'express';
import { ExtensionAPIFunctionParameter } from '@storefront-api/lib/module';

module.exports = ({ config }) => {
module.exports = ({ config }: ExtensionAPIFunctionParameter) => {
const api = Router();
const ServiceApi = require('@adempiere/grpc-api/src/services/userCustomization');
const service = new ServiceApi(config);
Expand All @@ -25,7 +26,7 @@ module.exports = ({ config }) => {
*
* @param {string} token - user token
* @param {string} browseUuid - browse uuid
* @param {number} level - asp level to apply (user/role/client)
* @param {number} level_type - asp level to apply (user/role/client)
* @param {number} level_id - value of level
* @param {string} level_uuid - value of level
* @param {array} field_attributes - attributes to set
Expand All @@ -40,7 +41,7 @@ module.exports = ({ config }) => {
token: req.headers.authorization,
//
browseUuid: req.body.browse_uuid,
level: req.body.level,
levelType: req.body.level_type,
levelId: req.body.level_id,
levelUuid: req.body.level_uuid,
fieldAttributes: req.body.field_attributes
Expand All @@ -60,5 +61,5 @@ module.exports = ({ config }) => {
}
});

return api
return api;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/************************************************************************************
* Copyright (C) 2012-2022 E.R.P. Consultores y Asociados, C.A. *
* Copyright (C) 2018-present E.R.P. Consultores y Asociados, C.A. *
* Contributor(s): Edwin Betancourt EdwinBetanc0urt@outlook.com *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
Expand All @@ -14,13 +14,15 @@
************************************************************************************/

import { Router } from 'express';
import { ExtensionAPIFunctionParameter } from '@storefront-api/lib/module';

import {
getUserFromGRPC,
getRoleFromGRPC,
getLevelCustomizationFromGRPC
getCustomizationLevelFromGRPC
} from '@adempiere/grpc-api/src/utils/userCustomizationFromGRPC';

module.exports = ({ config }) => {
module.exports = ({ config }: ExtensionAPIFunctionParameter) => {
const api = Router();
const ServiceApi = require('@adempiere/grpc-api/src/services/userCustomization');
const service = new ServiceApi(config);
Expand Down Expand Up @@ -97,7 +99,7 @@ module.exports = ({ config }) => {
result: err.details
});
}
})
});
}
});

Expand All @@ -124,8 +126,8 @@ module.exports = ({ config }) => {
result: {
record_count: response.getRecordCount(),
next_page_token: response.getNextPageToken(),
records: response.getRecordsList().map(user => {
return getLevelCustomizationFromGRPC(user)
records: response.getRecordsList().map(customizationLevel => {
return getCustomizationLevelFromGRPC(customizationLevel);
})
}
});
Expand All @@ -139,5 +141,5 @@ module.exports = ({ config }) => {
}
});

return api
return api;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/************************************************************************************
* Copyright (C) 2012-2023 E.R.P. Consultores y Asociados, C.A. *
* Copyright (C) 2018-present E.R.P. Consultores y Asociados, C.A. *
* Contributor(s): Edwin Betancourt EdwinBetanc0urt@outlook.com *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
Expand All @@ -14,8 +14,9 @@
************************************************************************************/

import { Router } from 'express';
import { ExtensionAPIFunctionParameter } from '@storefront-api/lib/module';

module.exports = ({ config }) => {
module.exports = ({ config }: ExtensionAPIFunctionParameter) => {
const api = Router();
const ServiceApi = require('@adempiere/grpc-api/src/services/userCustomization');
const service = new ServiceApi(config);
Expand Down Expand Up @@ -60,5 +61,5 @@ module.exports = ({ config }) => {
}
});

return api
return api;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/************************************************************************************
* Copyright (C) 2012-2022 E.R.P. Consultores y Asociados, C.A. *
* Copyright (C) 2018-present E.R.P. Consultores y Asociados, C.A. *
* Contributor(s): Edwin Betancourt EdwinBetanc0urt@outlook.com *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
Expand All @@ -14,8 +14,9 @@
************************************************************************************/

import { Router } from 'express';
import { ExtensionAPIFunctionParameter } from '@storefront-api/lib/module';

module.exports = ({ config }) => {
module.exports = ({ config }: ExtensionAPIFunctionParameter) => {
const api = Router();
const ServiceApi = require('@adempiere/grpc-api/src/services/userCustomization');
const service = new ServiceApi(config);
Expand Down Expand Up @@ -60,5 +61,5 @@ module.exports = ({ config }) => {
}
});

return api
return api;
}
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export function getProcessFromGRPC (process) {
// Convert field
export function getFiledFromGRPC (fieldToConvert) {
if (!fieldToConvert) {
return undefined
return undefined;
}
return {
id: fieldToConvert.getId(),
Expand Down Expand Up @@ -223,6 +223,8 @@ export function getFiledFromGRPC (fieldToConvert) {
is_always_updateable: fieldToConvert.getIsAlwaysUpdateable(),
is_translated: fieldToConvert.getIsTranslated(),
identifier_sequence: fieldToConvert.getIdentifierSequence(),
is_displayed_as_panel: fieldToConvert.getIsDisplayedAsPanel(),
is_displayed_as_table: fieldToConvert.getIsDisplayedAsTable(),
display_logic: fieldToConvert.getDisplayLogic(),
display_type: fieldToConvert.getDisplayType(),
default_value: fieldToConvert.getDefaultValue(),
Expand Down Expand Up @@ -262,5 +264,5 @@ export function getFiledFromGRPC (fieldToConvert) {
dependent_fields: fieldToConvert.getDependentFieldsList().map(dependentField => {
return getDependentFieldFromGRPC(dependentField);
})
}
};
}
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@4.9.6":
version "4.9.6"
resolved "https://registry.yarnpkg.com/@adempiere/grpc-api/-/grpc-api-4.9.6.tgz#bd7b082ffb9b216a05a2ed3479feb4d9de6e6cfc"
integrity sha512-EyclT4BtS+Ts4XhDH9reoXZZX728qd8PlovJln2q4PnhUr225gEMjUzn7BWJRTeFJs91R6Rq0J7VAr/f0AagZw==
"@adempiere/grpc-api@4.9.7":
version "4.9.7"
resolved "https://registry.yarnpkg.com/@adempiere/grpc-api/-/grpc-api-4.9.7.tgz#31c9ce19b646eb2f01627e4e0e627ded7bfcca41"
integrity sha512-Nctv79FzhcdEmhU7yN89nVppzbocoDA04kpKFbscdLjlc8dxRlRYKP415HAEKfksLMrC3nR02YFF8kviZn72WA==
dependencies:
"@grpc/grpc-js" "1.8.18"
google-protobuf "3.21.2"
Expand Down

0 comments on commit 1f7c62a

Please sign in to comment.