Support for starting local server

This commit is contained in:
Piotr Pekala 2020-01-21 06:34:44 -08:00
parent f49cc1960c
commit b134a7fecf
6 changed files with 47 additions and 3 deletions

View File

@ -66,6 +66,7 @@
"material-design-icons": "^3.0.1",
"ng-circle-progress": "^1.5.1",
"ng2-file-upload": "^1.3.0",
"ngx-childprocess": "^0.0.6",
"ngx-device-detector": "^1.3.18",
"ngx-electron": "^2.1.1",
"node-fetch": "^2.6.0",

View File

@ -265,6 +265,7 @@ import { StatusInfoComponent } from './components/system-status/status-info/stat
import { StatusChartComponent } from './components/system-status/status-chart/status-chart.component';
import { NgCircleProgressModule } from 'ng-circle-progress';
import { OpenFileExplorerActionComponent } from './components/project-map/context-menu/actions/open-file-explorer/open-file-explorer-action.component';
import { NgxChildProcessModule } from 'ngx-childprocess';
if (environment.production) {
Raven.config('https://b2b1cfd9b043491eb6b566fd8acee358@sentry.io/842726', {
@ -465,6 +466,7 @@ if (environment.production) {
ResizableModule,
DragAndDropModule,
DragDropModule,
NgxChildProcessModule,
MATERIAL_IMPORTS,
DeviceDetectorModule.forRoot(),
NgCircleProgressModule.forRoot()

View File

@ -1,3 +1,7 @@
.buttons-bar {
padding-top: 22px;
padding-top: 0px;
}
.button {
margin: 20px!important;
}

View File

@ -57,6 +57,9 @@
</mat-table>
</div>
<div class="buttons-bar"><button mat-raised-button color="primary" (click)="createModal()">Add server</button></div>
<div class="buttons-bar">
<button *ngIf="isElectronApp" mat-raised-button class="button" (click)="startLocalServer()">Start local server</button>
<button mat-raised-button class="button" color="primary" (click)="createModal()">Add server</button>
</div>
</div>
</div>

View File

@ -9,6 +9,8 @@ import { ServerService } from '../../services/server.service';
import { ServerDatabase } from '../../services/server.database';
import { AddServerDialogComponent } from './add-server-dialog/add-server-dialog.component';
import { ServerManagementService } from '../../services/server-management.service';
import { ElectronService } from 'ngx-electron';
import { ChildProcessService } from 'ngx-childprocess';
@Component({
@ -20,16 +22,20 @@ export class ServersComponent implements OnInit, OnDestroy {
dataSource: ServerDataSource;
displayedColumns = ['id', 'name', 'location', 'ip', 'port', 'actions'];
serverStatusSubscription: Subscription;
isElectronApp: boolean = false;
constructor(
private dialog: MatDialog,
private serverService: ServerService,
private serverDatabase: ServerDatabase,
private serverManagement: ServerManagementService,
private changeDetector: ChangeDetectorRef
private changeDetector: ChangeDetectorRef,
private electronService: ElectronService,
private childProcessService: ChildProcessService
) {}
ngOnInit() {
this.isElectronApp = this.electronService.isElectronApp;
const runningServersNames = this.serverManagement.getRunningServers();
this.serverService.findAll().then((servers: Server[]) => {
@ -80,6 +86,11 @@ export class ServersComponent implements OnInit, OnDestroy {
this.serverStatusSubscription.unsubscribe();
}
startLocalServer() {
const server = this.serverDatabase.data.find(n => n.location === 'bundled' || 'local');
this.startServer(server);
}
createModal() {
const dialogRef = this.dialog.open(AddServerDialogComponent, {
width: '350px',

View File

@ -1266,6 +1266,13 @@
resolved "https://registry.npmjs.org/@types/debug/-/debug-4.1.5.tgz#b14efa8852b7768d898906613c23f688713e02cd"
integrity sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ==
"@types/electron@^1.4.38":
version "1.6.10"
resolved "https://registry.npmjs.org/@types/electron/-/electron-1.6.10.tgz#7e87888ed3888767cca68e92772c2c8ea46bc873"
integrity sha512-MOCVyzIwkBEloreoCVrTV108vSf8fFIJPsGruLCoAoBZdxtnJUqKA4lNonf/2u1twSjAspPEfmEheC+TLm/cMw==
dependencies:
electron "*"
"@types/events@*":
version "3.0.0"
resolved "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7"
@ -3962,6 +3969,15 @@ electron-to-chromium@^1.3.191, electron-to-chromium@^1.3.322:
resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.322.tgz#a6f7e1c79025c2b05838e8e344f6e89eb83213a8"
integrity sha512-Tc8JQEfGQ1MzfSzI/bTlSr7btJv/FFO7Yh6tanqVmIWOuNCu6/D1MilIEgLtmWqIrsv+o4IjpLAhgMBr/ncNAA==
electron@*:
version "7.1.9"
resolved "https://registry.npmjs.org/electron/-/electron-7.1.9.tgz#5053195d2e476a3ecd881ece4edf64f0a8c32fa3"
integrity sha512-gkzDr08XxRaNZhwPLRXYNXDaPuiAeCrRPcClowlDVfCLKi+kRNhzekZpfYUBq8DdZCD29D3rCtgc9IHjD/xuHw==
dependencies:
"@electron/get" "^1.0.1"
"@types/node" "^12.0.12"
extract-zip "^1.0.3"
electron@7.1.2:
version "7.1.2"
resolved "https://registry.npmjs.org/electron/-/electron-7.1.2.tgz#d1726b9e50b29e97f5f12b52feb225ba87e0640f"
@ -6724,6 +6740,13 @@ ng2-file-upload@^1.3.0:
dependencies:
tslib "^1.9.0"
ngx-childprocess@^0.0.6:
version "0.0.6"
resolved "https://registry.npmjs.org/ngx-childprocess/-/ngx-childprocess-0.0.6.tgz#9b71eead5b7d490f0f47bd045b21a1aad25e09ad"
integrity sha1-m3HurVt9SQ8PR70EWyGhqtJeCa0=
dependencies:
"@types/electron" "^1.4.38"
ngx-device-detector@^1.3.18:
version "1.3.20"
resolved "https://registry.npmjs.org/ngx-device-detector/-/ngx-device-detector-1.3.20.tgz#4cb81bdfe0342427c57f561f76d4e461be7e1cb4"