Option to check for updates added

This commit is contained in:
piotrpekala7 2020-10-17 00:25:01 +02:00
parent 15b9748120
commit 57294f49a7
5 changed files with 37 additions and 2 deletions

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

@ -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/');
}
}