|
656 | 656 | <div class="panelHeader">#{shared_string}</div>
|
657 | 657 | <div id="ajxp_workspace_info_panel_content"></div>
|
658 | 658 | <script>
|
659 |
| - bufferCallback("ajxp_load_repo_info_timer", 300,function(){ |
660 |
| - if(!$('ajxp_workspace_info_panel_content') || !$('ajxp_workspace_info_panel_content').visible()){ |
661 |
| - return; |
662 |
| - } |
663 |
| - if(!ajaxplorer.user) return; |
664 |
| - $("ajxp_workspace_info_panel").addClassName("infopanel_loading"); |
665 |
| - var conn = new Connexion(); |
666 |
| - conn.setParameters({get_action:'load_repository_info'}); |
667 |
| - conn.onComplete = function(transport){ |
668 |
| - $("ajxp_workspace_info_panel").addClassName("infopanel_loading_finished"); |
669 |
| - if(transport.responseJSON && $('ajxp_workspace_info_panel_content')){ |
670 |
| - var data = transport.responseJSON; |
671 |
| - if(!data['core.users']['groups']){ |
672 |
| - data['core.users']['groups'] = 0; |
673 |
| - } |
674 |
| - $('ajxp_workspace_info_panel_content').update('#{internal_string}: ' + data['core.users']['users'] + ' <br/> #{external_string}: ' + data['core.users']['groups']); |
675 |
| - } |
| 659 | + if(pydio.user) { |
| 660 | + var cacheService = MetaCacheService.getInstance(); |
| 661 | + cacheService.registerMetaStream('workspace.info', 'MANUAL_TRIGGER'); |
| 662 | + var render = function(data){ |
| 663 | + $('ajxp_workspace_info_panel_content').update('#{internal_string}: ' + data['core.users']['users'] + ' <br/> #{external_string}: ' + data['core.users']['groups']); |
676 | 664 | };
|
677 |
| - conn.sendAsync(); |
678 |
| - }); |
| 665 | + var repoKey = pydio.user.getActiveRepository(); |
| 666 | + if(cacheService.hasKey('workspace.info', repoKey)){ |
| 667 | + render(cacheService.getByKey('workspace.info', repoKey)); |
| 668 | + }else{ |
| 669 | + bufferCallback("ajxp_load_repo_info_timer", 300,function(){ |
| 670 | + if(!$('ajxp_workspace_info_panel_content') || !$('ajxp_workspace_info_panel_content').visible()){ |
| 671 | + return; |
| 672 | + } |
| 673 | + $("ajxp_workspace_info_panel").addClassName("infopanel_loading"); |
| 674 | + PydioApi.getClient().request({get_action:'load_repository_info'}, function(transport){ |
| 675 | + $("ajxp_workspace_info_panel").addClassName("infopanel_loading_finished"); |
| 676 | + if(transport.responseJSON && $('ajxp_workspace_info_panel_content')){ |
| 677 | + var data = transport.responseJSON; |
| 678 | + if(!data['core.users']['groups']){ |
| 679 | + data['core.users']['groups'] = 0; |
| 680 | + } |
| 681 | + } |
| 682 | + cacheService.setKey('workspace.info', repoKey, data); |
| 683 | + render(data); |
| 684 | + }, null, {discrete:true}); |
| 685 | + }); |
| 686 | + } |
| 687 | + } |
| 688 | +
|
679 | 689 | </script>
|
680 | 690 | </div>
|
681 | 691 | ]]></html>
|
|
0 commit comments