summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn (J5) Palmieri <johnp@redhat.com>2011-11-14 20:29:22 (GMT)
committerJohn (J5) Palmieri <johnp@redhat.com>2011-11-14 20:30:26 (GMT)
commit63fc981e702fd54b5a5727d504bab47c8da5d3e0 (patch)
tree59e7d984bfebf3c2c4d5fbce5f2f2e7cb59c9ad1
parentebcadc88819346613eddff8cdef30d14d1f78385 (diff)
downloadfedoracommunity-63fc981e702fd54b5a5727d504bab47c8da5d3e0.zip
fedoracommunity-63fc981e702fd54b5a5727d504bab47c8da5d3e0.tar.gz
fedoracommunity-63fc981e702fd54b5a5727d504bab47c8da5d3e0.tar.xz
add changelog tab
-rw-r--r--fedoracommunity/connectors/kojiconnector.py64
-rw-r--r--fedoracommunity/public/images/16_build_state_0.pngbin416 -> 922 bytes
-rw-r--r--fedoracommunity/public/images/16_build_state_2.pngbin0 -> 997 bytes
-rw-r--r--fedoracommunity/public/images/16_build_state_3.pngbin711 -> 1031 bytes
-rw-r--r--fedoracommunity/public/images/16_build_state_4.pngbin562 -> 673 bytes
-rw-r--r--fedoracommunity/widgets/package/changelog.py67
-rw-r--r--fedoracommunity/widgets/package/package.py3
-rw-r--r--fedoracommunity/widgets/package/templates/builds_table_widget.mak19
-rw-r--r--fedoracommunity/widgets/package/templates/changelog.mak9
-rw-r--r--fedoracommunity/widgets/package/templates/changelog_table_widget.mak81
-rw-r--r--fedoracommunity/widgets/package/templates/updates_table_widget.mak10
-rwxr-xr-xsetup.py2
12 files changed, 205 insertions, 50 deletions
diff --git a/fedoracommunity/connectors/kojiconnector.py b/fedoracommunity/connectors/kojiconnector.py
index 875a8a5..17ab85f 100644
--- a/fedoracommunity/connectors/kojiconnector.py
+++ b/fedoracommunity/connectors/kojiconnector.py
@@ -196,7 +196,7 @@ class KojiConnector(IConnector, ICall, IQuery):
can_filter_wildcards = False)
f = ParamFilter()
- f.add_filter('package',[], allow_none = False)
+ f.add_filter('build_id',[], allow_none = False)
cls._query_changelogs_filter = f
cls._changelog_version_extract_re = re.compile('(.*)\W*<(.*)>\W*-?\W*(.*)')
@@ -208,24 +208,21 @@ class KojiConnector(IConnector, ICall, IQuery):
filters=None,
**params):
+
if not filters:
filters = {}
+
filters = self._query_changelogs_filter.filter(filters, conn=self)
- package = filters.get('package', '')
+ build_id = int(filters.get('build_id', None))
+ task_id = filters.get('task_id', None)
+ state = filters.get('state', None)
if order < 0:
order = '-' + sort_col
else:
order = sort_col
- pkg_id = None
- if package:
- pkg_id = self._koji_client.getPackageID(package)
-
- if not pkg_id:
- return (0, [])
-
queryOpts = None
qo = {}
@@ -243,30 +240,9 @@ class KojiConnector(IConnector, ICall, IQuery):
countQueryOpts = {'countOnly': True}
- self._koji_client.multicall = False
-
- # FIXME: Figure out how to deal with different builds
- #tags = self._koji_client.listTags(package=pkg_id,
- # queryOpts={})
-
- # ask pkgdb for the collections table
- # pkgdb = get_connector('pkgdb', self._request)
- # collections_table = pkgdb.get_collection_table()
-
- # get latest version and use that to get the changelog
- builds = self._koji_client.listBuilds(packageID=pkg_id,
- queryOpts={'limit': 1,
- 'offset': 0,
- 'order': '-nvr'})
-
- build_id = builds[0].get('build_id')
- if not build_id:
- return (0, [])
-
self._koji_client.multicall = True
self._koji_client.getChangelogEntries(buildID=build_id,
- queryOpts=countQueryOpts)
-
+ queryOpts=countQueryOpts)
self._koji_client.getChangelogEntries(buildID=build_id,
queryOpts=queryOpts)
@@ -459,14 +435,15 @@ class KojiConnector(IConnector, ICall, IQuery):
else:
order = sort_col
- user = self._koji_client.getUser(username)
-
- # we need to check if this user exists
- if username and not user:
- return (0, [])
-
+ user = None
id = None
- if user:
+ if username:
+ user = self._koji_client.getUser(username)
+
+ # we need to check if this user exists
+ if username and not user:
+ return (0, [])
+
id = user['id']
pkg_id = None
@@ -476,7 +453,16 @@ class KojiConnector(IConnector, ICall, IQuery):
queryOpts = None
if state:
- state = int(state)
+ try:
+ state = int(state)
+ except ValueError:
+ state_list = []
+ for value in state.split(','):
+ state_list.append(int(value))
+ state = state_list
+
+ elif state == '':
+ state = None
qo = {}
if not (start_row == None):
diff --git a/fedoracommunity/public/images/16_build_state_0.png b/fedoracommunity/public/images/16_build_state_0.png
index b655422..3af6f42 100644
--- a/fedoracommunity/public/images/16_build_state_0.png
+++ b/fedoracommunity/public/images/16_build_state_0.png
Binary files differ
diff --git a/fedoracommunity/public/images/16_build_state_2.png b/fedoracommunity/public/images/16_build_state_2.png
new file mode 100644
index 0000000..f403f93
--- /dev/null
+++ b/fedoracommunity/public/images/16_build_state_2.png
Binary files differ
diff --git a/fedoracommunity/public/images/16_build_state_3.png b/fedoracommunity/public/images/16_build_state_3.png
index 8182778..ec35ed2 100644
--- a/fedoracommunity/public/images/16_build_state_3.png
+++ b/fedoracommunity/public/images/16_build_state_3.png
Binary files differ
diff --git a/fedoracommunity/public/images/16_build_state_4.png b/fedoracommunity/public/images/16_build_state_4.png
index 1582ab3..67815fe 100644
--- a/fedoracommunity/public/images/16_build_state_4.png
+++ b/fedoracommunity/public/images/16_build_state_4.png
Binary files differ
diff --git a/fedoracommunity/widgets/package/changelog.py b/fedoracommunity/widgets/package/changelog.py
new file mode 100644
index 0000000..28e861c
--- /dev/null
+++ b/fedoracommunity/widgets/package/changelog.py
@@ -0,0 +1,67 @@
+import tw2.core as twc
+from moksha.api.widgets import Grid
+from moksha.api.connectors import get_connector
+from collections import OrderedDict
+
+class ChangelogGrid(Grid):
+ template='mako:fedoracommunity.widgets.package.templates.changelog_table_widget'
+ resource='koji'
+ resource_path='query_changelogs'
+
+ def prepare(self):
+ self.filters = {'build_id': self.build_id,
+ 'task_id': self.task_id,
+ 'state': self.state}
+ self.rows_per_page = 10
+
+ # Must do this last for our Grids
+ super(ChangelogGrid, self).prepare()
+
+
+class ChangelogWidget(twc.Widget):
+ template = 'mako:fedoracommunity.widgets.package.templates.changelog'
+ changelog_grid = ChangelogGrid
+
+ def prepare(self):
+ self.package_name = self.kwds['package_name']
+ koji = get_connector('koji')
+ try:
+ # FIXME for now hardcode this but we really should have some sort
+ # of mapping of releases to tags
+ tags = ({'name': 'Rawhide', 'tag': 'dist-rawhide'},
+ {'name': 'Fedora 16', 'tag': 'f16'},
+ {'name': 'Fedora 16', 'tag': 'f16-updates'},
+ {'name': 'Fedora 16 Testing', 'tag': 'f16-updates-testing'},
+ {'name': 'Fedora 15', 'tag': 'dist-f15'},
+ {'name': 'Fedora 15', 'tag': 'dist-f15-updates'},
+ {'name': 'Fedora 15 Testing', 'tag': 'dist-f15-updates-testing'},
+ {'name': 'Fedora 14', 'tag': 'dist-f14'},
+ {'name': 'Fedora 14', 'tag': 'dist-f14-updates'},
+ {'name': 'Fedora 14 Testing', 'tag': 'dist-f14-updates-testing'},
+ {'name': 'EPEL 6', 'tag': 'dist-6E-epel-base'},
+ {'name': 'EPEL 6', 'tag': 'dist-6E-epel'},
+ {'name': 'EPEL 6', 'tag': 'dist-6E-epel-testing'},
+ {'name': 'EPEL 5', 'tag': 'dist-5E-base'},
+ {'name': 'EPEL 5', 'tag': 'dist-5E-epel'},
+ {'name': 'EPEL 5', 'tag': 'dist-5E-epel-testing'},
+ )
+
+ latest_builds = OrderedDict()
+ for t in tags:
+ tag = t['tag']
+ builds = koji._koji_client.getLatestBuilds(tag, package=self.package_name)
+ if builds:
+ build = builds[0]
+ latest_builds[t['name']] = {'nvr': build['nvr'],
+ 'build_id': build['build_id'],
+ 'task_id': build['task_id'],
+ 'state': build['state']}
+
+ self.default_build_id = latest_builds['Rawhide']['build_id']
+ self.default_task_id = latest_builds['Rawhide']['task_id']
+ self.default_state = latest_builds['Rawhide']['state']
+ self.latest_builds = latest_builds
+
+ except Exception, e:
+ print('Unable to query koji: %s' % str(e))
+ self.latest_builds = 'Koji unavailable'
diff --git a/fedoracommunity/widgets/package/package.py b/fedoracommunity/widgets/package/package.py
index 6a01b6e..6844a52 100644
--- a/fedoracommunity/widgets/package/package.py
+++ b/fedoracommunity/widgets/package/package.py
@@ -60,7 +60,8 @@ class TabWidget(twc.Widget):
class PackageNavWidget(TabWidget):
tabs = collections.OrderedDict([('Overview', 'package.overview'),
- ('Bugs', 'package.bugs')])
+ ('Bugs', 'package.bugs'),
+ ('Changelog', 'package.changelog')])
base_url = Template(text='/${kwds["package_name"]}/');
default_tab = 'Overview'
args = twc.Param(default=None)
diff --git a/fedoracommunity/widgets/package/templates/builds_table_widget.mak b/fedoracommunity/widgets/package/templates/builds_table_widget.mak
index 1e8459e..bb5c490 100644
--- a/fedoracommunity/widgets/package/templates/builds_table_widget.mak
+++ b/fedoracommunity/widgets/package/templates/builds_table_widget.mak
@@ -2,10 +2,26 @@
<head></head>
<body>
<div class="list header-list">
+ <div id="grid-controls">
+ <form>
+ <div id="filter" class="grid_filter" name="status_filter">
+
+ <label for="state">Status:</label>
+ <select name="state">
+ <option selected="selected" value="">All</option>
+ <option value="0" style="background:url(/images/16_build_state_0.png) no-repeat center left; padding-left: 18px;"></img>Building</option>
+ <option value="1" style="background:url(/images/16_build_state_1.png) no-repeat center left; padding-left: 18px;">Success</option>
+ <option value="3" style="background:url(/images/16_build_state_3.png) no-repeat center left; padding-left: 18px;">Failed</option>
+ <option value="4" style="background:url(/images/16_build_state_4.png) no-repeat center left; padding-left: 18px;">Canceled</option>
+ <option value="2" style="background:url(/images/16_build_state_2.png) no-repeat center left; padding-left: 18px;">Deleted</option>
+ </select>
+ </div>
+ </form>
+ </div>
<table id="${w.id}" class="">
<thead>
<tr>
- <th><a href="#nvr">Package</a></th>
+ <th>Package</th>
<th>When</th>
<th>Build Time</th>
<th>Built By</th>
@@ -17,6 +33,7 @@
<td class="one-row">
<div id="menu_${'${build_id}'}" class="menu" panel="menu_panel_${'${build_id}'}">
<span class="package-name">
+ <img src="/images/16_build_state_${'${state}'}.png"></img>
<a href="/package_maintenance/tools/builds?package=${'${package_name}'}" moksha_url="dynamic">${'${package_name}'} </a>
</span>
<br/>${'${version}'}-${'${release}'}&nbsp;
diff --git a/fedoracommunity/widgets/package/templates/changelog.mak b/fedoracommunity/widgets/package/templates/changelog.mak
new file mode 100644
index 0000000..c78ad83
--- /dev/null
+++ b/fedoracommunity/widgets/package/templates/changelog.mak
@@ -0,0 +1,9 @@
+<div>
+ <div>
+ <h3>Current Builds</h3>
+ <div>${w.children[0].display(build_id=w.default_build_id,
+ task_id=w.default_task_id,
+ state=w.default_state,
+ latest_builds=w.latest_builds)}</div>
+ </div>
+</div>
diff --git a/fedoracommunity/widgets/package/templates/changelog_table_widget.mak b/fedoracommunity/widgets/package/templates/changelog_table_widget.mak
new file mode 100644
index 0000000..29ed643
--- /dev/null
+++ b/fedoracommunity/widgets/package/templates/changelog_table_widget.mak
@@ -0,0 +1,81 @@
+<html>
+<head></head>
+<body>
+ <div class="list header-list">
+ <script type="text/javascript">
+ function _text_filter(text) {
+ var results = $("<div />");
+ var ul = $("<ul />");
+ results.append(ul);
+ var v=text.split('\n');
+ for (i in v) {
+ line = v[i];
+
+ ul.append("<li>" + line + "</li>");
+ }
+
+ return results.html();
+ }
+ </script>
+ <div id='grid-controls'>
+ <form>
+ <div id="filter" class="grid_filter" name="build_filter">
+ <label for="version">Build:</label>
+ <select name="build_id">
+ % for (i, build) in enumerate(w.latest_builds.keys()):
+ <%
+ selected = ""
+ if i == 0:
+ selected = 'selected = "selected"'
+ %>
+ <option ${selected} value="${str(w.latest_builds[build]['build_id'])}">${build} (${w.latest_builds[build]['nvr']})</option>
+ % endfor
+ </select>
+ </div>
+ </form>
+ </div>
+ <table id="${w.id}">
+ <thead>
+ <th>Version</th>
+ <th>Changes</th>
+ <th>Author</th>
+ <th>Date</th>
+ </thead>
+ <tbody class="rowtemplate">
+ <tr>
+ <td>
+ <strong>${'${version}'}</strong>
+ </td>
+ <td>
+ {{html _text_filter(text)}}
+ </td>
+ <td>
+ <strong>${'${author}'}</strong><br/>
+ <a href="mailto:${'${email}'}">&lt;${'${email}'}&gt;</a>
+ </td>
+ <td>
+ ${'${display_date}'}
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <div id="grid-controls" if="total_rows == 0">
+ <div class="message template" id="info_display" >
+ This package has no Changelog entries
+ </div>
+ </div>
+ <div id="grid-controls" if="visible_rows >= total_rows && total_rows != 0">
+ <div class="message template" id="info_display" >
+ Viewing all Changelog entries
+ </div>
+ </div>
+ <div id="grid-controls" if="visible_rows < total_rows && total_rows != 0">
+ <div class="message template" id="info_display" >
+ Viewing @{first_visible_row}-@{last_visible_row} of @{total_rows} Changelog entries
+ </div>
+ <div class="pager" id="pager" type="more" ></div>
+
+ </div>
+ </div>
+</body>
+</html>
diff --git a/fedoracommunity/widgets/package/templates/updates_table_widget.mak b/fedoracommunity/widgets/package/templates/updates_table_widget.mak
index f8ac2e3..43bc39e 100644
--- a/fedoracommunity/widgets/package/templates/updates_table_widget.mak
+++ b/fedoracommunity/widgets/package/templates/updates_table_widget.mak
@@ -51,21 +51,15 @@
There are no updates for this package
</div>
</div>
- <div id="grid-controls" if="visible_rows < total_rows && total_rows != 0">
+ <div id="grid-controls" if="visible_rows > total_rows && total_rows != 0">
<div class="message template" id="info_display" >
Viewing all ${'${total_rows}'} updates for this package
</div>
- <div class="pager template" id="pager" type="more_link">
- <a href="${'${more_link}'}" moksha_url="dynamic">Goto updates &gt;</a>
- </div>
</div>
- <div id="grid-controls" if="visible_rows < total_rows && total_rows != 0">
+ <div id="grid-controls" if="visible_rows > total_rows && total_rows != 0">
<div class="message template" id="info_display" >
Viewing ${'${first_visible_row}'}-${'${last_visible_row}'} of ${'${total_rows}'} updates for this packahge
</div>
<div class="pager" id="pager" type="numeric" ></div>
- <div class="pager template" id="pager" type="more_link">
- <a href="${'${more_link}'}" moksha_url="dynamic">View more updates &gt;</a>
- </div>
</div>
</div>
diff --git a/setup.py b/setup.py
index 697570d..ef1528f 100755
--- a/setup.py
+++ b/setup.py
@@ -120,7 +120,7 @@ setup(
package.overview.builds = fedoracommunity.widgets.package.builds:Builds
package.bugs = fedoracommunity.widgets.package.bugs:BugsWidget
-
+ package.changelog = fedoracommunity.widgets.package.changelog:ChangelogWidget
[moksha.stream]
stats_cla_done = fedoracommunity.streams.stats:ClaDoneDataStream