mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-06-17 22:38:08 +00:00
Fix styles for light theme
This commit is contained in:
@ -1 +1 @@
|
||||
<div #terminal id="terminal"></div>
|
||||
<div class="lightTheme" #terminal id="terminal"></div>
|
||||
|
@ -0,0 +1,4 @@
|
||||
.lightTheme {
|
||||
background: white!important;
|
||||
color: black!important;
|
||||
}
|
||||
|
@ -6,13 +6,14 @@ import { AttachAddon } from 'xterm-addon-attach';
|
||||
import { Node } from '../../../cartography/models/node';
|
||||
import { FitAddon } from 'xterm-addon-fit';
|
||||
import { NodeConsoleService } from '../../../services/nodeConsole.service';
|
||||
import { ThemeService } from '../../../services/theme.service';
|
||||
|
||||
|
||||
@Component({
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
selector: 'app-web-console',
|
||||
templateUrl: './web-console.component.html',
|
||||
styleUrls: ['../../../../../node_modules/xterm/css/xterm.css']
|
||||
styleUrls: ['../../../../../node_modules/xterm/css/xterm.css', './web-console.component.scss']
|
||||
})
|
||||
export class WebConsoleComponent implements OnInit, AfterViewInit {
|
||||
@Input() server: Server;
|
||||
@ -21,15 +22,19 @@ export class WebConsoleComponent implements OnInit, AfterViewInit {
|
||||
|
||||
public term: Terminal = new Terminal();
|
||||
public fitAddon: FitAddon = new FitAddon();
|
||||
public isLightThemeEnabled: boolean = false;
|
||||
private copiedText: string = '';
|
||||
|
||||
@ViewChild('terminal') terminal: ElementRef;
|
||||
|
||||
constructor(
|
||||
private consoleService: NodeConsoleService
|
||||
private consoleService: NodeConsoleService,
|
||||
private themeService: ThemeService,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.themeService.getActualTheme() === 'light' ? this.isLightThemeEnabled = true : this.isLightThemeEnabled = false;
|
||||
|
||||
this.consoleService.consoleResized.subscribe(ev => {
|
||||
let numberOfColumns = Math.floor(ev.width / 9);
|
||||
let numberOfRows = Math.floor(ev.height / 17);
|
||||
@ -47,6 +52,8 @@ export class WebConsoleComponent implements OnInit, AfterViewInit {
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.term.open(this.terminal.nativeElement);
|
||||
if (this.isLightThemeEnabled) this.term.setOption('theme', { background: 'white', foreground: 'black', cursor: 'black' });
|
||||
|
||||
const socket = new WebSocket(this.getUrl());
|
||||
|
||||
socket.onerror = ((event) => {
|
||||
|
Reference in New Issue
Block a user