Jump to content

ProcessWire Dashboard


Recommended Posts

8 minutes ago, Sevarf2 said:

Hi @d'Hinnisdaël I'm using the module in all my projects now, very well done. Just one issue or something I missed to configure, when I'm using the template panel in which I need to create some pages based on buttons action I got PW fatar error class Page not found.

Not sure what you're running into here. If you have a repo or gist with the code that's blowing up, I'm happy to take a look. Best bet is to make sure your templates are properly namespaced (ProcessWire).

Link to comment
Share on other sites

It's just a simple page creation
 

$mainNode     = $pages->get(1030);
$today             = date("Ymd");
$checkToday = $pages->get("name=$today");
if( !$checkToday->id ){
    
    $td                    = new Page();
    $td->parent     = $mainNode;
    $td->template  = $templates->get("day");
    $td->title          = $today;
    $td->save();
    
}

 


and in my admin I call the panel which is that code
It's a fresh PW install 3.0.148

	wire()->addHookAfter('Dashboard::getPanels', function ($event) {
    
    $panels = $event->return;
	    $panels->add([
        'panel' => 'template',
        'title' => 'Excel import',
        'size'  => 'full',
        'icon'  => 'upload',
        'data' => [
            'template' => 'dashboard/dashb_import.php'
        ]
    ]);
 
	    
});
	
Link to comment
Share on other sites

@Sevarf2 How do you manage state in your template — get variables?

The template panel works best for displaying static data. For creating pages and importing data I'd suggest creating a custom panel type. That'd make it much easier to manage the required multi-step processes. Or better yet, a Process module for importing data and a separate dashboard panel that only kicks off the import and hands off the actual workload to the main module.

  • Like 1
Link to comment
Share on other sites

  • 2 months later...
51 minutes ago, apeisa said:

Just noticed that module documentation returns 404 https://philippdaun.github.io/processwire-dashboard/

You're right, thanks for letting me know. Links should be fixed now. I just switched to a different GitHub username and hadn't come around to updating the links yet.

The docs can be found here now: daun.github.io/processwire-dashboard/

  • Like 4
Link to comment
Share on other sites

Thanks @d'Hinnisdaël

Gotta say I really like this module, solid work & documentation.

One suggestion - not sure I understand the reason for current Collection pagination? It only shows the count of results, instead of showing actual pager. Changing this to actual pager is trivial, but probably something you would like to offer as an option?

$pagination = sprintf(
  $this->_('Showing %d of %d'),
  $this->collection->count,
  $this->collection->getTotal()
);
$footer .= "<div>{$pagination}</div>";

so instead of that just use:

$footer .= "<div>{$this->collection->renderPager()}</div>";

And we have default PW pager working as expected. Of course this is not fully functional (and probably reason why left out from initial version?) is that it doesn't work with current table sorts which are only client sorts.

Another route for case where you really need paging would be using pagelist, but there I think pager limit should be a setting too.

Link to comment
Share on other sites

23 hours ago, apeisa said:

One suggestion - not sure I understand the reason for current Collection pagination? It only shows the count of results, instead of showing actual pager. Changing this to actual pager is trivial, but probably something you would like to offer as an option?

There's really two reasons this isn't implemented:

1 — I don't think it's all that necessary. For actual browsing of data that requires state and pagination, there's much better tools available: PageList and PageLister, among others. The pagination info, as implemented currently, is merely meant to communicate that there's more results than currently shown and avoid any confusion there.

2 — It's probably not that trivial to build. The native pagination breaks down once you do any sorting or render multiple paginated panels on a dashboard. To make it work well, it would have to be a custom-built solution that fetches results via AJAX and does the sorting server-side.

I'm not currently doing any substantial work on the module, however I'm planning to implement some missing features when I find the time later this summer. In the meantime, I'll happily accept pull requests for a working pagination feature.

  • Like 2
Link to comment
Share on other sites

