Skip to content

Commit

Permalink
feat(index page): truncate git shas in table
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Oct 17, 2017
1 parent 16a0524 commit 94da4c7
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions lib/pact_broker/ui/view_models/relationship.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ def provider_name
end

def consumer_version_number
@relationship.consumer_version_number
short_version_number(@relationship.consumer_version_number)
end

def provider_version_number
@relationship.provider_version_number
short_version_number(@relationship.provider_version_number)
end

def tag_names
Expand Down Expand Up @@ -117,11 +117,11 @@ def warning?
def verification_tooltip
case @relationship.verification_status
when :success
"Successfully verified by #{provider_name} (v#{@relationship.latest_verification_provider_version_number})"
"Successfully verified by #{provider_name} (v#{short_version_number(@relationship.latest_verification_provider_version_number)})"
when :stale
"Pact has changed since last successful verification by #{provider_name} (v#{@relationship.latest_verification_provider_version_number})"
"Pact has changed since last successful verification by #{provider_name} (v#{short_version_number(@relationship.latest_verification_provider_version_number)})"
when :failed
"Verification by #{provider_name} (v#{@relationship.latest_verification_provider_version_number}) failed"
"Verification by #{provider_name} (v#{short_version_number(@relationship.latest_verification_provider_version_number)}) failed"
else
nil
end
Expand All @@ -133,6 +133,14 @@ def <=> other
provider_name.downcase <=> other.provider_name.downcase
end

def short_version_number version_number
return "" if version_number.nil?
if version_number.size > 12
version_number[0..12] + "..."
else
version_number
end
end
end
end
end
Expand Down

0 comments on commit 94da4c7

Please sign in to comment.