Merge branch 'dev' into 7264-itemShelvingRadar
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Guillermo Bonet 2024-05-15 11:54:55 +00:00
commit ac2a0c5151
20 changed files with 111 additions and 16 deletions

1
Jenkinsfile vendored
View File

@ -161,7 +161,6 @@ pipeline {
def packageJson = readJSON file: 'package.json' def packageJson = readJSON file: 'package.json'
env.VERSION = packageJson.version env.VERSION = packageJson.version
} }
echo "BRANCH_NAME: ${env.BRANCH_NAME}"
sh 'gulp build' sh 'gulp build'
sh 'docker-compose build front' sh 'docker-compose build front'
} }

View File

@ -6,6 +6,7 @@ services:
context: front context: front
environment: environment:
- TZ - TZ
- NODE_ENV
ports: ports:
- 80 - 80
deploy: deploy:

View File

@ -4,7 +4,9 @@ ENV TZ Europe/Madrid
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y --no-install-recommends nginx \ && apt-get install -y --no-install-recommends \
nginx \
gettext-base \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
&& ln -sf /dev/stdout /var/log/nginx/access.log \ && ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log && ln -sf /dev/stderr /var/log/nginx/error.log
@ -14,5 +16,7 @@ COPY nginx.conf sites-available/salix
RUN rm sites-enabled/default && ln -s ../sites-available/salix sites-enabled/salix RUN rm sites-enabled/default && ln -s ../sites-available/salix sites-enabled/salix
COPY dist /salix/dist COPY dist /salix/dist
COPY env.template.js /salix/dist
COPY nginx-entrypoint.sh /
CMD ["nginx", "-g", "daemon off;"] ENTRYPOINT [ "sh", "/nginx-entrypoint.sh" ]

3
front/env.template.js Normal file
View File

@ -0,0 +1,3 @@
window.process = {
env: {NODE_ENV: '${NODE_ENV}'}
};

View File

@ -0,0 +1,7 @@
#!/bin/sh
WWW_DIR=/salix/dist
INJECT_FILE_SRC="${WWW_DIR}/env.template.js"
INJECT_FILE_DST="${WWW_DIR}/env.js"
envsubst < "${INJECT_FILE_SRC}" > "${INJECT_FILE_DST}"
[ -z "$@" ] && nginx -g 'daemon off;' || $@

View File

@ -5,6 +5,8 @@
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=no"/> <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=no"/>
<meta name="mobile-web-app-capable" content="yes"/> <meta name="mobile-web-app-capable" content="yes"/>
<link rel="manifest" href="<%= require('./manifest.json') %>"/> <link rel="manifest" href="<%= require('./manifest.json') %>"/>
<script type="text/javascript" src="/env.js">
</script>
<title vn-title translate></title> <title vn-title translate></title>
</head> </head>
<body> <body>

View File

