summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn (J5) Palmieri <johnp@redhat.com>2011-11-28 21:10:56 (GMT)
committerJohn (J5) Palmieri <johnp@redhat.com>2011-11-28 21:10:56 (GMT)
commitaebceb43ecfee1b2c7ee1fffeef3d53a78ba2001 (patch)
treee3233fee0b004369fd000ee780b0cfba719f758d
parent4ff111704b89762826ac35a1ced14e701e8e0316 (diff)
downloadfedoracommunity-aebceb43ecfee1b2c7ee1fffeef3d53a78ba2001.zip
fedoracommunity-aebceb43ecfee1b2c7ee1fffeef3d53a78ba2001.tar.gz
fedoracommunity-aebceb43ecfee1b2c7ee1fffeef3d53a78ba2001.tar.xz
add requires table
-rw-r--r--fedoracommunity/widgets/package/relationships.py8
-rw-r--r--fedoracommunity/widgets/package/templates/relationshipbase.mak30
-rw-r--r--fedoracommunity/widgets/package/templates/requires_table_widget.mak39
3 files changed, 71 insertions, 6 deletions
diff --git a/fedoracommunity/widgets/package/relationships.py b/fedoracommunity/widgets/package/relationships.py
index 58838a8..4f7bf58 100644
--- a/fedoracommunity/widgets/package/relationships.py
+++ b/fedoracommunity/widgets/package/relationships.py
@@ -63,8 +63,14 @@ class RelationshipBaseWidget(twc.Widget):
build_info['arch_tasks'] = arch_tasks
self.build_to_archtask_map[build_info['build_id']] = arch_tasks
+class RequiresWidgetGrid(Grid):
+ template = template = 'mako:fedoracommunity.widgets.package.templates.requires_table_widget'
+ resource = 'koji'
+ resource_path = 'query_requires'
+ onReady = "update_grid()"
+
class RequiresWidget(RelationshipBaseWidget):
- pass
+ grid = RequiresWidgetGrid
class DependsWidget(RelationshipBaseWidget):
pass
diff --git a/fedoracommunity/widgets/package/templates/relationshipbase.mak b/fedoracommunity/widgets/package/templates/relationshipbase.mak
index 8f2aa79..c8f672e 100644
--- a/fedoracommunity/widgets/package/templates/relationshipbase.mak
+++ b/fedoracommunity/widgets/package/templates/relationshipbase.mak
@@ -12,7 +12,27 @@
import json
json_build_arch_tasks = json.dumps(w.build_to_archtask_map)
%>
+
var build_arch_tasks = ${json_build_arch_tasks};
+ var $grid = null;
+
+ function update_grid() {
+ if ($grid == null)
+ throw "Grid is not registered";
+
+ var build_id = $("#build_select").val();
+ var arch_index = $("#arch_select").val();
+ var task = build_arch_tasks[build_id][arch_index];
+ var nvr = task['nvr'];
+ var arch = task['label'];
+
+ $grid.mokshagrid("request_update",{"filters":{"nvr": nvr,
+ "arch": arch}});
+ }
+
+ function register_grid(grid) {
+ $grid = grid;
+ }
function on_build_change(self) {
var archs = build_arch_tasks[self.value];
@@ -25,9 +45,8 @@
var $option = $("<option></option>").text(arch_name).attr('value', i);
$arch_select.append($option);
}
-
+ update_grid();
}
-
</script>
<select name="build_id" id="build_select" onChange="on_build_change(this)">
% for (i, build) in enumerate(w.latest_builds.keys()):
@@ -50,13 +69,13 @@
% endfor
</select>
<label for="arch_task_id">Arch:</label>
- <select name="arch_task_id" id="arch_select" onChange="displayTree(this.value)">
+ <select name="arch_task_id" id="arch_select" onChange="update_grid()">
% for (i, arch_task) in enumerate(w.latest_builds.values()[0]['arch_tasks']):
<%
selected= ""
if i == 0:
selected = 'selected'
- task_id = str(arch_task['id'])
+
arch = arch_task['label']
%>
<option ${selected} value="${str(i)}">${arch}</option>
@@ -65,7 +84,8 @@
</div>
</form>
</div>
- <div id="tree_content">
+ <div id="relationship_content">
+ ${w.children[0].display(args=w.args, kwds=w.kwds) | n}
</div>
</div>
</div>
diff --git a/fedoracommunity/widgets/package/templates/requires_table_widget.mak b/fedoracommunity/widgets/package/templates/requires_table_widget.mak
new file mode 100644
index 0000000..20d2db7
--- /dev/null
+++ b/fedoracommunity/widgets/package/templates/requires_table_widget.mak
@@ -0,0 +1,39 @@
+<html>
+<head></head>
+<body>
+ <div class="list header-list">
+ <div id="grid-controls">
+ <div class="message template" id="info_display" >
+ ${'${total_rows}'} total requirements
+ </div>
+ </div>
+ <table id="${w.id}" class="">
+ <thead>
+ <tr>
+ <th>Requires</th>
+ <th>Provided By</th>
+ </tr>
+ </thead>
+
+ <tbody class="rowtemplate">
+ <tr>
+ <td>
+ ${'${name}'} ${'${ops}'} ${'${version}'}
+ </td>
+
+ <td>
+ </td>
+
+ </tr>
+ </tbody>
+ </table>
+ <div id="grid-controls" if="visible_rows < total_rows">
+ <div class="pager" id="pager" type="more" ></div>
+ </div>
+ </div>
+ <script type="text/javascript">
+ var $grid = $("#${w.id}");
+ register_grid($grid);
+ </script>
+</body>
+</html>