Yes, I think you are probably right with both of your reasons. I did try to make pagelist work with pagination (it does, but couldn't get limit to be set dynamically, so it follows whatever is set on pagelist module which defaults to 50). It seems that I wont need pagination at all on dashboard (more proof for your point 1), but if the need arises I will definitely take a closer look into it.

Link to comment
Share on other sites

  • 3 weeks later...

Release 0.7.0 adds a few features and fixes an issue reported by @MoritzLost.

  • Collection panel: Field names as column headers
    The collections panel now uses the field label as column header. No need to pass them in explicitly anymore. See the docs on column headers for details.
  • Shortcuts panel: Add option to hide shortcut summaries
    Disable the summaries altogether by setting the summaries option to false.
  • Shortcuts panel: Fix undefined-index error when destructuring shortcuts
  • Like 4
Link to comment
Share on other sites

On 8/2/2020 at 2:26 PM, d'Hinnisdaël said:

Release 0.7.0 adds a few features and fixes an issue reported by @MoritzLost.

I have a problem with the new version, each time I open the dashboard, I get 2 messages:

1525728519_2020-08-0510_07_04-Dashboard.png.b5924f8bee4ef9ab2edb8fd2f5c9c5b5.png

If the message is closed, it will be displayed again the next time the dashboard is opened.

Link to comment
Share on other sites

13 minutes ago, zoeck said:

I have a problem with the new version, each time I open the dashboard, I get 2 messages

Right, thanks, I left a session message in there. I pushed a patch at version 0.7.1. While it propagates to the module directory, removing line 119 of DashboardPanelCollection.module should work as well.

  • Like 1
Link to comment
Share on other sites

43 minutes ago, d'Hinnisdaël said:

Right, thanks, I left a session message in there. I pushed a patch at version 0.7.1. While it propagates to the module directory, removing line 119 of DashboardPanelCollection.module should work as well.

That's it, thank you very much! ? 

Link to comment
Share on other sites

  • 1 month later...

Hi,

I have a question, can't get to pass option to a chart panel.

Whatever option are not getting apply. must be a synthax probleme maybe.

Here is the code. for instance with this code the legend is still below the doughnut (it should be rigth to it) and the dougnut is fairly thin and it should be 50%.

Thanks for your help.

 

$panels->add(
['panel' => 'chart',
	 'title' => 'Tags Status',
		 'data' => [
		    'chart' => [
		      	'type' => 'doughnut',
		      	'data' => [
		      		'labels' => ['Doc without tag','Doc not reviewed','Docs tags OK'],
		        
		        	'datasets' => [
		            	[
		            	'data' => [$noTag, $TagNotReviewed, $TagReviewed]
				    ]
			    ],
			    'options' => [
			    	'cutoutPercentage' => '50',
			    	'position' => 'right',			
				]
     	    ]
     	]
	]
]
);

 

Link to comment
Share on other sites

14 hours ago, antpre said:

I have a question, can't get to pass option to a chart panel.

The code looks right to me. The fact that you're seeing a chart at all means there's probably something off in the way your options are structured. The panel itself only sets the defaults so overriding them like you're doing it should work. I'm afraid I won't be of much help here since debugging Chart.js config is a bit out of scope of this module ?

Link to comment
Share on other sites

  • 1 month later...

@d'Hinnisdaël I'm having some trouble with a Collection panel that lists user accounts. Specifically, with the "edit" action, which appears disabled for everyone but superusers. I checked the source code, apparently the edit action is disabled on DashboardPanelCollection.module#L327. $page->editable apparently returns false if the $page is a user, even for users with the user-admin permission. Probably because editing users is a special case?

Anyway, changing this to a hardcoded false fixes the problem in my case. Of course this isn't a general solution. Maybe the module could check for this special case and only disable the edit action if the current user doesn't have the user-admin permission? Not sure what the best solution is, does anybody know why $user->editable returns false even if the current user has the user-admin permission?

Thanks!

Link to comment
Share on other sites

@schwarzdesign Thanks for reporting. I'm afraid there's no easy solution without changing how the core handles user edit permissions. Currently, the editable() check fails for all processes other than the default page-edit or page-lister ones. That's why it doesn't work in the context of the Dashboard process. See the corresponding source code of PagePermissions.module.

I'm not sure why it's done this way and if there's a chance to get this opened up. I'd suggest you open an issue in the official ProcessWire repo to get a discussion started.

Checking for user-admin permissions as a special case sounds good but won't solve the problem: the user permissions are a lot more complex when you're handling superusers vs. non-superusers and multi-layer permission systems. There's user-admin-all and any combination of user-admin-[role] permissions we'd have to check manually. It's definitely better than the current state, though. I might implement this in the near future.

  • Thanks 1
Link to comment
Share on other sites

@d'Hinnisdaël Thanks for the reply! I've opened issue #1322 regarding the context-dependence of $user->editable. Hopefully something will come of it.

I also found issue #538, which seems to be related to this? Not sure. Regardless, the fact that $user->editable returns different results based on context is troublesome in any case, so I think you're right that this should be fixed in the core.

Link to comment
Share on other sites

Just that one of my dashboards is getting a bit large. I'd like to have maybe 3 tabs - one a pure dashboard of information, one with various settings and one webmaster-only board with system information and housekeeping etc. I could do it with a custom module, but I like your dashboard for the information view ?

Link to comment
Share on other sites

Maybe I'm trying to push this module too far. I decided to separate the other info into a separate (tabbed presentation) module.

Now I have a different need - to use a callback function in chart options. I can't see how to do that in the syntax, but maybe it's just not possible?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...