mirror of
https://github.com/status-im/github-comment-manager.git
synced 2025-02-20 13:18:24 +00:00
remove sconds when displaying duration
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
55baa44d2e
commit
20ac4cf8cd
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "github-comment-manager",
|
||||
"version": "0.0.1",
|
||||
"version": "0.1.0",
|
||||
"description": "Minimal API for managing GitHub comments for CIclicks.",
|
||||
"repository": "https://github.com/status-im/github-comment-manager",
|
||||
"main": "index.js",
|
||||
|
@ -23,6 +23,11 @@ const dateHelper = (data) => {
|
||||
)
|
||||
}
|
||||
|
||||
/* remove seconds from duration to make columns equal width */
|
||||
const shortenDuration = (data) => {
|
||||
return data.replace(/ [0-9]+ sec$/, '')
|
||||
}
|
||||
|
||||
/* adds archive attribute to builds to mark for folding in template */
|
||||
const extractArchiveBuilds = (builds) => {
|
||||
/* get unique commits */
|
||||
@ -46,6 +51,8 @@ class Comments {
|
||||
this.owner = owner /* name of user who makes the comments */
|
||||
/* add helper for formatting dates */
|
||||
Handlebars.registerHelper('date', dateHelper)
|
||||
/* add helper for shortening duration field */
|
||||
Handlebars.registerHelper('shortenDuration', shortenDuration)
|
||||
/* add helper for checking change in commit */
|
||||
Handlebars.registerHelper('commitChanged', commitHelper)
|
||||
/* add partis */
|
||||
|
@ -22,9 +22,9 @@ const buildsTable = `
|
||||
`.trim()
|
||||
const buildRow = `
|
||||
{{#if this.success}}
|
||||
| :heavy_check_mark: | {{ this.commit }} | [{{ this.id }}]({{ this.url }}) | {{date this.meta.created }} | {{ this.duration }} | \`{{ this.platform }}\` | [:package: package]({{ this.pkg_url }}) |
|
||||
| :heavy_check_mark: | {{ this.commit }} | [{{ this.id }}]({{ this.url }}) | {{date this.meta.created }} | {{ shortenDuration this.duration }} | \`{{ this.platform }}\` | [:package: package]({{ this.pkg_url }}) |
|
||||
{{else}}
|
||||
| :x: | {{ this.commit }} | [{{ this.id }}]({{ this.url }}) | {{date this.meta.created }} | {{ this.duration }} | \`{{ this.platform }}\` | [:page_facing_up: build log]({{ this.url }}consoleText) |
|
||||
| :x: | {{ this.commit }} | [{{ this.id }}]({{ this.url }}) | {{date this.meta.created }} | {{ shortenDuration this.duration }} | \`{{ this.platform }}\` | [:page_facing_up: build log]({{ this.url }}consoleText) |
|
||||
{{/if}}
|
||||
`.trim()
|
||||
module.exports = { main, partials: {buildRow, buildsTable} }
|
||||
|
@ -14,7 +14,7 @@ const getBuild = (idx) => ({
|
||||
commit: `COMMIT-${Math.floor(idx/4)}`,
|
||||
success: (idx%3) ? true : false,
|
||||
platform: `PLATFORM-${idx}`,
|
||||
duration: `DURATION-${idx}`,
|
||||
duration: `DURATION-${idx} 12 sec`,
|
||||
url: `URL-${idx}`,
|
||||
pkg_url: `PKG_URL-${idx}`,
|
||||
meta: { created: 1545294300000+(idx*56789) },
|
||||
|
Loading…
x
Reference in New Issue
Block a user