mirror of
https://github.com/documize/community.git
synced 2025-08-10 07:55:25 +02:00
add repo open issues report
This commit is contained in:
parent
8649a47345
commit
6ca92a0dee
4 changed files with 270 additions and 78 deletions
|
@ -21,9 +21,9 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
authenticated: false,
|
authenticated: false,
|
||||||
config: {},
|
config: {},
|
||||||
owners: null,
|
owners: null,
|
||||||
noOwners: false, // TODO required?
|
|
||||||
repos: null,
|
repos: null,
|
||||||
noRepos: false,
|
noRepos: false,
|
||||||
|
showCommits: false,
|
||||||
|
|
||||||
didReceiveAttrs() {
|
didReceiveAttrs() {
|
||||||
let self = this;
|
let self = this;
|
||||||
|
@ -38,11 +38,12 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
clientId: cfg.clientID,
|
clientId: cfg.clientID,
|
||||||
callbackUrl: cfg.authorizationCallbackURL,
|
callbackUrl: cfg.authorizationCallbackURL,
|
||||||
token: "",
|
token: "",
|
||||||
repo: null,
|
|
||||||
lists: [],
|
|
||||||
owner: null,
|
owner: null,
|
||||||
owner_name: "",
|
owner_name: "",
|
||||||
|
repo: null,
|
||||||
repo_name: "",
|
repo_name: "",
|
||||||
|
report: null,
|
||||||
|
lists: [],
|
||||||
branch: "",
|
branch: "",
|
||||||
branchURL: "",
|
branchURL: "",
|
||||||
branchSince: "",
|
branchSince: "",
|
||||||
|
@ -53,6 +54,7 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
let metaConfig = JSON.parse(self.get('meta.config'));
|
let metaConfig = JSON.parse(self.get('meta.config'));
|
||||||
config.owner = metaConfig.owner;
|
config.owner = metaConfig.owner;
|
||||||
config.repo = metaConfig.repo;
|
config.repo = metaConfig.repo;
|
||||||
|
config.report = metaConfig.report;
|
||||||
config.lists = metaConfig.lists;
|
config.lists = metaConfig.lists;
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
|
@ -93,13 +95,6 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
|
|
||||||
console.log("owner", thisOwner);
|
console.log("owner", thisOwner);
|
||||||
|
|
||||||
if (is.null(owners) || is.undefined(owners) || owners.length === 0) {
|
|
||||||
this.set('noOwners', true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.set('noOwners', false);
|
|
||||||
|
|
||||||
if (is.null(thisOwner) || is.undefined(thisOwner)) {
|
if (is.null(thisOwner) || is.undefined(thisOwner)) {
|
||||||
if (owners.length) {
|
if (owners.length) {
|
||||||
thisOwner = owners[0];
|
thisOwner = owners[0];
|
||||||
|
@ -109,6 +104,8 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
this.set('config.owner', owners.findBy('id', thisOwner.id));
|
this.set('config.owner', owners.findBy('id', thisOwner.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.set('owner', thisOwner);
|
||||||
|
|
||||||
this.get('sectionService').fetch(page, "repos", self.get('config'))
|
this.get('sectionService').fetch(page, "repos", self.get('config'))
|
||||||
.then(function(lists) {
|
.then(function(lists) {
|
||||||
self.set('busy', false);
|
self.set('busy', false);
|
||||||
|
@ -125,10 +122,8 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
getRepoLists() {
|
getRepoLists() {
|
||||||
this.set('busy', true);
|
this.set('busy', true);
|
||||||
|
|
||||||
let self = this;
|
|
||||||
let repos = this.get('repos');
|
let repos = this.get('repos');
|
||||||
let thisRepo = this.get('config.repo');
|
let thisRepo = this.get('config.repo');
|
||||||
let page = this.get('page');
|
|
||||||
|
|
||||||
console.log("repo", thisRepo);
|
console.log("repo", thisRepo);
|
||||||
|
|
||||||
|
@ -139,7 +134,7 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
|
|
||||||
this.set('noRepos', false);
|
this.set('noRepos', false);
|
||||||
|
|
||||||
if (is.null(thisRepo) || is.undefined(thisRepo)) {
|
if (is.null(thisRepo) || is.undefined(thisRepo) || thisRepo.owner !== this.get('config.owner').name) {
|
||||||
if (repos.length) {
|
if (repos.length) {
|
||||||
thisRepo = repos[0];
|
thisRepo = repos[0];
|
||||||
this.set('config.repo', thisRepo);
|
this.set('config.repo', thisRepo);
|
||||||
|
@ -148,21 +143,88 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
this.set('config.repo', repos.findBy('id', thisRepo.id));
|
this.set('config.repo', repos.findBy('id', thisRepo.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.get('sectionService').fetch(page, "lists", self.get('config'))
|
this.set('repo', thisRepo);
|
||||||
|
|
||||||
|
this.getReportLists();
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
getReportLists() {
|
||||||
|
let reports = [];
|
||||||
|
reports[0] = {
|
||||||
|
id: "commits", // used as method for fetching Go data
|
||||||
|
name: "Commits on a branch"
|
||||||
|
};
|
||||||
|
reports[1] = {
|
||||||
|
id: "open_issues", // used as method for fetching Go data
|
||||||
|
name: "Open Issues"
|
||||||
|
};
|
||||||
|
|
||||||
|
this.set("reports", reports);
|
||||||
|
|
||||||
|
let thisReport = this.get('config.report');
|
||||||
|
|
||||||
|
console.log("report", thisReport);
|
||||||
|
|
||||||
|
if (is.null(thisReport) || is.undefined(thisReport)) {
|
||||||
|
thisReport = reports[0];
|
||||||
|
this.set('config.report', thisReport);
|
||||||
|
} else {
|
||||||
|
this.set('config.report', reports.findBy('id', thisReport.id));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.set('report', thisReport);
|
||||||
|
|
||||||
|
this.renderSwitch(thisReport);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
renderSwitch(thisReport) {
|
||||||
|
this.set('showCommits', false);
|
||||||
|
switch (thisReport.id) {
|
||||||
|
case 'commits':
|
||||||
|
this.set('showCommits', true);
|
||||||
|
this.getBranchLists();
|
||||||
|
break;
|
||||||
|
case "open_issues":
|
||||||
|
// nothing to show
|
||||||
|
this.set('busy', false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
getBranchLists() {
|
||||||
|
this.set('busy', true);
|
||||||
|
|
||||||
|
console.log("branches");
|
||||||
|
|
||||||
|
let self = this;
|
||||||
|
let page = this.get('page');
|
||||||
|
|
||||||
|
this.get('sectionService').fetch(page, "branches", self.get('config'))
|
||||||
.then(function(lists) {
|
.then(function(lists) {
|
||||||
let savedLists = self.get('config.lists');
|
let savedLists = self.get('config.lists');
|
||||||
if (savedLists === null) {
|
if (savedLists === null) {
|
||||||
savedLists = [];
|
savedLists = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
lists.forEach(function(list) {
|
if (lists.length > 0) {
|
||||||
let saved = savedLists.findBy("id", list.id);
|
let noIncluded = true;
|
||||||
let included = false;
|
|
||||||
if (is.not.undefined(saved)) {
|
lists.forEach(function(list) {
|
||||||
included = saved.included;
|
let saved = savedLists.findBy("id", list.id);
|
||||||
|
let included = false;
|
||||||
|
if (is.not.undefined(saved)) {
|
||||||
|
included = saved.included;
|
||||||
|
noIncluded = false;
|
||||||
|
}
|
||||||
|
list.included = included;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (noIncluded) {
|
||||||
|
lists[0].included = true; // make the first entry the default
|
||||||
}
|
}
|
||||||
list.included = included;
|
}
|
||||||
});
|
|
||||||
|
|
||||||
self.set('config.lists', lists);
|
self.set('config.lists', lists);
|
||||||
self.set('busy', false);
|
self.set('busy', false);
|
||||||
|
@ -226,10 +288,10 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
},
|
},
|
||||||
|
|
||||||
onOwnerChange(thisOwner) {
|
onOwnerChange(thisOwner) {
|
||||||
console.log(thisOwner);
|
|
||||||
this.set('isDirty', true);
|
this.set('isDirty', true);
|
||||||
this.set('config.owner', thisOwner);
|
this.set('config.owner', thisOwner);
|
||||||
this.set('config.repos', []);
|
this.set('config.repos', []);
|
||||||
|
this.set('config.lists', []);
|
||||||
this.getOwnerLists();
|
this.getOwnerLists();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -240,6 +302,12 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
this.getRepoLists();
|
this.getRepoLists();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onReportChange(thisReport) {
|
||||||
|
this.set('isDirty', true);
|
||||||
|
this.set('config.report', thisReport);
|
||||||
|
this.getReportLists();
|
||||||
|
},
|
||||||
|
|
||||||
onCancel() {
|
onCancel() {
|
||||||
this.attrs.onCancel();
|
this.attrs.onCancel();
|
||||||
},
|
},
|
||||||
|
@ -255,7 +323,8 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
||||||
meta.set('config', JSON.stringify(this.get('config')));
|
meta.set('config', JSON.stringify(this.get('config')));
|
||||||
meta.set('externalSource', true);
|
meta.set('externalSource', true);
|
||||||
|
|
||||||
this.get('sectionService').fetch(page, "commits", this.get('config'))
|
let thisReport = this.get('config.report');
|
||||||
|
this.get('sectionService').fetch(page, thisReport.id, this.get('config'))
|
||||||
.then(function(response) {
|
.then(function(response) {
|
||||||
meta.set('rawBody', JSON.stringify(response));
|
meta.set('rawBody', JSON.stringify(response));
|
||||||
self.set('busy', false);
|
self.set('busy', false);
|
||||||
|
|
|
@ -30,22 +30,29 @@
|
||||||
{{ui-select id="repos-dropdown" content=repos action=(action 'onRepoChange') optionValuePath="id" optionLabelPath="name" selection=config.repo}}
|
{{ui-select id="repos-dropdown" content=repos action=(action 'onRepoChange') optionValuePath="id" optionLabelPath="name" selection=config.repo}}
|
||||||
</div>
|
</div>
|
||||||
<div class="input-control">
|
<div class="input-control">
|
||||||
<label>Branches</label>
|
<label>Report</label>
|
||||||
<div class="tip">Select branch</div>
|
<div class="tip">Select report type</div>
|
||||||
<div class="github-board">
|
{{ui-select id="report-dropdown" content=reports action=(action 'onReportChange') optionValuePath="id" optionLabelPath="name" selection=config.report}}
|
||||||
{{#each config.lists as |list|}}
|
|
||||||
<div class="github-list" {{action 'onListCheckbox' list.id}}>
|
|
||||||
{{#if list.included}}
|
|
||||||
<i class="material-icons widget-checkbox checkbox-gray github-list-checkbox">check_box</i>
|
|
||||||
{{else}}
|
|
||||||
<i class="material-icons widget-checkbox checkbox-gray github-list-checkbox">check_box_outline_blank</i>
|
|
||||||
{{/if}}
|
|
||||||
<span class="github-list-title">{{list.name}}</span>
|
|
||||||
</div>
|
|
||||||
{{/each}}
|
|
||||||
<div class="clearfix" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
{{#if showCommits}}
|
||||||
|
<div class="input-control">
|
||||||
|
<label>Branches</label>
|
||||||
|
<div class="tip">Select branch</div>
|
||||||
|
<div class="github-board">
|
||||||
|
{{#each config.lists as |list|}}
|
||||||
|
<div class="github-list" {{action 'onListCheckbox' list.id}}>
|
||||||
|
{{#if list.included}}
|
||||||
|
<i class="material-icons widget-checkbox checkbox-gray github-list-checkbox">check_box</i>
|
||||||
|
{{else}}
|
||||||
|
<i class="material-icons widget-checkbox checkbox-gray github-list-checkbox">check_box_outline_blank</i>
|
||||||
|
{{/if}}
|
||||||
|
<span class="github-list-title">{{list.name}}</span>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
<div class="clearfix" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -129,6 +129,17 @@ func (t *Provider) Command(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
provider.WriteJSON(w, render)
|
provider.WriteJSON(w, render)
|
||||||
|
|
||||||
|
case "open_issues":
|
||||||
|
|
||||||
|
render, err := t.getOpenIssues(client, config)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("github getOpenIssues:", err)
|
||||||
|
provider.WriteError(w, "github", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
provider.WriteJSON(w, render)
|
||||||
|
|
||||||
case "owners":
|
case "owners":
|
||||||
|
|
||||||
me, _, err := client.Users.Get("")
|
me, _, err := client.Users.Get("")
|
||||||
|
@ -205,7 +216,7 @@ func (t *Provider) Command(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
provider.WriteJSON(w, render)
|
provider.WriteJSON(w, render)
|
||||||
|
|
||||||
case "lists":
|
case "branches":
|
||||||
if config.Owner == "" || config.Repo == "" {
|
if config.Owner == "" || config.Repo == "" {
|
||||||
provider.WriteJSON(w, []githubBranch{}) // we have nothing to return
|
provider.WriteJSON(w, []githubBranch{}) // we have nothing to return
|
||||||
return
|
return
|
||||||
|
@ -244,6 +255,41 @@ func (*Provider) githubClient(config githubConfig) *gogithub.Client {
|
||||||
return gogithub.NewClient(tc)
|
return gogithub.NewClient(tc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (*Provider) getOpenIssues(client *gogithub.Client, config githubConfig) ([]githubIssue, error) {
|
||||||
|
|
||||||
|
guff, _, err := client.Issues.ListByRepo(config.Owner, config.Repo, nil)
|
||||||
|
|
||||||
|
ret := []githubIssue{}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return ret, err
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, v := range guff {
|
||||||
|
n := ""
|
||||||
|
a := ""
|
||||||
|
p := v.User
|
||||||
|
if p != nil {
|
||||||
|
if p.Name != nil {
|
||||||
|
n = *p.Name
|
||||||
|
}
|
||||||
|
if p.AvatarURL != nil {
|
||||||
|
a = *p.AvatarURL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ret = append(ret, githubIssue{
|
||||||
|
Name: n,
|
||||||
|
Message: *v.Title,
|
||||||
|
Date: v.UpdatedAt.Format("January 2 2006, 15:04"),
|
||||||
|
Avatar: a,
|
||||||
|
URL: *v.HTMLURL,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func (*Provider) getCommits(client *gogithub.Client, config githubConfig) ([]githubBranchCommits, error) {
|
func (*Provider) getCommits(client *gogithub.Client, config githubConfig) ([]githubBranchCommits, error) {
|
||||||
|
|
||||||
opts := &gogithub.CommitsListOptions{
|
opts := &gogithub.CommitsListOptions{
|
||||||
|
@ -338,44 +384,43 @@ func (t *Provider) Refresh(configJSON, data string) string {
|
||||||
|
|
||||||
c.Clean()
|
c.Clean()
|
||||||
|
|
||||||
refreshed, err := t.getCommits(t.githubClient(c), c)
|
switch c.ReportInfo.ID {
|
||||||
|
case "open_issues":
|
||||||
|
refreshed, err := t.getOpenIssues(t.githubClient(c), c)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("unable to get github open issues", err)
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
j, err := json.Marshal(refreshed)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("unable to marshall github open issues", err)
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
return string(j)
|
||||||
|
|
||||||
if err != nil {
|
default: // to handle legacy data, this handles commits
|
||||||
return data
|
refreshed, err := t.getCommits(t.githubClient(c), c)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("unable to get github commits", err)
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
j, err := json.Marshal(refreshed)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("unable to marshall github commits", err)
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
return string(j)
|
||||||
}
|
}
|
||||||
|
|
||||||
j, err := json.Marshal(refreshed)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
log.Error("unable to marshall github commits", err)
|
|
||||||
return data
|
|
||||||
}
|
|
||||||
|
|
||||||
return string(j)
|
|
||||||
}
|
|
||||||
|
|
||||||
type githubRender struct {
|
|
||||||
Config githubConfig
|
|
||||||
Repo githubRepo
|
|
||||||
Data []githubBranchCommits
|
|
||||||
CommitCount int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render ... just returns the data given, suitably formatted
|
// Render ... just returns the data given, suitably formatted
|
||||||
func (*Provider) Render(config, data string) string {
|
func (*Provider) Render(config, data string) string {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
raw := []githubBranchCommits{}
|
|
||||||
payload := githubRender{}
|
payload := githubRender{}
|
||||||
var c = githubConfig{}
|
var c = githubConfig{}
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(data), &raw)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
log.Error("unable to unmarshall github data", err)
|
|
||||||
return "Documize internal github json umarshall data error: " + err.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(config), &c)
|
err = json.Unmarshal([]byte(config), &c)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -384,18 +429,47 @@ func (*Provider) Render(config, data string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Clean()
|
c.Clean()
|
||||||
|
|
||||||
payload.Config = c
|
payload.Config = c
|
||||||
payload.Repo = c.RepoInfo
|
payload.Repo = c.RepoInfo
|
||||||
payload.Data = raw
|
|
||||||
|
|
||||||
for _, list := range raw {
|
switch c.ReportInfo.ID {
|
||||||
payload.CommitCount += len(list.Commits)
|
case "open_issues":
|
||||||
|
raw := []githubIssue{}
|
||||||
|
|
||||||
|
if len(data) > 0 {
|
||||||
|
err = json.Unmarshal([]byte(data), &raw)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("unable to unmarshall github open issue data", err)
|
||||||
|
return "Documize internal github json umarshall open issue data error: " + err.Error()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
payload.OpenIssues = raw
|
||||||
|
|
||||||
|
default: // to handle legacy data, this handles commits
|
||||||
|
raw := []githubBranchCommits{}
|
||||||
|
err = json.Unmarshal([]byte(data), &raw)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Error("unable to unmarshall github commit data", err)
|
||||||
|
return "Documize internal github json umarshall data error: " + err.Error()
|
||||||
|
}
|
||||||
|
c.ReportInfo.ID = "commits"
|
||||||
|
payload.BranchCommits = raw
|
||||||
|
for _, list := range raw {
|
||||||
|
payload.CommitCount += len(list.Commits)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
t := template.New("github")
|
t := template.New("github")
|
||||||
|
|
||||||
t, err = t.Parse(renderTemplate)
|
tmpl, ok := renderTemplates[c.ReportInfo.ID]
|
||||||
|
if !ok {
|
||||||
|
msg := "github render template not found for: " + c.ReportInfo.ID
|
||||||
|
log.ErrorString(msg)
|
||||||
|
return "Documize internal error: " + msg
|
||||||
|
}
|
||||||
|
|
||||||
|
t, err = t.Parse(tmpl)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("github render template.Parse error:", err)
|
log.Error("github render template.Parse error:", err)
|
||||||
|
|
|
@ -13,11 +13,20 @@ package github
|
||||||
|
|
||||||
import "strings"
|
import "strings"
|
||||||
|
|
||||||
const renderTemplate = `
|
type githubRender struct {
|
||||||
|
Config githubConfig
|
||||||
|
Repo githubRepo
|
||||||
|
BranchCommits []githubBranchCommits
|
||||||
|
CommitCount int
|
||||||
|
OpenIssues []githubIssue
|
||||||
|
}
|
||||||
|
|
||||||
|
var renderTemplates = map[string]string{
|
||||||
|
"commits": `
|
||||||
<div class="section-github-render">
|
<div class="section-github-render">
|
||||||
<p>There are {{ .CommitCount }} commits for branch <a href="{{.Config.BranchURL}}">{{.Config.Branch}}</a> of repository <a href="{{ .Repo.URL }}">{{.Repo.Name}}.</a></p>
|
<p>There are {{ .CommitCount }} commits for branch <a href="{{.Config.BranchURL}}">{{.Config.Branch}}</a> of repository <a href="{{ .Repo.URL }}">{{.Repo.Name}}.</a></p>
|
||||||
<div class="github-board">
|
<div class="github-board">
|
||||||
{{range $data := .Data}}
|
{{range $data := .BranchCommits}}
|
||||||
<div class="github-group-title">
|
<div class="github-group-title">
|
||||||
Commits on {{ $data.Day }}
|
Commits on {{ $data.Day }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -40,16 +49,40 @@ const renderTemplate = `
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`
|
`,
|
||||||
|
"open_issues": `
|
||||||
|
<div class="section-github-render">
|
||||||
|
<p>The issues for repository <a href="{{ .Repo.URL }}/issues">{{.Repo.Name}}.</a></p>
|
||||||
|
<div class="github-board">
|
||||||
|
<ul class="github-list">
|
||||||
|
{{range $data := .OpenIssues}}
|
||||||
|
<li class="github-commit-item">
|
||||||
|
<a class="link" href="{{$data.URL}}">
|
||||||
|
<div class="github-avatar">
|
||||||
|
<img alt="@{{$data.Name}}" src="{{$data.Avatar}}" height="36" width="36">
|
||||||
|
</div>
|
||||||
|
<div class="github-commit-body">
|
||||||
|
<div class="github-commit-title">{{$data.Message}}</div>
|
||||||
|
<div class="github-commit-meta">{{$data.Name}} committed on {{$data.Date}}</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
<div class="clearfix" />
|
||||||
|
</li>
|
||||||
|
{{end}}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`,
|
||||||
|
}
|
||||||
|
|
||||||
|
type githubReport struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
type githubOwner struct {
|
type githubOwner struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
//Included bool `json:"included"`
|
|
||||||
//Owner string `json:"owner"`
|
|
||||||
//Repo string `json:"repo"`
|
|
||||||
//Private bool `json:"private"` // TODO review field use
|
|
||||||
//URL string `json:"url"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type githubRepo struct {
|
type githubRepo struct {
|
||||||
|
@ -83,6 +116,14 @@ type githubCommit struct {
|
||||||
Avatar string `json:"avatar"`
|
Avatar string `json:"avatar"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type githubIssue struct {
|
||||||
|
Date string `json:"date"`
|
||||||
|
Message string `json:"message"`
|
||||||
|
URL string `json:"url"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Avatar string `json:"avatar"`
|
||||||
|
}
|
||||||
|
|
||||||
type githubConfig struct {
|
type githubConfig struct {
|
||||||
AppKey string `json:"appKey"` // TODO keep?
|
AppKey string `json:"appKey"` // TODO keep?
|
||||||
Token string `json:"token"`
|
Token string `json:"token"`
|
||||||
|
@ -94,6 +135,7 @@ type githubConfig struct {
|
||||||
BranchLines int `json:"branchLines"`
|
BranchLines int `json:"branchLines"`
|
||||||
OwnerInfo githubOwner `json:"owner"`
|
OwnerInfo githubOwner `json:"owner"`
|
||||||
RepoInfo githubRepo `json:"repo"`
|
RepoInfo githubRepo `json:"repo"`
|
||||||
|
ReportInfo githubReport `json:"report"`
|
||||||
ClientID string `json:"clientId"`
|
ClientID string `json:"clientId"`
|
||||||
CallbackURL string `json:"callbackUrl"`
|
CallbackURL string `json:"callbackUrl"`
|
||||||
Lists []githubBranch `json:"lists"`
|
Lists []githubBranch `json:"lists"`
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue