discovery start setting
This commit is contained in:
parent
661027198b
commit
b2950024f0
|
@ -1,3 +1,3 @@
|
||||||
.input-chip {
|
.input-chip {
|
||||||
width: 80%;
|
width: 60%;
|
||||||
}
|
}
|
|
@ -10,6 +10,7 @@
|
||||||
<mat-card-subtitle>{{cidr}}</mat-card-subtitle>
|
<mat-card-subtitle>{{cidr}}</mat-card-subtitle>
|
||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
|
<!-- <form (ngSubmit)="discovery()"> -->
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<mat-checkbox [checked]="true" [(ngModel)]="hostChecked">Host</mat-checkbox>
|
<mat-checkbox [checked]="true" [(ngModel)]="hostChecked">Host</mat-checkbox>
|
||||||
|
@ -44,6 +45,7 @@
|
||||||
<of-input-chip *ngIf="serviceChecked" [unselectedItems]="serviceItems"></of-input-chip>
|
<of-input-chip *ngIf="serviceChecked" [unselectedItems]="serviceItems"></of-input-chip>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- </form> -->
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
</mat-dialog-content>
|
</mat-dialog-content>
|
||||||
|
@ -51,7 +53,8 @@
|
||||||
|
|
||||||
<mat-dialog-actions fxLayoutAlign="end">
|
<mat-dialog-actions fxLayoutAlign="end">
|
||||||
<button mat-button mat-dialog-close>Cancel</button>
|
<button mat-button mat-dialog-close>Cancel</button>
|
||||||
<button mat-raised-button (click)="handleStart()" color="primary">Start</button>
|
<button mat-button mat-dialog-close color="primary" (click)="discovery()">Start</button>
|
||||||
|
<!-- <button mat-raised-button type="submit" color="primary">Start</button> -->
|
||||||
</mat-dialog-actions>
|
</mat-dialog-actions>
|
||||||
|
|
||||||
</div>
|
</div>
|
|
@ -1,6 +1,10 @@
|
||||||
import { Component, OnInit, AfterContentInit } from '@angular/core';
|
import { Component, OnInit, AfterContentInit } from '@angular/core';
|
||||||
import { MatCheckboxChange } from '@angular/material';
|
import { MatCheckboxChange } from '@angular/material';
|
||||||
|
import { FormGroup } from '@angular/forms';
|
||||||
|
import { Store, select } from '@ngrx/store';
|
||||||
|
import { RPCError } from 'packages/core/rpc/error';
|
||||||
|
import * as DiscoverySettingStore from '../../store/setting';
|
||||||
|
import { DiscoveryStartInfo } from '../../model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'of-setting',
|
selector: 'of-setting',
|
||||||
|
@ -10,6 +14,7 @@ import { MatCheckboxChange } from '@angular/material';
|
||||||
export class SettingComponent implements OnInit, AfterContentInit {
|
export class SettingComponent implements OnInit, AfterContentInit {
|
||||||
|
|
||||||
private cidr;
|
private cidr;
|
||||||
|
// private settingForm: FormGroup;
|
||||||
|
|
||||||
serviceItems = [
|
serviceItems = [
|
||||||
{ name: 'MySQL' },
|
{ name: 'MySQL' },
|
||||||
|
@ -17,7 +22,10 @@ export class SettingComponent implements OnInit, AfterContentInit {
|
||||||
{ name: 'Tomcat' },
|
{ name: 'Tomcat' },
|
||||||
{ name: 'Nginx' },
|
{ name: 'Nginx' },
|
||||||
];
|
];
|
||||||
constructor() { }
|
constructor(
|
||||||
|
private store: Store<DiscoverySettingStore.State>
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
}
|
}
|
||||||
|
@ -26,8 +34,11 @@ export class SettingComponent implements OnInit, AfterContentInit {
|
||||||
this.cidr = '192.168.1.0/24';
|
this.cidr = '192.168.1.0/24';
|
||||||
}
|
}
|
||||||
|
|
||||||
handleStart() {
|
discovery() {
|
||||||
console.log('Start discovery');
|
const startInfo: DiscoveryStartInfo = {
|
||||||
|
startIp: '1111',
|
||||||
|
endIP: '11111',
|
||||||
|
};
|
||||||
|
this.store.dispatch(new DiscoverySettingStore.Setting(startInfo));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
export interface DiscoveryStartInfo {
|
export interface DiscoveryStartInfo {
|
||||||
startIp: string;
|
startIp: string;
|
||||||
endIP: string;
|
endIP: string;
|
||||||
excludeIp: string;
|
excludeIp?: string;
|
||||||
startPort: string;
|
startPort?: string;
|
||||||
endPort: string;
|
endPort?: string;
|
||||||
services: Array<string>;
|
services?: Array<string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// export default DiscoveryStartInfo;
|
// export default DiscoveryStartInfo;
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
import 'rxjs/add/operator/map';
|
|
||||||
|
|
||||||
import { RPCClient } from 'packages/core/rpc/client/RPCClient';
|
import { RPCClient } from 'packages/core/rpc/client/RPCClient';
|
||||||
|
|
||||||
import { DiscoveryStartInfo } from '../model';
|
import { DiscoveryStartInfo } from '../model';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
@ -17,15 +13,7 @@ export class DiscoveryService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public start(dsInfo: DiscoveryStartInfo): Observable<DiscoveryStartInfo> {
|
public start(dsInfo: DiscoveryStartInfo): Observable<DiscoveryStartInfo> {
|
||||||
// const body = {
|
|
||||||
// signinId: email,
|
|
||||||
// signinPw: password,
|
|
||||||
// };
|
|
||||||
|
|
||||||
return this.rpcClient.call('DiscoveryService.start', dsInfo);
|
return this.rpcClient.call('DiscoveryService.startDiscovery', dsInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public signup(member: DiscoveryStartInfo): Observable<DiscoveryStartInfo> {
|
|
||||||
// return this.restService.post('/account/signup', member);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ export enum ActionType {
|
||||||
export class Setting implements Action {
|
export class Setting implements Action {
|
||||||
readonly type = ActionType.Setting;
|
readonly type = ActionType.Setting;
|
||||||
|
|
||||||
constructor(public payload: { payload: DiscoveryStartInfo}) {}
|
constructor(public payload: DiscoveryStartInfo) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SettingSuccess implements Action {
|
export class SettingSuccess implements Action {
|
||||||
|
|
|
@ -36,39 +36,15 @@ export class Effects {
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
@Effect()
|
@Effect()
|
||||||
signin$: Observable<Action> = this.actions$
|
startDiscovery$: Observable<Action> = this.actions$
|
||||||
.ofType(ActionType.Setting)
|
.ofType(ActionType.Setting)
|
||||||
.map((action: Setting) => action.payload)
|
.map((action: Setting) => action.payload)
|
||||||
.switchMap(payload => this.discoveryService.start(payload.payload))
|
.switchMap(payload => this.discoveryService.start(payload))
|
||||||
.map(discoveryStartInfo => {
|
.map(discoveryStartInfo => {
|
||||||
return new SettingSuccess(discoveryStartInfo);
|
return new SettingSuccess(discoveryStartInfo);
|
||||||
})
|
})
|
||||||
.catch((error: RPCError) => {
|
.catch((error: RPCError) => {
|
||||||
|
console.log(error.message);
|
||||||
return of(new SettingFailure(error));
|
return of(new SettingFailure(error));
|
||||||
});
|
});
|
||||||
|
|
||||||
// .map((action: Signin) => action.payload)
|
|
||||||
// .exhaustMap(payload =>
|
|
||||||
// this.memberService
|
|
||||||
// .signin(payload.email, payload.password)
|
|
||||||
// .map(member => {
|
|
||||||
// return new SigninSuccess(member);
|
|
||||||
// })
|
|
||||||
// .catch((error) => {
|
|
||||||
// return of(new SigninFailure(error.message));
|
|
||||||
// })
|
|
||||||
// );
|
|
||||||
|
|
||||||
@Effect({ dispatch: false })
|
|
||||||
signinSuccess$ = this.actions$
|
|
||||||
.ofType(ActionType.SettingSuccess)
|
|
||||||
.do(() => this.router.navigate(['/']));
|
|
||||||
|
|
||||||
@Effect({ dispatch: false })
|
|
||||||
signinRedirect$ = this.actions$
|
|
||||||
.ofType(ActionType.SettingRedirect)
|
|
||||||
.do(authed => {
|
|
||||||
this.router.navigate(['/login']);
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user