Export & Import of JCB mapped component. #53
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: joomla/Component-Builder#53
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
The feature request has been made to export JCB mapped components, and the ability to import that exported package.
This will be amazing :) are you up for the challenge?
I think it should be a Json or SQL dump file (with a possible key for encryption and decryption), and that the import should make use of the default import of each view.
I will add a new custom admin view to import and export components. @ro-ot you will need to build the import and export logic. I will bump the private repo with the changes, or lets use a branch.
Let me know.
Yes I think this is a very needed feature. I will start with the logic.
Lets do a public branch called dev or staging
The zipped json file seems best. What do you mean with
okay so json it is... how will we deal with the images, files and folders linked to the component? that would need to be part of the zip file.
The ability to lock the data so no one can use it unless they have the key used to export it. There should be the option for a global key per component. Basically to insure if you use this feature as a backup of your components, it is secure where ever you store it.
That brings up another feature, the option to setup this concept to constantly run and with this feature run backups to an FTP location or local folder, like that used during compilation.
I can add the above feature once we have the basic functionality in place.
Yes that is why I said zipped. So we can add other files,folders and images to this package.
The locking option is great, but could be to much for the initial development. I will see what is the time frame I have to do this.
You said to use the default import option per view, does that not work with CSV's instead of json?
Wow you are right... so let me take a look at this, csv could work.... but then we will have one per view, which is not a problem.
I will get back to you on that one.
I think the csv could work, we will just have to insure that the code data remains in base64 as it is stored in the DB, so we will need some tweaking there.
I think we should still use JSON as the data storage, it seems like the easiest way, and it is much more stable.
I main the data linking is in json objects in the DB and all those ids in those objects will all change in most cases during importing of a component. I think we can better manage the relationships in json.
I have used serialized on the db data and stored it in our own db.vdm file since in the long run this data should only work in JCB right.
I will still add the images, that has not been done as yet.
Next the import part, this will be tricky 🥇
Great work @Llewellynvdm I agree with the direction you took. I think we have an amazing feature here. This can become a key aspect!
I can't help with the import at this time, so if you want to do it go right head. But it seems little complicated!
Wow this is amazing stuff. Thanks @Llewellynvdm for making this happen!
https://youtu.be/lkE0ZiSWufg see it in action...
I just decided to give this a test, and getting an error. I downloaded a fresh copy of Joomla and did a compare between my installed version, and the fresh download, and the files match.
Warning: Header may not contain more than a single header, new line detected in C:\xampp\htdocs\dev\libraries\joomla\application\web.php on line 947
Error
An error has occurred.
1054 Unknown column 'a.*' in 'field list' SQL=SELECT
a
.*
FROMgax8s_componentbuilder_joomla_component
ASa
WHERE a.id IN (25) ORDER BY a.ordering ASCCall stack
Function Location
1 JApplicationCms->execute() C:\xampp\htdocs\dev\administrator\index.php:51
2 JApplicationAdministrator->doExecute() C:\xampp\htdocs\dev\libraries\cms\application\cms.php:261
3 JApplicationAdministrator->dispatch() C:\xampp\htdocs\dev\libraries\cms\application\administrator.php:152
4 JComponentHelper::renderComponent() C:\xampp\htdocs\dev\libraries\cms\application\administrator.php:98
5 JComponentHelper::executeComponent() C:\xampp\htdocs\dev\libraries\cms\component\helper.php:380
6 require_once() C:\xampp\htdocs\dev\libraries\cms\component\helper.php:405
7 JControllerLegacy->execute() C:\xampp\htdocs\dev\administrator\components\com_componentbuilder\componentbuilder.php:56
8 ComponentbuilderControllerJoomla_components->smartExport() C:\xampp\htdocs\dev\libraries\legacy\controller\legacy.php:702
9 ComponentbuilderModelJoomla_components->getSmartExport() C:\xampp\htdocs\dev\administrator\components\com_componentbuilder\controllers\joomla_components.php:160
10 JDatabaseDriverMysqli->execute() C:\xampp\htdocs\dev\administrator\components\com_componentbuilder\models\joomla_components.php:122
Did you do a fresh install of JCB? on a Joomla website that is also fresh?
@mwweb to test pull request is little more tricky then what you did. @Llewellynvdm can you not make a quick video on how this should be done... please 👍
@ro-ot... this was testing the export component feature in jcb 2.4.0. That's where the error is occurring.
Please make the comments on the pull request that is being tested. Here is a quick tutorial.. hope it helps!
@mwweb the bug that you found does not exist that is why I asked if it is a fresh install :)
If you open the code of \com_componentbuilder\models\joomla_components.php on line 104 you will see that the
Unknown column 'a.*'
that it is giving as a warning is not an error, but normal JDatabase syntax that is used in all over the place.Check your local file if it is the same on that line ;)
Fresh Joomla install on CentOs (account on my web server).
Fresh install of JCB 2.4.1
Went to Components -> Component Builder -> Joomla Components
Selected Demo Component
Click Export Components button
Result:
An error has occurred.
1054 Unknown column 'a.*' in 'field list' SQL=SELECT
a
.*
FROM#__componentbuilder_joomla_component
ASa
WHERE a.id IN (25) ORDER BY a.ordering ASCI am sorry, I will look at this again, not sure how we missed this. Will get back to you soon. Thanks!
@mwweb, hi Download this version and let me know if your error is resolved.
That works. No error, and it created the zip file in the tmp folder.
I know is a closed issue, but I just tested it and noticed some "odd" behavior. When attempting to export, all of the images (component image and dashboard images) are throwing errors. See a sample below:
JFile: :copy(/var/www/mwredev/images/component_images/MWR_3D_Box-right.png, /var/www/mwredev/tmp//JCB_mostWantedRealEstate/images/component_images/MWR_3D_Box-right.png): copy(/var/www/mwredev//tmp//JCB_mostWantedRealEstate/images/component_images/MWR_3D_Box-right.png): failed to open stream: No such file or directory
Notice that when it's attempting to "create" the tmp path that it is adding double // rather than a single( mwredev//tmp// )
Okay, I have added some new code to try and fix this. But we need to look little closer at this, the fix is not ideal. It will work but ugly 👎
I will add the fix to the active pull request, then you can test it there and comment on it there 👍