7 Commits

Author SHA1 Message Date
00d48b4de1 roles
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2024-01-30 14:00:41 +01:00
fc9cd70776 Merge branch 'main' of gitea.hottis.de:moerp/elo-rezept-rechner 2024-01-30 13:59:13 +01:00
8b9654370c roles 2024-01-30 13:59:02 +01:00
4471c140c1 placeholder 2024-01-30 13:53:30 +01:00
e87675dcbd fix namespace
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2024-01-30 13:41:59 +01:00
dc8d6d58e1 ci
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2024-01-30 13:35:17 +01:00
46826bfe09 nothing 2024-01-30 13:29:27 +01:00
4 changed files with 26 additions and 13 deletions

View File

@ -13,3 +13,21 @@ steps:
dockerfile: Dockerfile dockerfile: Dockerfile
when: when:
- event: [push, tag] - event: [push, tag]
deploy:
image: portainer/kubectl-shell:latest
secrets:
- source: kube_config
target: KUBE_CONFIG_CONTENT
- source: encryption_key
target: ENCRYPTION_KEY
- source: secrets_checksum
target: MD5_CHECKSUM
commands:
- export IMAGE_TAG=$CI_COMMIT_TAG
- printf "$KUBE_CONFIG_CONTENT" > /tmp/kubeconfig
- export KUBECONFIG=/tmp/kubeconfig
- ./deployment/deploy.sh
when:
- event: tag

View File

@ -6,8 +6,8 @@ if [ "$IMAGE_TAG" == "" ]; then
fi fi
IMAGE_NAME=gitea.hottis.de/wn/oidc-python-example IMAGE_NAME=gitea.hottis.de/moerp/elo-rezept-rechner
NAMESPACE=oidc-python-example NAMESPACE=moerp
DEPLOYMENT_DIR=$PWD/deployment DEPLOYMENT_DIR=$PWD/deployment
pushd $DEPLOYMENT_DIR > /dev/null pushd $DEPLOYMENT_DIR > /dev/null
@ -22,7 +22,7 @@ kubectl create namespace $NAMESPACE \
-o yaml | \ -o yaml | \
kubectl -f - apply kubectl -f - apply
kubectl create secret generic secrets \ kubectl create secret generic nutri-secrets \
--dry-run=client \ --dry-run=client \
-o yaml \ -o yaml \
--save-config \ --save-config \

View File

@ -94,6 +94,7 @@ def calculate_nutrition(food, weight):
# Index-Route # Index-Route
@app.route('/') @app.route('/')
@oidc.require_login @oidc.require_login
@oidc.require_keycloak_role('user')
def index(): def index():
return render_template('index.html') return render_template('index.html')
@ -101,6 +102,7 @@ def index():
@app.route('/get_products') @app.route('/get_products')
@oidc.require_login @oidc.require_login
@oidc.require_keycloak_role('user')
def get_products(): def get_products():
conn = get_db_connection() conn = get_db_connection()
cursor = conn.cursor() cursor = conn.cursor()
@ -117,6 +119,7 @@ def get_products():
# Route zum Hinzufügen und Berechnen von Lebensmitteln # Route zum Hinzufügen und Berechnen von Lebensmitteln
@app.route('/add_lm', methods=['GET']) @app.route('/add_lm', methods=['GET'])
@oidc.require_login @oidc.require_login
@oidc.require_keycloak_role('user')
def add_lm(): def add_lm():
food = request.args.get('food') food = request.args.get('food')
weight = float(request.args.get('weight')) weight = float(request.args.get('weight'))
@ -164,6 +167,7 @@ def add_nutrition():
@app.route('/nutrition') @app.route('/nutrition')
@oidc.require_login @oidc.require_login
@oidc.require_keycloak_role('user')
def nutrition(): def nutrition():
return render_template('nutrition.html') return render_template('nutrition.html')

View File

@ -172,15 +172,6 @@ function updateTotalNutrition() {
document.getElementById('total-ca').innerText = Math.round(totalCa); document.getElementById('total-ca').innerText = Math.round(totalCa);
} }
// Rufen Sie diese Funktion auf, wenn sich die Haupttabelle ändert
// Diese Funktion sollte aufgerufen werden, wenn ein Produkt hinzugefügt oder entfernt wird
</script> </script>
</head> </head>
<body> <body>
@ -196,7 +187,7 @@ function updateTotalNutrition() {
<div class="content"> <div class="content">
<form onsubmit="event.preventDefault(); addProduct();" id="product-form"> <form onsubmit="event.preventDefault(); addProduct();" id="product-form">
<label for="my_combobox">Wählen Sie ein Lebensmittel</label> <label for="my_combobox">Wählen Sie ein Lebensmittel</label>
<input list="products" name="my_combobox" id="my_combobox" oninput="updateButtonState()" autocomplete="off"> <input list="products" name="my_combobox" id="my_combobox" placeholder="Lebensmittel" oninput="updateButtonState()" autocomplete="off">
<datalist id="products"> <datalist id="products">
<!-- Produkte werden hier dynamisch eingefügt --> <!-- Produkte werden hier dynamisch eingefügt -->
</datalist> </datalist>