Set the default admin view #148
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: joomla/Component-Builder#148
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I would not like to use the dashboard but instead have the default view in the admin be one of the admin views. Is this possible? And if so how?
We can look at this as a feature request, since at this time adding more tabs to the dashboard is all you can really do to customize it.
We could in the future add a option to link to a custom_admin_view or admin_view. But this is not possible at this time. You can of course use custom scripting to completely change the dashboard.
I am planning to build this, @kevincam3 will you be able to help with testing this feature?
I might be able to assist in testing this as well. Sorry that I have been out of the loop for a while. Had a big project needing to convert from one platform to Joomla!, which showed there were a ton of suppressed error from the prior developer (over 600 of them). Anyway, I am mostly to the milestone of completing that one, so I should have a little time here and there.
This is not going to so major, since after some investigation I can see a very easy way to make this work. Soon as I have it ready I will push the changes up, and will be wonderful to just have some feed back once you have time. I totally understand... I mean you being out of the loop at times. now worries!
This little tweak will make it possible to really have smart dashboards 👍
@mwweb I have made the adaptation, and it should work. When opening a [Joomla Component]-tab->PHP you will see new button called Dashboard Type by default it must be set to Default which is the old way the dashboard was build. There should be a little explanation, for both options really, you can add to that explanation of you think it is unclear.
So when you select Dynamic there should open a drop-down, under the explanation, of all the linked Admin and Custom Admin Views selecting any of those will make it the new Dashboard or Default view.
So give it a try and give me your feedback.
I did a test with one of the components that I have been building.
I went into the component, PHP, and changed dashboard type to dynamic, then selected one of my admin views. I compiled, then installed. I don't see any change. If I click on the link item in component, it still loads the dashboard, rather than going to the "fields" view that I selected.
The dashboard will still be there if you have the old install, not sure why it will load it as the default... okay can you check some files in the compiled package?
Once it is compiled unzip the package and look to see if there is a model/view/controller with the component name. Since that was usually the dashboard, and with the new package this should not exist. Then if you open the back-end controller it should have the following new code:
Let me know and we take it from there.
This was a fresh compile on a new install of Joomla. I'm doing a complete clone of my existing dev site to test again. But, in looking, there is a model/view/controller with the component name, and the back-end controller has the default view as the component name, not the view I set it to.
After my clone is done, and I can test again, I'll update.
Make sure that the following changes was made to your compiler and the database...
The database there should be a few new fields in the
#__componentbuilder_joomla_component
table:dashboard
anddashboard_type
make sure they are there.Then in the compiler the following lines:
public $dynamicDashboard = false;
on line 328 of the b_Structure.php fileprivate function setDynamicDashboard()
on line 542 of the b_Structure.php file.IF those are there I expect the others are there also... now you can check if things work on compilation, by adding the following on line 614
This should have the new admin views listview name, if not then we need look at the following values, by changing the dump to:
Let me know what you find out, since on my side those values come out right...
The database was updated with this file.
As you will see this file adds those two fields and updates on to be 1 by default.
Okay I just added a few tweaks to the
setDynamicDashboard
method to give some error messages when things do not line-up. Make sure to try this new push to the staging branch.Well, it's doing something at least. I'm getting the wonderful error message:
Error
The admin view (A_139) is not available in your component! Please insure to only used admin views, for a dynamic dashboard, that are still linked to your component.
The problem is...the view I selected is an admin view, and it is available in the component. I'll have to test more when I'm not so tired.
Well this is the code:
So there is a few checks happening here that you can investigate:
if (count($getter) == 2 && is_numeric($getter[1]))
if (isset($targets[$t]) && $id > 0)
if (isset($this->componentData->{$targets[$t]}) && ComponentbuilderHelper::checkArray($this->componentData->{$targets[$t]}))
if (count($dashboard) && isset($dashboard[0]['settings']) && isset($dashboard[0]['settings']->{$keys[$t]}))
All the above should be true, and if not the related values should be looked at, to see why it is not true. I would so like to test things in your environment, since this must be an environment diff that is at play. I mean your environment is different from mine. I should spin up a VM with PHP7 to see these diffs more directly... soon 👍 I still run on PHP 5.6
Anyway thanks for your help with this.
I ran a test in PHP 5.6 and it ran fine. The problem appears to be an incompatibility with PHP 7.
I thought so... but could you identify what it is? I mean should be simple.
$this->componentData->{$targets[$t]}
?Can only be one of those really... since the rest is basic PHP.
I have just tested the feature on php 7.1.13 and J3.8.6rc and it appears to be working, I was able to select a different view when opening the component admin screen.
I don't have any custom admin views to test it on at the moment...
Yes I have been running test in PHP 7.2.3 and all works well on my end, I did make some other changes to address some PHP7 issues, but they were not related to this issue.
So I am thinking to move forward with this release. Thanks for all the testing, there will soon be a pull request to V2.6.18 we can fine tune this during that process, if it still remains an issue.
Thanks @Llewellynvdm this feature is excellent! I am surprised at how easy it was to do that with JCB. At times we see OOP deliver on its promise.