ing
This commit is contained in:
parent
f6834722b8
commit
6d74c96883
|
@ -39,7 +39,7 @@
|
|||
"@ngrx/schematics": "^6.1.0",
|
||||
"@ngrx/store": "^6.1.0",
|
||||
"@ngrx/store-devtools": "^6.1.0",
|
||||
"@overflow/rpc-js": "0.0.4",
|
||||
"@overflow/rpc-js": "0.0.11",
|
||||
"@types/fs-extra": "^5.0.4",
|
||||
"@types/jasmine": "~2.8.6",
|
||||
"@types/jasminewd2": "~2.0.3",
|
||||
|
@ -79,4 +79,4 @@
|
|||
"webpack-node-externals": "^1.7.2",
|
||||
"zone.js": "^0.8.26"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { ElectronProxyService } from '../commons/service/electron-proxy.service';
|
||||
import { ProbeService } from '../commons/service/probe.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
|
@ -12,11 +13,13 @@ export class AppComponent implements OnInit {
|
|||
|
||||
public constructor(
|
||||
private electronProxyService: ElectronProxyService,
|
||||
private probeService: ProbeService,
|
||||
) {
|
||||
this.showTitleBar = !__LINUX__;
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.probeService.connect();
|
||||
this.electronProxyService.sendReady(performance.now());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import { AppStoreModule } from './app-store.module';
|
|||
import { AppComponent } from './app.component';
|
||||
|
||||
import { CommonsModule } from '../commons/commons.module';
|
||||
import { SERVICES } from '../commons/service';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
|
@ -26,7 +27,9 @@ import { CommonsModule } from '../commons/commons.module';
|
|||
AppStoreModule,
|
||||
|
||||
],
|
||||
providers: [],
|
||||
providers: [
|
||||
...SERVICES,
|
||||
],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule { }
|
||||
|
|
|
@ -5,7 +5,6 @@ import { CommonsUIModule } from '@overflow/commons/ui/commons-ui.module';
|
|||
|
||||
|
||||
import { COMPONENTS } from './component';
|
||||
import { SERVICES } from './service';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -20,7 +19,6 @@ import { SERVICES } from './service';
|
|||
...COMPONENTS,
|
||||
],
|
||||
providers: [
|
||||
...SERVICES,
|
||||
]
|
||||
})
|
||||
export class CommonsModule { }
|
||||
|
|
|
@ -1,15 +1,35 @@
|
|||
import { Component, Input } from '@angular/core';
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
|
||||
import { Observable, Subscription, of } from 'rxjs';
|
||||
import { catchError, exhaustMap, map, tap, take } from 'rxjs/operators';
|
||||
|
||||
|
||||
import { ProbeService } from '../service/probe.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-nic-dropdown',
|
||||
templateUrl: './nic-dropdown.component.html',
|
||||
styleUrls: ['./nic-dropdown.component.scss'],
|
||||
})
|
||||
export class NicDropdownComponent {
|
||||
export class NicDropdownComponent implements OnInit {
|
||||
@Input() blockTarget: any;
|
||||
|
||||
constructor(
|
||||
private probeService: ProbeService,
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.probeService.call<any>('MachineService.Interfaces').pipe(
|
||||
map((ifaces: any) => {
|
||||
console.log(ifaces);
|
||||
}),
|
||||
catchError(error => {
|
||||
console.log(error);
|
||||
return of();
|
||||
}),
|
||||
take(1),
|
||||
).subscribe();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,26 +2,27 @@ import { Injectable } from '@angular/core';
|
|||
import {
|
||||
Client,
|
||||
ClientNotificationCodec,
|
||||
RxWebsocketRWC,
|
||||
RxWebsocketSubjectConfig,
|
||||
WebSocketClientRWC,
|
||||
WebSocketClientRWCConfig,
|
||||
JSONClientCodec
|
||||
} from '@overflow/rpc-js';
|
||||
import { Subscription } from 'rxjs';
|
||||
|
||||
@Injectable()
|
||||
export class ProbeService {
|
||||
private probeClient: Client;
|
||||
const config: WebSocketClientRWCConfig = {
|
||||
url: 'ws://localhost:60000/'
|
||||
};
|
||||
const rwc = new WebSocketClientRWC(config);
|
||||
const codec = new JSONClientCodec();
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ProbeService extends Client {
|
||||
private notiSubscription: Subscription;
|
||||
|
||||
public constructor() {
|
||||
const config: RxWebsocketSubjectConfig<any> = {
|
||||
url: ''
|
||||
};
|
||||
const rwc = new RxWebsocketRWC(config);
|
||||
const codec = new JSONClientCodec();
|
||||
this.probeClient = new Client(codec, rwc);
|
||||
this.notiSubscription = this.probeClient
|
||||
.notification()
|
||||
super(codec, rwc);
|
||||
this.notiSubscription = this.notification()
|
||||
.subscribe((notiCodec: ClientNotificationCodec) => {
|
||||
console.log(notiCodec.method());
|
||||
});
|
||||
|
|
|
@ -224,10 +224,11 @@
|
|||
tree-kill "^1.0.0"
|
||||
webpack-sources "^1.1.0"
|
||||
|
||||
"@overflow/rpc-js@0.0.4":
|
||||
version "0.0.4"
|
||||
resolved "https://nexus.loafle.net/repository/npm-all/@overflow/rpc-js/-/rpc-js-0.0.4.tgz#083577e4ca372c62bd8a529c29acca0163a1f6b6"
|
||||
"@overflow/rpc-js@0.0.11":
|
||||
version "0.0.11"
|
||||
resolved "https://nexus.loafle.net/repository/npm-all/@overflow/rpc-js/-/rpc-js-0.0.11.tgz#b73ede145d86d6517c7ed5e080e3e5bf4c757c3a"
|
||||
dependencies:
|
||||
pako "^1.0.6"
|
||||
rxjs "^6.2.2"
|
||||
url-join "^4.0.0"
|
||||
|
||||
|
@ -5104,7 +5105,7 @@ package-json@^4.0.0:
|
|||
registry-url "^3.0.3"
|
||||
semver "^5.1.0"
|
||||
|
||||
pako@~1.0.2, pako@~1.0.5:
|
||||
pako@^1.0.6, pako@~1.0.2, pako@~1.0.5:
|
||||
version "1.0.6"
|
||||
resolved "https://nexus.loafle.net/repository/npm-all/pako/-/pako-1.0.6.tgz#0101211baa70c4bca4a0f63f2206e97b7dfaf258"
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user