@ -139,6 +139,9 @@ function webpack(done) {
webpack.description = `Transpiles application into files`; webpack.description = `Transpiles application into files`;
function webpackDevServer(done) { function webpackDevServer(done) {
const replace = require('gulp-replace');
const rename = require('gulp-rename');
const webpack = require('webpack'); const webpack = require('webpack');
const merge = require('webpack-merge'); const merge = require('webpack-merge');
const WebpackDevServer = require('webpack-dev-server'); const WebpackDevServer = require('webpack-dev-server');
@ -148,6 +151,12 @@ function webpackDevServer(done) {
let devServer = wpConfig.devServer; let devServer = wpConfig.devServer;
// local env
gulp.src(srcDir + '/env.template.js')
.pipe(replace('${NODE_ENV}', 'development'))
.pipe(rename('env.js'))
.pipe(gulp.dest(buildDir));
for (let entryName in wpConfig.entry) { for (let entryName in wpConfig.entry) {
let entry = wpConfig.entry[entryName]; let entry = wpConfig.entry[entryName];
if (!Array.isArray(entry)) if (!Array.isArray(entry))

View File

@ -40,7 +40,8 @@ module.exports = Self => {
http: { http: {
path: '/:id/client-debt-statement-pdf', path: '/:id/client-debt-statement-pdf',
verb: 'GET' verb: 'GET'
} },
accessScopes: ['DEFAULT', 'read:multimedia']
}); });
Self.clientDebtStatementPdf = (ctx, id) => Self.printReport(ctx, id, 'client-debt-statement'); Self.clientDebtStatementPdf = (ctx, id) => Self.printReport(ctx, id, 'client-debt-statement');

View File

@ -3,6 +3,7 @@ const UserError = require('vn-loopback/util/user-error');
module.exports = function(Self) { module.exports = function(Self) {
Self.remoteMethodCtx('createReceipt', { Self.remoteMethodCtx('createReceipt', {
description: 'Creates receipt and its compensation if necessary', description: 'Creates receipt and its compensation if necessary',
accessType: 'READ',
accepts: [{ accepts: [{
arg: 'clientFk', arg: 'clientFk',
type: 'number', type: 'number',
@ -45,7 +46,8 @@ module.exports = function(Self) {
http: { http: {
verb: 'post', verb: 'post',
path: '/:clientFk/createReceipt' path: '/:clientFk/createReceipt'
} },
accessScopes: ['DEFAULT', 'read:multimedia']
}); });
Self.createReceipt = async(ctx, options) => { Self.createReceipt = async(ctx, options) => {

View File

@ -35,7 +35,8 @@ module.exports = Self => {
http: { http: {
path: '/:id/credit-request-pdf', path: '/:id/credit-request-pdf',
verb: 'GET' verb: 'GET'
} },
accessScopes: ['DEFAULT', 'read:multimedia']
}); });
Self.creditRequestPdf = (ctx, id) => Self.printReport(ctx, id, 'credit-request'); Self.creditRequestPdf = (ctx, id) => Self.printReport(ctx, id, 'credit-request');

View File

@ -47,7 +47,8 @@ module.exports = Self => {
http: { http: {
path: '/:id/incoterms-authorization-pdf', path: '/:id/incoterms-authorization-pdf',
verb: 'GET' verb: 'GET'
} },
accessScopes: ['DEFAULT', 'read:multimedia']
}); });
Self.incotermsAuthorizationPdf = (ctx, id) => Self.printReport(ctx, id, 'incoterms-authorization'); Self.incotermsAuthorizationPdf = (ctx, id) => Self.printReport(ctx, id, 'incoterms-authorization');

View File

@ -41,7 +41,8 @@ module.exports = Self => {
http: { http: {
path: '/:id/letter-debtor-pdf', path: '/:id/letter-debtor-pdf',
verb: 'GET' verb: 'GET'
} },
accessScopes: ['DEFAULT', 'read:multimedia']
}); });
Self.letterDebtorPdf = (ctx, id) => Self.printReport(ctx, id, 'letter-debtor'); Self.letterDebtorPdf = (ctx, id) => Self.printReport(ctx, id, 'letter-debtor');

View File

@ -29,7 +29,8 @@ module.exports = Self => {
http: { http: {
path: '/:id/balance-compensation-pdf', path: '/:id/balance-compensation-pdf',
verb: 'GET' verb: 'GET'
} },
accessScopes: ['DEFAULT', 'read:multimedia']
}); });
Self.balanceCompensationPdf = (ctx, id) => Self.printReport(ctx, id, 'balance-compensation'); Self.balanceCompensationPdf = (ctx, id) => Self.printReport(ctx, id, 'balance-compensation');

View File

@ -34,7 +34,8 @@ module.exports = Self => {
http: { http: {
path: '/:id/receipt-pdf', path: '/:id/receipt-pdf',
verb: 'GET' verb: 'GET'
} },
accessScopes: ['DEFAULT', 'read:multimedia']
}); });
Self.receiptPdf = (ctx, id) => Self.printReport(ctx, id, 'receipt'); Self.receiptPdf = (ctx, id) => Self.printReport(ctx, id, 'receipt');

View File

@ -31,7 +31,8 @@ module.exports = Self => {
http: { http: {
path: '/:reference/invoice-out-pdf', path: '/:reference/invoice-out-pdf',
verb: 'GET' verb: 'GET'
} },
accessScopes: ['DEFAULT', 'read:multimedia']
}); });
Self.invoiceOutPdf = async(ctx, reference) => { Self.invoiceOutPdf = async(ctx, reference) => {

View File

@ -51,7 +51,8 @@ module.exports = Self => {
http: { http: {
path: '/:id/label-pdf', path: '/:id/label-pdf',
verb: 'GET' verb: 'GET'
} },
accessScopes: ['DEFAULT', 'read:multimedia']
}); });
Self.labelPdf = (ctx, id) => Self.printReport(ctx, id, 'item-label'); Self.labelPdf = (ctx, id) => Self.printReport(ctx, id, 'item-label');

