2020-01-27 18:40:18 +00:00
|
|
|
import { Component, Input, ViewChild } from '@angular/core';
|
|
|
|
|
import { Events, MessageBus } from 'protocol';
|
|
|
|
|
import { MatTabGroup } from '@angular/material/tabs';
|
|
|
|
|
import { ComponentExplorerComponent } from './component-explorer/component-explorer.component';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'ng-devtools-tabs',
|
|
|
|
|
templateUrl: './devtools-tabs.component.html',
|
|
|
|
|
styleUrls: ['./devtools-tabs.component.css'],
|
|
|
|
|
})
|
|
|
|
|
export class DevToolsTabsComponent {
|
|
|
|
|
@Input() messageBus: MessageBus<Events>;
|
2020-01-29 17:10:57 +00:00
|
|
|
@Input() angularVersion: string | undefined = undefined;
|
2020-01-27 18:40:18 +00:00
|
|
|
@ViewChild(MatTabGroup) tabGroup: MatTabGroup;
|
|
|
|
|
@ViewChild(ComponentExplorerComponent) componentExplorer: ComponentExplorerComponent;
|
|
|
|
|
|
|
|
|
|
inspectorRunning = false;
|
|
|
|
|
|
2020-01-29 00:29:23 +00:00
|
|
|
toggleInspector(): void {
|
2020-01-27 18:40:18 +00:00
|
|
|
this.inspectorRunning = !this.inspectorRunning;
|
|
|
|
|
if (this.inspectorRunning) {
|
|
|
|
|
this.messageBus.emit('inspectorStart');
|
|
|
|
|
this.tabGroup.selectedIndex = 0;
|
|
|
|
|
} else {
|
|
|
|
|
this.messageBus.emit('inspectorEnd');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-29 00:29:23 +00:00
|
|
|
refresh(): void {
|
2020-01-27 18:40:18 +00:00
|
|
|
this.componentExplorer.refresh();
|
|
|
|
|
}
|
|
|
|
|
}
|