Hey Marc,

I can certainly relate. Time’s a problem for me as well. I’d love to add this 
ability, and think it makes sense, but I can’t give you an ETA right now. 
Swamped with a large To Do list.

If it were being written, what I’d expect is a hook that DashboardDataGrid’s 
view directly uses. It would take the ?view= provided to the URL, find the 
appropriate hook, and either render the queryset it provides through 
DashboardDataGrid, or render a custom DataGrid. There’s probably a lot to think 
through, like how the sidebar works, where things integrate, etc.

Christian

-- 
Christian Hammond - christ...@beanbaginc.com
Review Board - http://www.reviewboard.org
Beanbag, Inc. - http://www.beanbaginc.com

On June 17, 2014 at 12:15:56 PM, Marc Bryan (marc2...@gmail.com) wrote:

Thanks Christian. Makes sense to post to reviewboard-dev. :)

Are there any plans to add another extension point / change the way this works 
in the future? If I get a chance I can look into making a patch, but time is 
always the problem :D

Marc

On Monday, June 16, 2014 10:35:46 PM UTC-6, Christian Hammond wrote:
Hi Marc,

The reviewboard-dev list is a better place for these questions, since there’s 
less traffic there and more people interested in RB-related development.

That said, the problem is that you cannot replace the dashboard. The parameter 
for the datagrid in DataGridSidebarItemsHook is the class that the sidebar 
should apply to, but it must be an existing, established datagrid. What you’d 
have to do there is provide your own URL and view for your this datagrid, 
render that there, and then link to that URL. That also means you’ll need these 
hooks in two places, which is going to be a bit annoying.

It’s not ideal, but that’s how it works currently.

Christian

-- 
Christian Hammond - chri...@beanbaginc.com
Review Board - http://www.reviewboard.org
Beanbag, Inc. - http://www.beanbaginc.com

On June 16, 2014 at 11:24:54 AM, Marc Bryan (marc...@gmail.com) wrote:

Hi guys,

I'm having trouble writing a dashboard sidebar extension that adds custom 
filters to the datagrid.

ie. I would like to make a few different links, but an example of one would be 
'Needs More Reviews', which would filter the reviews by:
less than 2 Ship-its (2 is our internal rule)
has no open reviews
not yours

Here is what I have currently:

extension.py:

class MySidebarSection(BaseSidebarSection):
    label = 'My Dashboard'

    def get_items(self):
        yield SidebarNavItem(self, 'My Requests to Push', view_id='push')
        yield SidebarNavItem(self, 'My Requests to Fix', view_id='fix')
        yield SidebarNavItem(self, 'Involved Reviews', view_id='involved')
        yield SidebarNavItem(self, 'Needs More Reviews', view_id='outstanding')
        yield SidebarNavItem(self, 'All Requests to Push', view_id='approved')

class MyDashboard(Extension):
    metadata = {
        'Name': 'My Dashboard',
        'Summary': 'Summary here',
    }
    is_configurable = True

    def initialize(self):
        # Your extension initialization is done here.
        DataGridSidebarItemsHook(self, MyDashboardDataGrid, [MySidebarSection])


datagrids.py

class MyDashboardDataGrid(DashboardDataGrid):
    def load_extra_state(self, profile):
        # pass custom queryset and change title
        user = self.request.user
        fullPath = self.request.get_full_path()
        view = self.request.GET.get('view', self.default_view)

        q = Q(repository__name='MyRepo', target_groups__name='internal', 
status='P')

        if view == 'outstanding':
                q = q & Q(shipit_count__lt=2, issue_open_count=0)  # TODO: make 
sure the review isn't yours
                self.queryset = ReviewRequest.objects.filter(q)
                self.title = _('Requests That Need Reviews (Reviews with # 
ship-its < 2, no open issues, not yours)')

        return super(MyDashboardDataGrid, self).load_extra_state(profile)



I assume this is all I need to do, but I keep getting this error when I click 
on the 'Needs More Reviews' link.

Page not found (404)
Request Method: GET
Request URL: http://0.0.0.0:8080/dashboard/?view=outstanding

This 404 is being raised by DashboardDataGrid.load_extra_state().

It seems as if DataGridSidebarItemsHook isn't using MyDashboardDataGrid but 
instead using DashboardDataGrid.

Is there anything I am missing?

Thanks for your help.

Marc
--
Get the Review Board Power Pack at http://www.reviewboard.org/powerpack/
---
Sign up for Review Board hosting at RBCommons: https://rbcommons.com/
---
Happy user? Let us know at http://www.reviewboard.org/users/
---
You received this message because you are subscribed to the Google Groups 
"reviewboard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reviewboard...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Get the Review Board Power Pack at http://www.reviewboard.org/powerpack/
---
Sign up for Review Board hosting at RBCommons: https://rbcommons.com/
---
Happy user? Let us know at http://www.reviewboard.org/users/
---
You received this message because you are subscribed to the Google Groups 
"reviewboard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reviewboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
Get the Review Board Power Pack at http://www.reviewboard.org/powerpack/
---
Sign up for Review Board hosting at RBCommons: https://rbcommons.com/
---
Happy user? Let us know at http://www.reviewboard.org/users/
--- 
You received this message because you are subscribed to the Google Groups 
"reviewboard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reviewboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to