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: # Optionen:
# install - Erste Installation (inkl. System-Setup) # install - Erste Installation (inkl. System-Setup)
# update - Update einer bestehenden Installation # update - Update einer bestehenden Installation
# update no-backup - Update ohne Backup (nur Code-Update)
# rollback - Rollback zur vorherigen Version # rollback - Rollback zur vorherigen Version
# backup - Erstelle Backup der Datenbank # backup - Erstelle Backup der Datenbank
# status - Zeige Status der Services # status - Zeige Status der Services
@@ -459,8 +460,13 @@ do_update() {
print_info "Quell-Verzeichnis: $CURRENT_DIR" print_info "Quell-Verzeichnis: $CURRENT_DIR"
print_info "Ziel-Verzeichnis: $PROJECT_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 do_backup
else
print_info "Backup übersprungen (--no-backup Flag gesetzt)"
fi
# Kopiere aktualisierte Dateien # Kopiere aktualisierte Dateien
print_header "Kopiere aktualisierte Dateien" print_header "Kopiere aktualisierte Dateien"
@@ -769,6 +775,7 @@ Verwendung: $0 [OPTION]
Optionen: Optionen:
install Erste Installation (inkl. System-Setup) install Erste Installation (inkl. System-Setup)
update Update einer bestehenden Installation update Update einer bestehenden Installation
update no-backup Update ohne Backup (nur Code-Update, keine DB-Berührung)
rollback Rollback zur vorherigen Version rollback Rollback zur vorherigen Version
backup Erstelle Backup der Datenbank backup Erstelle Backup der Datenbank
status Zeige Status der Services status Zeige Status der Services
@@ -777,7 +784,8 @@ Optionen:
Beispiele: Beispiele:
$0 install # Erste Installation $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 backup # Backup erstellen
$0 status # Status anzeigen $0 status # Status anzeigen
@@ -790,7 +798,7 @@ case "${1:-help}" in
do_install do_install
;; ;;
update) update)
do_update do_update "$@"
;; ;;
rollback) rollback)
do_rollback do_rollback

View File

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

View File

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