readd check on start up for tabs (#1585)

This commit is contained in:
Anthony Dresser
2018-06-07 17:20:28 -07:00
committed by GitHub
parent 63fb4e2827
commit 44de602e52

View File

@@ -4,15 +4,13 @@
*--------------------------------------------------------------------------------------------*/
import {
Component, ContentChildren, QueryList, AfterContentInit, Inject, forwardRef, NgZone,
OnInit, Input, EventEmitter, Output, ViewChild, ElementRef, OnChanges, OnDestroy, ViewChildren,
AfterViewInit
Component, ContentChildren, QueryList, Inject, forwardRef, NgZone,
Input, EventEmitter, Output, ViewChild, ElementRef
} from '@angular/core';
import './panelStyles';
import { TabComponent } from './tab.component';
import { TabHeaderComponent } from './tabHeader.component';
import { ScrollableDirective } from 'sql/base/browser/ui/scrollable/scrollable.directive';
import { subscriptionToDisposable } from 'sql/base/common/lifecycle';
@@ -21,7 +19,6 @@ import { Action } from 'vs/base/common/actions';
import * as types from 'vs/base/common/types';
import { mixin } from 'vs/base/common/objects';
import { ScrollbarVisibility } from 'vs/base/common/scrollable';
import { addDisposableListener, EventType } from 'vs/base/browser/dom';
import { Disposable } from 'vs/base/common/lifecycle';
export interface IPanelOptions {
@@ -44,9 +41,6 @@ const defaultOptions: IPanelOptions = {
showIcon: false
};
const verticalLayout = 'vertical';
const horizontalLayout = 'horizontal';
let idPool = 0;
@Component({
@@ -78,7 +72,6 @@ export class PanelComponent extends Disposable {
@Input() public options: IPanelOptions;
@Input() public actions: Array<Action>;
@ContentChildren(TabComponent) private _tabs: QueryList<TabComponent>;
@ViewChildren(TabHeaderComponent) private _headerTabs: QueryList<TabHeaderComponent>;
@ViewChild(ScrollableDirective) private scrollable: ScrollableDirective;
@Output() public onTabChange = new EventEmitter<TabComponent>();
@@ -88,8 +81,8 @@ export class PanelComponent extends Disposable {
private _actionbar: ActionBar;
private _mru: TabComponent[];
private ScrollbarVisibility = ScrollbarVisibility;
private NavigationBarLayout = NavigationBarLayout;
protected ScrollbarVisibility = ScrollbarVisibility;
protected NavigationBarLayout = NavigationBarLayout;
@ViewChild('panelActionbar', { read: ElementRef }) private _actionbarRef: ElementRef;
constructor( @Inject(forwardRef(() => NgZone)) private _zone: NgZone) {
@@ -102,6 +95,10 @@ export class PanelComponent extends Disposable {
}
ngAfterContentInit(): void {
if (this._tabs && this._tabs.length > 0) {
this.selectTab(this._tabs.first);
}
this._register(subscriptionToDisposable(this._tabs.changes.subscribe(() => {
if (this._tabs && this._tabs.length > 0) {
this.selectTab(this._tabs.first);