This commit is contained in:
crusader 2018-03-06 14:57:09 +09:00
parent e1bc9555ec
commit 40c1e99411
76 changed files with 1030 additions and 23 deletions

View File

@ -5,8 +5,8 @@
export const environment = { export const environment = {
production: false, production: false,
restBaseURL: 'http://127.0.0.1:19080', restBaseURL: 'http://192.168.1.101:19080',
rpcBaseURL: 'ws://127.0.0.1:19090/webapp', rpcBaseURL: 'ws://192.168.1.101/webapp',
}; };
export const palete = { export const palete = {
primary: '#D32F2F', primary: '#D32F2F',

View File

@ -0,0 +1,5 @@
export interface Domain {
id?: number;
name?: string;
createDate?: Date;
}

View File

@ -0,0 +1,9 @@
import { Member } from 'packages/member/model';
import { Domain } from './Domain';
export interface DomainMember {
id: number;
createDate: Date;
member: Member;
domain: Domain;
}

View File

@ -0,0 +1,2 @@
export * from './Domain';
export * from './DomainMember';

View File

@ -0,0 +1,13 @@
import { MetaInfraType } from 'packages/meta/model';
import { Probe } from 'packages/probe/model';
import { Target } from 'packages/target/model';
export interface Infra {
id?: number;
infraType?: MetaInfraType;
childId?: number;
createDate?: Date;
probe?: Probe;
target?: Target;
}

View File

@ -0,0 +1,10 @@
import { InfraOS } from './InfraOS';
import { Infra } from './Infra';
export interface InfraHost extends Infra {
// id?: number;
os?: InfraOS;
ip?: number;
mac?: number;
createDate?: Date;
}

View File

@ -0,0 +1,8 @@
import { Infra } from './Infra';
export interface InfraMachine extends Infra {
// id?: number;
meta?: string;
createDate?: Date;
}

View File

@ -0,0 +1,11 @@
import { InfraMachine } from './InfraMachine';
import { MetaInfraVendor } from 'packages/meta/model';
import { Infra } from './Infra';
export interface InfraOS extends Infra {
// id?: number;
machine?: InfraMachine;
meta?: string;
createDate?: Date;
vendor?: MetaInfraVendor;
}

View File

@ -0,0 +1,10 @@
import { InfraOS } from './InfraOS';
import { Infra } from './Infra';
export interface InfraOSApplication extends Infra {
// id?: number;
os?: InfraOS;
name?: string;
createDate?: Date;
}

View File

@ -0,0 +1,9 @@
import { InfraOS } from './InfraOS';
import { Infra } from './Infra';
export interface InfraOSDaemon extends Infra {
// id?: number;
os?: InfraOS;
name?: string;
createDate?: Date;
}

View File

@ -0,0 +1,13 @@
import { InfraOS } from './InfraOS';
import { MetaInfraVendor } from 'packages/meta/model';
import { Infra } from './Infra';
export interface InfraOSPort extends Infra {
// id?: number;
os?: InfraOS;
createDate?: Date;
port?: number;
portType?: string;
vendor?: MetaInfraVendor;
tlsType?: boolean;
}

View File

@ -0,0 +1,13 @@
import { InfraHost } from './InfraHost';
import { MetaInfraVendor } from 'packages/meta/model';
import { Infra } from './Infra';
export interface InfraService extends Infra {
// id?: number;
host?: InfraHost;
portType?: string;
port?: number;
vendor?: MetaInfraVendor;
createDate?: Date;
tlsType?: boolean;
}

View File

@ -0,0 +1,8 @@
export * from './InfraHost';
export * from './InfraMachine';
export * from './InfraOSApplication';
export * from './InfraOSDaemon';
export * from './InfraOSPort';
export * from './InfraOS';
export * from './InfraService';
export * from './Infra';

View File

@ -23,7 +23,6 @@ export class SigninComponent implements OnInit {
private store: Store<AuthStore.State>, private store: Store<AuthStore.State>,
private formBuilder: FormBuilder, private formBuilder: FormBuilder,
) { ) {
console.log(this.store);
} }
ngOnInit() { ngOnInit() {

View File

@ -0,0 +1,10 @@
export interface Member {
id?: number;
email?: string;
password?: string;
name?: string;
phone?: string;
companyName?: string;
createDate?: Date;
status?: string;
}

View File

@ -0,0 +1 @@
export * from './Member';

View File

@ -1,10 +0,0 @@
export interface Member {
id: number;
email: string;
password: string;
name: string;
phone: string;
companyName: string;
createDate: Date;
status: string;
}

View File

@ -5,7 +5,7 @@ import 'rxjs/add/operator/map';
import { RESTService } from 'packages/commons/service/rest.service'; import { RESTService } from 'packages/commons/service/rest.service';
import { Member } from '../model/member'; import { Member } from '../model';
@Injectable() @Injectable()
export class MemberService { export class MemberService {

View File

@ -2,7 +2,7 @@ import { Action } from '@ngrx/store';
import { ErrorResponse } from 'packages/commons/service/error-response'; import { ErrorResponse } from 'packages/commons/service/error-response';
import { Member } from '../../model/member'; import { Member } from '../../model';
export enum ActionType { export enum ActionType {
Signin = '[member.auth] Signin', Signin = '[member.auth] Signin',

View File

@ -16,7 +16,7 @@ import 'rxjs/add/operator/take';
import { ErrorResponse } from 'packages/commons/service/error-response'; import { ErrorResponse } from 'packages/commons/service/error-response';
import { Member } from '../../model/member'; import { Member } from '../../model';
import { MemberService } from '../../service/member.service'; import { MemberService } from '../../service/member.service';
import { import {

View File

@ -11,7 +11,7 @@ import {
initialState, initialState,
} from './auth.state'; } from './auth.state';
import { Member } from '../../model/member'; import { Member } from '../../model';
export function reducer(state = initialState, action: Actions): State { export function reducer(state = initialState, action: Actions): State {
switch (action.type) { switch (action.type) {

View File

@ -1,6 +1,6 @@
import { ErrorResponse } from 'packages/commons/service/error-response'; import { ErrorResponse } from 'packages/commons/service/error-response';
import { Member } from '../../model/member'; import { Member } from '../../model';
export interface State { export interface State {
isSignin: boolean; isSignin: boolean;

View File

@ -2,7 +2,7 @@ import { Action } from '@ngrx/store';
import { ErrorResponse } from 'packages/commons/service/error-response'; import { ErrorResponse } from 'packages/commons/service/error-response';
import { Member } from '../../model/member'; import { Member } from '../../model';
export enum ActionType { export enum ActionType {
Signup = '[member.signup] Signup', Signup = '[member.signup] Signup',

View File

@ -15,7 +15,7 @@ import 'rxjs/add/operator/take';
import { ErrorResponse } from 'packages/commons/service/error-response'; import { ErrorResponse } from 'packages/commons/service/error-response';
import { Member } from '../../model/member'; import { Member } from '../../model';
import { MemberService } from '../../service/member.service'; import { MemberService } from '../../service/member.service';
import { import {

View File

@ -8,7 +8,7 @@ import {
initialState, initialState,
} from './signup.state'; } from './signup.state';
import { Member } from '../../model/member'; import { Member } from '../../model';
export function reducer(state = initialState, action: Actions): State { export function reducer(state = initialState, action: Actions): State {
switch (action.type) { switch (action.type) {

View File

@ -1,6 +1,6 @@
import { ErrorResponse } from 'packages/commons/service/error-response'; import { ErrorResponse } from 'packages/commons/service/error-response';
import { Member } from '../../model/member'; import { Member } from '../../model';
export interface State { export interface State {
error: ErrorResponse | null; error: ErrorResponse | null;

View File

@ -0,0 +1,34 @@
export interface MetaCrawler {
id: number;
createDate?: Date;
name?: string;
description?: string;
}
export enum MetaCrawler_ID {
ACTIVEDIRECTORY_CRAWLER = 1,
CASSANDRA_CRAWLER = 2,
DHCP_CRAWLER = 3,
DNS_CRAWLER = 4,
FTP_CRAWLER = 5,
HTTP_CRAWLER = 6,
IMAP_CRAWLER = 7,
LDAP_CRAWLER = 8,
MONGODB_CRAWLER = 9,
MSSQL_CRAWLER = 10,
MYSQL_CRAWLER = 11,
NETBIOS_CRAWLER = 12,
ORACLE_CRAWLER = 13,
POP_CRAWLER = 14,
POSTGRESQL_CRAWLER = 15,
REDIS_CRAWLER = 16,
RMI_CRAWLER = 17,
SMB_CRAWLER = 18,
SMTP_CRAWLER = 19,
SNMP_CRAWLER = 20,
SSH_CRAWLER = 21,
TELNET_CRAWLER = 22,
WMI_CRAWLER = 23,
UNKNOWN_CRAWLER = 24,
}

View File

@ -0,0 +1,17 @@
import { MetaInputType } from './MetaInputType';
import { MetaCrawler } from './MetaCrawler';
export interface MetaCrawlerInputItem {
id?: number;
inputType: MetaInputType;
crawler: MetaCrawler;
description: string;
name: string;
createDate: Date;
required: boolean;
defaultValue: string;
pattern: string;
keyName: string;
keyValue: string;
}

View File

@ -0,0 +1,14 @@
export interface MetaHistoryType {
id?: number;
name?: string;
createDate?: Date;
}
export enum MetaHistoryType_ID {
Member = 1,
Probe = 2,
Discovery = 3,
Target = 4,
Crawler = 5,
Sensor = 6,
}

View File

@ -0,0 +1,16 @@
export interface MetaInfraType {
id?: number;
name?: string;
createDate?: Date;
}
export enum MetaInfraType_ID {
MACHINE = 1,
HOST = 2,
OS = 3,
OS_APPLICATION = 4,
OS_DAEMON = 5,
OS_PORT = 6,
OS_SERVICE = 7,
}

View File

@ -0,0 +1,65 @@
import { MetaInfraType } from './MetaInfraType';
export interface MetaInfraVendor {
id?: number;
name: string;
createDate: Date;
infraType: MetaInfraType;
}
export enum MetaInfraVendor_Machine_ID {
APPLE = 1,
MICROSOFT = 2,
ASUS = 3,
HP = 4,
DELL = 5,
LENOVO = 6,
ACER = 7,
SAMSUNG = 8,
LG = 9,
CISCO = 10,
}
export enum MetaInfraVendor_HOST_ID {
Windows = 11,
Linux = 12,
MacOS = 13,
Ubuntu = 14,
CentOS = 15,
Fedora = 16,
RedHat = 17,
Debian = 18,
SUSE = 19,
CoreOS = 20,
AmazonLinux = 21,
Kubernetes = 22,
Docker = 23,
iOS = 24,
Android = 25,
}
export enum MetaInfraVendor_OS_ID {
Windows = 26,
MacOS = 27,
Ubuntu = 28,
CentOS = 29,
Fedora = 30,
RedHat = 31,
Debian = 32,
SUSE = 33,
CoreOS = 34,
AmazonLinux = 35,
Kubernetes = 36,
Docker = 37,
iOS = 38,
Android = 39,
}
export enum MetaInfraVendor_SERVICE_ID {
MySql = 40,
PostgreSQL = 41,
WMI = 42,
SNMP_V2 = 43,
UNKNOWN = 44,
}

View File

@ -0,0 +1,15 @@
export interface MetaInputType {
id?: number;
name: string;
description: string;
createDate: Date;
}
export enum MetaInputType_ID {
TEXT_TYPE = 1,
PASSWORD_TYPE = 2,
NUMBER_TYPE = 3,
BOOLEAN_TYPE = 4,
SELECT_TYPE = 5,
}

View File

@ -0,0 +1,12 @@
export interface MetaMemberStatus {
id: number;
name: string;
}
export enum MetaMemberStatus_ID {
NOAUTH = 1,
NORMAL = 2,
DIAPAUSE = 3,
WITHDRAWAL = 4,
}

View File

@ -0,0 +1,11 @@
export interface MetaNoAuthProbeStatus {
id?: number;
name: string;
}
export enum MetaNoAuthProbeStatus_ID {
ACCEPT = 1,
DENY = 2,
PROCESS = 3,
}

View File

@ -0,0 +1,7 @@
export interface MetaNotification {
id?: number;
createDate: Date;
name: string;
description: string;
}

View File

@ -0,0 +1,11 @@
export interface MetaProbeArchitecture {
id?: number;
architecture: string;
createDate: Date;
}
export enum MetaProbeArchitecture_ID {
x86_64bit = 1,
}

View File

@ -0,0 +1,13 @@
export interface MetaProbeOs {
id?: number;
name: string;
createDate: Date;
}
export enum MetaProbeOs_ID {
Windows = 1,
Debian = 2,
Ubuntu = 3,
Fedora = 4,
}

View File

@ -0,0 +1,11 @@
import { MetaProbeVersion } from './MetaProbeVersion';
import { MetaProbeOs } from './MetaProbeOs';
import { MetaProbeArchitecture } from './MetaProbeArchitecture';
export interface MetaProbePackage {
id?: number;
version: MetaProbeVersion;
os: MetaProbeOs;
architecture: MetaProbeArchitecture;
createDate: Date;
}

View File

@ -0,0 +1,10 @@
export interface MetaProbeStatus {
id: number;
name: string;
}
export enum MetaProbeStatus_ID {
INITIAL = 1,
NORMAL = 2,
}

View File

@ -0,0 +1,7 @@
export interface MetaProbeTaskType {
id?: number;
name: string;
description: string;
createDate: Date;
}

View File

@ -0,0 +1,5 @@
export interface MetaProbeVersion {
id?: number;
version: string;
createDate: Date;
}

View File

@ -0,0 +1,15 @@
import { MetaCrawler } from './MetaCrawler';
import { MetaSensorItemUnit } from './MetaSensorItemUnit';
import { MetaSensorItemType } from './MetaSensorItemType';
export interface MetaSensorDisplayItem {
id?: number;
key?: string;
displayName?: string;
description?: string;
crawler?: MetaCrawler;
unit?: MetaSensorItemUnit;
createDate?: Date;
default?: boolean;
itemType?: MetaSensorItemType;
}

View File

@ -0,0 +1,11 @@
import { MetaProbeArchitecture } from './MetaProbeArchitecture';
import { MetaSensorItemType } from './MetaSensorItemType';
export interface MetaSensorItem {
id?: number;
itemType?: MetaSensorItemType;
key?: string;
name?: string;
createDate?: Date;
}

View File

@ -0,0 +1,12 @@
import { MetaSensorItem } from './MetaSensorItem';
import { MetaCrawler } from './MetaCrawler';
export interface MetaSensorItemKey {
id: number;
item: MetaSensorItem;
key: string;
froms: string;
option: string;
crawler: MetaCrawler;
createDate: Date;
}

View File

@ -0,0 +1,6 @@
export interface MetaSensorItemType {
id?: number;
name: string;
description: string;
createDate: Date;
}

View File

@ -0,0 +1,6 @@
export interface MetaSensorItemUnit {
id: number;
unit: string;
createDate: Date;
mark: string;
}

View File

@ -0,0 +1,10 @@
export interface MetaSensorStatus {
id?: number;
name?: string;
}
export enum MetaSensorStatus_ID {
RUNNING = 1,
STOPPED = 2,
}

View File

@ -0,0 +1,10 @@
import { MetaInfraVendor } from './MetaInfraVendor';
import { MetaCrawler } from './MetaCrawler';
export interface MetaVendorCrawler {
id?: number;
crawler: MetaCrawler;
infraVendor: MetaInfraVendor;
createDate: Date;
}

View File

@ -0,0 +1,13 @@
import { MetaInfraVendor } from './MetaInfraVendor';
import { MetaSensorItem } from './MetaSensorItem';
export interface MetaVendorCrawlerSensorItem {
id?: number;
interval: string;
warnCondition: string;
createDate: Date;
sensorItem: MetaSensorItem;
vendor: MetaInfraVendor;
crawlerId: number;
}

View File

@ -0,0 +1,23 @@
export * from './MetaCrawlerInputItem';
export * from './MetaCrawler';
export * from './MetaHistoryType';
export * from './MetaInfraType';
export * from './MetaInfraVendor';
export * from './MetaInputType';
export * from './MetaMemberStatus';
export * from './MetaNoAuthProbeStatus';
export * from './MetaNotification';
export * from './MetaProbeArchitecture';
export * from './MetaProbeOs';
export * from './MetaProbePackage';
export * from './MetaProbeStatus';
export * from './MetaProbeTaskType';
export * from './MetaProbeVersion';
export * from './MetaSensorDisplayItem';
export * from './MetaSensorItemKey';
export * from './MetaSensorItem';
export * from './MetaSensorItemType';
export * from './MetaSensorItemUnit';
export * from './MetaSensorStatus';
export * from './MetaVendorCrawlerSensorItem';
export * from './MetaVendorCrawler';

View File

@ -1,4 +1,10 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { Store } from '@ngrx/store';
import * as NoAuthProbeStore from '../../store/noauth-probe';
@Component({ @Component({
selector: 'of-noauth-list', selector: 'of-noauth-list',
@ -7,7 +13,12 @@ import { Component, OnInit } from '@angular/core';
}) })
export class ListComponent implements OnInit { export class ListComponent implements OnInit {
constructor() { } constructor(
private router: Router,
private store: Store<NoAuthProbeStore.State>,
private formBuilder: FormBuilder,
) { }
ngOnInit() { ngOnInit() {
} }

View File

@ -0,0 +1,24 @@
import { Probe } from 'packages/probe/model';
import { MetaNoAuthProbeStatus } from 'packages/meta/model';
import { Domain } from 'packages/domain/model';
export interface NoAuthProbe {
// id?: number;
// hostName?: string;
// macAddress?: number;
// ipAddress?: number;
// status?: MetaNoAuthProbeStatus;
// tempProbeKey?: string;
// createDate?: Date;
// apiKey?: string;
// domain?: Domain;
// probe?: Probe;
id?: number;
description?: string;
status?: MetaNoAuthProbeStatus;
tempProbeKey?: string;
createDate?: Date;
apiKey?: string;
domain?: Domain;
probe?: Probe;
}

View File

@ -0,0 +1 @@
export * from './NoAuthProbe';

View File

@ -2,6 +2,7 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { COMPONENTS } from './component'; import { COMPONENTS } from './component';
import { SERVICES } from './service';
@NgModule({ @NgModule({
imports: [ imports: [
@ -13,5 +14,8 @@ import { COMPONENTS } from './component';
exports: [ exports: [
COMPONENTS, COMPONENTS,
], ],
providers: [
SERVICES,
]
}) })
export class NoauthModule { } export class NoauthModule { }

View File

@ -0,0 +1,5 @@
import { NoAuthProbeService } from './noauth-probe.service';
export const SERVICES = [
NoAuthProbeService,
];

View File

@ -0,0 +1,15 @@
import { TestBed, inject } from '@angular/core/testing';
import { NoAuthProbeService } from './noauth-probe.service';
describe('NoAuthProbeService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [NoAuthProbeService]
});
});
it('should be created', inject([NoAuthProbeService], (service: NoAuthProbeService) => {
expect(service).toBeTruthy();
}));
});

View File

@ -0,0 +1,33 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/map';
import { RPCService } from 'packages/commons/service/rpc.service';
import { Domain } from 'packages/domain/model';
import { NoAuthProbe } from '../model';
@Injectable()
export class NoAuthProbeService {
public constructor(
private rpcService: RPCService,
) {
}
public readAllByDomain(domain: Domain): Observable<NoAuthProbe[]> {
return this.rpcService.call<NoAuthProbe[]>('NoAuthProbeService.readAllByDomain', domain);
}
public acceptNoAuthProbe(noAuthProbe: NoAuthProbe): Observable<NoAuthProbe[]> {
return this.rpcService.call<NoAuthProbe[]>('NoAuthProbeService.acceptNoAuthProbe', noAuthProbe);
}
public denyNoauthProbe(noAuthProbe: NoAuthProbe): Observable<NoAuthProbe[]> {
return this.rpcService.call<NoAuthProbe[]>('NoAuthProbeService.denyNoauthProbe', noAuthProbe);
}
}

View File

@ -0,0 +1,4 @@
export * from './noauth-probe.action';
export * from './noauth-probe.effect';
export * from './noauth-probe.reducer';
export * from './noauth-probe.state';

View File

@ -0,0 +1,88 @@
import { Action } from '@ngrx/store';
import { ErrorResponse } from 'packages/commons/service/error-response';
import { Domain } from 'packages/domain/model';
import { NoAuthProbe } from '../../model';
export enum ActionType {
ReadAllByDomain = '[noauth-proboe.noauth-proboe] ReadAllByDomain',
ReadAllByDomainSuccess = '[noauth-proboe.noauth-proboe] ReadAllByDomainSuccess',
ReadAllByDomainFailure = '[noauth-proboe.noauth-proboe] ReadAllByDomainFailure',
Accept = '[noauth-proboe.noauth-proboe] Accept',
AcceptSuccess = '[noauth-proboe.noauth-proboe] AcceptSuccess',
AcceptFailure = '[noauth-proboe.noauth-proboe] AcceptFailure',
Deny = '[noauth-proboe.noauth-proboe] Deny',
DenySuccess = '[noauth-proboe.noauth-proboe] DenySuccess',
DenyFailure = '[noauth-proboe.noauth-proboe] DenyFailure',
}
export class ReadAllByDomain implements Action {
readonly type = ActionType.ReadAllByDomain;
constructor(public payload: Domain) {}
}
export class ReadAllByDomainSuccess implements Action {
readonly type = ActionType.ReadAllByDomainSuccess;
constructor(public payload: NoAuthProbe[]) {}
}
export class ReadAllByDomainFailure implements Action {
readonly type = ActionType.ReadAllByDomainFailure;
constructor(public payload: ErrorResponse) {}
}
export class Accept implements Action {
readonly type = ActionType.Accept;
constructor(public payload: NoAuthProbe) {}
}
export class AcceptSuccess implements Action {
readonly type = ActionType.AcceptSuccess;
constructor(public payload: NoAuthProbe[]) {}
}
export class AcceptFailure implements Action {
readonly type = ActionType.AcceptFailure;
constructor(public payload: ErrorResponse) {}
}
export class Deny implements Action {
readonly type = ActionType.Deny;
constructor(public payload: NoAuthProbe) {}
}
export class DenySuccess implements Action {
readonly type = ActionType.DenySuccess;
constructor(public payload: NoAuthProbe[]) {}
}
export class DenyFailure implements Action {
readonly type = ActionType.DenyFailure;
constructor(public payload: ErrorResponse) {}
}
export type Actions =
| ReadAllByDomain
| ReadAllByDomainSuccess
| ReadAllByDomainFailure
| Accept
| AcceptSuccess
| AcceptFailure
| Deny
| DenySuccess
| DenyFailure
;

View File

@ -0,0 +1,15 @@
import { TestBed, inject } from '@angular/core/testing';
import { Effects } from './noauth-probe.effect';
describe('NoAuth-Probe.Effects', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [Effects]
});
});
it('should be created', inject([Effects], (effects: Effects) => {
expect(effects).toBeTruthy();
}));
});

View File

@ -0,0 +1,82 @@
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { Effect, Actions, ofType } from '@ngrx/effects';
import { Action } from '@ngrx/store';
import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/exhaustMap';
import 'rxjs/add/operator/switchMap';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/take';
import { ErrorResponse } from 'packages/commons/service/error-response';
import { Domain } from 'packages/domain/model';
import { NoAuthProbe } from '../../model';
import { NoAuthProbeService } from '../../service/noauth-probe.service';
import {
ReadAllByDomain,
ReadAllByDomainFailure,
ReadAllByDomainSuccess,
Accept,
AcceptSuccess,
AcceptFailure,
Deny,
DenySuccess,
DenyFailure,
ActionType,
} from './noauth-probe.action';
@Injectable()
export class Effects {
constructor(
private actions$: Actions,
private noAuthProbeService: NoAuthProbeService,
private router: Router
) { }
@Effect()
readAllByDomain$: Observable<Action> = this.actions$
.ofType(ActionType.ReadAllByDomain)
.map((action: ReadAllByDomain) => action.payload)
.switchMap(payload => this.noAuthProbeService.readAllByDomain(payload))
.map(noAuthProbes => {
return new ReadAllByDomainSuccess(noAuthProbes);
})
.catch((error: ErrorResponse) => {
return of(new ReadAllByDomainFailure(error));
});
@Effect()
accept$: Observable<Action> = this.actions$
.ofType(ActionType.Accept)
.map((action: Accept) => action.payload)
.switchMap(payload => this.noAuthProbeService.acceptNoAuthProbe(payload))
.map(noAuthProbes => {
return new AcceptSuccess(noAuthProbes);
})
.catch((error: ErrorResponse) => {
return of(new AcceptFailure(error));
});
@Effect()
deny$: Observable<Action> = this.actions$
.ofType(ActionType.Deny)
.map((action: Deny) => action.payload)
.switchMap(payload => this.noAuthProbeService.denyNoauthProbe(payload))
.map(noAuthProbes => {
return new DenySuccess(noAuthProbes);
})
.catch((error: ErrorResponse) => {
return of(new DenyFailure(error));
});
}

View File

@ -0,0 +1,106 @@
import { ErrorResponse } from 'packages/commons/service/error-response';
import {
ReadAllByDomain,
ReadAllByDomainFailure,
ReadAllByDomainSuccess,
Accept,
AcceptSuccess,
AcceptFailure,
Deny,
DenySuccess,
DenyFailure,
ActionType,
Actions,
} from './noauth-probe.action';
import {
State,
initialState,
} from './noauth-probe.state';
import { NoAuthProbe } from '../../model';
export function reducer(state = initialState, action: Actions): State {
switch (action.type) {
case ActionType.ReadAllByDomain: {
return {
...state,
error: null,
isPending: true,
};
}
case ActionType.ReadAllByDomainSuccess: {
return {
...state,
error: null,
isPending: false,
noAuthProbes: action.payload,
};
}
case ActionType.ReadAllByDomainFailure: {
return {
...state,
error: action.payload,
isPending: false,
noAuthProbes: null,
};
}
case ActionType.Accept: {
return {
...state,
error: null,
isPending: true,
};
}
case ActionType.AcceptSuccess: {
return {
...state,
error: null,
isPending: false,
noAuthProbes: action.payload,
};
}
case ActionType.AcceptFailure: {
return {
...state,
error: action.payload,
isPending: false,
};
}
case ActionType.Deny: {
return {
...state,
error: null,
isPending: true,
};
}
case ActionType.DenySuccess: {
return {
...state,
error: null,
isPending: false,
noAuthProbes: action.payload,
};
}
case ActionType.DenyFailure: {
return {
...state,
error: action.payload,
isPending: false,
};
}
default: {
return state;
}
}
}

View File

@ -0,0 +1,19 @@
import { ErrorResponse } from 'packages/commons/service/error-response';
import { NoAuthProbe } from '../../model';
export interface State {
error: ErrorResponse | null;
isPending: boolean;
noAuthProbes: NoAuthProbe[] | null;
}
export const initialState: State = {
error: null,
isPending: false,
noAuthProbes: null,
};
export const getNoAuthProbes = (state: State) => state.noAuthProbes;
export const getError = (state: State) => state.error;
export const isPending = (state: State) => state.isPending;

View File

@ -0,0 +1,21 @@
import { MetaProbeStatus } from 'packages/meta/model';
import { Domain } from 'packages/domain/model';
import { Member } from 'packages/member/model';
import { Target } from 'packages/target/model';
import { InfraHost } from 'packages/infra/model';
export interface Probe {
id?: number;
status?: MetaProbeStatus; // INITIAL / NORMAL
description?: string;
createDate?: Date;
domain?: Domain;
probeKey?: string;
encryptionKey?: string;
displayName?: string;
cidr?: string;
authorizeDate?: Date;
authorizeMember?: Member;
host?: InfraHost;
targets?: Target[];
}

View File

@ -0,0 +1,9 @@
import { Probe } from './Probe';
import { InfraHost } from 'packages/infra/model';
export interface ProbeHost {
id?: number;
probe?: Probe;
host?: InfraHost;
}

View File

@ -0,0 +1,14 @@
import { Probe } from './Probe';
import { MetaProbeTaskType } from 'packages/meta/model';
export interface ProbeTask {
id?: number;
taskType: MetaProbeTaskType;
probe: Probe;
data: string;
createDate: Date;
sendDate: Date;
startDate: Date;
endDate: Date;
succeed: boolean;
}

View File

@ -0,0 +1,3 @@
export * from './Probe';
export * from './ProbeHost';
export * from './ProbeTask';

View File

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

View File

@ -0,0 +1,15 @@
import { TestBed, inject } from '@angular/core/testing';
import { ProbeService } from './probe.service';
describe('ProbeService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [ProbeService]
});
});
it('should be created', inject([ProbeService], (service: ProbeService) => {
expect(service).toBeTruthy();
}));
});

View File

@ -0,0 +1,18 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/map';
import { RPCService } from 'packages/commons/service/rpc.service';
@Injectable()
export class ProbeService {
public constructor(
private rpcService: RPCService,
) {
}
}

View File

@ -0,0 +1,13 @@
import { Target } from 'packages/target/model';
import { MetaCrawler, MetaSensorStatus } from 'packages/meta/model';
export interface Sensor {
id?: number;
createDate?: Date;
description?: string;
status?: MetaSensorStatus;
target?: Target;
crawler?: MetaCrawler;
crawlerInputItems?: string;
itemCount?: number;
}

View File

@ -0,0 +1,9 @@
import { Sensor } from './Sensor';
import { MetaSensorDisplayItem } from 'packages/meta/model';
export interface SensorItem {
id?: number;
sensor?: Sensor;
item?: MetaSensorDisplayItem;
createDate?: Date;
}

View File

@ -0,0 +1,13 @@
import { MetaCrawler, MetaSensorDisplayItem } from 'packages/meta/model';
import { Infra } from 'packages/infra/model';
export interface SensorRegistInfo {
sensorItemMap: Map<number, Array<MetaSensorDisplayItem>>;
crawler: MetaCrawler;
// targetId: number;
interval: number;
// type: string;
infra: Infra;
crawlerAuth: string;
}

View File

@ -0,0 +1,3 @@
export * from './Sensor';
export * from './SensorItem';
export * from './SensorRegistInfo';

View File

@ -0,0 +1,11 @@
import { Probe } from 'packages/probe/model';
import { Infra } from 'packages/infra/model';
import { Sensor } from 'packages/sensor/model';
export interface Target {
id?: number;
createDate?: Date;
displayName?: string;
description?: string;
sensors?: Sensor[];
}

View File

@ -0,0 +1 @@
export * from './Target';