Projects plugin : Add new option plugin_projects_descriptions (#75)
This commit is contained in:
@@ -374,6 +374,11 @@ inputs:
|
|||||||
description: Number of active projects to display
|
description: Number of active projects to display
|
||||||
default: 4
|
default: 4
|
||||||
|
|
||||||
|
# Display projects descriptions if enabled
|
||||||
|
plugin_projects_descriptions:
|
||||||
|
description: Display projects descriptions
|
||||||
|
default: no
|
||||||
|
|
||||||
# Tweets plugin
|
# Tweets plugin
|
||||||
# Enable it to display recent tweets of the twitter username attached to "user"
|
# Enable it to display recent tweets of the twitter username attached to "user"
|
||||||
plugin_tweets:
|
plugin_tweets:
|
||||||
|
|||||||
@@ -210,6 +210,8 @@
|
|||||||
info(`Projects ${option}`, q[`projects.${option}`] = input.string(`plugin_projects_${option}`))
|
info(`Projects ${option}`, q[`projects.${option}`] = input.string(`plugin_projects_${option}`))
|
||||||
for (const option of ["limit"])
|
for (const option of ["limit"])
|
||||||
info(`Projects ${option}`, q[`projects.${option}`] = input.number(`plugin_projects_${option}`))
|
info(`Projects ${option}`, q[`projects.${option}`] = input.number(`plugin_projects_${option}`))
|
||||||
|
for (const option of ["descriptions"])
|
||||||
|
info(`Projects ${option}`, q[`projects.${option}`] = input.bool(`plugin_projects_${option}`))
|
||||||
}
|
}
|
||||||
//Tweets
|
//Tweets
|
||||||
if (plugins.tweets.enabled) {
|
if (plugins.tweets.enabled) {
|
||||||
|
|||||||
@@ -210,7 +210,7 @@
|
|||||||
}
|
}
|
||||||
//Gists query
|
//Gists query
|
||||||
if (/^query Gists /.test(query)) {
|
if (/^query Gists /.test(query)) {
|
||||||
console.debug(`metrics/compute/mocks > mocking graphql api result > Projects`)
|
console.debug(`metrics/compute/mocks > mocking graphql api result > Gists`)
|
||||||
return /after: "MOCKED_CURSOR"/m.test(query) ? ({
|
return /after: "MOCKED_CURSOR"/m.test(query) ? ({
|
||||||
user:{
|
user:{
|
||||||
gists:{
|
gists:{
|
||||||
@@ -258,6 +258,7 @@
|
|||||||
{
|
{
|
||||||
name:"User-owned project",
|
name:"User-owned project",
|
||||||
updatedAt:`${faker.date.recent()}`,
|
updatedAt:`${faker.date.recent()}`,
|
||||||
|
body:faker.lorem.paragraph(),
|
||||||
progress:{
|
progress:{
|
||||||
doneCount:faker.random.number(10),
|
doneCount:faker.random.number(10),
|
||||||
inProgressCount:faker.random.number(10),
|
inProgressCount:faker.random.number(10),
|
||||||
@@ -279,6 +280,7 @@
|
|||||||
project:{
|
project:{
|
||||||
name:"Repository project example",
|
name:"Repository project example",
|
||||||
updatedAt:`${faker.date.recent()}`,
|
updatedAt:`${faker.date.recent()}`,
|
||||||
|
body:faker.lorem.paragraph(),
|
||||||
progress:{
|
progress:{
|
||||||
doneCount:faker.random.number(10),
|
doneCount:faker.random.number(10),
|
||||||
inProgressCount:faker.random.number(10),
|
inProgressCount:faker.random.number(10),
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
if ((!enabled)||(!q.projects))
|
if ((!enabled)||(!q.projects))
|
||||||
return null
|
return null
|
||||||
//Parameters override
|
//Parameters override
|
||||||
let {"projects.limit":limit = 4, "projects.repositories":repositories = ""} = q
|
let {"projects.limit":limit = 4, "projects.repositories":repositories = "", "projects.descriptions":descriptions = false} = q
|
||||||
//Repositories projects
|
//Repositories projects
|
||||||
repositories = decodeURIComponent(repositories ?? "").split(",").map(repository => repository.trim()).filter(repository => /[-\w]+[/][-\w]+[/]projects[/]\d+/.test(repository)) ?? []
|
repositories = decodeURIComponent(repositories ?? "").split(",").map(repository => repository.trim()).filter(repository => /[-\w]+[/][-\w]+[/]projects[/]\d+/.test(repository)) ?? []
|
||||||
//Limit
|
//Limit
|
||||||
@@ -41,13 +41,13 @@
|
|||||||
//Format progress
|
//Format progress
|
||||||
const {enabled, todoCount:todo, inProgressCount:doing, doneCount:done} = project.progress
|
const {enabled, todoCount:todo, inProgressCount:doing, doneCount:done} = project.progress
|
||||||
//Append
|
//Append
|
||||||
list.push({name:project.name, updated, progress:{enabled, todo, doing, done, total:todo+doing+done}})
|
list.push({name:project.name, updated, description:project.body, progress:{enabled, todo, doing, done, total:todo+doing+done}})
|
||||||
}
|
}
|
||||||
//Limit
|
//Limit
|
||||||
console.debug(`metrics/compute/${login}/plugins > projects > keeping only ${limit} projects`)
|
console.debug(`metrics/compute/${login}/plugins > projects > keeping only ${limit} projects`)
|
||||||
list.splice(limit)
|
list.splice(limit)
|
||||||
//Results
|
//Results
|
||||||
return {list, totalCount:projects.totalCount}
|
return {list, totalCount:projects.totalCount, descriptions}
|
||||||
}
|
}
|
||||||
//Handle errors
|
//Handle errors
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ query Projects {
|
|||||||
totalCount
|
totalCount
|
||||||
nodes {
|
nodes {
|
||||||
name
|
name
|
||||||
|
body
|
||||||
updatedAt
|
updatedAt
|
||||||
progress {
|
progress {
|
||||||
doneCount
|
doneCount
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ query RepositoryProject {
|
|||||||
repository(name: "$repository") {
|
repository(name: "$repository") {
|
||||||
project(number: $id) {
|
project(number: $id) {
|
||||||
name
|
name
|
||||||
|
body
|
||||||
updatedAt
|
updatedAt
|
||||||
progress {
|
progress {
|
||||||
doneCount
|
doneCount
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<section>
|
<section class="project">
|
||||||
<% for (const {name, updated, progress} of plugins.projects.list) { %>
|
<% for (const {name, updated, progress, description = ""} of plugins.projects.list) { %>
|
||||||
<div class="row fill-width">
|
<div class="row fill-width">
|
||||||
<section>
|
<section>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
@@ -23,6 +23,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
<% if (plugins.projects.descriptions) { %>
|
||||||
|
<div class="row fill-width">
|
||||||
|
<section>
|
||||||
|
<div class="field description">
|
||||||
|
<%= description %>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<% } %>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<section>
|
<section>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
|
|||||||
@@ -511,6 +511,22 @@
|
|||||||
margin: 0 2px;
|
margin: 0 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Projects */
|
||||||
|
.project .description {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
display: block;
|
||||||
|
width: 420px;
|
||||||
|
margin-left: 37px;
|
||||||
|
max-height: 38px;
|
||||||
|
font-size: 12px;
|
||||||
|
white-space: normal;
|
||||||
|
/* May not work in all browsers */
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-line-clamp: 2;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
}
|
||||||
|
|
||||||
/* Fade animation */
|
/* Fade animation */
|
||||||
.af {
|
.af {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
|||||||
@@ -211,6 +211,12 @@
|
|||||||
plugin_projects_repositories:"lowlighter/metrics/projects/1",
|
plugin_projects_repositories:"lowlighter/metrics/projects/1",
|
||||||
plugin_projects_limit:0,
|
plugin_projects_limit:0,
|
||||||
}, {skip:["terminal"]}],
|
}, {skip:["terminal"]}],
|
||||||
|
["Projects plugin (descriptions)", {
|
||||||
|
plugin_projects:true,
|
||||||
|
plugin_projects_repositories:"lowlighter/metrics/projects/1",
|
||||||
|
plugin_projects_limit:0,
|
||||||
|
plugin_projects_descriptions:true,
|
||||||
|
}, {skip:["terminal"]}],
|
||||||
["Lines plugin (default)", {
|
["Lines plugin (default)", {
|
||||||
base:"repositories",
|
base:"repositories",
|
||||||
plugin_lines:true,
|
plugin_lines:true,
|
||||||
|
|||||||
Reference in New Issue
Block a user