mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-16 10:16:16 +01:00
cache the mainTabPanel
This commit is contained in:
@@ -57,20 +57,25 @@ Sonia.scm.Main = Ext.extend(Ext.util.Observable, {
|
|||||||
sectionLogoutText: 'Log out',
|
sectionLogoutText: 'Log out',
|
||||||
navLogoutText: 'Log out',
|
navLogoutText: 'Log out',
|
||||||
|
|
||||||
|
mainTabPanel: null,
|
||||||
|
|
||||||
|
constructor : function(config) {
|
||||||
|
this.mainTabPanel = Ext.getCmp('mainTabPanel');
|
||||||
|
Sonia.scm.Main.superclass.constructor.call(this, config);
|
||||||
|
},
|
||||||
|
|
||||||
createRepositoryPanel: function(){
|
createRepositoryPanel: function(){
|
||||||
if ( debug ){
|
if ( debug ){
|
||||||
console.debug('create repository panel');
|
console.debug('create repository panel');
|
||||||
}
|
}
|
||||||
var mainTabPanel = Ext.getCmp('mainTabPanel');
|
this.mainTabPanel.add({
|
||||||
mainTabPanel.add({
|
|
||||||
id: 'repositories',
|
id: 'repositories',
|
||||||
xtype: 'repositoryPanel',
|
xtype: 'repositoryPanel',
|
||||||
title: this.tabRepositoriesText,
|
title: this.tabRepositoriesText,
|
||||||
closeable: false,
|
closeable: false,
|
||||||
autoScroll: true
|
autoScroll: true
|
||||||
});
|
});
|
||||||
mainTabPanel.setActiveTab('repositories');
|
this.mainTabPanel.setActiveTab('repositories');
|
||||||
},
|
},
|
||||||
|
|
||||||
createMainMenu: function(){
|
createMainMenu: function(){
|
||||||
@@ -84,7 +89,7 @@ Sonia.scm.Main = Ext.extend(Ext.util.Observable, {
|
|||||||
items: [{
|
items: [{
|
||||||
label: this.navRepositoriesText,
|
label: this.navRepositoriesText,
|
||||||
fn: function(){
|
fn: function(){
|
||||||
Ext.getCmp('mainTabPanel').setActiveTab('repositories');
|
this.mainTabPanel.setActiveTab('repositories');
|
||||||
},
|
},
|
||||||
scope: this
|
scope: this
|
||||||
}]
|
}]
|
||||||
@@ -184,10 +189,9 @@ Sonia.scm.Main = Ext.extend(Ext.util.Observable, {
|
|||||||
},
|
},
|
||||||
|
|
||||||
addTabPanel: function(id, xtype, title){
|
addTabPanel: function(id, xtype, title){
|
||||||
var mainTabPanel = Ext.getCmp('mainTabPanel');
|
var tab = this.mainTabPanel.findById( id );
|
||||||
var tab = mainTabPanel.findById( id );
|
|
||||||
if ( tab == null ){
|
if ( tab == null ){
|
||||||
mainTabPanel.add({
|
this.mainTabPanel.add({
|
||||||
id: id,
|
id: id,
|
||||||
xtype: xtype,
|
xtype: xtype,
|
||||||
title: title,
|
title: title,
|
||||||
@@ -195,7 +199,7 @@ Sonia.scm.Main = Ext.extend(Ext.util.Observable, {
|
|||||||
autoScroll: true
|
autoScroll: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
mainTabPanel.setActiveTab(id);
|
this.mainTabPanel.setActiveTab(id);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
@@ -227,7 +231,7 @@ Sonia.scm.Main = Ext.extend(Ext.util.Observable, {
|
|||||||
// clear repository store
|
// clear repository store
|
||||||
repositoryTypeStore.removeAll();
|
repositoryTypeStore.removeAll();
|
||||||
// remove all tabs
|
// remove all tabs
|
||||||
Ext.getCmp('mainTabPanel').removeAll();
|
this.mainTabPanel.removeAll();
|
||||||
// remove navigation items
|
// remove navigation items
|
||||||
Ext.getCmp('navigationPanel').removeAll();
|
Ext.getCmp('navigationPanel').removeAll();
|
||||||
},
|
},
|
||||||
@@ -341,19 +345,13 @@ Ext.onReady(function(){
|
|||||||
main = new Sonia.scm.Main();
|
main = new Sonia.scm.Main();
|
||||||
main.checkLogin();
|
main.checkLogin();
|
||||||
|
|
||||||
// adds a tab to main TabPanel
|
/**
|
||||||
|
* Adds a tab to main TabPanel
|
||||||
|
*
|
||||||
|
* @deprecated use main.addTabPanel
|
||||||
|
*/
|
||||||
function addTabPanel(id, xtype, title){
|
function addTabPanel(id, xtype, title){
|
||||||
var tab = mainTabPanel.findById( id );
|
main.addTabPanel(id, xtype, title);
|
||||||
if ( tab == null ){
|
|
||||||
mainTabPanel.add({
|
|
||||||
id: id,
|
|
||||||
xtype: xtype,
|
|
||||||
title: title,
|
|
||||||
closable: true,
|
|
||||||
autoScroll: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
mainTabPanel.setActiveTab(id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// register login callbacks
|
// register login callbacks
|
||||||
|
|||||||
Reference in New Issue
Block a user