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:
@@ -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(() => {
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user