mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Merge branch 'sherodtaylor-more-advanced-jira'
This commit is contained in:
commit
c43db75561
@ -34,6 +34,7 @@ jira:
|
||||
domain: "https://umbrellacorp.atlassian.net"
|
||||
email: "chriscummer@me.com"
|
||||
enabled: true
|
||||
jql: "issueType = Story"
|
||||
position:
|
||||
top: 4
|
||||
left: 1
|
||||
@ -68,6 +69,11 @@ Values: A valid email address string.
|
||||
Determines whether or not this module is executed and if its data displayed onscreen. <br />
|
||||
Values: `true`, `false`.
|
||||
|
||||
`jql` <br />
|
||||
_Optional_ <br />
|
||||
Custom JQL to be appended to the search query. <br />
|
||||
Values: See <a href="https://confluence.atlassian.com/jiracore/blog/2015/07/search-jira-like-a-boss-with-jql">Search Jira like a boss with JQL</a> for details.
|
||||
|
||||
`position` <br />
|
||||
Defines where in the grid this module's widget will be displayed. <br />
|
||||
|
||||
|
@ -108,7 +108,7 @@ Key: j Action: Select the next item in the list.</description>
|
||||
<description>Displays all Jira issues assigned to you for the specified project.
|
||||
Source Code wtf/jira/ Required ENV Variables Key: WTF_JIRA_API_KEY Value: Your Jira API key.
|
||||
Keyboard Commands None.
|
||||
Configuration jira:colors:rows:even:&#34;lightblue&#34;odd:&#34;white&#34;domain:&#34;https://umbrellacorp.atlassian.net&#34;email:&#34;chriscummer@me.com&#34;enabled:trueposition:top:4left:1height:1width:2project:&#34;JIRA&#34;refreshInterval:900username:&#34;chris.cummer&#34; Attributes colors.rows.even Define the foreground color for even-numbered rows. Values: Any X11 color name.
|
||||
Configuration jira:colors:rows:even:&#34;lightblue&#34;odd:&#34;white&#34;domain:&#34;https://umbrellacorp.atlassian.net&#34;email:&#34;chriscummer@me.com&#34;enabled:truejql:&#34;issueType = Story&#34;position:top:4left:1height:1width:2project:&#34;JIRA&#34;refreshInterval:900username:&#34;chris.cummer&#34; Attributes colors.rows.even Define the foreground color for even-numbered rows. Values: Any X11 color name.
|
||||
colors.rows.odd Define the foreground color for odd-numbered rows. Values: Any X11 color name.
|
||||
domain Your Jira corporate domain. Values: A valid URI.
|
||||
email The email address associated with your Jira account.</description>
|
||||
|
@ -108,7 +108,7 @@ Key: j Action: Select the next item in the list.</description>
|
||||
<description>Displays all Jira issues assigned to you for the specified project.
|
||||
Source Code wtf/jira/ Required ENV Variables Key: WTF_JIRA_API_KEY Value: Your Jira API key.
|
||||
Keyboard Commands None.
|
||||
Configuration jira:colors:rows:even:&#34;lightblue&#34;odd:&#34;white&#34;domain:&#34;https://umbrellacorp.atlassian.net&#34;email:&#34;chriscummer@me.com&#34;enabled:trueposition:top:4left:1height:1width:2project:&#34;JIRA&#34;refreshInterval:900username:&#34;chris.cummer&#34; Attributes colors.rows.even Define the foreground color for even-numbered rows. Values: Any X11 color name.
|
||||
Configuration jira:colors:rows:even:&#34;lightblue&#34;odd:&#34;white&#34;domain:&#34;https://umbrellacorp.atlassian.net&#34;email:&#34;chriscummer@me.com&#34;enabled:truejql:&#34;issueType = Story&#34;position:top:4left:1height:1width:2project:&#34;JIRA&#34;refreshInterval:900username:&#34;chris.cummer&#34; Attributes colors.rows.even Define the foreground color for even-numbered rows. Values: Any X11 color name.
|
||||
colors.rows.odd Define the foreground color for odd-numbered rows. Values: Any X11 color name.
|
||||
domain Your Jira corporate domain. Values: A valid URI.
|
||||
email The email address associated with your Jira account.</description>
|
||||
|
@ -133,6 +133,7 @@
|
||||
</span><span class="w"> </span>domain<span class="p">:</span><span class="w"> </span><span class="s2">"https://umbrellacorp.atlassian.net"</span><span class="w">
|
||||
</span><span class="w"> </span>email<span class="p">:</span><span class="w"> </span><span class="s2">"chriscummer@me.com"</span><span class="w">
|
||||
</span><span class="w"> </span>enabled<span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="w">
|
||||
</span><span class="w"> </span>jql<span class="p">:</span><span class="w"> </span><span class="s2">"issueType = Story"</span><span class="w">
|
||||
</span><span class="w"> </span>position<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>top<span class="p">:</span><span class="w"> </span><span class="m">4</span><span class="w">
|
||||
</span><span class="w"> </span>left<span class="p">:</span><span class="w"> </span><span class="m">1</span><span class="w">
|
||||
@ -165,6 +166,11 @@ Values: A valid email address string.</p>
|
||||
Determines whether or not this module is executed and if its data displayed onscreen. <br />
|
||||
Values: <code>true</code>, <code>false</code>.</p>
|
||||
|
||||
<p><code>jql</code> <br />
|
||||
<em>Optional</em> <br />
|
||||
Custom JQL to be appended to the search query. <br />
|
||||
Values: See <a href="https://confluence.atlassian.com/jiracore/blog/2015/07/search-jira-like-a-boss-with-jql">Search Jira like a boss with JQL</a> for details.</p>
|
||||
|
||||
<p><code>position</code> <br />
|
||||
Defines where in the grid this module’s widget will be displayed. <br /></p>
|
||||
|
||||
|
@ -7,11 +7,31 @@ import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func IssuesFor(username string) (*SearchResult, error) {
|
||||
url := fmt.Sprintf("/rest/api/2/search?jql=assignee=%s", username)
|
||||
func IssuesFor(username string, project string, jql string) (*SearchResult, error) {
|
||||
query := []string{}
|
||||
|
||||
if project != "" {
|
||||
query = append(query, buildJql("project", project))
|
||||
}
|
||||
|
||||
if username != "" {
|
||||
query = append(query, buildJql("assignee", username))
|
||||
}
|
||||
|
||||
if jql != "" {
|
||||
query = append(query, jql)
|
||||
}
|
||||
|
||||
v := url.Values{}
|
||||
|
||||
v.Set("jql", strings.Join(query, " AND "))
|
||||
|
||||
url := fmt.Sprintf("/rest/api/2/search?%s", v.Encode())
|
||||
|
||||
resp, err := jiraRequest(url)
|
||||
if err != nil {
|
||||
@ -24,6 +44,10 @@ func IssuesFor(username string) (*SearchResult, error) {
|
||||
return searchResult, nil
|
||||
}
|
||||
|
||||
func buildJql(key string, value string) string {
|
||||
return fmt.Sprintf("%s = \"%s\"", key, value)
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func jiraRequest(path string) (*http.Response, error) {
|
||||
|
@ -29,7 +29,7 @@ func (widget *Widget) Refresh() {
|
||||
return
|
||||
}
|
||||
|
||||
searchResult, err := IssuesFor(Config.UString("wtf.mods.jira.username"))
|
||||
searchResult, err := IssuesFor(Config.UString("wtf.mods.jira.username"), Config.UString("wtf.mods.jira.project", ""), Config.UString("wtf.mods.jira.jql", ""))
|
||||
|
||||
widget.UpdateRefreshedAt()
|
||||
widget.View.Clear()
|
||||
|
Loading…
x
Reference in New Issue
Block a user