mirror of
https://github.com/documize/community.git
synced 2025-07-24 23:59:47 +02:00
Merge pull request #39 from documize/section-rework
Section rework, making Trello and Github sections simpler, with a cleaner design
This commit is contained in:
commit
5bf63cf789
20 changed files with 334 additions and 309 deletions
|
@ -41,6 +41,9 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
|||
branchLines: "100",
|
||||
userId: "",
|
||||
pageId: page.get('id'),
|
||||
showMilestones: false,
|
||||
showIssues: false,
|
||||
showCommits: false,
|
||||
};
|
||||
|
||||
try {
|
||||
|
@ -50,6 +53,9 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
|||
config.branchSince = metaConfig.branchSince;
|
||||
config.userId = metaConfig.userId;
|
||||
config.pageId = metaConfig.pageId;
|
||||
config.showMilestones = metaConfig.showMilestones;
|
||||
config.showIssues = metaConfig.showIssues;
|
||||
config.showCommits = metaConfig.showCommits;
|
||||
} catch (e) {}
|
||||
|
||||
self.set('config', config);
|
||||
|
@ -168,12 +174,16 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
|||
return this.get('isDirty');
|
||||
},
|
||||
|
||||
onListCheckbox(id) {
|
||||
onListCheckbox(id) { // select one repository only
|
||||
let lists = this.get('config.lists');
|
||||
let list = lists.findBy('id', id);
|
||||
|
||||
lists.forEach(function (entry) {
|
||||
Ember.set(entry, 'included', false);
|
||||
});
|
||||
|
||||
if (list !== null) {
|
||||
Ember.set(list, 'included', !list.included);
|
||||
Ember.set(list, 'included', true);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@ html {
|
|||
background-color: $color-white;
|
||||
font-size: 14px;
|
||||
height: 100%;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
text-shadow: 1px 1px 1px rgba(0,0,0,0.004);
|
||||
}
|
||||
|
||||
body {
|
||||
|
@ -46,6 +48,8 @@ a {
|
|||
color: $color-link;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
text-shadow: 1px 1px 1px rgba(0,0,0,0.004);
|
||||
|
||||
a:hover, a:focus {
|
||||
text-decoration: underline;
|
||||
|
|
|
@ -21,10 +21,10 @@ $color-gray: #8b9096;
|
|||
$color-goldy: #cc9933;
|
||||
|
||||
$color-header: #f3f5f8;
|
||||
$color-link: #4caf50;
|
||||
$color-link: #0092d3;
|
||||
$color-border: #e1e1e1;
|
||||
|
||||
$color-input: #a1a1a1;
|
||||
$color-input: #5a5a5a;
|
||||
$color-stroke: #e1e1e1;
|
||||
|
||||
$color-tooltip: #a1a1a1;
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
.section-github-editor {
|
||||
.github-view label {
|
||||
margin: 0 10px;
|
||||
}
|
||||
|
||||
.github-repo {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
|
@ -40,8 +44,13 @@
|
|||
}
|
||||
|
||||
.section-github-render {
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.github-table {
|
||||
margin: 0 !important;
|
||||
margin: 10px 0 !important;
|
||||
border: none !important;
|
||||
line-height: 30px;
|
||||
|
||||
|
@ -56,63 +65,65 @@
|
|||
margin: 30px 0 0 0;
|
||||
}
|
||||
|
||||
.github-table thead tr th {
|
||||
padding: 15px 0;
|
||||
border-bottom: 1px solid #e1e1e1;
|
||||
text-transform: uppercase;
|
||||
font-size: 14px;
|
||||
text-align: left;
|
||||
|
||||
span {
|
||||
color:#838d94;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.github-table tbody tr td {
|
||||
border: none!important;
|
||||
padding: 5px 20px 5px 20px !important;
|
||||
}
|
||||
|
||||
.github-table .right-column {
|
||||
text-align: right;
|
||||
color:#838d94;
|
||||
}
|
||||
|
||||
span.data {
|
||||
color:#838d94;
|
||||
}
|
||||
|
||||
.issue-label {
|
||||
font-size: 11px;
|
||||
color: $color-white;
|
||||
padding: 0px 8px;
|
||||
margin-right: 5px;
|
||||
border-radius: 2px;
|
||||
box-shadow: inset 0 -1px 0 rgba(0,0,0,0.12);
|
||||
display: inline-block;
|
||||
line-height: 22px;
|
||||
color:white;
|
||||
font-size: 11px;
|
||||
padding: 4px 6px;
|
||||
border-radius: 4px;
|
||||
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12);
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
progress[value] {
|
||||
background-color: $color-off-white;
|
||||
border-radius: 3px;
|
||||
height: 15px;
|
||||
width: 150px;
|
||||
.progress-bar {
|
||||
display: inline-block; border-radius: 3px;
|
||||
width: 40%;
|
||||
background-color: #f1f1f1;
|
||||
height: 8px;
|
||||
margin-left: 10px;
|
||||
|
||||
.progress {
|
||||
height: 8px;
|
||||
border-radius: 4px;
|
||||
background-color: #4caf50;
|
||||
}
|
||||
}
|
||||
|
||||
.progress-meta {
|
||||
color: $color-gray;
|
||||
font-size: 1rem;
|
||||
font-family: "arial";
|
||||
span.issue-state {
|
||||
float: left;
|
||||
margin-right: 10px;
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
.contributor-name {
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.milestone-name, .issue-name, .contributor-name {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
.milestone-symbol {
|
||||
padding-top: 3px;
|
||||
}
|
||||
|
||||
.issue-symbol {
|
||||
padding-top: 3px;
|
||||
}
|
||||
|
||||
.contributor-meta {
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.milestone-meta, .issue-meta, .contributor-meta {
|
||||
color: $color-gray;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.github-avatar {
|
||||
img.github-avatar {
|
||||
width: 24px;
|
||||
border-radius: 4px;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.branch {
|
||||
font-family: "open_sanssemibold";
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,140 +53,51 @@
|
|||
}
|
||||
|
||||
.section-trello-render {
|
||||
.trello-table {
|
||||
border: none!important;
|
||||
margin: 0px !important;
|
||||
|
||||
td {
|
||||
border: none !important;
|
||||
vertical-align: top;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.heading {
|
||||
font-size: 1.6rem;
|
||||
margin: 30px 0 0 0;
|
||||
|
||||
h3 {
|
||||
font-size: 22px;
|
||||
margin: 0;
|
||||
font-family: "open_sanslight";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
table.trello-single-board {
|
||||
border: none!important;
|
||||
text-align: left;
|
||||
margin:0!important;
|
||||
}
|
||||
|
||||
.trello-single-board thead tr th {
|
||||
padding: 15px 0;
|
||||
border-bottom: 1px solid #e1e1e1;
|
||||
text-transform: uppercase;
|
||||
font-size: 14px;
|
||||
|
||||
span {
|
||||
color:#838d94;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.trello-single-board tbody tr td {
|
||||
border: none!important;
|
||||
padding: 5px 20px 5px 20px !important;
|
||||
}
|
||||
|
||||
.trello-label {
|
||||
color:white;
|
||||
font-size: 11px;
|
||||
color: #fff;
|
||||
padding: 0 8px;
|
||||
margin-right: 5px;
|
||||
border-radius: 2px;
|
||||
box-shadow: inset 0 -1px 0 rgba(0,0,0,.12);
|
||||
display: inline-block;
|
||||
line-height: 22px;
|
||||
text-shadow: 0 0 5px rgba(0,0,0,.2),0 0 2px #000;
|
||||
}
|
||||
|
||||
.board-stats {
|
||||
margin-bottom: 10px;
|
||||
td {
|
||||
color: $color-gray;
|
||||
padding: 20px 40px 30px 0px !important;
|
||||
}
|
||||
.stat-number {
|
||||
font-family: "open_sanslight";
|
||||
font-size: 40px;
|
||||
margin-right: 20px;
|
||||
color: black;
|
||||
}
|
||||
}
|
||||
|
||||
.trello-board {
|
||||
color: white;
|
||||
padding: 15px 20px;
|
||||
width: 190px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: inline-block;
|
||||
padding: 4px 6px;
|
||||
border-radius: 4px;
|
||||
margin-right: 20px;
|
||||
|
||||
span {
|
||||
display: table;
|
||||
font-size: 14px;
|
||||
line-height: 10px;
|
||||
opacity: 0.5;
|
||||
padding-bottom: 10px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12);
|
||||
margin-left: 14px;
|
||||
}
|
||||
|
||||
.board-summary {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
.member-name {
|
||||
font-size: 1.2rem;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.board-meta, .member-meta {
|
||||
color: $color-gray;
|
||||
}
|
||||
|
||||
.trello-avatar {
|
||||
border-radius: 4px;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
> .single-trello-board {
|
||||
width: 100%;
|
||||
max-height: 600px;
|
||||
padding: 10px;
|
||||
white-space: nowrap;
|
||||
overflow: auto;
|
||||
|
||||
> a {
|
||||
> .trello-board-title {
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
> .trello-list {
|
||||
background-color: #e2e4e6;
|
||||
padding: 10px;
|
||||
border-radius: 3px;
|
||||
margin: 10px 10px 0 0;
|
||||
width: 300px;
|
||||
max-height: 500px;
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
overflow: auto;
|
||||
vertical-align: top;
|
||||
|
||||
> .trello-list-title {
|
||||
font-weight: bold;
|
||||
color: #4c4c4c;
|
||||
font-size: 14px;
|
||||
margin: 0 10px 10px 0;
|
||||
}
|
||||
|
||||
> a {
|
||||
> .trello-card {
|
||||
color: #4c4c4c;
|
||||
border-bottom: 1px solid #CDD2D4;
|
||||
background-color: #fff;
|
||||
border-radius: 3px;
|
||||
padding: 7px 7px;
|
||||
margin: 5px 0;
|
||||
font-size: 14px;
|
||||
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
|
||||
line-height: 18px;
|
||||
overflow: hidden;
|
||||
word-wrap: break-word;
|
||||
white-space: normal;
|
||||
cursor: pointer;
|
||||
vertical-align: top;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,18 +7,30 @@
|
|||
<div class="pull-left width-45">
|
||||
<div class="input-form">
|
||||
<div class="heading">
|
||||
<div class="title">Select Repositories</div>
|
||||
<div class="title">Select Repository</div>
|
||||
<div class="tip">Choose source of code information to be displayed</div>
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>Organization or User</label>
|
||||
<div class="tip">Select organization or username whose repositories you want to show</div>
|
||||
<div class="tip">Select organization or username whose repository you want to show</div>
|
||||
{{ui-select id="owners-dropdown" content=owners action=(action 'onOwnerChange') optionValuePath="id" optionLabelPath="name" selection=config.owner}}
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>Show items since (default 7 days ago)</label>
|
||||
{{input id="branch-since" value=config.branchSince type="text" }}<br>
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>GitHub Views</label>
|
||||
<div class="tip">Select the views you want to show</div>
|
||||
<div class="github-view">
|
||||
{{input id="show-milestone" checked=config.showMilestones type="checkbox"}}
|
||||
<label>Show Milestones</label>
|
||||
{{input id="show-issues" checked=config.showIssues type="checkbox"}}
|
||||
<label>Show Issues</label>
|
||||
{{input id="show-commits" checked=config.showCommits type="checkbox" }}
|
||||
<label>Show Commits</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -28,7 +40,7 @@
|
|||
<div class="input-form">
|
||||
<div class="input-control">
|
||||
<label>Repositories</label>
|
||||
<div class="tip">Select the repositories to show</div>
|
||||
<div class="tip">Select the repository to show</div>
|
||||
<div class="github-board">
|
||||
{{#each config.lists as |list|}}
|
||||
<div class="github-list" {{action 'onListCheckbox' list.id}}>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<div class="color-error">You have no team boards to share - personal boards are never shown.</div>
|
||||
</div>
|
||||
{{else}}
|
||||
|
||||
<!--
|
||||
<div class="pull-left width-45">
|
||||
<div class="input-form">
|
||||
<div class="heading">
|
||||
|
@ -22,6 +22,7 @@
|
|||
{{input id="trello-since" value=config.since type="text" }}<br>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="input-control">
|
||||
<label>Select which boards you want to see</label>
|
||||
<div class="tip">All boards are selectd by default</div>
|
||||
|
@ -41,11 +42,12 @@
|
|||
<div class="clearfix" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pull-left width-10"> </div>
|
||||
|
||||
-->
|
||||
<div class="pull-left width-45">
|
||||
<div class="input-form">
|
||||
<div class="input-control">
|
||||
|
|
|
@ -26,7 +26,7 @@ type ProdInfo struct {
|
|||
// Product returns product edition details
|
||||
func Product() (p ProdInfo) {
|
||||
p.Major = "0"
|
||||
p.Minor = "20"
|
||||
p.Minor = "22"
|
||||
p.Patch = "0"
|
||||
p.Version = fmt.Sprintf("%s.%s.%s", p.Major, p.Minor, p.Patch)
|
||||
p.Edition = "Community"
|
||||
|
|
|
@ -90,6 +90,10 @@ const tagCommitsData = "commitsData"
|
|||
|
||||
func getCommits(client *gogithub.Client, config *githubConfig) ([]githubCommit, []githubAuthorStats, error) {
|
||||
|
||||
if !config.ShowCommits {
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
// first make sure we've got all the branches
|
||||
for _, orb := range config.Lists {
|
||||
if orb.Included {
|
||||
|
@ -253,6 +257,11 @@ func getCommits(client *gogithub.Client, config *githubConfig) ([]githubCommit,
|
|||
}
|
||||
|
||||
func refreshCommits(gr *githubRender, config *githubConfig, client *gogithub.Client) (err error) {
|
||||
|
||||
if !config.ShowCommits {
|
||||
return nil
|
||||
}
|
||||
|
||||
gr.BranchCommits, gr.AuthorStats, err = getCommits(client, config)
|
||||
if err != nil {
|
||||
log.Error("github refreshCommits:", err)
|
||||
|
@ -262,6 +271,11 @@ func refreshCommits(gr *githubRender, config *githubConfig, client *gogithub.Cli
|
|||
}
|
||||
|
||||
func renderCommits(payload *githubRender, c *githubConfig) error {
|
||||
|
||||
if !c.ShowCommits {
|
||||
return nil
|
||||
}
|
||||
|
||||
payload.CommitCount = 0
|
||||
for range payload.BranchCommits {
|
||||
payload.CommitCount++
|
||||
|
|
|
@ -13,6 +13,7 @@ package github
|
|||
|
||||
const commitsTemplate = `
|
||||
<div class="section-github-render">
|
||||
<!--
|
||||
{{if .HasAuthorStats}}
|
||||
<div class="heading">Contributors</div>
|
||||
<p>
|
||||
|
@ -24,8 +25,15 @@ const commitsTemplate = `
|
|||
{{if eq 1 .RepoCount}} repository. {{else}} repositories. {{end}}
|
||||
</p>
|
||||
|
||||
<div class="margin-top-20"></div>
|
||||
<table class="github-table">
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="title">Contributors</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{{range $stats := .AuthorStats}}
|
||||
<tr>
|
||||
|
@ -51,35 +59,36 @@ const commitsTemplate = `
|
|||
{{range $repo := $stats.Repos}} · {{$repo}} {{end}}
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="margin-top-10"></div>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{end}}
|
||||
-->
|
||||
|
||||
{{if .HasCommits}}
|
||||
<div class="heading">Commits</div>
|
||||
<p>There are {{len .BranchCommits}} commits by {{.NumContributors}} contributors across {{.RepoCount}}
|
||||
{{if eq 1 .RepoCount}} repository. {{else}} repositories. {{end}}
|
||||
</p>
|
||||
<div class="margin-top-20"></div>
|
||||
<table class="github-table">
|
||||
<table class="github-table" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="title">Commits <span>· {{len .BranchCommits}} commits by {{.NumContributors}} contributors</span>
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range $commit := .BranchCommits}}
|
||||
<tr>
|
||||
<td style="no-width">
|
||||
<img class="github-avatar" alt="@{{$commit.Name}}" src="{{$commit.Avatar}}" />
|
||||
</td>
|
||||
<td>
|
||||
<div class="contributor-name"><a href="{{$commit.URL}}">{{$commit.Message}}</a></div>
|
||||
<a href="{{$commit.URL}}">{{$commit.Message}}</a>
|
||||
<span class="data"> {{$commit.Branch}}</span>
|
||||
</td>
|
||||
<td class="right-column">
|
||||
<div class="contributor-meta">
|
||||
<img class="github-avatar" alt="@{{$commit.Name}}" src="{{$commit.Avatar}}" />
|
||||
{{$commit.Name}}
|
||||
{{if $commit.ShowDate}} · {{$commit.Date}} {{end}}
|
||||
{{if $commit.ShowBranch}} · {{$commit.Repo}}:<span class="bold">{{$commit.Branch}}</span>{{end}}
|
||||
· {{$commit.Date}}
|
||||
</div>
|
||||
<div class="margin-top-10"></div>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
|
|
|
@ -15,6 +15,7 @@ import (
|
|||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
//"fmt"
|
||||
"html/template"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
|
@ -235,6 +236,9 @@ func (p *Provider) Render(ctx *provider.Context, config, data string) string {
|
|||
|
||||
if err != nil {
|
||||
log.Error("github render template.Parse error:", err)
|
||||
//for k, v := range strings.Split(rep.template, "\n") {
|
||||
// fmt.Println("DEBUG", k+1, v)
|
||||
//}
|
||||
return "Documize internal github template.Parse error: " + err.Error()
|
||||
}
|
||||
|
||||
|
|
|
@ -106,6 +106,10 @@ func wrapLabels(labels []gogithub.Label) (l string, labelNames []string, labelCo
|
|||
|
||||
func getIssues(client *gogithub.Client, config *githubConfig) ([]githubIssue, error) {
|
||||
|
||||
if !config.ShowIssues {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
ret := []githubIssue{}
|
||||
|
||||
hadRepo := make(map[string]bool)
|
||||
|
@ -183,6 +187,11 @@ func getIssues(client *gogithub.Client, config *githubConfig) ([]githubIssue, er
|
|||
}
|
||||
|
||||
func refreshIssues(gr *githubRender, config *githubConfig, client *gogithub.Client) (err error) {
|
||||
|
||||
if !config.ShowIssues {
|
||||
return nil
|
||||
}
|
||||
|
||||
gr.Issues, err = getIssues(client, config)
|
||||
if err != nil {
|
||||
log.Error("unable to get github issues (cmd)", err)
|
||||
|
|
|
@ -13,14 +13,14 @@ package github
|
|||
|
||||
const (
|
||||
openIsvg = `
|
||||
<span title="Open issue">
|
||||
<span class="issue-state" title="Open Issue">
|
||||
<svg height="16" version="1.1" viewBox="0 0 14 16" width="14" class="color:#6cc644;">
|
||||
<path d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path>
|
||||
</svg>
|
||||
</span>
|
||||
`
|
||||
closedIsvg = `
|
||||
<span title="Closed issue">
|
||||
<span class="issue-state" title="Closed Issue">
|
||||
<svg height="16" version="1.1" viewBox="0 0 16 16" width="16" class="color:#bd2c00;">
|
||||
<path d="M7 10h2v2H7v-2zm2-6H7v5h2V4zm1.5 1.5l-1 1L12 9l4-4.5-1-1L12 7l-1.5-1.5zM8 13.7A5.71 5.71 0 0 1 2.3 8c0-3.14 2.56-5.7 5.7-5.7 1.83 0 3.45.88 4.5 2.2l.92-.92A6.947 6.947 0 0 0 8 1C4.14 1 1 4.14 1 8s3.14 7 7 7 7-3.14 7-7l-1.52 1.52c-.66 2.41-2.86 4.19-5.48 4.19v-.01z"></path>
|
||||
</svg>
|
||||
|
@ -29,35 +29,34 @@ const (
|
|||
issuesTemplate = `
|
||||
<div class="section-github-render">
|
||||
{{if .HasIssues}}
|
||||
<div class="heading">Issues</div>
|
||||
<p>
|
||||
There are {{.ClosedIssues}} closed
|
||||
{{if eq 1 .ClosedIssues}}issue{{else}}issues{{end}}
|
||||
and {{.OpenIssues}} open
|
||||
{{if eq 1 .OpenIssues}}issue{{else}}issues{{end}}
|
||||
across {{.RepoCount}}
|
||||
{{if eq 1 .RepoCount}} repository. {{else}} repositories. {{end}}
|
||||
</p>
|
||||
<table class="github-table" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="title">
|
||||
Issues <span>· {{.ClosedIssues}} closed {{if eq 1 .ClosedIssues}}{{else}}issues{{end}} and {{.OpenIssues}} open
|
||||
{{if eq 1 .OpenIssues}}issue{{else}}{{end}}</span>
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<div class="margin-top-20"></div>
|
||||
<table class="github-table">
|
||||
<tbody>
|
||||
{{range $data := .Issues}}
|
||||
<tr>
|
||||
<td class="no-width">
|
||||
<div class="issue-symbol">
|
||||
{{if $data.IsOpen}}
|
||||
` + openIsvg + `
|
||||
{{else}}
|
||||
` + closedIsvg + `
|
||||
{{end}}
|
||||
</div>
|
||||
</td>
|
||||
<td><div class="margin-left-10"></div></td>
|
||||
<td>
|
||||
<div class="issue-name"><a href="{{$data.URL}}">{{$data.Message}} <span class="dataid"></span></a></div>
|
||||
<span class="milestone-meta">#{{$data.ID}} · {{$data.Repo}} · {{$data.Milestone}} · {{$data.Creator}} opened on {{$data.Date}}</span>
|
||||
<div>{{$data.Labels}}</div>
|
||||
{{if $data.IsOpen}}
|
||||
` + openIsvg + `
|
||||
{{else}}
|
||||
` + closedIsvg + `
|
||||
{{end}}
|
||||
<a href="{{$data.URL}}">{{$data.Message}}</a> <span class="data">#{{$data.ID}}</span>
|
||||
{{$data.Labels}}
|
||||
</td>
|
||||
<td class="right-column">
|
||||
<div class="milestone-meta">
|
||||
<span class="meta-milestone">{{$data.Milestone}}</span> ·
|
||||
<span class="meta-creator">{{$data.Creator}}</span> · <span class="meta-date">{{$data.Date}}</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
|
|
|
@ -79,6 +79,10 @@ func init() {
|
|||
|
||||
func getMilestones(client *gogithub.Client, config *githubConfig) ([]githubMilestone, error) {
|
||||
|
||||
if !config.ShowMilestones {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
ret := []githubMilestone{}
|
||||
|
||||
hadRepo := make(map[string]bool)
|
||||
|
@ -115,7 +119,7 @@ func getMilestones(client *gogithub.Client, config *githubConfig) ([]githubMiles
|
|||
dd := "no due date"
|
||||
if v.DueOn != nil {
|
||||
// TODO refactor to add message in red if the milestone is overdue
|
||||
dd = "due on " + (*v.DueOn).Format(milestonesTimeFormat) + ""
|
||||
dd = "due " + (*v.DueOn).Format(milestonesTimeFormat) + ""
|
||||
}
|
||||
up := ""
|
||||
if v.UpdatedAt != nil {
|
||||
|
@ -156,6 +160,10 @@ func getMilestones(client *gogithub.Client, config *githubConfig) ([]githubMiles
|
|||
|
||||
func refreshMilestones(gr *githubRender, config *githubConfig, client *gogithub.Client) (err error) {
|
||||
|
||||
if !config.ShowMilestones {
|
||||
return nil
|
||||
}
|
||||
|
||||
gr.Milestones, err = getMilestones(client, config)
|
||||
if err != nil {
|
||||
log.Error("unable to get github milestones", err)
|
||||
|
@ -176,6 +184,11 @@ func refreshMilestones(gr *githubRender, config *githubConfig, client *gogithub.
|
|||
}
|
||||
|
||||
func renderMilestones(payload *githubRender, c *githubConfig) error {
|
||||
|
||||
if !c.ShowMilestones {
|
||||
return nil
|
||||
}
|
||||
|
||||
hadRepo := make(map[string]bool)
|
||||
payload.RepoCount = 0
|
||||
for _, orb := range payload.List {
|
||||
|
@ -197,10 +210,10 @@ func renderMilestones(payload *githubRender, c *githubConfig) error {
|
|||
}
|
||||
}
|
||||
if issuesClosed+issuesOpen > 0 {
|
||||
payload.Milestones = append(payload.Milestones, githubMilestone{
|
||||
Repo: orb.Repo, Private: orb.Private, Name: noMilestone, IsOpen: true,
|
||||
OpenIssues: issuesOpen, ClosedIssues: issuesClosed, URL: template.URL(orb.URL),
|
||||
})
|
||||
//payload.Milestones = append(payload.Milestones, githubMilestone{
|
||||
// Repo: orb.Repo, Private: orb.Private, Name: noMilestone, IsOpen: true,
|
||||
// OpenIssues: issuesOpen, ClosedIssues: issuesClosed, URL: template.URL(orb.URL),
|
||||
//})
|
||||
}
|
||||
|
||||
hadRepo[rName] = true
|
||||
|
|
|
@ -14,15 +14,15 @@ package github
|
|||
const (
|
||||
rawMSsvg = `<path d="M8 2H6V0h2v2zm4 5H2c-.55 0-1-.45-1-1V4c0-.55.45-1 1-1h10l2 2-2 2zM8 4H6v2h2V4zM6 16h2V8H6v8z"></path>`
|
||||
openMSsvg = `
|
||||
<span title="Open milestone">
|
||||
<span class="issue-state" title="Open Milestone">
|
||||
<svg height="16" width="14" version="1.1" viewBox="0 0 14 16">
|
||||
` + rawMSsvg + `
|
||||
</svg>
|
||||
</span>
|
||||
`
|
||||
closedMSsvg = `
|
||||
<span title="Closed milestone">
|
||||
<svg aria-hidden="true" class="octicon octicon-check" height="16" version="1.1" viewBox="0 0 12 16" width="12">
|
||||
<span class="issue-state" title="Closed Milestone">
|
||||
<svg aria-hidden="true" class="octicon octicon-check" height="16" height="14" version="1.1" viewBox="0 0 12 16">
|
||||
<path d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"></path>
|
||||
</svg>
|
||||
</span>
|
||||
|
@ -30,48 +30,40 @@ const (
|
|||
milestonesTemplate = `
|
||||
<div class="section-github-render">
|
||||
{{if .HasMilestones}}
|
||||
<div class="heading">Milestones</div>
|
||||
<p>
|
||||
There are
|
||||
{{.ClosedMS}}
|
||||
{{if eq 1 .ClosedMS}} milestone {{else}} milestones {{end}}
|
||||
closed and {{.OpenMS}}
|
||||
{{if eq 1 .OpenMS}} milestone {{else}} milestones {{end}}
|
||||
open across {{.RepoCount}}
|
||||
{{if eq 1 .RepoCount}} repository. {{else}} repositories. {{end}}
|
||||
</p>
|
||||
<div class="margin-top-20"></div>
|
||||
<table class="github-table">
|
||||
<tbody>
|
||||
<table class="github-table" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="title">Milestones <span>· {{.ClosedMS}} closed and {{.OpenMS}} open</span>
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{{range $data := .Milestones}}
|
||||
<tr>
|
||||
<td class="no-width">
|
||||
<div class="milestone-symbol">
|
||||
{{if $data.IsMilestone}}
|
||||
{{if $data.IsOpen}}
|
||||
` + openMSsvg + `
|
||||
{{else}}
|
||||
` + closedMSsvg + `
|
||||
{{end}}
|
||||
<td>
|
||||
{{if $data.IsMilestone}}
|
||||
{{if $data.IsOpen}}
|
||||
` + openMSsvg + `
|
||||
{{else}}
|
||||
` + closedMSsvg + `
|
||||
{{end}}
|
||||
</div>
|
||||
</td>
|
||||
<td><div class="margin-left-10"></div></td>
|
||||
<td>
|
||||
<div class="milestone-name"><a class="link" href="{{$data.URL}}">{{$data.Name}}</a></div>
|
||||
<span class="milestone-meta">{{$data.Repo}}</span>
|
||||
{{if $data.IsMilestone}}
|
||||
<span class="milestone-meta">· {{$data.DueDate}}</span>
|
||||
{{end}}
|
||||
<a class="link" href="{{$data.URL}}">{{$data.Name}}</a>
|
||||
<span class="data"> · {{if $data.IsMilestone}} {{$data.DueDate}}{{end}} </span>
|
||||
</td>
|
||||
<td><div class="margin-left-150"></div></td>
|
||||
<td class="no-width">
|
||||
<td class="right-column">
|
||||
{{if $data.IsMilestone}}
|
||||
<progress value="{{$data.Progress}}" max="100"></progress>
|
||||
<div class="progress-meta"><span class="bold color-off-black">{{$data.CompleteMsg}}</span> complete <span class="bold color-off-black">{{$data.OpenIssues}}</span> open <span class="bold color-off-black">{{$data.ClosedIssues}}</span> closed</div>
|
||||
<span class="bold color-off-black">{{$data.CompleteMsg}}</span> complete
|
||||
<span class="bold color-off-black">{{$data.OpenIssues}}</span> open
|
||||
<span class="bold color-off-black">{{$data.ClosedIssues}}</span> closed
|
||||
{{else}}
|
||||
<div class="progress-meta"><span class="bold color-off-black">{{$data.OpenIssues}}</span> open <span class="bold color-off-black">{{$data.ClosedIssues}}</span> closed</div>
|
||||
<span class="bold color-off-black">{{$data.OpenIssues}}</span> open <span class="bold color-off-black">{{$data.ClosedIssues}}</span> closed
|
||||
{{end}}
|
||||
<div class="progress-bar">
|
||||
<div class="progress" style="width:{{$data.Progress}}%;"></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
|
|
|
@ -84,21 +84,24 @@ type githubLabel struct {
|
|||
}
|
||||
|
||||
type githubConfig struct {
|
||||
Token string `json:"-"` // NOTE very important that the secret Token is not leaked to the client side, so "-"
|
||||
UserID string `json:"userId"`
|
||||
PageID string `json:"pageId"`
|
||||
Owner string `json:"owner_name"`
|
||||
BranchSince string `json:"branchSince,omitempty"`
|
||||
SincePtr *time.Time `json:"-"`
|
||||
Since string `json:"-"`
|
||||
BranchLines int `json:"branchLines,omitempty,string"`
|
||||
OwnerInfo githubOwner `json:"owner"`
|
||||
ClientID string `json:"clientId"`
|
||||
CallbackURL string `json:"callbackUrl"`
|
||||
Lists []githubBranch `json:"lists,omitempty"`
|
||||
ReportOrder []string `json:"-"`
|
||||
DateMessage string `json:"-"`
|
||||
UserNames map[string]string `json:"UserNames"`
|
||||
Token string `json:"-"` // NOTE very important that the secret Token is not leaked to the client side, so "-"
|
||||
UserID string `json:"userId"`
|
||||
PageID string `json:"pageId"`
|
||||
Owner string `json:"owner_name"`
|
||||
BranchSince string `json:"branchSince,omitempty"`
|
||||
SincePtr *time.Time `json:"-"`
|
||||
Since string `json:"-"`
|
||||
BranchLines int `json:"branchLines,omitempty,string"`
|
||||
OwnerInfo githubOwner `json:"owner"`
|
||||
ClientID string `json:"clientId"`
|
||||
CallbackURL string `json:"callbackUrl"`
|
||||
Lists []githubBranch `json:"lists,omitempty"`
|
||||
ReportOrder []string `json:"-"`
|
||||
DateMessage string `json:"-"`
|
||||
UserNames map[string]string `json:"UserNames"`
|
||||
ShowMilestones bool `json:"showMilestones,omitempty"`
|
||||
ShowIssues bool `json:"showIssues,omitempty"`
|
||||
ShowCommits bool `json:"showCommits,omitempty"`
|
||||
}
|
||||
|
||||
func (c *githubConfig) Clean() {
|
||||
|
@ -125,7 +128,18 @@ func (c *githubConfig) Clean() {
|
|||
}
|
||||
c.Since = (*c.SincePtr).Format(issuesTimeFormat)
|
||||
|
||||
c.ReportOrder = []string{tagSummaryData, tagMilestonesData, tagIssuesData, tagCommitsData}
|
||||
c.ReportOrder = []string{tagSummaryData}
|
||||
|
||||
if c.ShowMilestones {
|
||||
c.ReportOrder = append(c.ReportOrder, tagMilestonesData)
|
||||
}
|
||||
if c.ShowIssues {
|
||||
c.ReportOrder = append(c.ReportOrder, tagIssuesData)
|
||||
}
|
||||
if c.ShowCommits {
|
||||
c.ReportOrder = append(c.ReportOrder, tagCommitsData)
|
||||
}
|
||||
|
||||
c.BranchLines = 100 // overide any existing value with maximum allowable in one call
|
||||
|
||||
sort.Sort(branchesToSort(c.Lists)) // get the configured branches in a sensible order for display
|
||||
|
|
|
@ -13,7 +13,7 @@ package github
|
|||
|
||||
const summaryTemplate = `
|
||||
<div class="section-github-render">
|
||||
<p>Activity since {{.Config.Since}}{{.Config.DateMessage}} for {{.Config.Owner}} repositories:
|
||||
<p>Activity since {{.Config.Since}}{{.Config.DateMessage}} for {{.Config.Owner}} repository
|
||||
{{range $data := .Config.Lists}}
|
||||
{{if $data.Included}}
|
||||
<a class="link" href="{{$data.URL}}">
|
||||
|
@ -23,6 +23,7 @@ const summaryTemplate = `
|
|||
{{end}}
|
||||
</p>
|
||||
|
||||
<!--
|
||||
{{if .HasSharedLabels}}
|
||||
<div class="heading">Labels</div>
|
||||
<p>There
|
||||
|
@ -42,5 +43,6 @@ const summaryTemplate = `
|
|||
</tbody>
|
||||
</table>
|
||||
{{end}}
|
||||
-->
|
||||
</div>
|
||||
`
|
||||
|
|
|
@ -15,13 +15,13 @@ const renderTemplate = `
|
|||
{{if eq .Since ""}}
|
||||
<p>Preparing...</p>
|
||||
{{else}}
|
||||
<p>Activity since {{.Since}} for boards:
|
||||
{{range $idx, $brd := .Boards}}{{if gt $idx 0}}, {{end}}<a class="link" href="{{$brd.Board.URL}}">{{$brd.Board.OrgName}}/{{$brd.Board.Name}}</a>{{end}}.</p>
|
||||
<!-- <p>Activity since {{.Since}} for boards:
|
||||
{{range $idx, $brd := .Boards}}{{if gt $idx 0}}, {{end}}<a class="link" href="{{$brd.Board.URL}}">{{$brd.Board.OrgName}}/{{$brd.Board.Name}}</a>{{end}}.</p> -->
|
||||
{{end}}` +
|
||||
labelsTemplate +
|
||||
boardsTemplate +
|
||||
graphsTemplate +
|
||||
membersTemplate +
|
||||
archiveTemplate +
|
||||
//labelsTemplate +
|
||||
//boardsTemplate +
|
||||
//graphsTemplate +
|
||||
//membersTemplate +
|
||||
//archiveTemplate +
|
||||
tradTemplate +
|
||||
``
|
||||
|
|
|
@ -14,27 +14,46 @@ package trello
|
|||
const tradTemplate = `
|
||||
<div class="section-trello-render">
|
||||
{{if ne .Detail.Board.ID ""}}
|
||||
<div class="heading">{{.Detail.Board.Name}} Board</div>
|
||||
<div class="heading">
|
||||
<p>There are {{ .Detail.CardCount }} cards across {{ .Detail.ListCount }} lists on <a href="{{ .Detail.Board.URL }}">{{.Detail.Board.Name}} Board</a></p>
|
||||
</div>
|
||||
|
||||
<p class="non-printable-message">Non-printable</p>
|
||||
<div class="section-trello-render non-printable">
|
||||
<p>There are {{ .Detail.CardCount }} cards across {{ .Detail.ListCount }} lists
|
||||
for board <a href="{{ .Detail.Board.URL }}">{{.Detail.Board.Name}}.</a></p>
|
||||
<div class="single-trello-board" style="background-color: {{.Detail.Board.Prefs.BackgroundColor}}">
|
||||
<a href="{{ .Detail.Board.URL }}"><div class="trello-board-title">{{.Detail.Board.Name}}</div></a>
|
||||
<div class="single-trello-board">
|
||||
<table class="trello-single-board" style="width: 100%;">
|
||||
{{range $data := .Detail.Data}}
|
||||
<div class="trello-list">
|
||||
<div class="trello-list-title">{{ $data.List.Name }}</div>
|
||||
{{range $card := $data.Cards}}
|
||||
<a href="{{ $card.URL }}">
|
||||
<div class="trello-card">
|
||||
{{ $card.Name }}
|
||||
</div>
|
||||
</a>
|
||||
{{end}}
|
||||
</div>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="title">{{ $data.List.Name }} <span>· {{len $data.Cards}} cards</span></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{{range $card := $data.Cards}}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ $card.URL }}">
|
||||
<div class="trello-card">
|
||||
{{ $card.Name }}
|
||||
</div>
|
||||
</a>
|
||||
</td>
|
||||
<td style="text-align:right;">
|
||||
{{range $label := $card.Labels}}
|
||||
<span class="trello-label" style="background-color:{{$label.Color}}"> {{$label.Name}} </span>
|
||||
{{end}}
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
{{end}}
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
`
|
||||
|
|
|
@ -351,7 +351,7 @@ func getBoards(config *trelloConfig) (boards []trelloBoard, err error) {
|
|||
goto foundID
|
||||
}
|
||||
}
|
||||
boards[bx].Included = true // include boards by default
|
||||
boards[bx].Included = false // don't include boards by default
|
||||
foundID:
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue