[Rt-commit] rt branch, 5.0/user-summary-assets, created. rt-5.0.0alpha1-205-gf726997126

Jim Brandt jbrandt at bestpractical.com
Fri May 1 14:52:25 EDT 2020


The branch, 5.0/user-summary-assets has been created
        at  f726997126b9295d882cf1bddeed39e22517b603 (commit)

- Log -----------------------------------------------------------------
commit f726997126b9295d882cf1bddeed39e22517b603
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri May 1 14:43:14 2020 -0400

    Convert summary page asset searches to use AssetSQL

diff --git a/share/html/Group/Elements/AssetList b/share/html/Group/Elements/AssetList
index e88443bf58..d35b03e98e 100644
--- a/share/html/Group/Elements/AssetList
+++ b/share/html/Group/Elements/AssetList
@@ -61,8 +61,43 @@ my $Format = q[
     Description,
 ];
 $m->callback( CallbackName => 'ModifyFormat', %ARGS, Format => \$Format );
+
+my %QueryProperties = (
+    Query      => join(' OR ', map { "$_.id = ".$Group->PrincipalId } ('HeldBy', 'Contact', 'Owner') ),
+    OrderBy    => 'id',
+    Order      => 'ASC',
+);
+
+$m->callback( CallbackName => 'ModifyQueryProperties',
+    %ARGS,
+    QueryProperties => \%QueryProperties,
+);
+
+my $query_string = $m->comp('/Elements/QueryString',
+    Class       => 'RT::Assets',
+    Query       => $QueryProperties{Query},
+    OrderBy     => $QueryProperties{OrderBy},
+    Order       => $QueryProperties{Order},
+);
+
+my $search_url  =
+    RT->Config->Get('WebPath') .
+    '/Search/Results.html?' .
+    $query_string;
+
+my $bulk_update_url  =
+    RT->Config->Get('WebPath') .
+    '/Asset/Search/Bulk.html?' .
+    $query_string;
+
 </%INIT>
-<&| /Widgets/TitleBox, title => $Title, class => "group asset-list" &>
+<&| /Widgets/TitleBox,
+    title => $Title,
+    title_href => $search_url,
+    titleright => 'Bulk Update',
+    titleright_href => $bulk_update_url,
+    class => "group asset-list",
+&>
     <& /Elements/CollectionList,
         Collection      => $assets,
         OrderBy         => 'id',
diff --git a/share/html/User/Elements/AssetList b/share/html/User/Elements/AssetList
index 154737fd29..061a3a4361 100644
--- a/share/html/User/Elements/AssetList
+++ b/share/html/User/Elements/AssetList
@@ -61,8 +61,43 @@ my $Format = q[
     Description,
 ];
 $m->callback( CallbackName => 'ModifyFormat', %ARGS, Format => \$Format );
+
+my %QueryProperties = (
+    Query      => join(' OR ', map { "$_.id = ".$User->Id } ('HeldBy', 'Contact', 'Owner') ),
+    OrderBy    => 'id',
+    Order      => 'ASC',
+);
+
+$m->callback( CallbackName => 'ModifyQueryProperties',
+    %ARGS,
+    QueryProperties => \%QueryProperties,
+);
+
+my $query_string = $m->comp('/Elements/QueryString',
+    Class       => 'RT::Assets',
+    Query       => $QueryProperties{Query},
+    OrderBy     => $QueryProperties{OrderBy},
+    Order       => $QueryProperties{Order},
+);
+
+my $search_url  =
+    RT->Config->Get('WebPath') .
+    '/Search/Results.html?' .
+    $query_string;
+
+my $bulk_update_url  =
+    RT->Config->Get('WebPath') .
+    '/Asset/Search/Bulk.html?' .
+    $query_string;
+
 </%init>
-<&| /Widgets/TitleBox, title => $Title, class => "user asset-list" &>
+<&| /Widgets/TitleBox,
+    title => $Title,
+    title_href => $search_url,
+    titleright => 'Bulk Update',
+    titleright_href => $bulk_update_url,
+    class => "user asset-list",
+&>
     <& /Elements/CollectionList,
         Collection      => $assets,
         OrderBy         => 'id',

-----------------------------------------------------------------------


More information about the rt-commit mailing list