Changeset 273


Ignore:
Timestamp:
01/02/11 18:20:04 (13 years ago)
Author:
nanardon
Message:
  • allow to filter rpm list in distrib/
Location:
server/trunk/web
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • server/trunk/web/lib/Sophie/Controller/Distrib.pm

    r272 r273  
    321321    } 
    322322 
    323     @{$c->stash->{rpm}} = map { 
    324             {  
    325               pkgid => $_->pkgid, 
    326               filename => $_->filename, 
    327             } 
    328         } 
    329         $c->forward('distrib_rs', [ $distribution ]) 
    330         ->search_related('MediasPaths') 
    331         ->search_related('Paths') 
    332         ->search_related('Rpmfiles', {}, { order_by => qw(filename) }) 
    333         ->all; 
     323    $c->stash->{rpm} = [ map { 
     324        { 
     325        pkgid => $_->pkgid, 
     326        filename => $_->filename, 
     327        } 
     328        } $c->forward('/search/rpms/rpms_rs', [ $distribution ]) 
     329        ->search( 
     330            { 
     331                $c->req->param('fl') 
     332                    ? ( filename => { ILIKE => $c->req->param('fl') . '%' } ) 
     333                    : (), 
     334            }, { order_by => [ qw(filename) ] }) 
     335        ->all ]; 
    334336 
    335337    $c->stash->{xmlrpc} = $c->stash->{rpm}; 
     
    371373    } 
    372374 
     375    $distribution->{src} = 0; 
     376 
    373377    $c->stash->{rpm} = [ map { 
    374             {  
    375               pkgid => $_->pkgid, 
    376               filename => $_->filename, 
    377             } 
    378         } 
    379         $c->forward('distrib_rs', [ $distribution ]) 
    380         ->search_related('MediasPaths') 
    381         ->search_related('Paths') 
    382         ->search_related('Rpmfiles', { 
    383             pkgid => { 
    384                 IN => $c->model('Base')->resultset('Rpms') 
    385                 ->search({ issrc => 'false' })->get_column('pkgid') ->as_query } 
    386         }, 
    387         { order_by => [ qw(filename) ] } 
    388         )->all ]; 
     378        { 
     379        pkgid => $_->pkgid, 
     380        filename => $_->filename, 
     381        } 
     382        } $c->forward('/search/rpms/rpms_rs', [ $distribution ]) 
     383        ->search( 
     384            { 
     385                $c->req->param('fl') 
     386                    ? ( filename => { ILIKE => $c->req->param('fl') . '%' } ) 
     387                    : (), 
     388            }, { order_by => [ qw(filename) ] }) 
     389        ->all ]; 
    389390 
    390391    $c->stash->{xmlrpc} = $c->stash->{rpm}; 
     
    426427    } 
    427428 
    428     @{$c->stash->{rpm}} = map { 
    429             {  
    430               pkgid => $_->pkgid, 
    431               filename => $_->filename, 
    432             } 
    433         } 
    434         $c->forward('distrib_rs', [ $distribution ]) 
    435         ->search_related('MediasPaths') 
    436         ->search_related('Paths') 
    437         ->search_related('Rpmfiles', { 
    438             pkgid => { 
    439                 IN => $c->model('Base')->resultset('Rpms') 
    440                 ->search({ issrc => 'true' })->get_column('pkgid') ->as_query } 
    441         }, 
    442         { order_by => [ qw(filename) ] } 
    443         )->all; 
     429    $distribution->{src} = 1; 
     430 
     431    $c->stash->{rpm} = [ map { 
     432        { 
     433        pkgid => $_->pkgid, 
     434        filename => $_->filename, 
     435        } 
     436        } $c->forward('/search/rpms/rpms_rs', [ $distribution ]) 
     437        ->search( 
     438            { 
     439                $c->req->param('fl') 
     440                    ? ( filename => { ILIKE => $c->req->param('fl') . '%' } ) 
     441                    : (), 
     442            }, { order_by => [ qw(filename) ] }) 
     443        ->all ]; 
    444444 
    445445    $c->stash->{xmlrpc} = $c->stash->{rpm}; 
  • server/trunk/web/lib/Sophie/Controller/Search/Rpms.pm

    r157 r273  
    5555                select => [qw(filename pkgid name shortname version arch label) ], 
    5656                as => [qw(filename pkgid distribution dist release arch media) ], 
    57                 rows => $searchspec->{rows} || 10000, 
     57                rows => $searchspec->{rows} || 30000, 
    5858                order_by => [ 'Rpmfiles.added desc' ], 
    5959            }, 
     
    173173 
    174174    $c->stash->{rs} = 
    175         $c->forward('rpms_rs')->search( 
     175        $c->forward('rpms_rs', [ $searchspec ])->search( 
    176176        { 
    177177            filename => { LIKE => $file }, 
  • server/trunk/web/root/templates/html/distrib/list_rpms.html

    r184 r273  
    11<!-- $Id$ --> 
    22 
     3<div Id="sophie_body_main"> 
     4<form action="[% c.uri_for('/', c.req.path) %]" method="POST"> 
     5    <label for="fl">Filter to filename starting by:</label> 
     6    <input type="text" id="fl" name="fl" value="[% c.req.param('fl') | html %]"> 
     7</form> 
     8[% c.prototype.observe_field( 
     9    'fl', 
     10    { 
     11    url => c.uri_for('/', c.req.path, { ajax => 1 }), 
     12    frequency => 2, 
     13    update => 'rpms_list', 
     14    with => '"ajax=1&fl=" + value', 
     15    } 
     16) %] 
     17 
     18<div id="rpms_list"> 
    319[% INCLUDE 'distrib/list_rpms.tt' %] 
     20</div> 
     21</div> 
  • server/trunk/web/root/templates/html/distrib/list_srpms.html

    r190 r273  
    11<!-- $Id$ --> 
    22 
     3<div Id="sophie_body_main"> 
     4<form action="[% c.uri_for('/', c.req.path) %]" method="POST"> 
     5    <label for="fl">Filter to filename starting by:</label> 
     6    <input type="text" id="fl" name="fl" value="[% c.req.param('fl') | html %]"> 
     7</form> 
     8[% c.prototype.observe_field( 
     9    'fl', 
     10    { 
     11    url => c.uri_for('/', c.req.path, { ajax => 1 }), 
     12    frequency => 2, 
     13    update => 'rpms_list', 
     14    with => '"ajax=1&fl=" + value', 
     15    } 
     16) %] 
     17 
     18<div id="rpms_list"> 
    319[% INCLUDE 'distrib/list_srpms.tt' %] 
     20</div> 
     21</div> 
  • server/trunk/web/root/templates/html/distrib/media_list_rpms.html

    r230 r273  
    11<!-- $Id$ --> 
     2 
    23<div Id="sophie_body_main"> 
     4<form action="[% c.uri_for('/', c.req.path) %]" method="POST"> 
     5    <label for="fl">Filter to filename starting by:</label> 
     6    <input type="text" id="fl" name="fl" value="[% c.req.param('fl') | html %]"> 
     7</form> 
     8[% c.prototype.observe_field( 
     9    'fl', 
     10    { 
     11    url => c.uri_for('/', c.req.path, { ajax => 1 }), 
     12    frequency => 2, 
     13    update => 'rpms_list', 
     14    with => '"ajax=1&fl=" + value', 
     15    } 
     16) %] 
     17 
     18<div id="rpms_list"> 
    319[% INCLUDE 'distrib/media_list_rpms.tt' %] 
     20</div> 
    421</div> 
    522 
Note: See TracChangeset for help on using the changeset viewer.