Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

mucho updates: icon changes, sortable columns

  • Loading branch information...
commit 3cb1b19d3646d7844a57d7df6d9714555672243d 1 parent 10d5b7b
Chris Weyl authored April 15, 2010
52  lib/Fedora/App/Updates/Controller/REST.pm
@@ -7,6 +7,9 @@ BEGIN { extends  'Catalyst::Controller::REST' }
7 7
 
8 8
 use DBIx::Class::ResultClass::HashRefInflator;
9 9
 
  10
+# debugging...
  11
+#use Smart::Comments '###';
  12
+
10 13
 ##############################################################3
11 14
 # Helpers
12 15
 
@@ -106,9 +109,9 @@ sub packages_GET {
106 109
     my ($self, $c) = @_;
107 110
 
108 111
     # FIXME need search bits here
109  
-    my $search = $self->query_to_dbic($c);
110  
-
111  
-    my $rs = $c->model('Updates::Packages')->search($search, { order_by => 'me.name' });
  112
+    #my $search = $self->query_to_dbic($c);
  113
+    #my $rs = $c->model('Updates::Packages')->search($search, { order_by => 'me.name' });
  114
+    my $rs = $c->model('Updates::Packages')->search($self->query_to_dbic($c));
112 115
     my $transform_sub = sub { shift->all_versions };
113 116
 
114 117
     return $self->handle_partial_request($c, $rs, $transform_sub)
@@ -121,10 +124,49 @@ sub query_to_dbic {
121 124
     my ($self, $c) = @_;
122 125
 
123 126
     # FIXME this needs refactoring... ew
  127
+    #my %legal = map { $_ => 1 } qw{ name owner };
  128
+    my %legal = (owner => 'owner_id', name => 'name');
  129
+    my $params = $c->req->parameters;
  130
+
  131
+    ### $params
  132
+
  133
+    my ($search, $attrs) = ({}, { order_by => 'me.name' });
  134
+
  135
+    PARAM_LOOP:
  136
+    for my $param (keys %$params) {
  137
+
  138
+        if ($legal{$param}) {
  139
+
  140
+            # if we're a wildcard search...
  141
+            my $value = $params->{$param};
  142
+            $value =~ s/\*/%/g;
  143
+            $search->{"me.$legal{$param}"} = $value =~ /%/ ? { LIKE => $value } : $value;
  144
+            next PARAM_LOOP;
  145
+        }
  146
+
  147
+        next PARAM_LOOP unless $param =~ /^sort\(/;
  148
+
  149
+        # so, get our sort name and ASC/DESC
  150
+        $param =~ s/^sort\(//;
  151
+        $param =~ s/\)$//;
  152
+
  153
+        my $order = $param =~ /^-/ ? '-desc' : '-asc';
  154
+        warn $param;
  155
+        $param =~ s/^(-| )//;
  156
+        warn $param;
  157
+        next PARAM_LOOP unless $legal{$param};
  158
+        $attrs->{order_by} = { $order => "me.$legal{$param}" };
  159
+    }
  160
+
  161
+    ### $search
  162
+    ### $attrs
  163
+
  164
+    return ($search, $attrs);
  165
+
124 166
     my $name  = $c->req->parameters->{name};
125 167
     my $owner = $c->req->parameters->{owner};
126 168
 
127  
-    my $search = {};
  169
+    my ($search, $atts) = ({}, {});
128 170
 
129 171
     if ($name =~ /\*/) {
130 172
 
@@ -145,6 +187,8 @@ sub query_to_dbic {
145 187
     return $search;
146 188
 }
147 189
 
  190
+
  191
+
148 192
 __PACKAGE__->meta->make_immutable;
149 193
 
150 194
 __END__
2  lib/Fedora/App/Updates/Controller/Root.pm
@@ -49,6 +49,8 @@ sub packages : Path('packages') Args(0) {
49 49
     return;
50 50
 }
51 51
 
  52
+sub test : Local { }
  53
+
52 54
 sub end : ActionClass('RenderView') {}
53 55
 
54 56
 __PACKAGE__->meta->make_immutable;
8  lib/Fedora/App/Updates/Schema/Result/Versions.pm
@@ -255,11 +255,11 @@ sub update_class {
255 255
     #return 'attn' if $self->current lt $self->package->upstream_ga;
256 256
     #return 'check'
257 257
 
258  
-    return 'error' if not defined $self->current;
259  
-    return 'check' if not defined $self->package->upstream_ga;
  258
+    return 'ss_sprite ss_cross' if not defined $self->current;
  259
+    return 'ss_sprite ss_accept' if not defined $self->package->upstream_ga;
260 260
     return $self->current lt $self->package->upstream_ga
261  
-         ? 'attn'
262  
-         : 'check'
  261
+         ? 'ss_sprite ss_error'
  262
+         : 'ss_sprite ss_accept'
263 263
          ;
264 264
 }
265 265
 
13  root/src/index.tt2
@@ -37,6 +37,8 @@
37 37
 
38 38
 <script language="javascript">
39 39
 
  40
+dojo.require("dojox.data.JsonQueryRestStore");
  41
+
40 42
 dojo.require("dojox.grid.EnhancedGrid");
41 43
 dojo.require("dojox.grid.enhanced.plugins.DnD");
42 44
 dojo.require("dojox.grid.enhanced.plugins.Menu");
@@ -68,6 +70,8 @@ function format_cell(dist, value) {
68 70
 
69 71
 function format_rawhide(value) { format_cell('rawhide', value); }
70 72
 
  73
+function no_sort(index) { return index < 3 }
  74
+
71 75
 </script>
72 76
 
73 77
 <!-- begin packages -->
@@ -102,7 +106,7 @@ function format_rawhide(value) { format_cell('rawhide', value); }
102 106
 
103 107
 <select dojoType="dijit.form.FilteringSelect" id="users_select" name="users_select">
104 108
   <script type="dojo/method" event="onChange">
105  
-   packagesGrid.setQuery(dojo.fromJson(this.value));
  109
+    packagesGrid.setQuery(dojo.fromJson(this.value));
106 110
   </script>
107 111
     <option value="{ owner: '*' }"   selected >All Owners</option>
108 112
 [% FOREACH user = users -%]
@@ -115,6 +119,7 @@ function format_rawhide(value) { format_cell('rawhide', value); }
115 119
     dojoType="dojox.grid.EnhancedGrid"
116 120
     store="packageStore"
117 121
     query="{ name: 'perl-*' }"
  122
+    canSort="no_sort"
118 123
     jsId="packagesGrid"
119 124
     rowsPerPage="150"
120 125
     clientSort="true"
@@ -127,7 +132,7 @@ function format_rawhide(value) { format_cell('rawhide', value); }
127 132
     <tr>
128 133
       <th field="name" cellType="dojox.grid.cells._Widget"  width="20em">Package</th>
129 134
       <th field="owner"         width="8em">Owner</th>
130  
-      <th field="upstream_ga"   width="8em" >Upstream</th>
  135
+      <th field="upstream_ga" sortable="false"  width="8em" >Upstream</th>
131 136
 [% FOREACH dist = dists -%]
132 137
       <th field="[% dist %]-html" cellType="dojox.grid.cells._Widget" width="8em">[% dist %]</th>
133 138
 [% END -%]
@@ -135,6 +140,10 @@ function format_rawhide(value) { format_cell('rawhide', value); }
135 140
   </thead>
136 141
 </table>
137 142
 
  143
+<div dojoType="dijit.layout.ContentPane" splitter="true" region="right">
  144
+<p>Hi there!</p>
  145
+</div>
  146
+
138 147
 </div> [%# bordercontainer %]
139 148
 
140 149
 <!-- end packages -->
93  root/src/test.tt2
... ...
@@ -0,0 +1,93 @@
  1
+[%# /* vim: set filetype=tt2html : */ -%]
  2
+[% META title = 'Package Listing' %]
  3
+
  4
+<link rel="stylesheet" type="text/css"
  5
+    href="[% c.uri_for('/static/js/dojo/1.4/dojox/grid/resources/Grid.css') %]" />
  6
+<link rel="stylesheet" type="text/css"
  7
+    href="[% c.uri_for('/static/js/dojo/1.4/dojox/grid/resources/tundraGrid.css') %]" />
  8
+<link rel="stylesheet" type="text/css"
  9
+    href="[% c.uri_for('/static/js/dojo/1.4/dojox/grid/enhanced/resources/tundraEnhancedGrid.css') %]" />
  10
+<link rel="stylesheet" type="text/css"
  11
+    href="[% c.uri_for('/static/js/dojo/1.4/dojox/grid/enhanced/resources/EnhancedGrid_rtl.css') %]" />
  12
+
  13
+<style type="text/css">
  14
+  /*
  15
+  @import "[% c.uri_for('/static/js/dojo/1.4/dojox/grid/resources/Grid.css') %]";
  16
+  @import "[% c.uri_for('/static/js/dojo/1.4/dojox/grid/resources/tundraGrid.css') %]";
  17
+  @import "/static/js/dojo/1.4/dojox/grid/enhanced/resources/tundraEnhancedGrid.css";
  18
+  @import "/static/js/dojo/1.4/dojox/grid/enhanced/resources/EnhancedGrid_rtl.css";
  19
+  */
  20
+
  21
+  #grid1, #grid2, #grid3 {
  22
+    width: 85.2em;
  23
+    height: 50em;
  24
+  }
  25
+
  26
+  /* .dojoxGrid td, .dojoxGrid th {
  27
+  #gridDiv td, #gridDiv th { */
  28
+  #content .dojoxGridCell {
  29
+
  30
+    border-color:transparent #D5CDB5 #D5CDB5 transparent;
  31
+  }
  32
+
  33
+  /* this feels.... wrong. */
  34
+  #content table.dojoxGridRowTable th, #content table.dojoxGridRowTable td { border-width: 0px; }
  35
+</style>
  36
+
  37
+
  38
+<script language="javascript">
  39
+
  40
+dojo.require("dojox.data.JsonQueryRestStore");
  41
+
  42
+dojo.require("dojox.grid.EnhancedGrid");
  43
+dojo.require("dojox.grid.enhanced.plugins.DnD");
  44
+dojo.require("dojox.grid.enhanced.plugins.Menu");
  45
+dojo.require("dojox.grid.enhanced.plugins.NestedSorting");
  46
+dojo.require("dojox.grid.enhanced.plugins.IndirectSelection");
  47
+
  48
+dojo.require("dijit.layout.BorderContainer");
  49
+dojo.require("dijit.layout.ContentPane");
  50
+
  51
+dojo.require("dijit.form.FilteringSelect");
  52
+
  53
+dojo.ready(function() {
  54
+
  55
+    dojo.connect(dojo.byId("side_package_search"), "onchange",
  56
+        function(value) {
  57
+            pkgGrid.setQuery({ name: dijit.byId('side_package_search').value });
  58
+        }
  59
+    );
  60
+
  61
+});
  62
+
  63
+function format_cell(dist, value) {
  64
+    var item = packagesStore.getItem(row.index);
  65
+    if (item) {
  66
+      var upstream = packagesStore.getValue(item, "upstream_ga", null);
  67
+      var rawhide = packagesStore.getValue(item, "rawhide", null);
  68
+    }
  69
+}
  70
+
  71
+function format_rawhide(value) { format_cell('rawhide', value); }
  72
+
  73
+function no_sort(index) { return index < 3 }
  74
+
  75
+dojo.require("dojox.fx");
  76
+dojo.require("dojox.widget.CalendarFx");
  77
+dojo.require("dojox.widget.Calendar");
  78
+dojo.require("dojox.widget.DailyCalendar");
  79
+
  80
+</script>
  81
+
  82
+<div dojoType="dojox.widget.DailyCalendar" id="calLimits" value="2008-12-25" constraints="{min:'2008-12-12',max:'2009-01-15'}">
  83
+  <script type="dojo/connect" event="onValueSelected" args="value">
  84
+    log("Date Value selected: " + value);
  85
+  </script>
  86
+</div>
  87
+
  88
+
  89
+
  90
+<!-- begin packages -->
  91
+
  92
+
  93
+<!-- end packages -->
4  root/src/ttsite.css
@@ -13,6 +13,10 @@
13 13
 
14 14
 /* @import url("http://fedoraproject.org/static/css/fedora.css"); */
15 15
 
  16
+div#head h1#page_title {
  17
+    width: 100%;
  18
+}
  19
+
16 20
 /* snagged from https://admin.fedoraproject.org/pkgdb/static/css/pkgdb.css */
17 21
 
18 22
 a.bodhi

0 notes on commit 3cb1b19

Please sign in to comment.
Something went wrong with that request. Please try again.