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

Changed endpoint star to stars #1603

Merged
merged 3 commits into from
Apr 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/all-badge-examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -2116,7 +2116,7 @@ const allBadgeExamples = [
},
{
title: 'Vaadin Directory',
previewUri: '/vaadin-directory/star/vaadinvaadin-grid.svg',
previewUri: '/vaadin-directory/stars/vaadinvaadin-grid.svg',
keywords: [
'vaadin-directory',
'vaadin directory',
Expand Down
11 changes: 7 additions & 4 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7846,7 +7846,7 @@ cache(function(data, match, sendBadge, request) {
}));

// Vaadin Directory Integration
camp.route(/^\/vaadin-directory\/(star|status|rating|rc|rating-count|v|version|rd|release-date)\/(.*).(svg|png|gif|jpg|json)$/, cache(function (data, match, sendBadge, request) {
camp.route(/^\/vaadin-directory\/(star|stars|status|rating|rc|rating-count|v|version|rd|release-date)\/(.*).(svg|png|gif|jpg|json)$/, cache(function (data, match, sendBadge, request) {
var type = match[1]; // Field required
var urlIdentifier = match[2]; // Name of repository
var format = match[3]; // Format
Expand All @@ -7869,8 +7869,11 @@ camp.route(/^\/vaadin-directory\/(star|status|rating|rc|rating-count|v|version|r
var lv = data.latestAvailableRelease.name.toLowerCase();
var ld = data.latestAvailableRelease.publicationDate;
switch (type) {
case 'star': // Star
badgeData.text[0] = getLabel('rating', data);
// Since the first deploy was with `star`, I put the case there
// for safety pre-caution
case 'star':
case 'stars': // Stars
badgeData.text[0] = getLabel('stars', data);
badgeData.text[1] = starRating(rating);
badgeData.colorscheme = floorCountColor(rating, 2, 3, 4);
break;
Expand Down Expand Up @@ -7902,7 +7905,7 @@ camp.route(/^\/vaadin-directory\/(star|status|rating|rc|rating-count|v|version|r
case 'version':
badgeData.text[0] = getLabel('latest ver', data);
badgeData.text[1] = lv;
badgeData.colorscheme = "blue";
badgeData.colorB = '#00b4f0';
break;
case 'rd':
case 'release-date': // The release date of the latest version
Expand Down
15 changes: 11 additions & 4 deletions services/vaadin-directory/vaadin-directory.tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,17 @@ const t = new ServiceTester({
});
module.exports = t;

t.create('star of component displayed in star icons')
t.create('stars of component displayed in star icons')
.get('/star/vaadinvaadin-grid.json')
.expectJSONTypes(Joi.object().keys({
name: 'rating',
name: 'stars',
value: isStarRating
}));

t.create('stars of component displayed in star icons')
.get('/stars/vaadinvaadin-grid.json')
.expectJSONTypes(Joi.object().keys({
name: 'stars',
value: isStarRating
}));

Expand Down Expand Up @@ -80,14 +87,14 @@ t.create('latest release date of the component (format: yyyy-mm-dd)')
}));

t.create('Invalid addon')
.get('/star/404.json')
.get('/stars/404.json')
.expectJSON({
name: 'Vaadin Directory',
value: 'not found'
});

t.create('No connection')
.get('/star/vaadinvaadin-grid.json')
.get('/stars/vaadinvaadin-grid.json')
.networkOff()
.expectJSON({
name: 'Vaadin Directory',
Expand Down