Merge branch 'master' into API-requests-doesn't-use-HTTPS-when-SSL-is-configured

This commit is contained in:
piotrpekala7 2020-10-17 00:27:56 +02:00
commit 9861f4a2f5
12 changed files with 67 additions and 10 deletions

View File

@ -5,3 +5,5 @@ packaging==19.0
appdirs==1.4.3
psutil==5.6.7
jsonschema==2.6.0 # lock down jsonschema, 3.0 makes problems
urllib3>=1.25.9 # not directly required, pinned by Snyk to avoid a vulnerability

View File

@ -282,6 +282,7 @@ import { ChangeHostnameDialogComponent } from './components/project-map/change-h
import { ApplianceInfoDialogComponent } from './components/project-map/new-template-dialog/appliance-info-dialog/appliance-info-dialog.component';
import { InformationDialogComponent } from './components/dialogs/information-dialog.component';
import { TemplateNameDialogComponent } from './components/project-map/new-template-dialog/template-name-dialog/template-name-dialog.component';
import { UpdatesService } from './services/updates.service';
@NgModule({
@ -565,7 +566,8 @@ import { TemplateNameDialogComponent } from './components/project-map/new-templa
ServerResolve,
ConsoleGuard,
Title,
ApplianceService
ApplianceService,
UpdatesService
],
entryComponents: [
AddServerDialogComponent,

View File

@ -21,7 +21,7 @@
(mousedown)="toggleDragging(true)"
[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>
<ng-template mat-tab-label>
@ -32,7 +32,7 @@
<mat-tab *ngFor="let node of nodes; let index = index" [label]="tab">
<ng-template mat-tab-label>
<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>
</button>
</ng-template>
@ -40,13 +40,13 @@
</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>
</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>
</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>
</button>
</div>

View File

@ -41,6 +41,11 @@
background: #263238!important;
}
.lightThemeConsoleHeader {
background: white!important;
color: black!important;
}
:host ::ng-deep .mat-tab-label {
height: 3rem !important;
min-width: 8rem !important;

View File

@ -59,6 +59,10 @@
<mat-icon>info</mat-icon>
<span>Go to system status</span>
</button>
<button mat-menu-item routerLink="/settings">
<mat-icon>settings</mat-icon>
<span>Go to settings</span>
</button>
<button mat-menu-item (click)="addNewTemplate()">
<mat-icon>control_point</mat-icon>
<span>New template</span>

View File

@ -1 +1 @@
<div #terminal id="terminal"></div>
<div class="lightTheme" #terminal id="terminal"></div>

View File

@ -0,0 +1,4 @@
.lightTheme {
background: white!important;
color: black!important;
}

View File

@ -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) => {

View File

@ -54,6 +54,18 @@
</div>
</mat-expansion-panel>
<mat-expansion-panel [expanded]="false">
<mat-expansion-panel-header>
<mat-panel-title> Updates </mat-panel-title>
<mat-panel-description> Check for updates </mat-panel-description>
</mat-expansion-panel-header>
<div class="theme-panel">
<button mat-raised-button (click)="checkForUpdates()" class="fullWidth">Check for updates</button>
</div>
</mat-expansion-panel>
</mat-accordion>
</div>

View File

@ -3,3 +3,7 @@
display: flex;
padding: 10px;
}
.fullWidth {
width: 100%;
}

View File

@ -4,6 +4,7 @@ import { ToasterService } from '../../services/toaster.service';
import { ConsoleService } from '../../services/settings/console.service';
import { ThemeService } from '../../services/theme.service';
import { MapSettingsService } from '../../services/mapsettings.service';
import { UpdatesService } from '../../services/updates.service';
@Component({
selector: 'app-settings',
@ -20,7 +21,8 @@ export class SettingsComponent implements OnInit {
private toaster: ToasterService,
private consoleService: ConsoleService,
private themeService: ThemeService,
public mapSettingsService: MapSettingsService
public mapSettingsService: MapSettingsService,
public updatesService: UpdatesService
) {}
ngOnInit() {
@ -38,4 +40,8 @@ export class SettingsComponent implements OnInit {
setDarkMode(value: boolean) {
this.themeService.setDarkMode(value);
}
checkForUpdates() {
window.open("https://gns3.com/software");
}
}

View File

@ -0,0 +1,11 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Injectable()
export class UpdatesService {
constructor(private httpClient: HttpClient) {}
getLatestVersion() {
return this.httpClient.get('http://update.gns3.net/');
}
}