Speedup the import page of JCB packages, to via background ajax get package info and store it in local browser memory

This commit is contained in:
Llewellyn van der Merwe 2018-05-03 13:30:53 +02:00
parent 8b8b42ae8f
commit 47f90de990
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
4 changed files with 43 additions and 6 deletions

View File

@ -130,7 +130,7 @@ Component Builder is mapped as a component in itself on my local development env
+ *Version*: 2.7.7
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+ *Line count*: **193640**
+ *Line count*: **193677**
+ *Field count*: **1030**
+ *File count*: **1201**
+ *Folder count*: **193**

View File

@ -130,7 +130,7 @@ Component Builder is mapped as a component in itself on my local development env
+ *Version*: 2.7.7
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+ *Line count*: **193640**
+ *Line count*: **193677**
+ *Field count*: **1030**
+ *File count*: **1201**
+ *Folder count*: **193**

View File

@ -931,12 +931,10 @@ class ComponentbuilderModelJoomla_components extends JModelList
}
$this->info['getKeyFrom']['package_links'] = $this->exportPackageLinks;
// we started adding this at v2.7.7
$this->info['key'] = true;
$this->info['source']['paid'] = true;
}
else
{
// we started adding this at v2.7.7
$this->info['key'] = false;
// Set the owner information
$data = base64_encode($data);
}

View File

@ -352,9 +352,48 @@ jQuery(document).ready(function($) {
</form>
</div>
<script type="text/javascript">
// set packages that are on the page
var packages = {};
jQuery(document).ready(function($)
{
// get all jcb packages
jQuery("#jcb_package option").each(function()
{
var key = jQuery(this).val();
packages[key] = 'jcb';
});
// get all vdm packages
jQuery("#vdm_package option").each(function()
{
var key = jQuery(this).val();
packages[key] = 'vdm';
});
// no start behind the scene getting of package info
autoJCBpackageInfo();
});
function autoJCBpackageInfo(){
jQuery.each( packages, function( url, type ) {
var key = url.replace(/\W/g, '');
// check if the values are local
var result = jQuery.jStorage.get('JCB-packages-details'+key, null);
if (!result && url.length > 0) {
autoJCBpackageInfoAgain(url, key, type);
}
});
}
function autoJCBpackageInfoAgain(url, key,type){
getJCBpackageInfo_server(url).done(function(result) {
if(result.owner || result.packages){
jQuery.jStorage.set('JCB-packages-details'+key, result, {TTL: expire});
}
});
}
function getJCBpackageInfo(type){
// show spinner
jQuery('#loading').show();
jQuery('#loading').css('display', 'block');
jQuery('#noticeboard').show();
jQuery('#installer-import').hide();
// get value