func renderHistoryTable(history []HealingEvent, filter string, ctx *cmd.Context) { fmt.Fprintln(ctx.Stdout, strings.ToUpper(filter[:1])+filter[1:]+":") headers := cmd.Row([]string{"Start", "Finish", "Success", "Failing", "Created", "Error"}) t := cmd.Table{Headers: headers} for i := len(history) - 1; i >= 0; i-- { event := history[i] if event.Action != filter+"-healing" { continue } data := make([]string, 2) if filter == "node" { data[0] = event.FailingNode.Address data[1] = event.CreatedNode.Address } else { data[0] = event.FailingContainer.ID data[1] = event.CreatedContainer.ID if len(data[0]) > 10 { data[0] = data[0][:10] } if len(data[1]) > 10 { data[1] = data[1][:10] } } t.AddRow(cmd.Row([]string{ event.StartTime.Local().Format(time.Stamp), event.EndTime.Local().Format(time.Stamp), fmt.Sprintf("%t", event.Successful), data[0], data[1], event.Error, })) } t.LineSeparator = true t.Reverse() ctx.Stdout.Write(t.Bytes()) }