Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert more badges to use static previews #1961

Closed
chris48s opened this issue Aug 23, 2018 · 2 comments
Closed

Convert more badges to use static previews #1961

chris48s opened this issue Aug 23, 2018 · 2 comments
Labels
good first issue New contributors, join in! performance-improvement Related to performance or throughput of the badge servers service-badge Accepted and actionable changes, features, and bugs

Comments

@chris48s
Copy link
Member

chris48s commented Aug 23, 2018

We show example badges on our home page but they don't need to show real data. For performance reasons, it is useful to render a badge using some fake example data instead of making a call to a real API. It is also useful to show the URL format in a parametrised form.

We can do this by switching from defining a previewUrl to defining:

  • urlPattern pattern (the URL format in a parameterised form)
  • exampleUrl (a real badge URL the user can call if they want to) namedParams (mappings of pattern placeholders to values for a real, working example)
  • staticExample (a JSON object or call to the service's render() function which generates a fake badge)

You can find examples of service badges which use a previewUrl using this search:

https://github.com/search?utf8=%E2%9C%93&q=previewUrl+user%3Abadges+repo%3Ashields+path%3A%2Fservices+language%3AJavaScript&type=Code&ref=advsearch&l=JavaScript&l=

An example pull request will probably look like this:

https://github.com/badges/shields/pull/2230/files

@chris48s chris48s added the performance-improvement Related to performance or throughput of the badge servers label Aug 23, 2018
niccokunzmann added a commit to niccokunzmann/shields that referenced this issue Aug 24, 2018
@paulmelnikow paulmelnikow added the good first issue New contributors, join in! label Nov 6, 2018
@paulmelnikow
Copy link
Member

@chris48s I tagged this "good first issue." Would you be up for updating your top post with a few sentences about how new contributors could go about helping with this?

@chris48s
Copy link
Member Author

chris48s commented Nov 7, 2018

no probs. I've updated the top post

paulmelnikow added a commit that referenced this issue Dec 1, 2018
…amo] (#2407)

It seems useful to accelerate #1961 even as the badge rewrites are still underway. This introduces a small amount of technical debt by hard-coding the static example, though continuing this work could allow us to eliminate the old ways of specifying examples. It seems like a decent tradeoff.
paulmelnikow added a commit that referenced this issue Dec 3, 2018
paulmelnikow added a commit that referenced this issue Dec 4, 2018
paulmelnikow added a commit that referenced this issue Dec 4, 2018
@paulmelnikow paulmelnikow mentioned this issue Dec 10, 2018
12 tasks
@paulmelnikow paulmelnikow added the service-badge Accepted and actionable changes, features, and bugs label Jan 8, 2019
paulmelnikow added a commit that referenced this issue Jan 11, 2019
- With examples using `pattern`s, allow building the URL from its component parts, including the query string.
- Provide a button to copy the link, with an animation.

To enable this for other badges, convert them to use a `pattern`: #1961.
@paulmelnikow paulmelnikow pinned this issue Jan 22, 2019
@paulmelnikow paulmelnikow unpinned this issue Jan 22, 2019
@paulmelnikow paulmelnikow changed the title Convert more badges to use static examples Convert more badges to use static previews Jan 22, 2019
paulmelnikow added a commit that referenced this issue Jan 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue New contributors, join in! performance-improvement Related to performance or throughput of the badge servers service-badge Accepted and actionable changes, features, and bugs
Projects
None yet
Development

No branches or pull requests

2 participants