View File

@ -28,7 +28,8 @@ module.exports = Self => {
http: { http: {
path: `/:id/docuwareDownload`, path: `/:id/docuwareDownload`,
verb: 'GET' verb: 'GET'
} },
accessScopes: ['DEFAULT', 'read:multimedia']
}); });
Self.docuwareDownload = async id => { Self.docuwareDownload = async id => {

View File

@ -82,6 +82,8 @@
"gulp-print": "^2.0.1", "gulp-print": "^2.0.1",
"gulp-wrap": "^0.15.0", "gulp-wrap": "^0.15.0",
"gulp-yaml": "^1.0.1", "gulp-yaml": "^1.0.1",
"gulp-rename": "^2.0.0",
"gulp-replace": "^1.1.4",
"html-loader": "^0.4.5", "html-loader": "^0.4.5",
"html-loader-jest": "^0.2.1", "html-loader-jest": "^0.2.1",
"html-webpack-plugin": "^5.5.1", "html-webpack-plugin": "^5.5.1",

View File

@ -202,6 +202,12 @@ devDependencies:
gulp-print: gulp-print:
specifier: ^2.0.1 specifier: ^2.0.1
version: 2.0.1 version: 2.0.1
gulp-rename:
specifier: ^2.0.0
version: 2.0.0
gulp-replace:
specifier: ^1.1.4
version: 1.1.4
gulp-wrap: gulp-wrap:
specifier: ^0.15.0 specifier: ^0.15.0
version: 0.15.0(ejs@2.3.1) version: 0.15.0(ejs@2.3.1)
@ -2632,6 +2638,10 @@ packages:
resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==}
dev: true dev: true
/@types/expect@1.20.4:
resolution: {integrity: sha512-Q5Vn3yjTDyCMV50TB6VRIbQNxSE4OmZR86VSbGaNpfUolm0iePBB4KdEEHmxoY5sT2+2DIvXW0rvMDP2nHZ4Mg==}
dev: true
/@types/express-serve-static-core@4.17.42: /@types/express-serve-static-core@4.17.42:
resolution: {integrity: sha512-ckM3jm2bf/MfB3+spLPWYPUH573plBFwpOhqQ2WottxYV85j1HQFlxmnTq57X1yHY9awZPig06hL/cLMgNWHIQ==} resolution: {integrity: sha512-ckM3jm2bf/MfB3+spLPWYPUH573plBFwpOhqQ2WottxYV85j1HQFlxmnTq57X1yHY9awZPig06hL/cLMgNWHIQ==}
dependencies: dependencies:
@ -2790,6 +2800,13 @@ packages:
resolution: {integrity: sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==} resolution: {integrity: sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==}
dev: false dev: false
/@types/vinyl@2.0.12:
resolution: {integrity: sha512-Sr2fYMBUVGYq8kj3UthXFAu5UN6ZW+rYr4NACjZQJvHvj+c8lYv0CahmZ2P/r7iUkN44gGUBwqxZkrKXYPb7cw==}
dependencies:
'@types/expect': 1.20.4
'@types/node': 20.11.16
dev: true
/@types/yargs-parser@21.0.3: /@types/yargs-parser@21.0.3:
resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==} resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==}
dev: true dev: true
@ -3770,6 +3787,11 @@ packages:
engines: {node: '>=8'} engines: {node: '>=8'}
dev: true dev: true
/binaryextensions@2.3.0:
resolution: {integrity: sha512-nAihlQsYGyc5Bwq6+EsubvANYGExeJKHDO3RjnvwU042fawQTQfM3Kxn7IHUXQOz4bzfwsGYYHGSvXyW4zOGLg==}
engines: {node: '>=0.8'}
dev: true
/bindings@1.5.0: /bindings@1.5.0:
resolution: {integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==} resolution: {integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==}
requiresBuild: true requiresBuild: true
@ -7090,6 +7112,22 @@ packages:
map-stream: 0.0.7 map-stream: 0.0.7
dev: true dev: true
/gulp-rename@2.0.0:
resolution: {integrity: sha512-97Vba4KBzbYmR5VBs9mWmK+HwIf5mj+/zioxfZhOKeXtx5ZjBk57KFlePf5nxq9QsTtFl0ejnHE3zTC9MHXqyQ==}
engines: {node: '>=4'}
dev: true
/gulp-replace@1.1.4:
resolution: {integrity: sha512-SVSF7ikuWKhpAW4l4wapAqPPSToJoiNKsbDoUnRrSgwZHH7lH8pbPeQj1aOVYQrbZKhfSVBxVW+Py7vtulRktw==}
engines: {node: '>=10'}
dependencies:
'@types/node': 20.11.16
'@types/vinyl': 2.0.12
istextorbinary: 3.3.0
replacestream: 4.0.3
yargs-parser: 21.1.1
dev: true
/gulp-util@3.0.8: /gulp-util@3.0.8:
resolution: {integrity: sha512-q5oWPc12lwSFS9h/4VIjG+1NuNDlJ48ywV2JKItY4Ycc/n1fXJeYPVQsfu5ZrhQi7FGSDBalwUCLar/GyHXKGw==} resolution: {integrity: sha512-q5oWPc12lwSFS9h/4VIjG+1NuNDlJ48ywV2JKItY4Ycc/n1fXJeYPVQsfu5ZrhQi7FGSDBalwUCLar/GyHXKGw==}
engines: {node: '>=0.10'} engines: {node: '>=0.10'}
@ -8324,6 +8362,14 @@ packages:
istanbul-lib-report: 3.0.1 istanbul-lib-report: 3.0.1
dev: true dev: true
/istextorbinary@3.3.0:
resolution: {integrity: sha512-Tvq1W6NAcZeJ8op+Hq7tdZ434rqnMx4CCZ7H0ff83uEloDvVbqAwaMTZcafKGJT0VHkYzuXUiCY4hlXQg6WfoQ==}
engines: {node: '>=8'}
dependencies:
binaryextensions: 2.3.0
textextensions: 3.3.0
dev: true
/jackspeak@2.3.6: /jackspeak@2.3.6:
resolution: {integrity: sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==} resolution: {integrity: sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==}
engines: {node: '>=14'} engines: {node: '>=14'}
@ -12065,6 +12111,14 @@ packages:
remove-trailing-separator: 1.1.0 remove-trailing-separator: 1.1.0
dev: true dev: true
/replacestream@4.0.3:
resolution: {integrity: sha512-AC0FiLS352pBBiZhd4VXB1Ab/lh0lEgpP+GGvZqbQh8a5cmXVoTe5EX/YeTFArnp4SRGTHh1qCHu9lGs1qG8sA==}
dependencies:
escape-string-regexp: 1.0.5
object-assign: 4.1.1
readable-stream: 2.3.8
dev: true
/request@2.88.2: /request@2.88.2:
resolution: {integrity: sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==} resolution: {integrity: sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==}
engines: {node: '>= 6'} engines: {node: '>= 6'}
@ -13563,6 +13617,11 @@ packages:
resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==}
dev: true dev: true
/textextensions@3.3.0:
resolution: {integrity: sha512-mk82dS8eRABNbeVJrEiN5/UMSCliINAuz8mkUwH4SwslkNP//gbEzlWNS5au0z5Dpx40SQxzqZevZkn+WYJ9Dw==}
engines: {node: '>=8'}
dev: true
/throat@5.0.0: /throat@5.0.0:
resolution: {integrity: sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA==} resolution: {integrity: sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA==}
dev: true dev: true

View File

@ -70,6 +70,7 @@ let baseConfig = {
] ]
}, },
optimization: { optimization: {
nodeEnv: false,
runtimeChunk: true, runtimeChunk: true,
splitChunks: { splitChunks: {
chunks: 'all', chunks: 'all',
@ -99,9 +100,6 @@ let baseConfig = {
filename: 'index.html', filename: 'index.html',
chunks: ['salix'] chunks: ['salix']
}), }),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(env)
})
], ],
devtool: 'source-map', devtool: 'source-map',
stats: { stats: {