Refactor deploy script to add 'no-backup' option for updates, allowing users to skip database backups during code updates. Update help text for clarity on available options and improve overall script usability.

This commit is contained in:
Torsten Schulz (local)
2026-05-14 16:34:25 +02:00
parent 83305c0940
commit 7d5c8cffc7
3 changed files with 54 additions and 38 deletions

View File

@@ -11,6 +11,7 @@
# Optionen:
# install - Erste Installation (inkl. System-Setup)
# update - Update einer bestehenden Installation
# update no-backup - Update ohne Backup (nur Code-Update)
# rollback - Rollback zur vorherigen Version
# backup - Erstelle Backup der Datenbank
# status - Zeige Status der Services
@@ -459,8 +460,13 @@ do_update() {
print_info "Quell-Verzeichnis: $CURRENT_DIR"
print_info "Ziel-Verzeichnis: $PROJECT_DIR"
# Backup erstellen
# Backup erstellen (nur wenn nicht explizit übersprungen)
SKIP_BACKUP="${2:-false}"
if [ "$SKIP_BACKUP" != "no-backup" ]; then
do_backup
else
print_info "Backup übersprungen (--no-backup Flag gesetzt)"
fi
# Kopiere aktualisierte Dateien
print_header "Kopiere aktualisierte Dateien"
@@ -769,6 +775,7 @@ Verwendung: $0 [OPTION]
Optionen:
install Erste Installation (inkl. System-Setup)
update Update einer bestehenden Installation
update no-backup Update ohne Backup (nur Code-Update, keine DB-Berührung)
rollback Rollback zur vorherigen Version
backup Erstelle Backup der Datenbank
status Zeige Status der Services
@@ -777,7 +784,8 @@ Optionen:
Beispiele:
$0 install # Erste Installation
$0 update # Update durchführen
$0 update # Update durchführen (mit Backup)
$0 update no-backup # Nur Code-Update, kein Backup
$0 backup # Backup erstellen
$0 status # Status anzeigen
@@ -790,7 +798,7 @@ case "${1:-help}" in
do_install
;;
update)
do_update
do_update "$@"
;;
rollback)
do_rollback

View File

@@ -92,6 +92,19 @@ const fetchStats = async () => {
isReady.value = true
}
/** Lädt Zustand, laufende Zeiten und Tages-Stats neu (z. B. nach Stempeln oder Zeitkorrektur). */
const refreshStatusData = async () => {
await fetchCurrentState()
await fetchWorklogData()
await fetchStats()
}
const onWorklogUpdated = (e) => {
// Nach Stempeln in dieser Komponente wurde bereits refreshStatusData ausgeführt
if (e.detail?.fromStatusBoxClock) return
void refreshStatusData()
}
const fetchCurrentState = async () => {
try {
const response = await fetch(`${API_URL}/time-entries/current-state`, {
@@ -317,13 +330,10 @@ const handleAction = async (action) => {
return
}
// Aktualisiere Status und Worklog-Daten sofort
await fetchCurrentState()
await fetchWorklogData()
await fetchStats()
// Event auslösen für andere Komponenten (z.B. WeekOverview)
window.dispatchEvent(new CustomEvent('worklog-updated'))
await refreshStatusData()
window.dispatchEvent(
new CustomEvent('worklog-updated', { detail: { fromStatusBoxClock: true } })
)
} catch (error) {
console.error('Fehler beim Stempeln:', error)
@@ -366,22 +376,17 @@ const rightButton = computed(() => {
// Event-Handler für Login
const handleLoginCompleted = async () => {
await fetchCurrentState()
await fetchWorklogData()
await fetchStats()
await refreshStatusData()
}
onMounted(async () => {
// Initiales Laden
await fetchCurrentState()
await fetchWorklogData()
await fetchStats()
await refreshStatusData()
window.addEventListener('worklog-updated', onWorklogUpdated)
// Server-Daten alle 60 Sekunden neu laden
dataFetchInterval = setInterval(async () => {
await fetchCurrentState()
await fetchWorklogData()
await fetchStats()
await refreshStatusData()
}, 60000)
// Anzeige 2x pro Sekunde aktualisieren (nur Berechnung, keine Server-Requests)
@@ -398,6 +403,7 @@ onBeforeUnmount(() => {
if (dataFetchInterval) clearInterval(dataFetchInterval)
if (displayUpdateInterval) clearInterval(displayUpdateInterval)
window.removeEventListener('login-completed', handleLoginCompleted)
window.removeEventListener('worklog-updated', onWorklogUpdated)
})
const displayRows = computed(() => {

View File

@@ -275,6 +275,7 @@ async function createTimefix() {
loadTimefixes(),
loadWorklogEntries() // Lade auch die Dropdown-Liste neu
])
window.dispatchEvent(new CustomEvent('worklog-updated'))
} catch (error) {
console.error('Fehler beim Erstellen der Zeitkorrektur:', error)
await alert(`Fehler: ${error.message}`, 'Fehler')
@@ -304,6 +305,7 @@ async function deleteTimefix(id) {
}
await loadTimefixes()
window.dispatchEvent(new CustomEvent('worklog-updated'))
} catch (error) {
console.error('Fehler beim Löschen der Zeitkorrektur:', error)
await alert(`Fehler: ${error.message}`, 'Fehler')