Merge branch 'master' of https://git.loafle.net/overflow/overflow-webapp
This commit is contained in:
commit
6cbc8a5e84
38
src/app/commons/component/layout/layout.module.ts
Normal file
38
src/app/commons/component/layout/layout.module.ts
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { MaterialModule } from 'packages/commons/material/material.module';
|
||||||
|
import { FooterComponent } from './footer/footer.component';
|
||||||
|
import { NotificationModule } from 'packages/notification/notification.module';
|
||||||
|
import { HeaderComponent } from './header/header.component';
|
||||||
|
import { LocalizationModule } from 'angular-l10n';
|
||||||
|
import { RouterModule } from '@angular/router';
|
||||||
|
import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar';
|
||||||
|
import { MenuItemModule } from 'packages/commons/component/menu-item/menu-item.module';
|
||||||
|
import { SidebarComponent } from './sidebar/sidebar.component';
|
||||||
|
import { SubMenubarComponent } from './sub-menubar/sub-menubar.component';
|
||||||
|
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
MaterialModule,
|
||||||
|
NotificationModule,
|
||||||
|
LocalizationModule,
|
||||||
|
RouterModule,
|
||||||
|
PerfectScrollbarModule,
|
||||||
|
MenuItemModule,
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
FooterComponent,
|
||||||
|
HeaderComponent,
|
||||||
|
SidebarComponent,
|
||||||
|
SubMenubarComponent
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
FooterComponent,
|
||||||
|
HeaderComponent,
|
||||||
|
SidebarComponent,
|
||||||
|
SubMenubarComponent
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class LayoutModule { }
|
|
@ -15,11 +15,10 @@ import { NotificationModule } from 'packages/notification/notification.module';
|
||||||
import { MemberModule } from 'packages/member/member.module';
|
import { MemberModule } from 'packages/member/member.module';
|
||||||
|
|
||||||
import { MaterialModule } from 'packages/commons/material/material.module';
|
import { MaterialModule } from 'packages/commons/material/material.module';
|
||||||
import { HeaderModule } from 'packages/commons/component/header/header.module';
|
|
||||||
import { SidebarModule } from 'packages/commons/component/sidebar/sidebar.module';
|
|
||||||
|
|
||||||
import { PagesComponent } from './pages.component';
|
import { PagesComponent } from './pages.component';
|
||||||
import { PagesRoutingModule } from './pages-routing.module';
|
import { PagesRoutingModule } from './pages-routing.module';
|
||||||
|
import { LayoutModule } from 'app/commons/component/layout/layout.module';
|
||||||
|
|
||||||
|
|
||||||
const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
|
const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
|
||||||
|
@ -34,8 +33,7 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
|
||||||
PerfectScrollbarModule,
|
PerfectScrollbarModule,
|
||||||
LocalizationModule,
|
LocalizationModule,
|
||||||
MaterialModule,
|
MaterialModule,
|
||||||
HeaderModule,
|
LayoutModule,
|
||||||
SidebarModule,
|
|
||||||
NotificationModule,
|
NotificationModule,
|
||||||
MemberModule,
|
MemberModule,
|
||||||
],
|
],
|
||||||
|
|
|
@ -4,10 +4,10 @@ import { CommonModule } from '@angular/common';
|
||||||
import { ProbeModule } from 'packages/probe/probe.module';
|
import { ProbeModule } from 'packages/probe/probe.module';
|
||||||
|
|
||||||
import { MaterialModule } from 'packages/commons/material/material.module';
|
import { MaterialModule } from 'packages/commons/material/material.module';
|
||||||
import { SubMenubarModule } from 'packages/commons/component/sub-menubar/sub-menubar.module';
|
|
||||||
|
|
||||||
import { ProbePageComponent } from './probe-page.component';
|
import { ProbePageComponent } from './probe-page.component';
|
||||||
import { ProbePageRoutingModule } from './probe-page-routing.module';
|
import { ProbePageRoutingModule } from './probe-page-routing.module';
|
||||||
|
import { LayoutModule } from 'app/commons/component/layout/layout.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -15,7 +15,7 @@ import { ProbePageRoutingModule } from './probe-page-routing.module';
|
||||||
ProbePageRoutingModule,
|
ProbePageRoutingModule,
|
||||||
MaterialModule,
|
MaterialModule,
|
||||||
ProbeModule,
|
ProbeModule,
|
||||||
SubMenubarModule,
|
LayoutModule,
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
ProbePageComponent,
|
ProbePageComponent,
|
||||||
|
|
|
@ -2,13 +2,13 @@ import { NgModule } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
|
|
||||||
import { MaterialModule } from 'packages/commons/material/material.module';
|
import { MaterialModule } from 'packages/commons/material/material.module';
|
||||||
import { SubMenubarModule } from 'packages/commons/component/sub-menubar/sub-menubar.module';
|
|
||||||
|
|
||||||
import { ProbeModule } from 'packages/probe/probe.module';
|
import { ProbeModule } from 'packages/probe/probe.module';
|
||||||
import { NoauthModule } from 'packages/noauth/noauth.module';
|
import { NoauthModule } from 'packages/noauth/noauth.module';
|
||||||
|
|
||||||
import { ProbesPageComponent } from './probes-page.component';
|
import { ProbesPageComponent } from './probes-page.component';
|
||||||
import { ProbesPageRoutingModule } from './probes-page-routing.module';
|
import { ProbesPageRoutingModule } from './probes-page-routing.module';
|
||||||
|
import { LayoutModule } from 'app/commons/component/layout/layout.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -17,7 +17,7 @@ import { ProbesPageRoutingModule } from './probes-page-routing.module';
|
||||||
MaterialModule,
|
MaterialModule,
|
||||||
ProbeModule,
|
ProbeModule,
|
||||||
NoauthModule,
|
NoauthModule,
|
||||||
SubMenubarModule
|
LayoutModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
ProbesPageComponent,
|
ProbesPageComponent,
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
import {MatDialog} from '@angular/material';
|
|
||||||
import { SettingComponent as DiscoverySettingComponent } from 'packages/discovery/component/setting/setting.component';
|
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'of-sensor-setting-page',
|
selector: 'of-sensor-setting-page',
|
||||||
|
@ -11,7 +8,7 @@ import { SettingComponent as DiscoverySettingComponent } from 'packages/discover
|
||||||
})
|
})
|
||||||
export class SensorSettingPageComponent implements OnInit {
|
export class SensorSettingPageComponent implements OnInit {
|
||||||
|
|
||||||
constructor(public dialog: MatDialog) { }
|
constructor() { }
|
||||||
|
|
||||||
step = 1;
|
step = 1;
|
||||||
|
|
||||||
|
@ -19,26 +16,10 @@ export class SensorSettingPageComponent implements OnInit {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
openDialog(): void {
|
|
||||||
const dialogRef = this.dialog.open(DiscoverySettingComponent, {
|
|
||||||
width: '850px',
|
|
||||||
});
|
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
|
||||||
console.log('The dialog was closed');
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
onNext() {
|
onNext() {
|
||||||
this.step = 2;
|
this.step = 2;
|
||||||
// this.router.navigate(['step2']);
|
// this.router.navigate(['step2']);
|
||||||
}
|
}
|
||||||
|
|
||||||
onCloseCancel() {
|
|
||||||
// this.dialogRef.close('Cancel');
|
|
||||||
this.openDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,6 @@ import { DiscoveryModule } from 'packages/discovery/discovery.module';
|
||||||
|
|
||||||
import { MaterialModule } from 'packages/commons/material/material.module';
|
import { MaterialModule } from 'packages/commons/material/material.module';
|
||||||
|
|
||||||
import { SettingComponent as DiscoverySettingComponent } from 'packages/discovery/component/setting/setting.component';
|
|
||||||
|
|
||||||
import { SensorSettingPageRoutingModule } from './sensor-setting-page-routing.module';
|
import { SensorSettingPageRoutingModule } from './sensor-setting-page-routing.module';
|
||||||
import { SensorSettingPageComponent } from './sensor-setting-page.component';
|
import { SensorSettingPageComponent } from './sensor-setting-page.component';
|
||||||
|
|
||||||
|
@ -21,11 +19,9 @@ import { SensorSettingPageComponent } from './sensor-setting-page.component';
|
||||||
SensorSettingPageRoutingModule,
|
SensorSettingPageRoutingModule,
|
||||||
SensorModule,
|
SensorModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
DiscoveryModule
|
|
||||||
],
|
],
|
||||||
entryComponents: [
|
declarations: [
|
||||||
DiscoverySettingComponent
|
SensorSettingPageComponent
|
||||||
],
|
]
|
||||||
declarations: [SensorSettingPageComponent]
|
|
||||||
})
|
})
|
||||||
export class SensorSettingPageModule { }
|
export class SensorSettingPageModule { }
|
||||||
|
|
|
@ -4,10 +4,10 @@ import { CommonModule } from '@angular/common';
|
||||||
import { SensorModule } from 'packages/sensor/sensor.module';
|
import { SensorModule } from 'packages/sensor/sensor.module';
|
||||||
|
|
||||||
import { MaterialModule } from 'packages/commons/material/material.module';
|
import { MaterialModule } from 'packages/commons/material/material.module';
|
||||||
import { SubMenubarModule } from 'packages/commons/component/sub-menubar/sub-menubar.module';
|
|
||||||
|
|
||||||
import { SensorPageRoutingModule } from './sensor-page-routing.module';
|
import { SensorPageRoutingModule } from './sensor-page-routing.module';
|
||||||
import { SensorPageComponent } from './sensor-page.component';
|
import { SensorPageComponent } from './sensor-page.component';
|
||||||
|
import { LayoutModule } from 'app/commons/component/layout/layout.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -15,7 +15,7 @@ import { SensorPageComponent } from './sensor-page.component';
|
||||||
SensorPageRoutingModule,
|
SensorPageRoutingModule,
|
||||||
MaterialModule,
|
MaterialModule,
|
||||||
SensorModule,
|
SensorModule,
|
||||||
SubMenubarModule,
|
LayoutModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
SensorPageComponent,
|
SensorPageComponent,
|
||||||
|
|
|
@ -4,10 +4,10 @@ import { CommonModule } from '@angular/common';
|
||||||
import { TargetModule } from 'packages/target/target.module';
|
import { TargetModule } from 'packages/target/target.module';
|
||||||
|
|
||||||
import { MaterialModule } from 'packages/commons/material/material.module';
|
import { MaterialModule } from 'packages/commons/material/material.module';
|
||||||
import { SubMenubarModule } from 'packages/commons/component/sub-menubar/sub-menubar.module';
|
|
||||||
|
|
||||||
import { TargetPageComponent } from './target-page.component';
|
import { TargetPageComponent } from './target-page.component';
|
||||||
import { TargetPageRoutingModule } from './target-page-routing.module';
|
import { TargetPageRoutingModule } from './target-page-routing.module';
|
||||||
|
import { LayoutModule } from 'app/commons/component/layout/layout.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -15,7 +15,7 @@ import { TargetPageRoutingModule } from './target-page-routing.module';
|
||||||
TargetPageRoutingModule,
|
TargetPageRoutingModule,
|
||||||
MaterialModule,
|
MaterialModule,
|
||||||
TargetModule,
|
TargetModule,
|
||||||
SubMenubarModule,
|
LayoutModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
TargetPageComponent,
|
TargetPageComponent,
|
||||||
|
|
|
@ -4,17 +4,18 @@ import { CommonModule } from '@angular/common';
|
||||||
import { TargetModule } from 'packages/target/target.module';
|
import { TargetModule } from 'packages/target/target.module';
|
||||||
|
|
||||||
import { MaterialModule } from 'packages/commons/material/material.module';
|
import { MaterialModule } from 'packages/commons/material/material.module';
|
||||||
import { SubMenubarModule } from 'packages/commons/component/sub-menubar/sub-menubar.module';
|
|
||||||
|
|
||||||
import { TargetsPageRoutingModule } from './targets-page-routing.module';
|
import { TargetsPageRoutingModule } from './targets-page-routing.module';
|
||||||
import { TargetsPageComponent } from './targets-page.component';
|
import { TargetsPageComponent } from './targets-page.component';
|
||||||
|
import { LayoutModule } from 'app/commons/component/layout/layout.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
MaterialModule,
|
MaterialModule,
|
||||||
TargetsPageRoutingModule,
|
TargetsPageRoutingModule,
|
||||||
TargetModule
|
TargetModule,
|
||||||
|
LayoutModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
TargetsPageComponent
|
TargetsPageComponent
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { CommonModule } from '@angular/common';
|
|
||||||
import { MaterialModule } from 'packages/commons/material/material.module';
|
|
||||||
|
|
||||||
import { FooterComponent } from './footer.component';
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [
|
|
||||||
CommonModule,
|
|
||||||
MaterialModule
|
|
||||||
],
|
|
||||||
declarations: [
|
|
||||||
FooterComponent
|
|
||||||
],
|
|
||||||
exports: [
|
|
||||||
FooterComponent
|
|
||||||
]
|
|
||||||
})
|
|
||||||
export class FooterModule { }
|
|
|
@ -1,22 +0,0 @@
|
||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { CommonModule } from '@angular/common';
|
|
||||||
import { MaterialModule } from 'packages/commons/material/material.module';
|
|
||||||
|
|
||||||
import { NotificationModule } from 'packages/notification/notification.module';
|
|
||||||
|
|
||||||
import { HeaderComponent } from './header.component';
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [
|
|
||||||
CommonModule,
|
|
||||||
MaterialModule,
|
|
||||||
NotificationModule,
|
|
||||||
],
|
|
||||||
declarations: [
|
|
||||||
HeaderComponent
|
|
||||||
],
|
|
||||||
exports: [
|
|
||||||
HeaderComponent
|
|
||||||
]
|
|
||||||
})
|
|
||||||
export class HeaderModule { }
|
|
|
@ -1,35 +0,0 @@
|
||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { CommonModule } from '@angular/common';
|
|
||||||
import { RouterModule } from '@angular/router';
|
|
||||||
|
|
||||||
import {
|
|
||||||
LocalizationModule,
|
|
||||||
} from 'angular-l10n';
|
|
||||||
|
|
||||||
import {
|
|
||||||
PerfectScrollbarModule,
|
|
||||||
} from 'ngx-perfect-scrollbar';
|
|
||||||
|
|
||||||
import { MaterialModule } from 'packages/commons/material/material.module';
|
|
||||||
|
|
||||||
import { MenuItemModule } from 'packages/commons/component/menu-item/menu-item.module';
|
|
||||||
|
|
||||||
import { SidebarComponent } from './sidebar.component';
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [
|
|
||||||
CommonModule,
|
|
||||||
LocalizationModule,
|
|
||||||
MaterialModule,
|
|
||||||
RouterModule,
|
|
||||||
PerfectScrollbarModule,
|
|
||||||
MenuItemModule,
|
|
||||||
],
|
|
||||||
declarations: [
|
|
||||||
SidebarComponent,
|
|
||||||
],
|
|
||||||
exports: [
|
|
||||||
SidebarComponent,
|
|
||||||
]
|
|
||||||
})
|
|
||||||
export class SidebarModule { }
|
|
|
@ -1,21 +0,0 @@
|
||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { CommonModule } from '@angular/common';
|
|
||||||
import { RouterModule } from '@angular/router';
|
|
||||||
|
|
||||||
import { MaterialModule } from 'packages/commons/material/material.module';
|
|
||||||
import { SubMenubarComponent } from './sub-menubar.component';
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [
|
|
||||||
CommonModule,
|
|
||||||
MaterialModule,
|
|
||||||
RouterModule
|
|
||||||
],
|
|
||||||
declarations: [
|
|
||||||
SubMenubarComponent,
|
|
||||||
],
|
|
||||||
exports: [
|
|
||||||
SubMenubarComponent,
|
|
||||||
]
|
|
||||||
})
|
|
||||||
export class SubMenubarModule { }
|
|
|
@ -9,7 +9,10 @@ import 'rxjs/add/operator/catch';
|
||||||
import 'rxjs/add/operator/timeout';
|
import 'rxjs/add/operator/timeout';
|
||||||
import 'rxjs/add/observable/throw';
|
import 'rxjs/add/observable/throw';
|
||||||
|
|
||||||
import { RESTError } from '../error';
|
import {
|
||||||
|
RESTError,
|
||||||
|
RESTServerError,
|
||||||
|
} from '../error';
|
||||||
|
|
||||||
export class RESTClient {
|
export class RESTClient {
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -39,14 +42,23 @@ export class RESTClient {
|
||||||
.request<T>(method, Location.joinWithSlash(this._baseURL, entry), options)
|
.request<T>(method, Location.joinWithSlash(this._baseURL, entry), options)
|
||||||
.map(response => response)
|
.map(response => response)
|
||||||
.catch((error: HttpErrorResponse) => {
|
.catch((error: HttpErrorResponse) => {
|
||||||
console.error(error);
|
const restError: RESTError = {
|
||||||
const aryMsg = error.error.message.split('|');
|
request: {
|
||||||
const resError: RESTError = {
|
method: method,
|
||||||
code: error.error.code,
|
entry: entry,
|
||||||
message: aryMsg[0],
|
options: options,
|
||||||
data: aryMsg[1] === 'null' ? '' : aryMsg[1],
|
},
|
||||||
|
response: error.error,
|
||||||
};
|
};
|
||||||
return Observable.throw(resError);
|
|
||||||
|
console.error(restError);
|
||||||
|
// const aryMsg = error.error.message.split('|');
|
||||||
|
// const resError: RESTError = {
|
||||||
|
// code: error.error.code,
|
||||||
|
// message: aryMsg[0],
|
||||||
|
// data: aryMsg[1] === 'null' ? '' : aryMsg[1],
|
||||||
|
// };
|
||||||
|
return Observable.throw(restError);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,13 @@
|
||||||
export interface RESTError {
|
export interface RESTError {
|
||||||
|
request: {
|
||||||
|
method: string;
|
||||||
|
entry: string;
|
||||||
|
options?: any;
|
||||||
|
};
|
||||||
|
response: RESTServerError;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RESTServerError {
|
||||||
code: number;
|
code: number;
|
||||||
message: string;
|
message: string;
|
||||||
data?: any;
|
data?: any;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
import { Subject } from 'rxjs/Subject';
|
import { Subject } from 'rxjs/Subject';
|
||||||
|
|
||||||
|
|
||||||
|
import { RPCError } from '../error';
|
||||||
import { RPCClientRWC } from './rwc/RPCClientRWC';
|
import { RPCClientRWC } from './rwc/RPCClientRWC';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -11,14 +13,17 @@ import {
|
||||||
|
|
||||||
export interface RPCRequestState {
|
export interface RPCRequestState {
|
||||||
subject: Subject<any>;
|
subject: Subject<any>;
|
||||||
request: any;
|
request: {
|
||||||
|
method: string;
|
||||||
|
params: any[];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export abstract class RPCClient {
|
export abstract class RPCClient {
|
||||||
private _requestID: number;
|
private _requestID: number;
|
||||||
|
|
||||||
private _pendingRequestsCount: number;
|
private _pendingRequestsCount: number;
|
||||||
private _pendingRequests: Map<number, Subject<any>>;
|
private _pendingRequests: Map<number, RPCRequestState>;
|
||||||
|
|
||||||
public constructor(
|
public constructor(
|
||||||
private _codec: RPCClientCodec,
|
private _codec: RPCClientCodec,
|
||||||
|
@ -85,7 +90,14 @@ export abstract class RPCClient {
|
||||||
if (hasResponse) {
|
if (hasResponse) {
|
||||||
id = this.getRequestID();
|
id = this.getRequestID();
|
||||||
resSubject = new Subject<T>();
|
resSubject = new Subject<T>();
|
||||||
this._pendingRequests.set(id, resSubject);
|
const reqState: RPCRequestState = {
|
||||||
|
subject: resSubject,
|
||||||
|
request: {
|
||||||
|
method: method,
|
||||||
|
params: args,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this._pendingRequests.set(id, reqState);
|
||||||
this._pendingRequestsCount++;
|
this._pendingRequestsCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,15 +126,20 @@ export abstract class RPCClient {
|
||||||
const result = resCodec.result();
|
const result = resCodec.result();
|
||||||
const error = resCodec.error();
|
const error = resCodec.error();
|
||||||
|
|
||||||
const resSubject: Subject<any> = this._pendingRequests.get(id);
|
const reqState: RPCRequestState = this._pendingRequests.get(id);
|
||||||
|
|
||||||
this._pendingRequests.delete(id);
|
this._pendingRequests.delete(id);
|
||||||
this._pendingRequestsCount--;
|
this._pendingRequestsCount--;
|
||||||
|
|
||||||
if (undefined !== result) {
|
if (undefined !== result) {
|
||||||
resSubject.next(result);
|
reqState.subject.next(result);
|
||||||
} else if (undefined !== error) {
|
} else if (undefined !== error) {
|
||||||
console.error(error);
|
const rpcError: RPCError = {
|
||||||
resSubject.error(error);
|
request: reqState.request,
|
||||||
|
response: error,
|
||||||
|
};
|
||||||
|
console.error(rpcError);
|
||||||
|
reqState.subject.error(rpcError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,15 @@
|
||||||
|
export interface RPCError {
|
||||||
|
request: {
|
||||||
|
method: string,
|
||||||
|
params: any[],
|
||||||
|
};
|
||||||
|
response: RPCServerError;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error object representation when a method invocation fails.
|
* Error object representation when a method invocation fails.
|
||||||
*/
|
*/
|
||||||
export interface RPCError {
|
export interface RPCServerError {
|
||||||
/** Indicates the error type that occurred. */
|
/** Indicates the error type that occurred. */
|
||||||
code: ErrorCode;
|
code: ErrorCode;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { RPCError } from '../error';
|
import { RPCServerError } from '../error';
|
||||||
|
|
||||||
export abstract class RPCClientCodec {
|
export abstract class RPCClientCodec {
|
||||||
abstract request(method: string, args: any[], id: number): any;
|
abstract request(method: string, args: any[], id: number): any;
|
||||||
|
@ -7,7 +7,7 @@ export abstract class RPCClientCodec {
|
||||||
|
|
||||||
export abstract class RPCClientResponseCodec {
|
export abstract class RPCClientResponseCodec {
|
||||||
abstract id(): number | undefined;
|
abstract id(): number | undefined;
|
||||||
abstract error(): RPCError | undefined;
|
abstract error(): RPCServerError | undefined;
|
||||||
abstract result(): any | undefined;
|
abstract result(): any | undefined;
|
||||||
|
|
||||||
abstract isNotification(): boolean;
|
abstract isNotification(): boolean;
|
||||||
|
|
|
@ -5,7 +5,7 @@ import {
|
||||||
} from '../RPCClientCodec';
|
} from '../RPCClientCodec';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
RPCError,
|
RPCServerError,
|
||||||
} from '../../error';
|
} from '../../error';
|
||||||
|
|
||||||
export interface ClientNotification {
|
export interface ClientNotification {
|
||||||
|
@ -23,7 +23,7 @@ export interface ClientRequest {
|
||||||
export interface ClientResponse {
|
export interface ClientResponse {
|
||||||
jsonrpc: string;
|
jsonrpc: string;
|
||||||
result?: any;
|
result?: any;
|
||||||
error?: RPCError;
|
error?: RPCServerError;
|
||||||
id?: number;
|
id?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ export class RPCClientJSONResponseCodec extends RPCClientResponseCodec {
|
||||||
public id(): number | undefined {
|
public id(): number | undefined {
|
||||||
return this._res.id;
|
return this._res.id;
|
||||||
}
|
}
|
||||||
public error(): RPCError | undefined {
|
public error(): RPCServerError | undefined {
|
||||||
return this._res.error;
|
return this._res.error;
|
||||||
}
|
}
|
||||||
public result(): any | undefined {
|
public result(): any | undefined {
|
||||||
|
|
|
@ -44,7 +44,7 @@ export class Effects {
|
||||||
return new SettingSuccess(discoveryStartInfo);
|
return new SettingSuccess(discoveryStartInfo);
|
||||||
})
|
})
|
||||||
.catch((error: RPCError) => {
|
.catch((error: RPCError) => {
|
||||||
console.log(error.message);
|
console.log(error.response.message);
|
||||||
return of(new SettingFailure(error));
|
return of(new SettingFailure(error));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ export class MapComponent implements OnInit, AfterContentInit {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(error: RPCError) => {
|
(error: RPCError) => {
|
||||||
console.log(error.message);
|
console.log(error.response.message);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ export class ListComponent implements OnInit, AfterContentInit {
|
||||||
this.dataSource.sort = this.sort;
|
this.dataSource.sort = this.sort;
|
||||||
},
|
},
|
||||||
(error: RPCError) => {
|
(error: RPCError) => {
|
||||||
console.log(error.message);
|
console.log(error.response.message);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ export class ListComponent implements OnInit, AfterContentInit {
|
||||||
this.dataSource.sort = this.sort;
|
this.dataSource.sort = this.sort;
|
||||||
},
|
},
|
||||||
(error: RPCError) => {
|
(error: RPCError) => {
|
||||||
console.log(error.message);
|
console.log(error.response.message);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
console.log(this.selected.id + ' accept');
|
console.log(this.selected.id + ' accept');
|
||||||
|
@ -81,9 +81,9 @@ export class ListComponent implements OnInit, AfterContentInit {
|
||||||
this.dataSource.sort = this.sort;
|
this.dataSource.sort = this.sort;
|
||||||
},
|
},
|
||||||
(error: RPCError) => {
|
(error: RPCError) => {
|
||||||
console.log(error.message);
|
console.log(error.response.message);
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
console.log(this.selected.id + ' deny');
|
console.log(this.selected.id + ' deny');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ export class NotificationBadgeComponent implements OnInit, AfterContentInit {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(error: RPCError) => {
|
(error: RPCError) => {
|
||||||
console.log(error.message);
|
console.log(error.response.message);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
this.mark$.subscribe(
|
this.mark$.subscribe(
|
||||||
|
@ -48,7 +48,7 @@ export class NotificationBadgeComponent implements OnInit, AfterContentInit {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(error: RPCError) => {
|
(error: RPCError) => {
|
||||||
console.log(error.message);
|
console.log(error.response.message);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ export class NotificationComponent implements OnInit, AfterContentInit {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(error: RPCError) => {
|
(error: RPCError) => {
|
||||||
console.log(error.message);
|
console.log(error.response.message);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ export class Effects {
|
||||||
return new MarkAsReadSuccess(notification);
|
return new MarkAsReadSuccess(notification);
|
||||||
})
|
})
|
||||||
.catch((error: RPCError) => {
|
.catch((error: RPCError) => {
|
||||||
console.log(error.message);
|
console.log(error.response.message);
|
||||||
return of(new MarkAsReadFailure(error));
|
return of(new MarkAsReadFailure(error));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ export class Effects {
|
||||||
return new MarkAllAsReadSuccess(page);
|
return new MarkAllAsReadSuccess(page);
|
||||||
})
|
})
|
||||||
.catch((error: RPCError) => {
|
.catch((error: RPCError) => {
|
||||||
console.log('errrrrrrrrrrrrrr : ' + error.message);
|
console.log('errrrrrrrrrrrrrr : ' + error.response.message);
|
||||||
return of(new MarkAllAsReadFailure(error));
|
return of(new MarkAllAsReadFailure(error));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ export class DetailComponent implements OnInit, AfterContentInit {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(error: RPCError) => {
|
(error: RPCError) => {
|
||||||
console.log(error.message);
|
console.log(error.response.message);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ export class ListComponent implements OnInit, AfterContentInit {
|
||||||
this.dataSource.sort = this.sort;
|
this.dataSource.sort = this.sort;
|
||||||
},
|
},
|
||||||
(error: RPCError) => {
|
(error: RPCError) => {
|
||||||
console.log(error.message);
|
console.log(error.response.message);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ export class ListComponent implements OnInit, AfterContentInit {
|
||||||
this.dataSource.sort = this.sort;
|
this.dataSource.sort = this.sort;
|
||||||
},
|
},
|
||||||
(error: RPCError) => {
|
(error: RPCError) => {
|
||||||
console.log(error.message);
|
console.log(error.response.message);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
@import '~@angular/material/theming';
|
@import '~@angular/material/theming';
|
||||||
@import '~app/pages/pages.component.scss';
|
@import '~app/pages/pages.component.scss';
|
||||||
@import '~packages/commons/component/sidebar/sidebar.component.scss';
|
@import '~app/commons/component/layout/sidebar/sidebar.component.scss';
|
||||||
@import '~packages/commons/component/menu-item/menu-item.component.scss';
|
@import '~packages/commons/component/menu-item/menu-item.component.scss';
|
||||||
@import '~packages/commons/component/dashboard-card/dashboard-card.component.scss';
|
@import '~packages/commons/component/dashboard-card/dashboard-card.component.scss';
|
||||||
@import '~packages/commons/component/sensor-summary/sensor-summary.component.scss';
|
@import '~packages/commons/component/sensor-summary/sensor-summary.component.scss';
|
||||||
|
|
Loading…
Reference in New Issue
Block a user