discovery
This commit is contained in:
parent
2aea2336ce
commit
fa1c67e563
|
@ -40,7 +40,8 @@
|
||||||
"ngx-perfect-scrollbar": "^5.3.1",
|
"ngx-perfect-scrollbar": "^5.3.1",
|
||||||
"nvd3": "^1.8.6",
|
"nvd3": "^1.8.6",
|
||||||
"rxjs": "^5.5.6",
|
"rxjs": "^5.5.6",
|
||||||
"zone.js": "^0.8.20"
|
"zone.js": "^0.8.20",
|
||||||
|
"ip-cidr": "^1.1.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular/cli": "1.6.5",
|
"@angular/cli": "1.6.5",
|
||||||
|
|
|
@ -15,6 +15,7 @@ export class InputChipComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.selectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
selected(app: any) {
|
selected(app: any) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<div>
|
<div *ngIf="!started">
|
||||||
|
|
||||||
<h2 mat-dialog-title>Discovery Setting</h2>
|
<h2 mat-dialog-title>Discovery Setting</h2>
|
||||||
|
|
||||||
|
@ -17,10 +17,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<mat-form-field *ngIf="hostChecked">
|
<mat-form-field *ngIf="hostChecked">
|
||||||
<input matInput placeholder="Start IP" type="string">
|
<input matInput placeholder="Start IP" type="string" [(ngModel)]="startIP">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field *ngIf="hostChecked">
|
<mat-form-field *ngIf="hostChecked">
|
||||||
<input matInput placeholder="End IP" type="string">
|
<input matInput placeholder="End IP" type="string" [(ngModel)]="endIP">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -30,10 +30,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<mat-form-field *ngIf="portChecked">
|
<mat-form-field *ngIf="portChecked">
|
||||||
<input matInput placeholder="Start Port" type="number">
|
<input matInput placeholder="Start Port" type="number" [(ngModel)]="startPort">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field *ngIf="portChecked">
|
<mat-form-field *ngIf="portChecked">
|
||||||
<input matInput placeholder="End Port" type="number">
|
<input matInput placeholder="End Port" type="number" [(ngModel)]="endPort">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -53,8 +53,12 @@
|
||||||
|
|
||||||
<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-button mat-dialog-close color="primary" (click)="discovery()">Start</button>
|
<button mat-button color="primary" (click)="discovery()">Start</button>
|
||||||
<!-- <button mat-raised-button type="submit" color="primary">Start</button> -->
|
<!-- <button mat-raised-button type="submit" color="primary">Start</button> -->
|
||||||
</mat-dialog-actions>
|
</mat-dialog-actions>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div *ngIf="started">
|
||||||
|
tree 나올꼬얌
|
||||||
|
</div>
|
|
@ -1,11 +1,12 @@
|
||||||
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 { Store, select } from '@ngrx/store';
|
||||||
import { RPCError } from 'packages/core/rpc/error';
|
import { RPCError } from 'packages/core/rpc/error';
|
||||||
|
|
||||||
import * as DiscoverySettingStore from '../../store/setting';
|
import * as DiscoverySettingStore from '../../store/setting';
|
||||||
import { DiscoveryStartInfo } from '../../model';
|
import { DiscoveryStartInfo } from '../../model';
|
||||||
|
import * as CIDR from 'ip-cidr';
|
||||||
|
import * as DiscoveryStore from '../../store/setting';
|
||||||
|
import { SettingSelector } from '../../store';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'of-setting',
|
selector: 'of-setting',
|
||||||
|
@ -14,8 +15,18 @@ import { DiscoveryStartInfo } from '../../model';
|
||||||
})
|
})
|
||||||
export class SettingComponent implements OnInit, AfterContentInit {
|
export class SettingComponent implements OnInit, AfterContentInit {
|
||||||
|
|
||||||
private cidr;
|
settingSucceed$ = this.store.pipe(select(SettingSelector.select('isStart')));
|
||||||
|
started = false;
|
||||||
|
|
||||||
|
cidr;
|
||||||
|
startIP;
|
||||||
|
endIP;
|
||||||
|
startPort;
|
||||||
|
endPort;
|
||||||
// private settingForm: FormGroup;
|
// private settingForm: FormGroup;
|
||||||
|
hostChecked = true;
|
||||||
|
portChecked = true;
|
||||||
|
serviceChecked = true;
|
||||||
|
|
||||||
serviceItems = [
|
serviceItems = [
|
||||||
{ name: 'MySQL' },
|
{ name: 'MySQL' },
|
||||||
|
@ -24,22 +35,55 @@ export class SettingComponent implements OnInit, AfterContentInit {
|
||||||
{ name: 'Nginx' },
|
{ name: 'Nginx' },
|
||||||
];
|
];
|
||||||
constructor(
|
constructor(
|
||||||
private store: Store<DiscoverySettingStore.State>
|
private store: Store<DiscoverySettingStore.State>,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.settingSucceed$.subscribe(
|
||||||
|
(ds: DiscoveryStartInfo) => {
|
||||||
|
if (ds !== null) {
|
||||||
|
this.started = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
(error: RPCError) => {
|
||||||
|
console.log(error.response.message);
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterContentInit() {
|
ngAfterContentInit() {
|
||||||
this.cidr = '192.168.1.0/24';
|
this.cidr = '192.168.1.0/24';
|
||||||
|
this.hostRange();
|
||||||
|
this.portRange();
|
||||||
|
}
|
||||||
|
|
||||||
|
hostRange() {
|
||||||
|
const cidr = new CIDR(this.cidr);
|
||||||
|
if (!cidr.isValid()) {
|
||||||
|
alert('Invalid cidr : ' + this.cidr);
|
||||||
|
this.startIP = 'Unknown';
|
||||||
|
this.endIP = 'Unknown';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.startIP = cidr.addressStart.address;
|
||||||
|
this.endIP = cidr.addressEnd.address;
|
||||||
|
}
|
||||||
|
|
||||||
|
portRange() {
|
||||||
|
this.startPort = '1';
|
||||||
|
this.endPort = '1024';
|
||||||
}
|
}
|
||||||
|
|
||||||
discovery() {
|
discovery() {
|
||||||
const startInfo: DiscoveryStartInfo = {
|
const startInfo: DiscoveryStartInfo = {
|
||||||
startIp: '1111',
|
startIp: this.startIP,
|
||||||
endIP: '11111',
|
endIP: this.endIP,
|
||||||
|
startPort: this.startPort,
|
||||||
|
endPort: this.endPort
|
||||||
};
|
};
|
||||||
this.store.dispatch(new DiscoverySettingStore.Setting(startInfo));
|
this.store.dispatch(new DiscoverySettingStore.Setting(startInfo));
|
||||||
|
this.started = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,3 +34,8 @@ export const NotificationSelector = new StateSelector<NotificationStore.State>(c
|
||||||
selectDiscoveryState,
|
selectDiscoveryState,
|
||||||
(state: State) => state.notification
|
(state: State) => state.notification
|
||||||
));
|
));
|
||||||
|
|
||||||
|
export const SettingSelector = new StateSelector<SettingStore.State>(createSelector(
|
||||||
|
selectDiscoveryState,
|
||||||
|
(state: State) => state.setting
|
||||||
|
));
|
||||||
|
|
61
yarn.lock
61
yarn.lock
|
@ -1425,6 +1425,12 @@ chownr@^1.0.1:
|
||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.0.1.tgz#e2a75042a9551908bebd25b8523d5f9769d79181"
|
resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.0.1.tgz#e2a75042a9551908bebd25b8523d5f9769d79181"
|
||||||
|
|
||||||
|
cidr-range@^1.0.6:
|
||||||
|
version "1.0.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/cidr-range/-/cidr-range-1.0.6.tgz#8ce6a648dca7eceb34e82013c22479f843f1c452"
|
||||||
|
dependencies:
|
||||||
|
ip "^1.1.3"
|
||||||
|
|
||||||
cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3:
|
cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3:
|
||||||
version "1.0.4"
|
version "1.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de"
|
resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de"
|
||||||
|
@ -3501,11 +3507,30 @@ invert-kv@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6"
|
resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6"
|
||||||
|
|
||||||
|
ip-address@^5.8.6:
|
||||||
|
version "5.8.9"
|
||||||
|
resolved "https://registry.yarnpkg.com/ip-address/-/ip-address-5.8.9.tgz#6379277c23fc5adb20511e4d23ec2c1bde105dfd"
|
||||||
|
dependencies:
|
||||||
|
jsbn "1.1.0"
|
||||||
|
lodash.find "^4.6.0"
|
||||||
|
lodash.max "^4.0.1"
|
||||||
|
lodash.merge "^4.6.0"
|
||||||
|
lodash.padstart "^4.6.1"
|
||||||
|
lodash.repeat "^4.1.0"
|
||||||
|
sprintf-js "1.1.0"
|
||||||
|
|
||||||
|
ip-cidr@^1.1.2:
|
||||||
|
version "1.1.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/ip-cidr/-/ip-cidr-1.1.2.tgz#3276a25145b716cb542a23eb944d4dfc45a20557"
|
||||||
|
dependencies:
|
||||||
|
ip-address "^5.8.6"
|
||||||
|
jsbn "^0.1.0"
|
||||||
|
|
||||||
ip@1.0.1:
|
ip@1.0.1:
|
||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/ip/-/ip-1.0.1.tgz#c7e356cdea225ae71b36d70f2e71a92ba4e42590"
|
resolved "https://registry.yarnpkg.com/ip/-/ip-1.0.1.tgz#c7e356cdea225ae71b36d70f2e71a92ba4e42590"
|
||||||
|
|
||||||
ip@^1.1.0, ip@^1.1.2, ip@^1.1.5:
|
ip@^1.1.0, ip@^1.1.2, ip@^1.1.3, ip@^1.1.5:
|
||||||
version "1.1.5"
|
version "1.1.5"
|
||||||
resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a"
|
resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a"
|
||||||
|
|
||||||
|
@ -3906,7 +3931,11 @@ js-yaml@~3.7.0:
|
||||||
argparse "^1.0.7"
|
argparse "^1.0.7"
|
||||||
esprima "^2.6.0"
|
esprima "^2.6.0"
|
||||||
|
|
||||||
jsbn@~0.1.0:
|
jsbn@1.1.0:
|
||||||
|
version "1.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-1.1.0.tgz#b01307cb29b618a1ed26ec79e911f803c4da0040"
|
||||||
|
|
||||||
|
jsbn@^0.1.0, jsbn@~0.1.0:
|
||||||
version "0.1.1"
|
version "0.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
|
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
|
||||||
|
|
||||||
|
@ -4223,6 +4252,14 @@ lodash.clonedeep@^4.3.2, lodash.clonedeep@^4.5.0:
|
||||||
version "4.5.0"
|
version "4.5.0"
|
||||||
resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef"
|
resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef"
|
||||||
|
|
||||||
|
lodash.find@^4.6.0:
|
||||||
|
version "4.6.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/lodash.find/-/lodash.find-4.6.0.tgz#cb0704d47ab71789ffa0de8b97dd926fb88b13b1"
|
||||||
|
|
||||||
|
lodash.max@^4.0.1:
|
||||||
|
version "4.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/lodash.max/-/lodash.max-4.0.1.tgz#8735566c618b35a9f760520b487ae79658af136a"
|
||||||
|
|
||||||
lodash.memoize@^4.1.2:
|
lodash.memoize@^4.1.2:
|
||||||
version "4.1.2"
|
version "4.1.2"
|
||||||
resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe"
|
resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe"
|
||||||
|
@ -4231,10 +4268,22 @@ lodash.memoize@~3.0.3:
|
||||||
version "3.0.4"
|
version "3.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-3.0.4.tgz#2dcbd2c287cbc0a55cc42328bd0c736150d53e3f"
|
resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-3.0.4.tgz#2dcbd2c287cbc0a55cc42328bd0c736150d53e3f"
|
||||||
|
|
||||||
|
lodash.merge@^4.6.0:
|
||||||
|
version "4.6.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.1.tgz#adc25d9cb99b9391c59624f379fbba60d7111d54"
|
||||||
|
|
||||||
lodash.mergewith@^4.6.0:
|
lodash.mergewith@^4.6.0:
|
||||||
version "4.6.0"
|
version "4.6.0"
|
||||||
resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.0.tgz#150cf0a16791f5903b8891eab154609274bdea55"
|
resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.0.tgz#150cf0a16791f5903b8891eab154609274bdea55"
|
||||||
|
|
||||||
|
lodash.padstart@^4.6.1:
|
||||||
|
version "4.6.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/lodash.padstart/-/lodash.padstart-4.6.1.tgz#d2e3eebff0d9d39ad50f5cbd1b52a7bce6bb611b"
|
||||||
|
|
||||||
|
lodash.repeat@^4.1.0:
|
||||||
|
version "4.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/lodash.repeat/-/lodash.repeat-4.1.0.tgz#fc7de8131d8c8ac07e4b49f74ffe829d1f2bec44"
|
||||||
|
|
||||||
lodash.tail@^4.1.1:
|
lodash.tail@^4.1.1:
|
||||||
version "4.1.1"
|
version "4.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/lodash.tail/-/lodash.tail-4.1.1.tgz#d2333a36d9e7717c8ad2f7cacafec7c32b444664"
|
resolved "https://registry.yarnpkg.com/lodash.tail/-/lodash.tail-4.1.1.tgz#d2333a36d9e7717c8ad2f7cacafec7c32b444664"
|
||||||
|
@ -6637,6 +6686,10 @@ split-string@^3.0.1, split-string@^3.0.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
extend-shallow "^3.0.0"
|
extend-shallow "^3.0.0"
|
||||||
|
|
||||||
|
sprintf-js@1.1.0:
|
||||||
|
version "1.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.1.0.tgz#cffcaf702daf65ea39bb4e0fa2b299cec1a1be46"
|
||||||
|
|
||||||
sprintf-js@^1.0.3, sprintf-js@~1.0.2:
|
sprintf-js@^1.0.3, sprintf-js@~1.0.2:
|
||||||
version "1.0.3"
|
version "1.0.3"
|
||||||
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
|
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
|
||||||
|
@ -7113,10 +7166,6 @@ typedarray@~0.0.5:
|
||||||
version "0.0.6"
|
version "0.0.6"
|
||||||
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
|
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
|
||||||
|
|
||||||
typescript-string-enums@^0.3.5:
|
|
||||||
version "0.3.5"
|
|
||||||
resolved "https://registry.yarnpkg.com/typescript-string-enums/-/typescript-string-enums-0.3.5.tgz#00f5c30422ec5d8061ed49a0fe06610ae99f02a2"
|
|
||||||
|
|
||||||
typescript@~2.5.3:
|
typescript@~2.5.3:
|
||||||
version "2.5.3"
|
version "2.5.3"
|
||||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.5.3.tgz#df3dcdc38f3beb800d4bc322646b04a3f6ca7f0d"
|
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.5.3.tgz#df3dcdc38f3beb800d4bc322646b04a3f6ca7f0d"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user