Add static preview to some [GitHub] services (#2766)
This commit is contained in:
@@ -12,6 +12,11 @@ const {
|
||||
checkErrorResponse: githubCheckErrorResponse,
|
||||
} = require('./github-helpers')
|
||||
|
||||
const commonExampleAttrs = {
|
||||
keywords: ['activity', 'latest'],
|
||||
documentation,
|
||||
}
|
||||
|
||||
// This legacy service should be rewritten to use e.g. BaseJsonService.
|
||||
//
|
||||
// Tips for rewriting:
|
||||
@@ -26,6 +31,7 @@ module.exports = class GithubLastCommit extends LegacyService {
|
||||
static get route() {
|
||||
return {
|
||||
base: 'github/last-commit',
|
||||
pattern: ':user/:repo/:branch*',
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,15 +39,32 @@ module.exports = class GithubLastCommit extends LegacyService {
|
||||
return [
|
||||
{
|
||||
title: 'GitHub last commit',
|
||||
previewUrl: 'google/skia',
|
||||
keywords: ['GitHub', 'last', 'latest', 'commit'],
|
||||
documentation,
|
||||
pattern: ':user/:repo',
|
||||
namedParams: {
|
||||
user: 'google',
|
||||
repo: 'skia',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'last commit',
|
||||
message: 'today',
|
||||
color: 'brightgreen',
|
||||
},
|
||||
...commonExampleAttrs,
|
||||
},
|
||||
{
|
||||
title: 'GitHub last commit (branch)',
|
||||
previewUrl: 'google/skia/infra/config',
|
||||
keywords: ['GitHub', 'last', 'latest', 'commit'],
|
||||
documentation,
|
||||
pattern: ':user/:repo/:branch',
|
||||
namedParams: {
|
||||
user: 'google',
|
||||
repo: 'skia',
|
||||
branch: 'infra/config',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'last commit',
|
||||
message: 'april 2018',
|
||||
color: 'yellow',
|
||||
},
|
||||
...commonExampleAttrs,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user