This commit is contained in:
geek 2018-06-06 19:36:51 +09:00
parent 1bbd827596
commit 418947dfc0
7 changed files with 51 additions and 21 deletions

View File

@ -143,9 +143,9 @@ export class DetailComponent implements OnInit, AfterContentInit, OnDestroy {
} }
onDisplayNameChangeKeypress(event, value) { onDisplayNameChangeKeypress(event, value) {
if (event.key === 'Enter') { // if (event.key === 'Enter') {
this.onDisplayNameChange(value); // this.onDisplayNameChange(value);
} // }
} }
} }

View File

@ -1,9 +1,9 @@
import { DetailComponent } from './detail/detail.component'; import { DetailComponent } from './detail/detail.component';
import { ListComponent } from './list/list.component'; import { ListComponent } from './list/list.component';
// import { FilterComponent } from './list/filter/filter.component'; import {FilterComponent} from './list/filter/filter.component';
export const COMPONENTS = [ export const COMPONENTS = [
ListComponent, ListComponent,
// DetailComponent, DetailComponent,
// FilterComponent FilterComponent
]; ];

View File

@ -4,8 +4,12 @@ import { Infra } from '@overflow/commons-typescript/model/infra';
import { Probe } from '@overflow/commons-typescript/model/probe'; import { Probe } from '@overflow/commons-typescript/model/probe';
import { Target } from '@overflow/commons-typescript/model/target'; import { Target } from '@overflow/commons-typescript/model/target';
import { Observable, of, Subscription } from 'rxjs';
import { Store, select } from '@ngrx/store'; import { Store, select } from '@ngrx/store';
import { TargetService } from '../../service/target.service';
import { InfraService } from '@overflow/infra/service/infra.service';
import {PageParams} from '@overflow/commons-typescript/model/commons/PageParams';
import { catchError, map, tap, take } from 'rxjs/operators';
import {Page} from '@overflow/commons-typescript/model/commons/Page';
@Component({ @Component({
selector: 'of-target-list', selector: 'of-target-list',
@ -20,14 +24,13 @@ export class ListComponent implements OnInit, AfterContentInit, OnDestroy {
// target: Target = null; // target: Target = null;
// sensorSettingDisplay = false; // sensorSettingDisplay = false;
pageSize = '10'; // pageSize = '10';
totalLength = 0; // totalLength = 0;
currPage = 0; // currPage = 0;
constructor( constructor(
// private route: ActivatedRoute, private store: Store<any>,
// private router: Router, private targetService: TargetService,
// private store: Store<any>,
) { ) {
} }
@ -44,7 +47,27 @@ export class ListComponent implements OnInit, AfterContentInit, OnDestroy {
// console.log(error); // console.log(error);
// } // }
// ); // );
console.log('ddddddddddddddddddddd'); const pageParams: PageParams = {
pageNo: 0,
countPerPage: 10,
sortCol: 'id',
sortDirection: 'descending',
};
this.targetService.readAllByProbeID(1, pageParams)
.pipe(
tap(() => {
}),
map((r: Page<Target>) => {
console.log(r);
}),
catchError(err => {
console.log(err);
return err;
}),
take(1),
).subscribe();
} }
ngAfterContentInit() { ngAfterContentInit() {

View File

@ -1,5 +1,5 @@
import { TargetService } from './target.service'; import { TargetService } from './target.service';
export const SERVICES = [ export const SERVICES = [
// TargetService, TargetService,
]; ];

View File

@ -5,6 +5,9 @@ import { Observable } from 'rxjs';
import { Target } from '@overflow/commons-typescript/model/target'; import { Target } from '@overflow/commons-typescript/model/target';
import { Host, Service } from '@overflow/commons-typescript/model/discovery'; import { Host, Service } from '@overflow/commons-typescript/model/discovery';
import {PageParams} from '@overflow/commons-typescript/model/commons/PageParams';
import {Page} from '@overflow/commons-typescript/model/commons/Page';
import {Notification} from '@overflow/commons-typescript/model/notification';
@Injectable() @Injectable()
export class TargetService { export class TargetService {
@ -18,10 +21,10 @@ export class TargetService {
public registDiscoveredTargets(probeID: number, hosts: Host[], services: Service[]): Observable<Target> { public registDiscoveredTargets(probeID: number, hosts: Host[], services: Service[]): Observable<Target> {
return this.rpcService.call('TargetService.registDiscoveredTargets', probeID, hosts, services); return this.rpcService.call('TargetService.registDiscoveredTargets', probeID, hosts, services);
} }
//
public modify(target: Target): Observable<Target> { // public modify(target: Target): Observable<Target> {
return this.rpcService.call<Target>('TargetService.modify', target); // return this.rpcService.call<Target>('TargetService.modify', target);
} // }
public findExistHostTarget(probeID: number, hostIP: string): Observable<Target> { public findExistHostTarget(probeID: number, hostIP: string): Observable<Target> {
return this.rpcService.call<Target>('TargetService.readExistHostTarget', probeID, hostIP); return this.rpcService.call<Target>('TargetService.readExistHostTarget', probeID, hostIP);
@ -30,4 +33,8 @@ export class TargetService {
public findExistServiceTarget(hostID: number, portNumber: number, portType: string): Observable<Target> { public findExistServiceTarget(hostID: number, portNumber: number, portType: string): Observable<Target> {
return this.rpcService.call<Target>('TargetService.readExistServiceTarget', hostID, portNumber, portType); return this.rpcService.call<Target>('TargetService.readExistServiceTarget', hostID, portNumber, portType);
} }
public readAllByProbeID(probeID: number, pageParams: PageParams): Observable<Page<Target>> {
return this.rpcService.call<Page<Target>>('TargetService.readAllByProbeID', probeID, pageParams);
}
} }

View File

@ -2,7 +2,7 @@
<div class="ui-g"> <div class="ui-g">
<div class="ui-g-12"> <div class="ui-g-12">
<div class="card no-margin"> <div class="card no-margin">
<!--<of-target-list></of-target-list>--> <of-target-list></of-target-list>
</div> </div>
</div> </div>
</div> </div>

View File

@ -14,7 +14,7 @@ import { TargetPageComponent } from './target-page.component';
CommonModule, CommonModule,
UIModule, UIModule,
TargetPageRoutingModule, TargetPageRoutingModule,
// TargetModule, TargetModule,
// TabbarModule // TabbarModule
], ],
declarations: [ declarations: [