You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kibble.apache.org by hu...@apache.org on 2017/10/22 17:23:15 UTC
[kibble] branch master updated (23fac54 -> b6a1bc3)
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/kibble.git.
from 23fac54 replace kludge with a simple empty test
new 370b2b5 allow 'distinguish' which lets widgets divide into sub-categories
new 1da10fb regen API spec
new b6a1bc3 allow distinguishing between PRs and issues
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
api/pages/issue/issues.py | 225 ++++++++++++---------
api/yaml/openapi.yaml | 5 +
.../components/schemas/defaultWidgetArgs.yaml | 4 +
3 files changed, 134 insertions(+), 100 deletions(-)
--
To stop receiving notification emails like this one, please contact
['"commits@kibble.apache.org" <co...@kibble.apache.org>'].
[kibble] 01/03: allow 'distinguish' which lets widgets divide into
sub-categories
Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kibble.git
commit 370b2b5d71de715cf5b4316faa068ee146267613
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Sun Oct 22 18:56:16 2017 +0200
allow 'distinguish' which lets widgets divide into sub-categories
initially for distinguishing between issues and PRs.
---
api/yaml/openapi/components/schemas/defaultWidgetArgs.yaml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/api/yaml/openapi/components/schemas/defaultWidgetArgs.yaml b/api/yaml/openapi/components/schemas/defaultWidgetArgs.yaml
index 120addf..a4fa80c 100644
--- a/api/yaml/openapi/components/schemas/defaultWidgetArgs.yaml
+++ b/api/yaml/openapi/components/schemas/defaultWidgetArgs.yaml
@@ -68,3 +68,7 @@ properties:
description: ID Of optional view to use
example: abcdef12345678
type: string
+ distinguish:
+ description: Enables distinguishing different types of data objects, subject to the individual API endpoint
+ type: boolean
+ example: false
--
To stop receiving notification emails like this one, please contact
"commits@kibble.apache.org" <co...@kibble.apache.org>.
[kibble] 02/03: regen API spec
Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kibble.git
commit 1da10fb25811ad8a214bf9066679c0d182e5a28e
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Sun Oct 22 18:56:25 2017 +0200
regen API spec
---
api/yaml/openapi.yaml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/api/yaml/openapi.yaml b/api/yaml/openapi.yaml
index 024e382..ac7a480 100644
--- a/api/yaml/openapi.yaml
+++ b/api/yaml/openapi.yaml
@@ -434,6 +434,11 @@ components:
collapse:
description: for some widgets, this collapses sources based on a regex
type: string
+ distinguish:
+ description: Enables distinguishing different types of data objects, subject
+ to the individual API endpoint
+ example: false
+ type: boolean
email:
description: filter sources based on an email (a person)
type: string
--
To stop receiving notification emails like this one, please contact
"commits@kibble.apache.org" <co...@kibble.apache.org>.
[kibble] 03/03: allow distinguishing between PRs and issues
Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kibble.git
commit b6a1bc3bfaf14d1aab03f02217a1708df3aefe5a
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Sun Oct 22 19:23:06 2017 +0200
allow distinguishing between PRs and issues
---
api/pages/issue/issues.py | 225 +++++++++++++++++++++++++---------------------
1 file changed, 125 insertions(+), 100 deletions(-)
diff --git a/api/pages/issue/issues.py b/api/pages/issue/issues.py
index fb3526c..9d7d3dd 100644
--- a/api/pages/issue/issues.py
+++ b/api/pages/issue/issues.py
@@ -92,120 +92,145 @@ def run(API, environ, indata, session):
interval = indata.get('interval', 'month')
+ # By default, we lump PRs and issues into the same category
+ distinct = {
+ 'issues': ['issue', 'pullrequest']
+ }
+
+ # If requested, we split them into two
+ if indata.get('distinguish', False):
+ distinct = {
+ 'issues': ['issue'],
+ 'pull requests': ['pullrequest']
+ }
+
+ timeseries = {}
- ####################################################################
- # ISSUES OPENED #
- ####################################################################
- dOrg = session.user['defaultOrganisation'] or "apache"
- query = {
- 'query': {
- 'bool': {
- 'must': [
- {'range':
+ # For each category and the issue types that go along with that,
+ # grab opened and closed over time.
+ for iType, iValues in distinct.items():
+ ####################################################################
+ # ISSUES OPENED #
+ ####################################################################
+ dOrg = session.user['defaultOrganisation'] or "apache"
+ query = {
+ 'query': {
+ 'bool': {
+ 'must': [
+ {'range':
+ {
+ 'created': {
+ 'from': dateFrom,
+ 'to': dateTo
+ }
+ }
+ },
{
- 'created': {
- 'from': dateFrom,
- 'to': dateTo
+ 'term': {
+ 'organisation': dOrg
+ }
+ },
+ {
+ 'terms': {
+ 'issuetype': iValues
}
}
- },
- {
- 'term': {
- 'organisation': dOrg
- }
- }
- ]
+ ]
+ }
}
}
+ # Source-specific or view-specific??
+ if indata.get('source'):
+ query['query']['bool']['must'].append({'term': {'sourceID': indata.get('source')}})
+ elif viewList:
+ query['query']['bool']['must'].append({'terms': {'sourceID': viewList}})
+ if indata.get('email'):
+ query['query']['bool']['must'].append({'term': {'issueCreator': indata.get('email')}})
+
+ # Get number of opened ones, this period
+ query['aggs'] = {
+ 'commits': {
+ 'date_histogram': {
+ 'field': 'createdDate',
+ 'interval': interval
+ }
+ }
}
- # Source-specific or view-specific??
- if indata.get('source'):
- query['query']['bool']['must'].append({'term': {'sourceID': indata.get('source')}})
- elif viewList:
- query['query']['bool']['must'].append({'terms': {'sourceID': viewList}})
- if indata.get('email'):
- query['query']['bool']['must'].append({'term': {'issueCreator': indata.get('email')}})
-
- # Get number of opened ones, this period
- query['aggs'] = {
- 'commits': {
- 'date_histogram': {
- 'field': 'createdDate',
- 'interval': interval
- }
- }
- }
- res = session.DB.ES.search(
- index=session.DB.dbname,
- doc_type="issue",
- size = 0,
- body = query
- )
-
- timeseries = {}
- for bucket in res['aggregations']['commits']['buckets']:
- ts = int(bucket['key'] / 1000)
- count = bucket['doc_count']
- timeseries[ts] = timeseries.get(ts, { 'opened': 0, 'closed': 0})
- timeseries[ts]['opened'] += count
+ res = session.DB.ES.search(
+ index=session.DB.dbname,
+ doc_type="issue",
+ size = 0,
+ body = query
+ )
-
- ####################################################################
- # ISSUES CLOSED #
- ####################################################################
- dOrg = session.user['defaultOrganisation'] or "apache"
- query = {
- 'query': {
- 'bool': {
- 'must': [
- {'range':
+ for bucket in res['aggregations']['commits']['buckets']:
+ ts = int(bucket['key'] / 1000)
+ count = bucket['doc_count']
+ timeseries[ts] = timeseries.get(ts, {iType + ' opened': 0, iType + ' closed': count})
+ timeseries[ts][iType + ' opened'] = timeseries[ts].get(iType + ' opened') + count
+
+
+ ####################################################################
+ # ISSUES CLOSED #
+ ####################################################################
+ dOrg = session.user['defaultOrganisation'] or "apache"
+ query = {
+ 'query': {
+ 'bool': {
+ 'must': [
+ {'range':
+ {
+ 'closed': {
+ 'from': dateFrom,
+ 'to': dateTo
+ }
+ }
+ },
{
- 'closed': {
- 'from': dateFrom,
- 'to': dateTo
+ 'term': {
+ 'organisation': dOrg
+ }
+ },
+ {
+ 'terms': {
+ 'issuetype': iValues
}
}
- },
- {
- 'term': {
- 'organisation': dOrg
- }
- }
- ]
+ ]
+ }
}
}
+ if viewList:
+ query['query']['bool']['must'].append({'terms': {'sourceID': viewList}})
+ if indata.get('source'):
+ query['query']['bool']['must'].append({'term': {'sourceID': indata.get('source')}})
+ if indata.get('email'):
+ query['query']['bool']['must'].append({'term': {'issueCloser': indata.get('email')}})
+
+ # Get number of closed ones, this period
+ query['aggs'] = {
+ 'commits': {
+ 'date_histogram': {
+ 'field': 'closedDate',
+ 'interval': interval
+ }
+ }
}
- if viewList:
- query['query']['bool']['must'].append({'terms': {'sourceID': viewList}})
- if indata.get('source'):
- query['query']['bool']['must'].append({'term': {'sourceID': indata.get('source')}})
- if indata.get('email'):
- query['query']['bool']['must'].append({'term': {'issueCloser': indata.get('email')}})
-
- # Get number of closed ones, this period
- query['aggs'] = {
- 'commits': {
- 'date_histogram': {
- 'field': 'closedDate',
- 'interval': interval
- }
- }
- }
- res = session.DB.ES.search(
- index=session.DB.dbname,
- doc_type="issue",
- size = 0,
- body = query
- )
-
- for bucket in res['aggregations']['commits']['buckets']:
- ts = int(bucket['key'] / 1000)
- count = bucket['doc_count']
- if not ts in timeseries:
- timeseries[ts] = {'opened': 0, 'closed': count}
- else:
- timeseries[ts]['closed'] = timeseries[ts].get('closed', 0) + count
-
+ res = session.DB.ES.search(
+ index=session.DB.dbname,
+ doc_type="issue",
+ size = 0,
+ body = query
+ )
+
+ for bucket in res['aggregations']['commits']['buckets']:
+ ts = int(bucket['key'] / 1000)
+ count = bucket['doc_count']
+ if not ts in timeseries:
+ timeseries[ts] = {iType + ' opened': 0, iType + ' closed': count}
+ else:
+ timeseries[ts][iType + ' closed'] = timeseries[ts].get(iType + ' closed', 0) + count
+
ts = []
for k, v in timeseries.items():
v['date'] = k
--
To stop receiving notification emails like this one, please contact
"commits@kibble.apache.org" <co...@kibble.apache.org>.