Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit d954b07

Browse files
committed
Use new cacheService for workspace.info
1 parent 7fbb67a commit d954b07

File tree

1 file changed

+29
-19
lines changed

1 file changed

+29
-19
lines changed

core/src/plugins/core.conf/standard_conf_actions.xml

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -656,26 +656,36 @@
656656
<div class="panelHeader">#{shared_string}</div>
657657
<div id="ajxp_workspace_info_panel_content"></div>
658658
<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']);
676664
};
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+
679689
</script>
680690
</div>
681691
]]></html>

0 commit comments

Comments
 (0)