Commit cb48562f authored by Lucas Détré's avatar Lucas Détré 😺
Browse files

Merge branch 'vue-editor' of ssh://git.beta.pole-emploi.fr:23/open-source/trefle into new-simulator

parents add43a81 3151172b
......@@ -17,6 +17,7 @@ test:
only:
- branches
- master
- /^api-v[0-9.ab]+$/
except:
- /^WIP-.*$/
......
# Changelog
## 0.8.0
- new explorer in VueJS with iso fonctionalty with old one
- new explorer: possibility to modifiy rules
- api: new authentification endpoint, be authentify to process rules modification
- api: new remuneration endpoint /remuneration
- api: new source code endpoint, possibility to interact with gitlab to modifiy rules
- api: new certifinfo endpoint, to get label of one or more certifinfo
- api: new healthcheck endpoint
- change repo from framagit to gitlab PE
## 0.7.0
- switch to LBF json catalog instead of Intercarif XML
......
......@@ -70,14 +70,15 @@ Get a more detailed coverage report:
2. Add this env var:
```
VERSION api-vX.X.X
OLD_VERSION api-vX.X.X
BACK_VERSION backoffice-vX.X.X
LBF_CHARMAP "sA,4B,RC,cD,oE,gF,yG,wH,mI,HJ,7K,EL,aM,YN,XO,8P,GQ,BR,kS,iT,IU,AV,TW,DX,pY,JZ,2a,Lb,Mc, d,de,Cf,Qg,fh,ri,Pj,Nk,Vl,vm,0n,Ko,ep,jq,Zr,9s,ht,Fu,tv,-w,Ux,1y,xz,30,u1,52,q3,W4,S5,66,n7,b8,O9,_+,l/,z "
CATALOG_USER {ASK-YOUR-LBF-CATALOG-API-USER}
CATALOG_KEY {ASK-YOUR-LBF-CATALOG-API-KEY}
CATALOG_URL https://labonneformation.pole-emploi.fr/api/v1/detail
TREFLE_GIT https://git.beta.pole-emploi.fr/open-source/trefle.git
VERSION=api-vX.X.X
OLD_VERSION=api-vX.X.X
BACK_VERSION=backoffice-vX.X.X
LBF_CHARMAP="sA,4B,RC,cD,oE,gF,yG,wH,mI,HJ,7K,EL,aM,YN,XO,8P,GQ,BR,kS,iT,IU,AV,TW,DX,pY,JZ,2a,Lb,Mc, d,de,Cf,Qg,fh,ri,Pj,Nk,Vl,vm,0n,Ko,ep,jq,Zr,9s,ht,Fu,tv,-w,Ux,1y,xz,30,u1,52,q3,W4,S5,66,n7,b8,O9,_+,l/,z "
CATALOG_USER={ASK-YOUR-LBF-CATALOG-API-USER}
CATALOG_KEY={ASK-YOUR-LBF-CATALOG-API-KEY}
CATALOG_URL=https://labonneformation.pole-emploi.fr/api/v1/detail
TREFLE_GIT=https://git.beta.pole-emploi.fr/open-source/trefle.git
GITLAB_TOKEN={ASK-GITLAB-TOKEN}
```
......@@ -87,7 +88,7 @@ OLD_VERSION and BACK_VERSION must be compatible
3. Add email, password, and rule file authorized to be modified in docker/authorisations.csv
i.e: `myname@email.com, mypassord, Occitanie.rules`
4. docker-compose up --build -d
4. `docker-compose up --build -d` to use image from the gitlab registry or `docker-compose -f docker-compose.yml -f docker-compose.override-build.yml up -d --build` to build the image from scratch
## Update acces
......
......@@ -67,7 +67,7 @@
<ul id="ul-financement-results-list">
<li v-for="financement in this.filteredFinancements" :key="financement.id" class="mt-4 row">
<span class="col-md-3 col-sm-12">
<a :href="'/0.7/explorer/referentiel#'+financement.racine">
<a :href="'/0.8/explorer/referentiel#'+financement.racine">
<strong class="financement-fields">{{ financement.intitule }}</strong>
</a>
</span>
......
......@@ -41,7 +41,7 @@ const routes = [
const router = new VueRouter({
mode: 'history',
base: '0.7/explorer',
base: '/0.8/explorer',
routes:routes
});
......
module.exports = {
publicPath: "/0.7/explorer/",
publicPath: "/0.8/explorer/",
assetsDir: "src/assets/",
devServer: {
proxy: 'https://trefle.beta.pole-emploi.fr/0.7/'
proxy: 'https://trefle.beta.pole-emploi.fr/0.8/'
}
}
......@@ -16,34 +16,34 @@ server {
location = / {
root /srv/trefle/backoffice;
rewrite ^/$ /0.7/explorer last;
rewrite ^/$ /0.8/explorer last;
}
location /0.7 {
location /0.8 {
root /srv/trefle/backoffice;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
location /0.7/explorer {
location /0.8/explorer {
alias /srv/trefle/backoffice;
index index.html;
try_files $uri /0.7/explorer/index.html;
try_files $uri /0.8/explorer/index.html;
}
rewrite /0.7/(.*) /$1 break;
rewrite /0.8/(.*) /$1 break;
try_files $uri @gunicorn-master;
}
location /api-moteur/0.7 {
rewrite /api-moteur/0.7/(.*) /$1 break;
location /api-moteur/0.8 {
rewrite /api-moteur/0.8/(.*) /$1 break;
try_files $uri @gunicorn-master;
}
location ^~ {
rewrite ^/(.*)$ /0.7/$1 last;
rewrite ^/(.*)$ /0.8/$1 last;
}
#previous API version
......@@ -54,25 +54,25 @@ server {
proxy_set_header Host $host;
}
location /0.6 {
location /0.7 {
root /srv/trefle-old/trefle;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
location /0.6/explorer {
location /0.7/explorer {
alias /srv/trefle-old/trefle/explorer;
index index.html;
}
rewrite /0.6/(.*) /$1 break;
rewrite /0.7/(.*) /$1 break;
try_files $uri @gunicorn-old;
}
location /api-moteur/0.6 {
rewrite /api-moteur/0.6/(.*) /$1 break;
location /api-moteur/0.7 {
rewrite /api-moteur/0.7/(.*) /$1 break;
try_files $uri @gunicorn-old;
}
......
/srv/log/* {
/srv/log/*.log {
weekly
rotate 52
missingok
......
......@@ -9,7 +9,7 @@ def is_pkg(line):
with Path("requirements.txt").open() as reqs:
install_requires = [l for l in reqs.read().split("\n") if is_pkg(l)]
VERSION = (0, 7, 16)
VERSION = (0, 8, 0)
__author__ = "Yohan Boniface"
__contact__ = "yohan.boniface@data.gouv.fr"
......
......@@ -129,37 +129,6 @@ async def remuneration_(request, response):
# k: v for k, v in context.items()
# if k in SCHEMA and "label" in SCHEMA[k]}
response.json = body
"""
try:
await simulate(context, financements)
except DataError as err:
error = {err.key: err.error}
log_simulate(context, errors=error)
raise HttpError(HTTPStatus.UNPROCESSABLE_ENTITY, error)
eligible = request.query.bool("eligible", None)
if eligible is not None:
financements = [f for f in financements if f["eligible"] == eligible]
else:
financements = sorted(financements, key=lambda value: value["eligible"],
reverse=True)
explain = request.query.bool("explain", False)
for financement in financements:
financement["explain"] = (
[s.json for s in financement["explain"]] if explain else None
)
body = {"financements": financements}
if request.query.bool("context", False):
body["context"] = {
k: v for k, v in context.items() if k in SCHEMA and "label" in SCHEMA[k]
}
if request.query.bool("scenario", False):
body["scenario"] = make_scenario(context, financements)
response.json = body
log_simulate(context, financements=financements)
"""
app.route("/legacy", methods=["POST"])(simulate_legacy)
......
......@@ -32,6 +32,7 @@ CATALOG_URL = os.environ.get(
GITLAB_URL = os.environ.get("GITLAB_URL", "https://git.beta.pole-emploi.fr")
GITLAB_PROJECT = os.environ.get("GITLAB_PROJECT", "open-source/trefle")
GITLAB_TOKEN = os.environ.get("GITLAB_TOKEN", "need-private-access-token")
# TODO remove COMMIT_AUTHORIZED env var hence AUTHORIZED replaced it
COMMIT_AUTHORIZED = set(os.environ.get(
"COMMIT_AUTHORIZED",
"contributeur@trefle.beta.pole-emploi.fr"
......
......@@ -37,7 +37,7 @@ paths:
$ref: '#/components/schemas/request'
examples:
compute-request:
$ref: '#/components/examples/compute-request'
$ref: '#/components/examples/compute-financement-request'
responses:
200:
description: Calcul effectué avec succès
......@@ -47,7 +47,7 @@ paths:
$ref: '#/components/schemas/collection'
examples:
compute-success:
$ref: '#/components/examples/compute-success'
$ref: '#/components/examples/compute-financement-success'
422:
description: Les informations sont invalides
content:
......@@ -61,6 +61,7 @@ paths:
schema:
$ref: '#/components/schemas/errors'
/api-moteur/0.7/financement: *baseendpoint
/api-moteur/0.8/financement: *baseendpoint
/remuneration: &baseremuendpoint
post:
summary: Lancer un calcul de remuneration
......@@ -71,17 +72,17 @@ paths:
$ref: '#/components/schemas/request'
examples:
compute-request:
$ref: '#/components/examples/compute-request'
$ref: '#/components/examples/compute-remuneration-request'
responses:
200:
description: Calcul effectué avec succès
content:
application/json:
schema:
$ref: '#/components/schemas/collection'
$ref: '#/components/schemas/remuneration'
examples:
compute-success:
$ref: '#/components/examples/compute-success'
$ref: '#/components/examples/compute-remuneration-success'
422:
description: Les informations sont invalides
content:
......@@ -94,7 +95,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/errors'
/api-moteur/0.7/remuneration: *baseremuendpoint
/api-moteur/0.8/remuneration: *baseremuendpoint
components:
schemas:
request:
......@@ -113,12 +114,16 @@ components:
type: array
items:
$ref: "#/components/schemas/financement"
remuneration:
type: array
items:
$ref: "#/components/schemas/remuneration"
errors:
type: object
additionalProperties:
type: string
examples:
compute-request:
compute-financement-request:
summary: Données du bénéfiaire et formation
value:
{
......@@ -131,7 +136,7 @@ components:
"numero": "03_1702030F"
}
}
compute-success:
compute-financement-success:
summary: Liste des financements éligible
value:
{
......@@ -167,4 +172,37 @@ components:
}
]
}
compute-remuneration-request:
summary: Données du bénéfiaire et formation
value:
{
"beneficiaire": {
"age": 40,
"naissance": "1980-01-01",
"allocation": 300,
"type_allocation": "ass",
"th": true,
"a_travaille_douze_mois_sur_24_mois": true,
"a_travaille_douze_mois": true,
"a_travaille_six_mois": true,
"parent_isole": false,
"mere_trois_enfant": false,
"veuve_ou_divorcee": false,
"seule_et_enceinte": false,
},
"formation": {
"codes_financeur": [2],
"region": 27,
}
}
compute-remuneration-success:
summary: Rémunération et aides éligibles
value:
{
"remuneration":910.02,
"fin_remuneration":null,
"indemnite_conges_payes":0,
"intitule_remuneration":"Rémunérations applicables",
"remuneration_texte":"C'est une rémunération minimum en fonction de votre expérience"
}
......@@ -333,8 +333,6 @@ class Condition(Step):
super().compile()
# TODO add some context for knowing if financement or remuneration is the target
keys = [pointer.key for pointer in self.params.values() if pointer.key]
# print(self.params.value())
# print(keys)
for pointer in self.params.values():
try:
pointer.resolve_labels(*keys)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment