mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-06-17 14:28:13 +00:00
Fix styles for light theme
This commit is contained in:
@ -21,7 +21,7 @@
|
|||||||
(mousedown)="toggleDragging(true)"
|
(mousedown)="toggleDragging(true)"
|
||||||
[ngStyle]="style"> -->
|
[ngStyle]="style"> -->
|
||||||
|
|
||||||
<div class="consoleHeader">
|
<div class="consoleHeader" [ngClass]="{lightThemeConsoleHeader: isLightThemeEnabled}">
|
||||||
<mat-tab-group class="tabs" [selectedIndex]="selected.value" (selectedIndexChange)="selected.setValue($event)">
|
<mat-tab-group class="tabs" [selectedIndex]="selected.value" (selectedIndexChange)="selected.setValue($event)">
|
||||||
<mat-tab>
|
<mat-tab>
|
||||||
<ng-template mat-tab-label>
|
<ng-template mat-tab-label>
|
||||||
@ -32,7 +32,7 @@
|
|||||||
<mat-tab *ngFor="let node of nodes; let index = index" [label]="tab">
|
<mat-tab *ngFor="let node of nodes; let index = index" [label]="tab">
|
||||||
<ng-template mat-tab-label>
|
<ng-template mat-tab-label>
|
||||||
<div class="col" style="margin-left: 20px;">{{node.name}}</div>
|
<div class="col" style="margin-left: 20px;">{{node.name}}</div>
|
||||||
<button style="color:white" mat-icon-button (click)="removeTab(index)">
|
<button [ngClass]="{lightThemeConsoleHeader: isLightThemeEnabled}" style="color:white" mat-icon-button (click)="removeTab(index)">
|
||||||
<mat-icon>close</mat-icon>
|
<mat-icon>close</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
@ -40,13 +40,13 @@
|
|||||||
|
|
||||||
</mat-tab-group>
|
</mat-tab-group>
|
||||||
|
|
||||||
<button *ngIf="!isMinimized" style="color:white" mat-icon-button (click)="minimize(true)">
|
<button *ngIf="!isMinimized" [ngClass]="{lightThemeConsoleHeader: isLightThemeEnabled}" style="color:white" mat-icon-button (click)="minimize(true)">
|
||||||
<mat-icon>remove</mat-icon>
|
<mat-icon>remove</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<button *ngIf="isMinimized" style="color:white" mat-icon-button (click)="minimize(false)">
|
<button *ngIf="isMinimized" [ngClass]="{lightThemeConsoleHeader: isLightThemeEnabled}" style="color:white" mat-icon-button (click)="minimize(false)">
|
||||||
<mat-icon>web_asset</mat-icon>
|
<mat-icon>web_asset</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<button style="color:white" mat-icon-button (click)="close()">
|
<button [ngClass]="{lightThemeConsoleHeader: isLightThemeEnabled}" style="color:white" mat-icon-button (click)="close()">
|
||||||
<mat-icon>close</mat-icon>
|
<mat-icon>close</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -41,6 +41,11 @@
|
|||||||
background: #263238!important;
|
background: #263238!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.lightThemeConsoleHeader {
|
||||||
|
background: white!important;
|
||||||
|
color: black!important;
|
||||||
|
}
|
||||||
|
|
||||||
:host ::ng-deep .mat-tab-label {
|
:host ::ng-deep .mat-tab-label {
|
||||||
height: 3rem !important;
|
height: 3rem !important;
|
||||||
min-width: 8rem !important;
|
min-width: 8rem !important;
|
||||||
|
@ -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 { Node } from '../../../cartography/models/node';
|
||||||
import { FitAddon } from 'xterm-addon-fit';
|
import { FitAddon } from 'xterm-addon-fit';
|
||||||
import { NodeConsoleService } from '../../../services/nodeConsole.service';
|
import { NodeConsoleService } from '../../../services/nodeConsole.service';
|
||||||
|
import { ThemeService } from '../../../services/theme.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
selector: 'app-web-console',
|
selector: 'app-web-console',
|
||||||
templateUrl: './web-console.component.html',
|
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 {
|
export class WebConsoleComponent implements OnInit, AfterViewInit {
|
||||||
@Input() server: Server;
|
@Input() server: Server;
|
||||||
@ -21,15 +22,19 @@ export class WebConsoleComponent implements OnInit, AfterViewInit {
|
|||||||
|
|
||||||
public term: Terminal = new Terminal();
|
public term: Terminal = new Terminal();
|
||||||
public fitAddon: FitAddon = new FitAddon();
|
public fitAddon: FitAddon = new FitAddon();
|
||||||
|
public isLightThemeEnabled: boolean = false;
|
||||||
private copiedText: string = '';
|
private copiedText: string = '';
|
||||||
|
|
||||||
@ViewChild('terminal') terminal: ElementRef;
|
@ViewChild('terminal') terminal: ElementRef;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private consoleService: NodeConsoleService
|
private consoleService: NodeConsoleService,
|
||||||
|
private themeService: ThemeService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.themeService.getActualTheme() === 'light' ? this.isLightThemeEnabled = true : this.isLightThemeEnabled = false;
|
||||||
|
|
||||||
this.consoleService.consoleResized.subscribe(ev => {
|
this.consoleService.consoleResized.subscribe(ev => {
|
||||||
let numberOfColumns = Math.floor(ev.width / 9);
|
let numberOfColumns = Math.floor(ev.width / 9);
|
||||||
let numberOfRows = Math.floor(ev.height / 17);
|
let numberOfRows = Math.floor(ev.height / 17);
|
||||||
@ -47,6 +52,8 @@ export class WebConsoleComponent implements OnInit, AfterViewInit {
|
|||||||
|
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
this.term.open(this.terminal.nativeElement);
|
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());
|
const socket = new WebSocket(this.getUrl());
|
||||||
|
|
||||||
socket.onerror = ((event) => {
|
socket.onerror = ((event) => {
|
||||||
|
Reference in New Issue
Block a user