1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-09 15:35:27 +02:00

Handle errors better, improve wording

This commit is contained in:
Elliott Stoneham 2016-06-30 17:53:39 +01:00
parent be05b21c5f
commit e2312b9632
3 changed files with 33 additions and 21 deletions

View file

@ -182,8 +182,11 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
renderSwitch(thisReport) { renderSwitch(thisReport) {
$.datetimepicker.setLocale('en'); if (is.undefined(this.get('initDateTimePicker'))) {
$('#branch-since').datetimepicker(); $.datetimepicker.setLocale('en');
$('#branch-since').datetimepicker();
this.set('initDateTimePicker', "Done");
}
let bl = this.get('config.branchLines'); let bl = this.get('config.branchLines');
if (is.undefined(bl) || bl === "" || bl <= 0) { if (is.undefined(bl) || bl === "" || bl <= 0) {

View file

@ -578,7 +578,7 @@ func (t *Provider) Refresh(configJSON, data string) string {
if err != nil { if err != nil {
log.Error("unable to unmarshall github config", err) log.Error("unable to unmarshall github config", err)
return data return "internal configuration error '" + err.Error() + "'"
} }
c.Clean() c.Clean()
@ -637,7 +637,7 @@ func (p *Provider) Render(config, data string) string {
if err != nil { if err != nil {
log.Error("unable to unmarshall github config", err) log.Error("unable to unmarshall github config", err)
return "Documize internal github json umarshall config error: " + err.Error() return "Please delete and recreate this Github section."
} }
c.Clean() c.Clean()
@ -682,18 +682,23 @@ func (p *Provider) Render(config, data string) string {
err = json.Unmarshal([]byte(data), &raw) err = json.Unmarshal([]byte(data), &raw)
if err != nil { if err != nil {
log.Error("unable to unmarshall github issue data", err) log.Error("unable to unmarshall github issue data", err)
return "Documize internal github json umarshall open data error: " + err.Error() return "Documize internal github json umarshall open data error: " + err.Error() + "<BR>" + data
} }
} }
payload.Issues = raw payload.Issues = raw
if len(c.Lists) > 0 { if strings.TrimSpace(c.IssuesText) != "" {
for _, v := range c.Lists { payload.ShowIssueNumbers = true
if v.Included { payload.DateMessage = c.IssuesText
payload.ShowList = true } else {
break if len(c.Lists) > 0 {
for _, v := range c.Lists {
if v.Included {
payload.ShowList = true
break
}
} }
payload.List = c.Lists
} }
payload.List = c.Lists
} }
default: // to handle legacy data, this handles commits default: // to handle legacy data, this handles commits
@ -702,7 +707,7 @@ func (p *Provider) Render(config, data string) string {
if err != nil { if err != nil {
log.Error("unable to unmarshall github commit data", err) log.Error("unable to unmarshall github commit data", err)
return "Documize internal github json umarshall data error: " + err.Error() return "Documize internal github json umarshall data error: " + err.Error() + "<BR>" + data
} }
c.ReportInfo.ID = "commits_data" c.ReportInfo.ID = "commits_data"
payload.BranchCommits = raw payload.BranchCommits = raw

View file

@ -20,13 +20,14 @@ import (
) )
type githubRender struct { type githubRender struct {
Config githubConfig Config githubConfig
Repo githubRepo Repo githubRepo
List []githubBranch List []githubBranch
ShowList bool ShowList bool
BranchCommits []githubBranchCommits ShowIssueNumbers bool
CommitCount int BranchCommits []githubBranchCommits
Issues []githubIssue CommitCount int
Issues []githubIssue
//IssueNum int //IssueNum int
//IssueNumActivity []githubIssueActivity //IssueNumActivity []githubIssueActivity
Limit int Limit int
@ -76,9 +77,12 @@ var renderTemplates = map[string]string{
<span style="background-color:#{{$label.Color}}">{{$label.Name}}</span> <span style="background-color:#{{$label.Color}}">{{$label.Name}}</span>
{{end}} {{end}}
{{end}} {{end}}
{{end}};
{{if .ShowIssueNumbers}}
issue(s) {{ .DateMessage }}.
{{else}}
up to {{ .Limit }} items are shown{{ .DateMessage }}.
{{end}} {{end}}
.
Up to {{ .Limit }} items are shown{{ .DateMessage }}.
</p> </p>
<div class="github-board"> <div class="github-board">
<ul class="github-list"> <ul class="github-list">