Status: New
Owner: ----
Labels: Type-Enhancement Priority-Medium

New issue 3423 by marc2...@gmail.com: Extensions: Allow custom datagrids to be used with DataGridSidebarItemsHook
http://code.google.com/p/reviewboard/issues/detail?id=3423

*** For customer support, please post to reviewbo...@googlegroups.com
*** If you have a patch, please submit it to
http://reviews.reviewboard.org/
***
*** Do not post confidential information in this enhancement request!


What version are you running?

Review Board 2.0.1


What's the URL of the page this enhancement relates to, if any?

The main dashboard.


Describe the enhancement and the motivation for it.

The full discussion is tracked here:

https://groups.google.com/d/msg/reviewboard/dBgLHUrjyp8/WOLTOnbkF4wJ

I would like to be able to add SidebarNavItems that add custom queries to the main dashboard.

I attempted this by writing my own DashboardDataGrid and SidebarSection, and then passing them both into DataGridSidebarItemsHook, but it seems that you need to pass a datagrid that already exists.

Here is a condensed version of the code I attempted for quick reference:


class MyDashboardDataGrid(DashboardDataGrid):
    def load_extra_state(self, profile):
        # pass custom queryset and change title
        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)

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

    def get_items(self):
yield SidebarNavItem(self, 'Needs More Reviews', view_id='outstanding')

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])


What operating system are you using? What browser?

Windows and Ubuntu. Mostly Chrome.


Please provide any additional information below.

Thanks!

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"reviewboard-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reviewboard-issues+unsubscr...@googlegroups.com.
To post to this group, send email to reviewboard-issues@googlegroups.com.
Visit this group at http://groups.google.com/group/reviewboard-issues.
For more options, visit https://groups.google.com/d/optout.

Reply via email to