mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2024-12-05 02:01:32 +00:00
Implement changing between terminal menu items
This commit is contained in:
parent
32dab3b967
commit
469c5ced7b
@ -23,13 +23,15 @@
|
||||
<div class="tfw-terminal">
|
||||
<div class="btn-group btn-group-sm flex-wrap tao-grid-center-left tfw-console-terminal-menu">
|
||||
<button class="tfw-console-terminal-menu-button"
|
||||
[class.selected]="terminalOrConsole === 'terminal'">TERMINAL</button>
|
||||
(click)="selectTerminalMenuItem('terminal')"
|
||||
[class.selected]="selectedTerminalMenuItem === 'terminal'">TERMINAL</button>
|
||||
<button class="tfw-console-terminal-menu-button"
|
||||
[class.selected]="terminalOrConsole === 'console'">CONSOLE</button>
|
||||
(click)="selectTerminalMenuItem('console')"
|
||||
[class.selected]="selectedTerminalMenuItem === 'console'">CONSOLE</button>
|
||||
</div>
|
||||
<hr>
|
||||
<app-terminal *ngIf="terminalOrConsole === 'terminal'"></app-terminal>
|
||||
<app-console *ngIf="terminalOrConsole === 'console'"></app-console>
|
||||
<app-terminal [hidden]="selectedTerminalMenuItem !== 'terminal'"></app-terminal>
|
||||
<app-console [hidden]="selectedTerminalMenuItem !== 'console'"></app-console>
|
||||
</div>
|
||||
<div class="tfw-sidebar">
|
||||
<app-sidebar (layoutChanged)="setLayout($event)" [layout]="layout"></app-sidebar>
|
||||
|
@ -20,7 +20,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
||||
hide_messages: boolean = config.dashboard.hide_messages;
|
||||
iframeUrl: string = config.dashboard.iframeUrl;
|
||||
@ViewChild('webiframe') webiframe: ElementRef;
|
||||
terminalOrConsole = config.dashboard.terminalOrConsole;
|
||||
selectedTerminalMenuItem = config.dashboard.terminalOrConsole;
|
||||
|
||||
command_handlers = {'layout': this.layoutHandler.bind(this),
|
||||
'reload_frontend': this.reloadFrontendHandlder.bind(this)};
|
||||
@ -85,4 +85,11 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
||||
this.webiframe.nativeElement.contentWindow.location.reload(true);
|
||||
});
|
||||
}
|
||||
|
||||
selectTerminalMenuItem(item: string) {
|
||||
if (!item.match('(terminal|console)')) {
|
||||
return;
|
||||
}
|
||||
this.selectedTerminalMenuItem = item;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user