11 Commits

Author SHA1 Message Date
fd3e8751fe order by name
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2024-02-01 09:28:26 +01:00
21ea1aa56f Merge branch 'main' of gitea.hottis.de:moerp/elo-rezept-rechner
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-01-31 16:46:36 +01:00
eefc8d5b21 fix image tag 2024-01-31 16:46:31 +01:00
41010b8a7b small fix
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-01-31 16:27:17 +01:00
43583fb7f3 color
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-01-31 16:17:37 +01:00
1f5b4163e7 fix
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-01-31 16:11:17 +01:00
38d3381ecd test instance
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-01-31 15:51:31 +01:00
db769ca053 postfix instead of prefix, 2
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-01-31 15:31:03 +01:00
536e933fef postfix instead of prefix 2024-01-31 15:30:53 +01:00
d469a7cf2c test deployment
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-01-31 15:27:22 +01:00
d308fd662a logging, 4
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2024-01-31 15:05:58 +01:00
8 changed files with 52 additions and 10 deletions

View File

@ -14,6 +14,22 @@ steps:
when:
- event: [push, tag]
deploytest:
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:
- printf "$KUBE_CONFIG_CONTENT" > /tmp/kubeconfig
- export KUBECONFIG=/tmp/kubeconfig
- ./deployment/deploy.sh test
when:
- event: [push, tag]
deploy:
image: portainer/kubectl-shell:latest
secrets:

View File

@ -1,5 +1,7 @@
#!/bin/bash
if [ "$ENCRYPTION_KEY" = "" ]; then
echo "ENCRYPTION_KEY not set"
exit 1
@ -10,6 +12,7 @@ if [ "$MD5_CHECKSUM" = "" ]; then
exit 1
fi
SECRETS_CIPHERTEXT_FILE=secrets.enc
SECRETS_PLAINTEXT_FILE=/tmp/secrets
TMP_FILE=`mktemp`

View File

@ -46,10 +46,10 @@ metadata:
spec:
tls:
- hosts:
- nutri.hottis.de
- nutri%POSTFIX%.hottis.de
secretName: nutri-cert
rules:
- host: nutri.hottis.de
- host: nutri%POSTFIX%.hottis.de
http:
paths:
- path: /

View File

@ -1,13 +1,19 @@
#!/bin/bash
if [ "$1" == "test" ]; then
POSTFIX="-test"
IMAGE_TAG=${CI_COMMIT_SHA}
else
POSTFIX=""
fi
if [ "$IMAGE_TAG" == "" ]; then
echo "Make sure IMAGE_TAG is set"
exit 1
fi
IMAGE_NAME=gitea.hottis.de/moerp/elo-rezept-rechner
NAMESPACE=moerp
NAMESPACE=moerp${POSTFIX}
DEPLOYMENT_DIR=$PWD/deployment
pushd $DEPLOYMENT_DIR > /dev/null
@ -15,7 +21,7 @@ pushd $DEPLOYMENT_DIR > /dev/null
. /tmp/secrets
rm /tmp/secrets
CLIENT_SECRETS=`cat oidc-config.json | sed -e's!%CLIENT_SECRET%!'$CLIENT_SECRET'!'`
CLIENT_SECRETS=`cat oidc-config${POSTFIX}.json | sed -e's!%CLIENT_SECRET%!'$CLIENT_SECRET'!'`
kubectl create namespace $NAMESPACE \
--dry-run=client \
@ -37,6 +43,7 @@ kubectl create secret generic nutri-secrets \
cat $DEPLOYMENT_DIR/deploy-yml.tmpl | \
sed -e 's,%IMAGE%,'$IMAGE_NAME':'$IMAGE_TAG','g | \
sed -e 's,%POSTFIX%,'$POSTFIX','g | \
kubectl apply -f - -n $NAMESPACE
popd > /dev/null

View File

@ -0,0 +1,13 @@
{
"web": {
"issuer": "https://auth2.hottis.de/realms/hottis",
"auth_uri": "https://auth2.hottis.de/ealms/hottis/protocol/openid-connect/auth",
"client_id": "nutri",
"client_secret": "%CLIENT_SECRET%",
"redirect_uris": [
"https://nutri-test.hottis.de/*"
],
"userinfo_uri": "https://auth2.hottis.de/realms/hottis/protocol/openid-connect/userinfo",
"token_uri": "https://auth2.hottis.de/realms/hottis/protocol/openid-connect/token"
}
}

View File

@ -19,7 +19,7 @@ app.config.update({
})
oidc = OpenIDConnect(app)
app.logger.handlers = logging.getLogger('gunicorn.error').handlers
def calculate_nutrition(food, weight):
try:
@ -65,7 +65,7 @@ def get_products():
try:
conn = psycopg2.connect()
with conn.cursor() as cursor:
cursor.execute('SELECT name FROM nutrition_table')
cursor.execute('SELECT name FROM nutrition_table ORDER BY name')
products = cursor.fetchall()
return {'products': [product[0] for product in products]}
finally:

View File

@ -72,7 +72,7 @@ tr:nth-child(even) {
}
.selected, tr.selected {
background-color: #e5b5b5; /* Hervorhebung der Auswahl */
background-color: #efcccc; /* Hervorhebung der Auswahl */
}
tr:hover:not(.selected) {
@ -172,7 +172,7 @@ tr:hover:not(.selected) {
}
#database-nutrition-table tr.selected {
background-color: #f0e68c;
background-color: #efcccc;
}

View File

@ -40,6 +40,7 @@
// Beispielsweise das Formular zurücksetzen
form.reset();
updateSubmitButtonState();
loadDatabaseEntries();
}).catch(error => {
console.error('Fehler:', error);
});
@ -98,7 +99,7 @@
}
function updateDeleteButtonState() {
const selectedRows = document.querySelectorAll('#nutrition-table .selected').length;
const selectedRows = document.querySelectorAll('#database-nutrition-table .selected').length;
const deleteButton = document.getElementById('delete-row-button');
deleteButton.disabled = selectedRows === 0;
if (selectedRows === 0) {
@ -107,11 +108,13 @@
}
function loadDatabaseEntries() {
fetch('/get_database_entries') // Pfad zur entsprechenden Flask-Route
.then(response => response.json())
.then(data => {
const tableBody = document.getElementById('database-nutrition-table').getElementsByTagName('tbody')[0];
tableBody.innerHTML = '';
data.forEach(entry => {
const row = tableBody.insertRow();
row.insertCell(0).innerHTML = entry.food;