From c4e23862cd6e7a892fa1981f835405502501b1ec Mon Sep 17 00:00:00 2001 From: InsanePrawn Date: Wed, 21 Nov 2018 04:06:13 +0100 Subject: [PATCH] Added status view for SnapJob. --- client/status.go | 65 ++++++++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 27 deletions(-) diff --git a/client/status.go b/client/status.go index bf882f7..f5e886e 100644 --- a/client/status.go +++ b/client/status.go @@ -298,7 +298,44 @@ func (t *tui) draw() { t.setIndent(1) t.newline() - if v.Type != job.TypePush && v.Type != job.TypePull { + if v.Type == job.TypePush || v.Type == job.TypePull { + activeStatus, ok := v.JobSpecific.(*job.ActiveSideStatus) + if !ok || activeStatus == nil { + t.printf("ActiveSideStatus is null") + t.newline() + continue + } + + t.printf("Replication:") + t.newline() + t.addIndent(1) + t.renderReplicationReport(activeStatus.Replication, t.getReplicationProgresHistory(k)) + t.addIndent(-1) + + t.printf("Pruning Sender:") + t.newline() + t.addIndent(1) + t.renderPrunerReport(activeStatus.PruningSender) + t.addIndent(-1) + + t.printf("Pruning Receiver:") + t.newline() + t.addIndent(1) + t.renderPrunerReport(activeStatus.PruningReceiver) + t.addIndent(-1) + } else if v.Type == job.TypeSnap { + snapStatus, ok := v.JobSpecific.(*job.SnapJobStatus) + if !ok || snapStatus == nil { + t.printf("SnapJobStatus is null") + t.newline() + continue + } + t.printf("Pruning snapshots:") + t.newline() + t.addIndent(1) + t.renderPrunerReport(snapStatus.Pruning) + t.addIndent(-1) + } else { t.printf("No status representation for job type '%s', dumping as YAML", v.Type) t.newline() asYaml, err := yaml.Marshal(v.JobSpecific) @@ -311,32 +348,6 @@ func (t *tui) draw() { t.newline() continue } - - pushStatus, ok := v.JobSpecific.(*job.ActiveSideStatus) - if !ok || pushStatus == nil { - t.printf("ActiveSideStatus is null") - t.newline() - continue - } - - t.printf("Replication:") - t.newline() - t.addIndent(1) - t.renderReplicationReport(pushStatus.Replication, t.getReplicationProgresHistory(k)) - t.addIndent(-1) - - t.printf("Pruning Sender:") - t.newline() - t.addIndent(1) - t.renderPrunerReport(pushStatus.PruningSender) - t.addIndent(-1) - - t.printf("Pruning Receiver:") - t.newline() - t.addIndent(1) - t.renderPrunerReport(pushStatus.PruningReceiver) - t.addIndent(-1) - } } termbox.Flush()