0
1
Fork 0

Merge branch 'dev' into 6492-replaceProcedure

This commit is contained in:
Jorge Penadés 2024-04-10 10:36:06 +00:00
commit 17243878f9
24 changed files with 71 additions and 115 deletions

53
Jenkinsfile vendored
View File

@ -1,5 +1,27 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
def BRANCH_ENV = [
test: 'test',
master: 'production'
]
node {
stage('Setup') {
env.MAIN_REPLICAS = 1
env.CRON_REPLICAS = 0
env.NODE_ENV = BRANCH_ENV[env.BRANCH_NAME] ?: 'dev'
switch (env.BRANCH_NAME) {
case 'master':
env.MAIN_REPLICAS = 3
env.CRON_REPLICAS = 1
break
}
echo "NODE_NAME: ${env.NODE_NAME}"
echo "WORKSPACE: ${env.WORKSPACE}"
}
}
pipeline { pipeline {
agent any agent any
environment { environment {
@ -7,28 +29,6 @@ pipeline {
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}" STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
} }
stages { stages {
stage('Checkout') {
steps {
script {
def packageJson = readJSON file: 'package.json'
env.VERSION = packageJson.version
switch (env.BRANCH_NAME) {
case 'master':
env.NODE_ENV = 'production'
env.MAIN_REPLICAS = 3
env.CRON_REPLICAS = 1
break
case 'test':
env.NODE_ENV = 'test'
env.MAIN_REPLICAS = 1
env.CRON_REPLICAS = 0
break
}
}
setEnv()
}
}
stage('Debuild') { stage('Debuild') {
when { when {
anyOf { anyOf {
@ -60,6 +60,10 @@ pipeline {
CREDS = credentials('docker-registry') CREDS = credentials('docker-registry')
} }
steps { steps {
script {
def packageJson = readJSON file: 'package.json'
env.VERSION = packageJson.version
}
sh 'docker login --username $CREDS_USR --password $CREDS_PSW $REGISTRY' sh 'docker login --username $CREDS_USR --password $CREDS_PSW $REGISTRY'
sh 'docker-compose build --build-arg BUILD_ID=$BUILD_ID --parallel' sh 'docker-compose build --build-arg BUILD_ID=$BUILD_ID --parallel'
sh 'docker-compose push' sh 'docker-compose push'
@ -76,12 +80,17 @@ pipeline {
DOCKER_HOST = "${env.SWARM_HOST}" DOCKER_HOST = "${env.SWARM_HOST}"
} }
steps { steps {
script {
def packageJson = readJSON file: 'package.json'
env.VERSION = packageJson.version
}
sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.STACK_NAME}" sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.STACK_NAME}"
} }
} }
} }
post { post {
unsuccessful { unsuccessful {
setEnv()
sendEmail() sendEmail()
} }
} }

View File

@ -1,36 +1,55 @@
# Hedera # Hedera
Hedera is the main web page for Verdnatura. Hedera is the main web shop page for Verdnatura.
## Getting Started ## Prerequisites
Required dependencies. Required applications.
* PHP >= 7.0 * PHP >= 7.0
* Node.js >= 8.0 * Node.js >= 8.0
* [php-vn-lib](https://gitea.verdnatura.es/verdnatura/php-vn-lib)
### Web application ### Installing dependencies and launching
Launch fronted. Pull from repository.
Run this commands on project root directory to install Node dependencies.
``` ```
npm run front $ npm install
``` ```
Launch backend. Install project dependences (debian/control).
Pull from repository [php-vn-lib](https://gitea.verdnatura.es/verdnatura/php-vn-lib) and install [dependences](https://gitea.verdnatura.es/verdnatura/php-vn-lib/src/branch/master/debian/control) of this project.
Configure config.php file.
Launch project fronted.
``` ```
npm run db $ npm run front
npm run back ```
php -S 127.0.0.1:3001 -t . index.php
Launch salix backend.
```
$ npm run db
$ npm run back
```
Launch project backend.
```
$ php -S 127.0.0.1:3001 -t . index.php
``` ```
### Command line ### Command line
Run server side method from command line. Run server side method from command line.
``` ```
php hedera-web.php -m method_path $ php hedera-web.php -m method_path
``` ```
## Built with ## Built with
* [nodejs](https://nodejs.org/)
* [php](https://www.php.net/)
* [Webpack](https://webpack.js.org/) * [Webpack](https://webpack.js.org/)
* [MooTools](https://mootools.net/) * [MooTools](https://mootools.net/)
* [TinyMCE](https://www.tinymce.com/) * [TinyMCE](https://www.tinymce.com/)

View File

@ -12,6 +12,8 @@
* *
* - http://www.mydomain.org -> config.www.php * - http://www.mydomain.org -> config.www.php
* - http://test.mydomain.org -> config.test.php * - http://test.mydomain.org -> config.test.php
*
* Put the password in base64.
*/ */
return [ return [
/** /**

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (23.40.6) stable; urgency=low hedera-web (24.8.2) stable; urgency=low
* Initial Release. * Initial Release.

View File

@ -1,7 +1,7 @@
version: '3.7' version: '3.7'
services: services:
main: main:
image: registry.verdnatura.es/hedera-web:${BRANCH_NAME:?} image: registry.verdnatura.es/hedera-web:${VERSION:?}
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
@ -25,7 +25,7 @@ services:
limits: limits:
memory: 2G memory: 2G
cron: cron:
image: registry.verdnatura.es/hedera-web:${BRANCH_NAME:?} image: registry.verdnatura.es/hedera-web:${VERSION:?}
command: 'cron -f' command: 'cron -f'
configs: configs:
- source: config - source: config

View File

@ -3,12 +3,5 @@ import './style.scss';
export default new Class({ export default new Class({
Extends: Hedera.Form, Extends: Hedera.Form,
Template: require('./ui.xml'), Template: require('./ui.xml'),
onShowClick(column, agencyId) {
this.hash.setAll({
form: 'agencies/provinces',
agency: agencyId
});
}
}); });

View File

@ -1,5 +1,4 @@
ListByAgency: Paquets per agència ListByAgency: Paquets per agència
ShowByProvince: Mostrar desglose per província
Agency: Agència Agency: Agència
Exps: Exps. Exps: Exps.
Bundles: Paquets Bundles: Paquets

View File

@ -1,5 +1,4 @@
ListByAgency: Bundles by agency ListByAgency: Bundles by agency
ShowByProvince: Show breakdown by province
Agency: Agency Agency: Agency
Exps: Exps. Exps: Exps.
Bundles: Bundles Bundles: Bundles

View File

@ -1,5 +1,4 @@
ListByAgency: Bultos por agencia ListByAgency: Bultos por agencia
ShowByProvince: Mostrar desglose por provincia
Agency: Agencia Agency: Agencia
Exps: Exps. Exps: Exps.
Bundles: Bultos Bundles: Bultos

View File

@ -1,5 +1,4 @@
ListByAgency: Liste par agence ListByAgency: Liste par agence
ShowByProvince: Montrer par province
Agency: Agence Agency: Agence
Exps: Expéditeur Exps: Expéditeur
Bundles: Cartons Bundles: Cartons

View File

@ -1,5 +1,4 @@
ListByAgency: Bultos por agencia ListByAgency: Bultos por agencia
ShowByProvince: Mostrar desglosse por Distrito
Agency: Agencia Agency: Agencia
Exps: Exps. Exps: Exps.
Bundles: Bultos Bundles: Bultos

View File

@ -10,11 +10,6 @@
CALL vn.agencyVolume() CALL vn.agencyVolume()
</custom> </custom>
</db-model> </db-model>
<htk-column-button
column="agency_id"
icon="search"
tip="_ShowByProvince"
on-clicked="onShowClick"/>
<htk-column-text title="_Agency" column="Agencia"/> <htk-column-text title="_Agency" column="Agencia"/>
<htk-column-spin title="_Exps" column="expediciones"/> <htk-column-spin title="_Exps" column="expediciones"/>
<htk-column-spin title="_Bundles" column="Bultos"/> <htk-column-spin title="_Bundles" column="Bultos"/>

View File

@ -1,7 +0,0 @@
import './style.scss';
export default new Class({
Extends: Hedera.Form,
Template: require('./ui.xml')
});

View File

@ -1,6 +0,0 @@
ByProvince: Desglose per província
Return: Tornar
SelectAgency: Selecciona una agència al llistat de l'esquerra
Province: Província
Expeditions: Exps.
Left: Falten

View File

@ -1,6 +0,0 @@
ByProvince: Breakdown by province
Return: Return
SelectAgency: Select an agency
Province: Province
Expeditions: Exps.
Left: Left

View File

@ -1,6 +0,0 @@
ByProvince: Desglose por provincia
Return: Volver
SelectAgency: Selecciona una agencia
Province: Provincia
Expeditions: Exps.
Left: Faltan

View File

@ -1,6 +0,0 @@
ByProvince: Par province
Return: Retour
SelectAgency: Sélectionnez une agence
Province: Province
Expeditions: Expéditions
Left: Restant

View File

@ -1,6 +0,0 @@
ByProvince: Desglosse por Distritos
Return: Voltar
SelectAgency: Seleccione uma agência
Province: Distrito
Expeditions: Exps.
Left: Faltam

View File

@ -1,18 +0,0 @@
<vn>
<div id="title">
<h1><t>ByProvince</t></h1>
</div>
<div id="form" class="provinces vn-w-sm">
<div class="box">
<htk-grid>
<db-model property="model" lot="hash">
CALL vn2008.desglose_volume(#agency)
</db-model>
<htk-column-text title="_Province" column="Provincia"/>
<htk-column-spin title="_Expeditions" column="expediciones"/>
<htk-column-spin title="_Bundles" column="Bultos"/>
<htk-column-spin title="_Left" column="Prevision"/>
</htk-grid>
</div>
</div>
</vn>

View File

@ -40,9 +40,7 @@ export const routes = {
}, },
agencies: { agencies: {
packages: packages:
() => import('agencies/packages'), () => import('agencies/packages')
provinces:
() => import('agencies/provinces')
}, },
cms: { cms: {
about: about:

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "hedera-web", "name": "hedera-web",
"version": "24.8.0", "version": "24.8.1",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "hedera-web", "name": "hedera-web",
"version": "24.8.0", "version": "24.8.1",
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"js-yaml": "^3.12.1", "js-yaml": "^3.12.1",

View File

@ -1,6 +1,6 @@
{ {
"name": "hedera-web", "name": "hedera-web",
"version": "24.8.0", "version": "24.8.2",
"description": "Verdnatura web page", "description": "Verdnatura web page",
"license": "GPL-3.0", "license": "GPL-3.0",
"repository": { "repository": {

View File

@ -18,7 +18,7 @@ class Segment {
switch ($type) { switch ($type) {
case Type::DATE: case Type::DATE:
$tmp = Date.vnNew(); $tmp = new Date();
$tmp->setDate(substr($v, 0, 4), substr($v, 4, 2), substr($v, 6, 2)); $tmp->setDate(substr($v, 0, 4), substr($v, 4, 2), substr($v, 6, 2));
return $tmp; return $tmp;
case Type::TIME: case Type::TIME: