Skip to content

Commit

Permalink
chore: display fixed fk error ids
Browse files Browse the repository at this point in the history
  • Loading branch information
yashmehrotra committed Nov 3, 2024
1 parent b0ff0ef commit 950ae52
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions upstream/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ type ForeignKeyErrorSummary struct {
IDs []string `json:"ids,omitempty"`
}

const FKErrorIDCount = 10

func (fks ForeignKeyErrorSummary) MarshalJSON() ([]byte, error) {
// Display less IDs to keep UI consistent
fks.IDs = fks.IDs[:min(len(fks.IDs), FKErrorIDCount)]
if len(fks.IDs) >= FKErrorIDCount {
fks.IDs = append(fks.IDs, "...")
}
return json.Marshal(fks)
}

type ReconcileTableSummary struct {
Success int `json:"success,omitempty"`
FKeyError ForeignKeyErrorSummary `json:"foreign_error,omitempty"`
Expand Down

0 comments on commit 950ae52

Please sign in to comment.