Notify when prune completes
This commit is contained in:
@@ -1 +0,0 @@
|
|||||||
1fda0986918fa5838cbd8f56ce013e1c5a2add51c41fb5cee14fe77c0e33c0b4 urbm-2026.06.22.r002-x86_64-1.txz
|
|
||||||
BIN
Binary file not shown.
@@ -0,0 +1 @@
|
|||||||
|
3459126382e7099035ffbdd3d39ca419e2531d0602d2eaac1ae0621d67ae5c91 urbm-2026.06.22.r003-x86_64-1.txz
|
||||||
Vendored
+6
-2
@@ -2,13 +2,17 @@
|
|||||||
<!DOCTYPE PLUGIN [
|
<!DOCTYPE PLUGIN [
|
||||||
<!ENTITY name "urbm">
|
<!ENTITY name "urbm">
|
||||||
<!ENTITY author "Michael Roll">
|
<!ENTITY author "Michael Roll">
|
||||||
<!ENTITY version "2026.06.22.r002">
|
<!ENTITY version "2026.06.22.r003">
|
||||||
<!ENTITY pluginURL "https://git.casaderoll.de/michael/URBM/raw/branch/main/dist/urbm.plg">
|
<!ENTITY pluginURL "https://git.casaderoll.de/michael/URBM/raw/branch/main/dist/urbm.plg">
|
||||||
<!ENTITY packageURL "https://git.casaderoll.de/michael/URBM/raw/branch/main/dist/urbm-&version;-x86_64-1.txz">
|
<!ENTITY packageURL "https://git.casaderoll.de/michael/URBM/raw/branch/main/dist/urbm-&version;-x86_64-1.txz">
|
||||||
<!ENTITY packageSHA256 "1fda0986918fa5838cbd8f56ce013e1c5a2add51c41fb5cee14fe77c0e33c0b4">
|
<!ENTITY packageSHA256 "3459126382e7099035ffbdd3d39ca419e2531d0602d2eaac1ae0621d67ae5c91">
|
||||||
]>
|
]>
|
||||||
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="&pluginURL;" min="7.0.0" support="https://git.casaderoll.de/michael/URBM/issues" icon="urbm.png">
|
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="&pluginURL;" min="7.0.0" support="https://git.casaderoll.de/michael/URBM/issues" icon="urbm.png">
|
||||||
<CHANGES>
|
<CHANGES>
|
||||||
|
### 2026.06.22.r003
|
||||||
|
- Send Unraid and Gotify notifications after scheduled or manual repository prune tasks finish.
|
||||||
|
- Use task-specific notification summary headings for backup, rsync, restore, prune, and check messages.
|
||||||
|
|
||||||
### 2026.06.22.r002
|
### 2026.06.22.r002
|
||||||
- Preserve page and tree-container scroll positions after expanding deeply nested folders in source, target, settings, repository, and snapshot trees.
|
- Preserve page and tree-container scroll positions after expanding deeply nested folders in source, target, settings, repository, and snapshot trees.
|
||||||
- Restore scroll positions after the browser has processed focus/layout changes to prevent jumps back to the root.
|
- Restore scroll positions after the browser has processed focus/layout changes to prevent jumps back to the root.
|
||||||
|
|||||||
@@ -27,3 +27,18 @@ func TestNotificationTitleIncludesRepositoryAndStatus(t *testing.T) {
|
|||||||
t.Fatalf("title = %q", title)
|
t.Fatalf("title = %q", title)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNotificationMessageIncludesPruneSummary(t *testing.T) {
|
||||||
|
started := time.Date(2026, 6, 22, 3, 0, 0, 0, time.UTC)
|
||||||
|
finished := started.Add(42 * time.Second)
|
||||||
|
run := model.Run{TaskType: "prune", Status: "success", StartedAt: &started, FinishedAt: &finished, Message: "prune completed"}
|
||||||
|
message := notificationMessage("Repository-Bereinigung", "LV-426", run, finished)
|
||||||
|
for _, expected := range []string{"🧹 Prune-Zusammenfassung", "📦 Repository: LV-426", "🗂️ Job: Repository-Bereinigung", "⏱️ Dauer: 42 Sekunden", "🔐 Ziel: Restic Repository", "✅ Status: Erfolgreich"} {
|
||||||
|
if !strings.Contains(message, expected) {
|
||||||
|
t.Errorf("message %q does not contain %q", message, expected)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if strings.Contains(message, "⚠️ Details: prune completed") {
|
||||||
|
t.Fatalf("message contains redundant prune completion details: %q", message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -427,8 +427,14 @@ func (s *Service) ForceUnlockRepository(ctx context.Context, repoID string) erro
|
|||||||
return s.restic.ForceUnlock(ctx, mounted.Repository)
|
return s.restic.ForceUnlock(ctx, mounted.Repository)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) execute(ctx context.Context, run model.Run) model.Run {
|
func (s *Service) execute(ctx context.Context, run model.Run) (result model.Run) {
|
||||||
ctx = restic.WithRunID(ctx, run.ID)
|
ctx = restic.WithRunID(ctx, run.ID)
|
||||||
|
maintenanceRepoName := ""
|
||||||
|
defer func() {
|
||||||
|
if result.TaskType == "prune" && (result.Status == "success" || result.Status == "warning" || result.Status == "failed") {
|
||||||
|
go s.notify("Repository-Bereinigung", maintenanceRepoName, result)
|
||||||
|
}
|
||||||
|
}()
|
||||||
if run.TaskType == "backup" {
|
if run.TaskType == "backup" {
|
||||||
return s.executeBackup(ctx, run)
|
return s.executeBackup(ctx, run)
|
||||||
}
|
}
|
||||||
@@ -442,6 +448,7 @@ func (s *Service) execute(ctx context.Context, run model.Run) model.Run {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return failed(run, "validation", "repository no longer exists")
|
return failed(run, "validation", "repository no longer exists")
|
||||||
}
|
}
|
||||||
|
maintenanceRepoName = repo.Name
|
||||||
live := run
|
live := run
|
||||||
appendLiveLog(&live, strings.ToUpper(run.TaskType)+" wird vorbereitet")
|
appendLiveLog(&live, strings.ToUpper(run.TaskType)+" wird vorbereitet")
|
||||||
s.updateActive(live)
|
s.updateActive(live)
|
||||||
@@ -817,7 +824,11 @@ func notificationMessage(name, repository string, run model.Run, now time.Time)
|
|||||||
if status == "" {
|
if status == "" {
|
||||||
status = run.Status
|
status = run.Status
|
||||||
}
|
}
|
||||||
lines := []string{"📊 Backup-Zusammenfassung", ""}
|
summaryTitle := map[string]string{"backup": "📊 Backup-Zusammenfassung", "rsync": "📊 Rsync-Zusammenfassung", "restore": "📊 Restore-Zusammenfassung", "prune": "🧹 Prune-Zusammenfassung", "check": "🔎 Prüfungs-Zusammenfassung"}[run.TaskType]
|
||||||
|
if summaryTitle == "" {
|
||||||
|
summaryTitle = "📊 URBM-Zusammenfassung"
|
||||||
|
}
|
||||||
|
lines := []string{summaryTitle, ""}
|
||||||
if repository != "" {
|
if repository != "" {
|
||||||
lines = append(lines, "📦 Repository: "+repository)
|
lines = append(lines, "📦 Repository: "+repository)
|
||||||
}
|
}
|
||||||
@@ -852,7 +863,7 @@ func notificationMessage(name, repository string, run model.Run, now time.Time)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
lines = append(lines, "", "🔐 Ziel: "+notificationTargetLabel(run.TaskType), statusIcon(run.Status)+" Status: "+status)
|
lines = append(lines, "", "🔐 Ziel: "+notificationTargetLabel(run.TaskType), statusIcon(run.Status)+" Status: "+status)
|
||||||
if run.Message != "" && run.Message != "backup completed" && run.Message != "rsync completed" {
|
if run.Message != "" && run.Message != run.TaskType+" completed" {
|
||||||
lines = append(lines, "⚠️ Details: "+run.Message)
|
lines = append(lines, "⚠️ Details: "+run.Message)
|
||||||
}
|
}
|
||||||
return strings.Join(lines, "\n")
|
return strings.Join(lines, "\n")
|
||||||
|
|||||||
+5
-1
@@ -2,13 +2,17 @@
|
|||||||
<!DOCTYPE PLUGIN [
|
<!DOCTYPE PLUGIN [
|
||||||
<!ENTITY name "urbm">
|
<!ENTITY name "urbm">
|
||||||
<!ENTITY author "Michael Roll">
|
<!ENTITY author "Michael Roll">
|
||||||
<!ENTITY version "2026.06.22.r002">
|
<!ENTITY version "2026.06.22.r003">
|
||||||
<!ENTITY pluginURL "https://git.casaderoll.de/michael/URBM/raw/branch/main/dist/urbm.plg">
|
<!ENTITY pluginURL "https://git.casaderoll.de/michael/URBM/raw/branch/main/dist/urbm.plg">
|
||||||
<!ENTITY packageURL "https://git.casaderoll.de/michael/URBM/raw/branch/main/dist/urbm-&version;-x86_64-1.txz">
|
<!ENTITY packageURL "https://git.casaderoll.de/michael/URBM/raw/branch/main/dist/urbm-&version;-x86_64-1.txz">
|
||||||
<!ENTITY packageSHA256 "REPLACE_DURING_RELEASE">
|
<!ENTITY packageSHA256 "REPLACE_DURING_RELEASE">
|
||||||
]>
|
]>
|
||||||
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="&pluginURL;" min="7.0.0" support="https://git.casaderoll.de/michael/URBM/issues" icon="urbm.png">
|
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="&pluginURL;" min="7.0.0" support="https://git.casaderoll.de/michael/URBM/issues" icon="urbm.png">
|
||||||
<CHANGES>
|
<CHANGES>
|
||||||
|
### 2026.06.22.r003
|
||||||
|
- Send Unraid and Gotify notifications after scheduled or manual repository prune tasks finish.
|
||||||
|
- Use task-specific notification summary headings for backup, rsync, restore, prune, and check messages.
|
||||||
|
|
||||||
### 2026.06.22.r002
|
### 2026.06.22.r002
|
||||||
- Preserve page and tree-container scroll positions after expanding deeply nested folders in source, target, settings, repository, and snapshot trees.
|
- Preserve page and tree-container scroll positions after expanding deeply nested folders in source, target, settings, repository, and snapshot trees.
|
||||||
- Restore scroll positions after the browser has processed focus/layout changes to prevent jumps back to the root.
|
- Restore scroll positions after the browser has processed focus/layout changes to prevent jumps back to the root.
|
||||||
|
|||||||
+4
-4
@@ -9,12 +9,12 @@ Tag="URBM Unraid Restic Backup Manager backup snapshots restore"
|
|||||||
<?php
|
<?php
|
||||||
$pluginRoot = '/plugins/urbm';
|
$pluginRoot = '/plugins/urbm';
|
||||||
?>
|
?>
|
||||||
<link rel="stylesheet" href="<?= $pluginRoot ?>/assets/urbm.css?v=20260622r002">
|
<link rel="stylesheet" href="<?= $pluginRoot ?>/assets/urbm.css?v=20260622r003">
|
||||||
<div id="urbm-app" data-api="<?= $pluginRoot ?>/api.php">
|
<div id="urbm-app" data-api="<?= $pluginRoot ?>/api.php">
|
||||||
<header class="bu-header">
|
<header class="bu-header">
|
||||||
<div class="bu-brand">
|
<div class="bu-brand">
|
||||||
<img class="bu-logo" src="<?= $pluginRoot ?>/images/urbm.png?v=20260622r002" alt="URBM-Logo">
|
<img class="bu-logo" src="<?= $pluginRoot ?>/images/urbm.png?v=20260622r003" alt="URBM-Logo">
|
||||||
<div><h1>URBM <span class="bu-version">2026.06.22.r002</span></h1><p>Restic Backup Manager für Unraid</p></div>
|
<div><h1>URBM <span class="bu-version">2026.06.22.r003</span></h1><p>Restic Backup Manager für Unraid</p></div>
|
||||||
</div>
|
</div>
|
||||||
<div id="bu-health" class="bu-health" tabindex="0" data-tooltip="Zeigt, ob die URBM-Hintergrundkomponente erreichbar ist. Beispiel: 'Daemon online' bedeutet, dass Jobs gestartet werden können.">Verbindung wird hergestellt...</div>
|
<div id="bu-health" class="bu-health" tabindex="0" data-tooltip="Zeigt, ob die URBM-Hintergrundkomponente erreichbar ist. Beispiel: 'Daemon online' bedeutet, dass Jobs gestartet werden können.">Verbindung wird hergestellt...</div>
|
||||||
</header>
|
</header>
|
||||||
@@ -32,4 +32,4 @@ $pluginRoot = '/plugins/urbm';
|
|||||||
<div id="bu-tooltip" role="tooltip" aria-hidden="true"></div>
|
<div id="bu-tooltip" role="tooltip" aria-hidden="true"></div>
|
||||||
</div>
|
</div>
|
||||||
<script>window.URBM_CSRF = <?= json_encode($var['csrf_token'] ?? '') ?>;</script>
|
<script>window.URBM_CSRF = <?= json_encode($var['csrf_token'] ?? '') ?>;</script>
|
||||||
<script src="<?= $pluginRoot ?>/assets/urbm-2026.06.22.r002.js"></script>
|
<script src="<?= $pluginRoot ?>/assets/urbm-2026.06.22.r003.js"></script>
|
||||||
|
|||||||
Reference in New Issue
Block a user