forked from rust-lang/crates.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1354: Don't use shields.io's crate badges r=sgrif Every single time someone loads a crates.io badge from shields.io, they make a separate API call to our servers for each one, with no caching. This means that right now when you go to the search page, you're going to make 11 API calls when you should be making 1. The result is that shields.io accounts for an unreasonably large amount of traffic to our systems. We have all the information we need for this badge when we load the page, so let's just do that and use their "badge with these words" API instead. I've just removed it from the version show page since we already display that info elsewhere on the page, and it's especially confusing when the numbers don't match.
- Loading branch information
Showing
4 changed files
with
22 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Component from '@ember/component'; | ||
import { computed } from '@ember/object'; | ||
|
||
export default Component.extend({ | ||
classNames: ['vers'], | ||
|
||
tagName: 'span', | ||
|
||
color: computed('crate.max_version', function() { | ||
if (this.get('crate.max_version')[0] == '0') { | ||
return 'orange'; | ||
} else { | ||
return 'blue'; | ||
} | ||
}), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<img | ||
src="https://img.shields.io/badge/crates.io-v{{ crate.max_version }}-{{ color }}.svg?longCache=true" | ||
alt="{{ crate.max_version }}" | ||
title="{{ crate.name }}’s current version badge" | ||
data-test-version-badge> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters