Set the default admin view #148
Closed
opened 2017-10-26 11:29:32 +00:00 by kevincam3
·
18 comments
No Branch/Tag Specified
6.x
5.x
4.x
3.x
v6.2.0
v5.2.0
v4.2.0
v6.1.6
v5.1.6
v4.1.5
v6.1.5
v5.1.5
v4.1.4
v6.1.4
v5.1.4
v4.1.3
v6.1.3
v5.1.3
v6.1.2
v5.1.2
v4.1.2
v5.1.1
v4.1.1
v4.1.0
v3.2.5
v5.1.0
v5.0.3
v4.0.3
v3.2.4
v5.0.2
v4.0.2
v3.2.3
v5.0.1
v4.0.1
v3.2.2
v5.0.0
v4.0.0
v3.2.1
v3.2.0
v3.1.28
v3.1.27
v3.1.26
v3.1.24
v3.1.19
v3.1.17
v3.1.15
v3.1.12
v3.1.11
v3.1.10
v3.1.9
v3.1.8
v3.1.7
v3.1.6
v3.1.5
v3.1.4
v3.1.3
v3.1.2
v2.13.1
v2.13.0
v2.12.16
v2.12.15
v2.12.14
v2.12.10
v2.12.9
v2.12.8
v2.12.7
v2.12.6
v2.12.4
v2.12.3
v2.12.2
v2.11.7
v2.11.4
v2.11.3
v2.11.2
v2.11.0
v2.10.13
v2.10.11
v2.10.9
v2.10.5
v2.10.1
v2.10.0
v2.9.21
v2.9.18
v2.9.14
v2.9.11
v2.9.10
v2.9.8
v2.9.7
v2.9.1
v2.9.0
v2.8.5
v2.8.4
v2.8.2
v2.8.0
v2.7.10
v2.7.7
v2.7.6
v2.7.5
v2.7.4
v2.7.1
v2.7.0
v2.6.17
v2.6.16
v2.6.15
v2.6.14
v2.6.13
v2.6.12
v2.6.11
v2.6.10
v2.6.9
v2.6.8
v2.6.7
v2.6.6
v2.6.5
v2.6.3
v2.6.2
v2.6.1
v2.6.0
v2.5.8
v2.5.6
v2.5.5
v2.5.4
v2.5.1
v2.5.0
v2.4.10
v2.4.9
v2.4.8
v2.4.7
v2.4.6
v2.4.5
v2.4.4
v2.4.3
v2.4.2
v2.4.1
v2.4.0
v2.3.10
v2.3.9
v2.3.8
v2.3.7
v2.3.6
v2.3.5
v2.3.4
v2.3.2
v2.3.1
v2.3.0
v2.2.10
v2.2.9
v2.2.6
v2.2.5
v2.2.4
v2.2.3
v2.2.2
v2.2.0
v2.1.21
v2.1.20
v2.1.19
v2.1.18
v2.1.17
v2.1.16
v2.1.14
v2.1.13
v2.1.12
v2.1.11
v2.1.10
v2.1.9
v2.1.8
v2.1.7
v2.1.6
v2.1.5
v2.1.4
v2.1.3
v2.1.2
v2.1.1
v2.1.0
v2.0.9
v2.0.8
No labels
enhancement
Milestone
No items
No Milestone
Major improvement to core (speedup production)
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: joomla/Component-Builder#148
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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_componenttable:dashboardanddashboard_typemake 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
setDynamicDashboardmethod 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.