Fix few dashboard panel issues (#801)

* home tab is shown by default when the dashboard is opened

* add scroll bar when tab list is overflow

* fix regression in other tab panels

* address comments
This commit is contained in:
Abbie Petchtes
2018-03-06 10:28:15 -08:00
committed by GitHub
parent bab9fc01ea
commit 0bba972657
5 changed files with 79 additions and 30 deletions

View File

@@ -174,7 +174,7 @@ export abstract class DashboardPage extends Disposable implements OnDestroy {
}));
this._tabsDispose.push(this.dashboardService.onAddNewTabs(e => {
this.loadNewTabs(e);
this.loadNewTabs(e, true);
}));
}
@@ -188,7 +188,7 @@ export abstract class DashboardPage extends Disposable implements OnDestroy {
this.dashboardService.writeSettings([this.context, 'tabs'].join('.'), writeableConfig, target);
}
private loadNewTabs(dashboardTabs: IDashboardTab[]) {
private loadNewTabs(dashboardTabs: IDashboardTab[], openLastTab: boolean = false) {
if (dashboardTabs && dashboardTabs.length > 0) {
let selectedTabs = dashboardTabs.map(v => {
let container = dashboardHelper.getDashboardContainer(v.container);
@@ -226,10 +226,12 @@ export abstract class DashboardPage extends Disposable implements OnDestroy {
return config;
});
// put this immediately on the stack so that is ran *after* the tab is rendered
setTimeout(() => {
this._panel.selectTab(selectedTabs.pop().id);
});
if (openLastTab) {
// put this immediately on the stack so that is ran *after* the tab is rendered
setTimeout(() => {
this._panel.selectTab(selectedTabs.pop().id);
});
}
}
}