d'Hinnisdaël Posted February 10, 2021 Author Share Posted February 10, 2021 @MarkE Callback function in what context? What's the goal? Link to comment Share on other sites More sharing options...
MarkE Posted February 10, 2021 Share Posted February 10, 2021 On 2/10/2021 at 2:22 PM, d'Hinnisdaël said: Callback function in what context? What's the goal? Expand I have a chart that has a logarithmic y axis and I want normal numeric notation, not scientific, on the tick marks. In Chart.js v2 it seems the only way you can do this is with a callback - see https://github.com/chartjs/Chart.js/issues/3121 Link to comment Share on other sites More sharing options...
d'Hinnisdaël Posted February 11, 2021 Author Share Posted February 11, 2021 @MarkE There's currently no direct way to do this — the chart data is passed as a JSON blob, so no functions. I've been looking at setting up charts via JS files or JSON endpoints, but nothing concrete yet. I'll probably end up moving the chart panel to a chartkick.js implementation which would allow all of that. 1 Link to comment Share on other sites More sharing options...
adrian Posted September 21, 2021 Share Posted September 21, 2021 @d'Hinnisdaël - if you're contemplating moving away from chartjs, can I recommend a library that outputs SVG, rather than canvas - perhaps c3js? The reason being that it makes styling the charts with CSS really easy and also modifying them with D3JS is easy. On a different note, I wonder if you'd consider setting up support for multiple tabs using WireTab? One of my dashboards is getting very long and it would be great to be able to split it up into different views and I think a tabbed interface would be effective. Link to comment Share on other sites More sharing options...
d'Hinnisdaël Posted September 21, 2021 Author Share Posted September 21, 2021 On 9/21/2021 at 4:48 PM, adrian said: @d'Hinnisdaël - if you're contemplating moving away from chartjs, can I recommend a library that outputs SVG, rather than canvas - perhaps c3js? The reason being that it makes styling the charts with CSS really easy and also modifying them with D3JS is easy. On a different note, I wonder if you'd consider setting up support for multiple tabs using WireTab? One of my dashboards is getting very long and it would be great to be able to split it up into different views and I think a tabbed interface would be effective. Expand Good point about making charts styleable via CSS. My experience has been that most clients and most dashboards don't need charts at all, so frankly I don't think I'll be investing too much time here, but if or when I decide to revamp the chart panel I'll keep that in mind. Adding tabs is definitely on my list. Groups are already supported, so adding tabs should be somewhat trivial. There's possible performance issues to keep in mind when rendering too many panels at once but that shouldn't be a blocker. 2 Link to comment Share on other sites More sharing options...
d'Hinnisdaël Posted September 22, 2021 Author Share Posted September 22, 2021 @adrian I went ahead and added very basic tab support. Thanks for the nudge. If you want to give it a try, feel free to check out the tabs branch of the repo. Theoretically it supports nesting tabs inside groups and vice versa, however it's largely untested so let me know if you run into trouble. I'd like to do some more testing before releasing a new version. wire()->addHookAfter('Dashboard::getPanels', function ($event) { $panels = $event->return; $tab1 = $panels->createTab(['title' => 'Lorem ipsum']); $tab1->add(/* add panels here */); $tab2 = $panels->createTab(['title' => 'Dolor sit amet']); $tab2->add(/* add panels here */); $panels->add($tab1); $panels->add($tab2); }); 1 Link to comment Share on other sites More sharing options...
Siddhi Jagtap Posted September 23, 2021 Share Posted September 23, 2021 I recently installed the Processwire Dashboard module (https://daun.github.io/processwire-dashboard/#/). After I added the hook code in site/templates/admin.php, even though I can see the dashboard, the 'Pages' page shows this error - Fatal error: Cannot redeclare _checkForMaxInputVars() (previously declared in wire/core/admin.php:line 96).' When I try to add a panel to show the Pagelist or simply try to access the subpages of any parent page, I see this error too. This error disappears when I remove the hook code from sites/templates/admin.php file. The code that the Dashboard module suggests we add to this file is as follows: wire()->addHookAfter('Dashboard::getPanels', function ($event) { /* Get list of panels */ $panels = $event->return; /* Add panels */ $panels->add([ 'panel' => 'collection', 'title' => 'News items', 'data' => [ 'collection' => 'template=news-item, limit=10', 'sortable' => true, ], ]); }); /* Make sure to add the hook *before* the default admin process */ require $config->paths->adminTemplates . 'controller.php'; Any suggestions on how to solve this? Thanks. Link to comment Share on other sites More sharing options...
d'Hinnisdaël Posted September 23, 2021 Author Share Posted September 23, 2021 I think the correct way of doing it is a bit different with newer ProcessWire versions. Try this one: require $config->paths->core . 'admin.php'; 1 Link to comment Share on other sites More sharing options...
Siddhi Jagtap Posted September 24, 2021 Share Posted September 24, 2021 @d'Hinnisdaëlthat worked. I just removed the last line requiring controller.php and kept the one for admin.php there itself. Thanks a ton! 1 Link to comment Share on other sites More sharing options...
wbmnfktr Posted December 4, 2021 Share Posted December 4, 2021 I'm using Dashboard to show some changelogs within the dashboard... but somehow repeaters don't respect that they aren't available as they would in normal pages. <?php namespace Processwire; $cl = pages()->get('template=dashChangelog'); $cles = $cl->changelogentry->sort('-date'); ?> That's how I get the main page for my Dashboard element and from there I do my usual foreach(): <?php foreach ($cles as $cle): ?> <div class="cle"> <p><strong>? <?php echo date('Y-m-d', $cle->date); ?></strong></p> <?php echo $cle->body; ?> </div> <?php endforeach; ?> When I disable a repeater item... it still shows up. In regular pages this wouldn't happen so... what do I have to change for the Dashboard? Maybe I skipped a thought or two... but this confuses me. Link to comment Share on other sites More sharing options...
monollonom Posted December 4, 2021 Share Posted December 4, 2021 Is it possible outputFormatting is set to false by the module ? If so your repeaters will return everything, including the disabled ones. Link to comment Share on other sites More sharing options...
d'Hinnisdaël Posted December 4, 2021 Author Share Posted December 4, 2021 @wbmnfktr I just created a quick test case and you're right, ProcessWire seems to have access checks disabled for repeaters in this context. Output formatting seems to be turned on, however. Is this usually the case in the admin? Link to comment Share on other sites More sharing options...
wbmnfktr Posted December 8, 2021 Share Posted December 8, 2021 On 12/4/2021 at 1:31 PM, d'Hinnisdaël said: Is this usually the case in the admin? Expand I don't know anything about this in regards to the admin area but I found a fix that makes it work as expected. Maybe it's necessary in the admin, never needed it for repeaters in the frontend so far. <?php namespace Processwire; $cl = pages()->get('template=dashChangelog'); $cles = $cl->changelogentry->sort('-date')->filter("status=1"); ?> The additional ->filter("status=1") does the trick here. Link to comment Share on other sites More sharing options...
d'Hinnisdaël Posted December 8, 2021 Author Share Posted December 8, 2021 On 12/8/2021 at 8:57 PM, wbmnfktr said: I don't know anything about this in regards to the admin area but I found a fix that makes it work as expected. Maybe it's necessary in the admin, never needed it for repeaters in the frontend so far. <?php namespace Processwire; $cl = pages()->get('template=dashChangelog'); $cles = $cl->changelogentry->sort('-date')->filter("status=1"); ?> The additional ->filter("status=1") does the trick here. Expand Good catch. Now that I think about it, returning all repeaters makes sense in the admin context — otherwise you wouldn't be able to edit all repeater items on page edit screens. But as you said, you'll have to remember to properly mark/mask unpublished repeaters yourself. 1 Link to comment Share on other sites More sharing options...
Pete Posted January 26, 2022 Share Posted January 26, 2022 Hiya, loving this dashboard for a few more complex projects. I have a request for the number panel - since I often add a link in the "detail", if the number is zero then the link isn't shown. It would be great if there was a way to show it regardless. Actually it's hard to tell if it's a bug or intentional. In DashboardPanelNumber.module if I wrap the number in is_numeric it works when zero is passed as the number as below: public function setup() { parent::setup(); $this->locale = $this->data['locale'] ?? setlocale(LC_ALL, 0); $this->detail = $this->data['detail'] ?? ''; $this->number = is_numeric($this->data['number']) ? $this->data['number'] : null; if (is_int($this->number) || is_float($this->number)) { $this->number = $this->formatNumber($this->number); } } 2 Link to comment Share on other sites More sharing options...
d'Hinnisdaël Posted January 27, 2022 Author Share Posted January 27, 2022 On 1/26/2022 at 6:55 PM, Pete said: Hiya, loving this dashboard for a few more complex projects. I have a request for the number panel - since I often add a link in the "detail", if the number is zero then the link isn't shown. It would be great if there was a way to show it regardless. Actually it's hard to tell if it's a bug or intentional. In DashboardPanelNumber.module if I wrap the number in is_numeric it works when zero is passed as the number as below: public function setup() { parent::setup(); $this->locale = $this->data['locale'] ?? setlocale(LC_ALL, 0); $this->detail = $this->data['detail'] ?? ''; $this->number = is_numeric($this->data['number']) ? $this->data['number'] : null; if (is_int($this->number) || is_float($this->number)) { $this->number = $this->formatNumber($this->number); } } Expand Sounds good, happy to integrate that if you submit a pull request on the GitHub repo. 2 Link to comment Share on other sites More sharing options...
Pete Posted January 27, 2022 Share Posted January 27, 2022 Done, thanks ? 1 Link to comment Share on other sites More sharing options...
adrian Posted February 8, 2022 Share Posted February 8, 2022 Hi @d'Hinnisdaël - just wondering if you've had any thoughts about changing the charting library, or at least updating to v3 of ChartJS. The old 2.x branch has lots of limitations with the time axis type. Thanks! Link to comment Share on other sites More sharing options...
d'Hinnisdaël Posted February 8, 2022 Author Share Posted February 8, 2022 On 2/8/2022 at 3:17 PM, adrian said: Hi @d'Hinnisdaël - just wondering if you've had any thoughts about changing the charting library, or at least updating to v3 of ChartJS. The old 2.x branch has lots of limitations with the time axis type. Expand Realistically speaking, I won't get to refactoring the chart panel until later this year. Updating the chart.js library in the meantime sounds good, though. Do you happen to know if the update contains any breaking changes that would apply to its use in the context of this dashboard? I haven't been actively following along and I'd like to avoid breaking people's existing dashboards if possible. Link to comment Share on other sites More sharing options...
adrian Posted February 8, 2022 Share Posted February 8, 2022 I am not a regular ChartJS user so not sure of any breaking changes, although pointing the module's CDN link to the latest version does result in a JS error coming from the module's DashboardPanelChart.js file. I haven't looked into to see what fix is required though. Link to comment Share on other sites More sharing options...
d'Hinnisdaël Posted February 8, 2022 Author Share Posted February 8, 2022 On 2/8/2022 at 4:08 PM, adrian said: I am not a regular ChartJS user so not sure of any breaking changes, although pointing the module's CDN link to the latest version does result in a JS error coming from the module's DashboardPanelChart.js file. I haven't looked into to see what fix is required though. Expand Yeah, the migration guide looks pretty daunting. In that case I prefer leaving it as-is for now. If you find a simple fix, let me know and I'll happily review/merge any input. 1 Link to comment Share on other sites More sharing options...
adrian Posted February 9, 2022 Share Posted February 9, 2022 Thanks for taking a look @d'Hinnisdaël - I decided to go with a "template" panel type and build a custom chart, mostly because there was something amiss with using a time series with the way the module is configured and it was easier this way. Link to comment Share on other sites More sharing options...
adrian Posted February 16, 2022 Share Posted February 16, 2022 Hi @d'Hinnisdaël - I wonder if you'd be willing to support loading a tab directly from the hash in the URL please? Thanks for considering. 3 Link to comment Share on other sites More sharing options...
adrian Posted March 17, 2022 Share Posted March 17, 2022 Hi @d'Hinnisdaël - I am really loving the new tab option, but I am looking for a way to add a panel above the tabs so that it is available no matter which tab the user is on. If I add the panel directly to $panels, it always appears at the bottom of the page below the tabs. Any ideas how I can make this work? Thanks so much! 2 Link to comment Share on other sites More sharing options...
d'Hinnisdaël Posted March 17, 2022 Author Share Posted March 17, 2022 On 3/17/2022 at 4:09 AM, adrian said: Hi @d'Hinnisdaël - I am really loving the new tab option, but I am looking for a way to add a panel above the tabs so that it is available no matter which tab the user is on. If I add the panel directly to $panels, it always appears at the bottom of the page below the tabs. Any ideas how I can make this work? Expand If you create a panel group and add the tabs to that, it should work. 2 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now