Merge pull request #419 from GNS3/Display-progress-when-server-is-starting

Display progress when server is starting #390
This commit is contained in:
ziajka 2019-06-28 08:59:09 +02:00 committed by GitHub
commit 3a358d199c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 3 deletions

View File

@ -13,8 +13,9 @@
<ng-container matColumnDef="name">
<mat-header-cell *matHeaderCellDef> Name </mat-header-cell>
<mat-cell *matCellDef="let row">
<a [routerLink]="['/server', row.id, 'projects']" class="table-link">{{ row.name }}</a></mat-cell
>
<a *ngIf="getServerStatus(row) === 'running' || row.location === 'remote'" [routerLink]="['/server', row.id, 'projects']" class="table-link">{{ row.name }}</a>
<span *ngIf="getServerStatus(row) != 'running' && row.location !== 'remote'">{{ row.name }}</span>
</mat-cell>
</ng-container>
<ng-container matColumnDef="location">
@ -42,6 +43,8 @@
<button mat-icon-button (click)="stopServer(row)" *ngIf="row.location === 'local' && getServerStatus(row) === 'running'">
<mat-icon aria-label="Stop server">stop</mat-icon>
</button>
<mat-spinner [diameter]="24" *ngIf="row.location === 'local' && getServerStatus(row) === 'starting'"></mat-spinner>
<button mat-icon-button (click)="deleteServer(row)">
<mat-icon aria-label="Remove server">delete</mat-icon>

View File

@ -49,6 +49,9 @@ export class ServersComponent implements OnInit, OnDestroy {
if(!server) {
return;
}
if(serverStatus.status === 'starting') {
server.status = 'starting';
}
if(serverStatus.status === 'stopped') {
server.status = 'stopped';
}

View File

@ -5,7 +5,7 @@ import { Subject } from 'rxjs';
export interface ServerStateEvent {
serverName: string;
status: "started" | "errored" | "stopped" | "stderr";
status: "starting" | "started" | "errored" | "stopped" | "stderr";
message: string;
}
@ -29,6 +29,12 @@ export class ServerManagementService implements OnDestroy {
}
async start(server: Server) {
var startingEvent : ServerStateEvent = {
serverName: server.name,
status: "starting",
message: ''
};
this.serverStatusChanged.next(startingEvent);
return await this.electronService.remote.require('./local-server.js').startLocalServer(server);
}