meta arranging
This commit is contained in:
parent
2d0ff36638
commit
d8536ef011
|
@ -66,7 +66,9 @@ export class MapComponent implements OnInit, AfterContentInit {
|
||||||
|
|
||||||
const dialogRef = this.dialog.open(SettingComponent, {
|
const dialogRef = this.dialog.open(SettingComponent, {
|
||||||
width: '80%',
|
width: '80%',
|
||||||
data: { }
|
data: {
|
||||||
|
'infra': infra
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { StoreModule } from '@ngrx/store';
|
||||||
|
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
|
||||||
|
import {
|
||||||
|
StoreRouterConnectingModule,
|
||||||
|
RouterStateSerializer,
|
||||||
|
} from '@ngrx/router-store';
|
||||||
|
import { EffectsModule } from '@ngrx/effects';
|
||||||
|
import { combineReducers, ActionReducer, ActionReducerMap, MetaReducer } from '@ngrx/store';
|
||||||
|
|
||||||
|
import {
|
||||||
|
REDUCERS,
|
||||||
|
EFFECTS,
|
||||||
|
} from './store';
|
||||||
|
|
||||||
|
import { MODULE } from './meta.constant';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
StoreModule.forFeature(MODULE.name, REDUCERS),
|
||||||
|
EffectsModule.forFeature(EFFECTS),
|
||||||
|
],
|
||||||
|
})
|
||||||
|
export class MetaStoreModule { }
|
|
@ -0,0 +1,22 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
|
||||||
|
import { MaterialModule } from 'packages/commons/material/material.module';
|
||||||
|
|
||||||
|
import { SERVICES } from './service';
|
||||||
|
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
MaterialModule,
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
SERVICES,
|
||||||
|
],
|
||||||
|
})
|
||||||
|
export class MetaModule { }
|
|
@ -1,15 +0,0 @@
|
||||||
import { TestBed, inject } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { CrawlerService } from './crawler.service';
|
|
||||||
|
|
||||||
describe('MemberService', () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
providers: [CrawlerService]
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be created', inject([CrawlerService], (service: CrawlerService) => {
|
|
||||||
expect(service).toBeTruthy();
|
|
||||||
}));
|
|
||||||
});
|
|
|
@ -16,16 +16,7 @@ export class CrawlerService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public signin(email: string, password: string): Observable<MetaCrawler> {
|
|
||||||
const body = {
|
|
||||||
signinId: email,
|
|
||||||
signinPw: password,
|
|
||||||
};
|
|
||||||
|
|
||||||
return this.rpcClient.call<MetaCrawler>('CrawlerService.', body);
|
|
||||||
}
|
|
||||||
|
|
||||||
public readAll(): Observable<MetaCrawler[]> {
|
public readAll(): Observable<MetaCrawler[]> {
|
||||||
return this.rpcClient.call<MetaCrawler[]>('CrawlerService.');
|
return this.rpcClient.call<MetaCrawler[]>('CrawlerService.readAll');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
export * from './readall.action';
|
|
||||||
export * from './readall.effect';
|
|
||||||
export * from './readall.reducer';
|
|
||||||
export * from './readall.state';
|
|
4
src/packages/meta/store/crawler/list/index.ts
Normal file
4
src/packages/meta/store/crawler/list/index.ts
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
export * from './list.action';
|
||||||
|
export * from './list.effect';
|
||||||
|
export * from './list.reducer';
|
||||||
|
export * from './list.state';
|
|
@ -3,7 +3,7 @@ import { Action } from '@ngrx/store';
|
||||||
import { RPCError } from 'packages/core/rpc/error';
|
import { RPCError } from 'packages/core/rpc/error';
|
||||||
|
|
||||||
|
|
||||||
import { MetaCrawler } from '../../model';
|
import { MetaCrawler } from '../../../model';
|
||||||
|
|
||||||
export enum ActionType {
|
export enum ActionType {
|
||||||
ReadAll = '[meta.crawler-readall] ReadAll',
|
ReadAll = '[meta.crawler-readall] ReadAll',
|
|
@ -1,8 +1,8 @@
|
||||||
import { TestBed, inject } from '@angular/core/testing';
|
import { TestBed, inject } from '@angular/core/testing';
|
||||||
|
|
||||||
import { Effects } from './readall.effect';
|
import { Effects } from './list.effect';
|
||||||
|
|
||||||
describe('Auth.Effects', () => {
|
describe('List.Effects', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
providers: [Effects]
|
providers: [Effects]
|
|
@ -18,15 +18,15 @@ import { RPCError } from 'packages/core/rpc/error';
|
||||||
|
|
||||||
import { DomainMember } from 'packages/domain/model';
|
import { DomainMember } from 'packages/domain/model';
|
||||||
|
|
||||||
import { MetaCrawler } from '../../model';
|
import { MetaCrawler } from '../../../model';
|
||||||
import { CrawlerService } from '../../service/crawler.service';
|
import { CrawlerService } from '../../../service/crawler.service';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ReadAll,
|
ReadAll,
|
||||||
ReadAllSuccess,
|
ReadAllSuccess,
|
||||||
ReadAllFailure,
|
ReadAllFailure,
|
||||||
ActionType,
|
ActionType,
|
||||||
} from './readall.action';
|
} from './list.action';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class Effects {
|
export class Effects {
|
||||||
|
@ -38,20 +38,15 @@ export class Effects {
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
@Effect()
|
@Effect()
|
||||||
signin$: Observable<Action> = this.actions$
|
readAll$: Observable<Action> = this.actions$
|
||||||
.ofType(ActionType.ReadAll)
|
.ofType(ActionType.ReadAll)
|
||||||
.map((action: ReadAll) => action.payload)
|
.map((action: ReadAll) => action.payload)
|
||||||
.switchMap(payload => this.crawlerService.readAll())
|
.switchMap(payload => this.crawlerService.readAll())
|
||||||
.map((metaCrawlerList: MetaCrawler[]) => {
|
.map(list => {
|
||||||
return new ReadAllSuccess(metaCrawlerList);
|
return new ReadAllSuccess(list);
|
||||||
})
|
})
|
||||||
.catch((error: RPCError) => {
|
.catch((error: RPCError) => {
|
||||||
return of(new ReadAllFailure(error));
|
return of(new ReadAllFailure(error));
|
||||||
});
|
});
|
||||||
|
|
||||||
@Effect({ dispatch: false })
|
|
||||||
signinSuccess$ = this.actions$
|
|
||||||
.ofType(ActionType.ReadAllSuccess)
|
|
||||||
.do(() => this.router.navigate(['/']));
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,14 +1,14 @@
|
||||||
import {
|
import {
|
||||||
Actions,
|
Actions,
|
||||||
ActionType,
|
ActionType,
|
||||||
} from './readall.action';
|
} from './list.action';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
State,
|
State,
|
||||||
initialState,
|
initialState,
|
||||||
} from './readall.state';
|
} from './list.state';
|
||||||
|
|
||||||
import { MetaCrawler } from '../../model';
|
import { MetaCrawler } from '../../../model';
|
||||||
|
|
||||||
export function reducer(state = initialState, action: Actions): State {
|
export function reducer(state = initialState, action: Actions): State {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
|
@ -1,6 +1,6 @@
|
||||||
import { RPCError } from 'packages/core/rpc/error';
|
import { RPCError } from 'packages/core/rpc/error';
|
||||||
|
import { MetaCrawler } from '../../../model';
|
||||||
|
|
||||||
import { MetaCrawler } from '../../model';
|
|
||||||
|
|
||||||
export interface State {
|
export interface State {
|
||||||
error: RPCError | null;
|
error: RPCError | null;
|
|
@ -8,24 +8,24 @@ import {
|
||||||
|
|
||||||
import { MODULE } from '../meta.constant';
|
import { MODULE } from '../meta.constant';
|
||||||
|
|
||||||
import * as CrawlerReadAllStore from './crawler-readall';
|
import * as ListStore from './crawler/list';
|
||||||
|
|
||||||
export interface State {
|
export interface State {
|
||||||
readAll: CrawlerReadAllStore.State;
|
list: ListStore.State;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const REDUCERS = {
|
export const REDUCERS = {
|
||||||
readAll: CrawlerReadAllStore.reducer,
|
list: ListStore.reducer,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const EFFECTS = [
|
export const EFFECTS = [
|
||||||
CrawlerReadAllStore.Effects,
|
ListStore.Effects,
|
||||||
];
|
];
|
||||||
|
|
||||||
export const selectCrawlerReadAllState = createFeatureSelector<State>(MODULE.name);
|
export const selectCrawlerListState = createFeatureSelector<State>(MODULE.name);
|
||||||
|
|
||||||
export const CrawlerReadAllSelector = new StateSelector<CrawlerReadAllStore.State>(createSelector(
|
export const CrawlerListSelector = new StateSelector<ListStore.State>(createSelector(
|
||||||
selectCrawlerReadAllState,
|
selectCrawlerListState,
|
||||||
(state: State) => state.readAll
|
(state: State) => state.list
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,6 @@ export class Effects {
|
||||||
return new MarkAllAsReadSuccess(page);
|
return new MarkAllAsReadSuccess(page);
|
||||||
})
|
})
|
||||||
.catch((error: RPCError) => {
|
.catch((error: RPCError) => {
|
||||||
console.log('errrrrrrrrrrrrrr : ' + error.response.message);
|
|
||||||
return of(new MarkAllAsReadFailure(error));
|
return of(new MarkAllAsReadFailure(error));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Component, OnInit, Input, OnChanges } from '@angular/core';
|
import { Component, OnInit, Input, OnChanges, AfterContentInit } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { Target } from 'packages/target/model';
|
import { Target } from 'packages/target/model';
|
||||||
import { MetaCrawler } from '../../../../meta/model';
|
import { MetaCrawler } from '../../../../meta/model';
|
||||||
|
@ -9,7 +9,7 @@ import { MetaCrawler } from '../../../../meta/model';
|
||||||
templateUrl: './crawler-selector.component.html',
|
templateUrl: './crawler-selector.component.html',
|
||||||
styleUrls: ['./crawler-selector.component.scss']
|
styleUrls: ['./crawler-selector.component.scss']
|
||||||
})
|
})
|
||||||
export class CrawlerSelectorComponent implements OnInit, OnChanges {
|
export class CrawlerSelectorComponent implements OnInit, OnChanges, AfterContentInit {
|
||||||
|
|
||||||
@Input() selectedTarget: Target;
|
@Input() selectedTarget: Target;
|
||||||
crawlers: MetaCrawler[];
|
crawlers: MetaCrawler[];
|
||||||
|
@ -20,6 +20,10 @@ export class CrawlerSelectorComponent implements OnInit, OnChanges {
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngAfterContentInit() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
ngOnChanges() {
|
ngOnChanges() {
|
||||||
if (this.selectedTarget) {
|
if (this.selectedTarget) {
|
||||||
console.log('Getting valid crawlers for ' + this.selectedTarget.displayName);
|
console.log('Getting valid crawlers for ' + this.selectedTarget.displayName);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<mat-grid-list cols="2" rowHeight="5:1">
|
<mat-grid-list cols="2" rowHeight="5:1">
|
||||||
|
|
||||||
<mat-grid-tile [colspan]="1" [rowspan]="3" style="background-color: lightblue">
|
<mat-grid-tile [colspan]="1" [rowspan]="3" style="background-color: lightblue">
|
||||||
<of-target-selector (targetSelectEvent)="handleTargetSelection($event)"></of-target-selector>
|
<of-target-selector [target]="selectedTarget" (targetSelectEvent)="handleTargetSelection($event)" [target]="target"></of-target-selector>
|
||||||
</mat-grid-tile>
|
</mat-grid-tile>
|
||||||
|
|
||||||
<mat-grid-tile [colspan]="1" [rowspan]="2" style="background-color: lightcoral">
|
<mat-grid-tile [colspan]="1" [rowspan]="2" style="background-color: lightcoral">
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit, Input, Inject } from '@angular/core';
|
||||||
import { AfterContentInit } from '@angular/core/src/metadata/lifecycle_hooks';
|
import { AfterContentInit } from '@angular/core/src/metadata/lifecycle_hooks';
|
||||||
import { Target } from '../../../target/model';
|
import { Target } from '../../../target/model';
|
||||||
|
import { MAT_DIALOG_DATA } from '@angular/material';
|
||||||
|
import { Infra } from '../../../infra/model';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -13,7 +15,13 @@ export class SettingComponent implements OnInit, AfterContentInit {
|
||||||
selectedTarget: Target = null;
|
selectedTarget: Target = null;
|
||||||
step = 1;
|
step = 1;
|
||||||
|
|
||||||
constructor() { }
|
constructor(
|
||||||
|
@Inject(MAT_DIALOG_DATA) public data: any
|
||||||
|
) {
|
||||||
|
if (data !== null) {
|
||||||
|
this.selectedTarget = data.infra.target;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
<perfect-scrollbar style="height: 150px">
|
<perfect-scrollbar style="height: 150px">
|
||||||
|
|
||||||
<mat-radio-group class="radio-group" >
|
<mat-radio-group class="radio-group" >
|
||||||
<mat-radio-button class="radio-button" *ngFor="let target of targets" value={{target.id}} (change)="targetSelected(target)">
|
<mat-radio-button class="radio-button" *ngFor="let t of targets" value={{t.id}} (change)="targetSelected(t)" [checked]="t.id === target.id">
|
||||||
{{target.displayName}}
|
{{t.displayName}}
|
||||||
</mat-radio-button>
|
</mat-radio-button>
|
||||||
</mat-radio-group>
|
</mat-radio-group>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Component, OnInit, Output, EventEmitter } from '@angular/core';
|
import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { MatRadioButton } from '@angular/material';
|
import { MatRadioButton } from '@angular/material';
|
||||||
import { Target } from 'packages/target/model';
|
import { Target } from 'packages/target/model';
|
||||||
|
@ -11,6 +11,7 @@ import { Target } from 'packages/target/model';
|
||||||
})
|
})
|
||||||
export class TargetSelectorComponent implements OnInit {
|
export class TargetSelectorComponent implements OnInit {
|
||||||
|
|
||||||
|
@Input() target: Target = null;
|
||||||
@Output() targetSelectEvent = new EventEmitter<Target>();
|
@Output() targetSelectEvent = new EventEmitter<Target>();
|
||||||
targets: Target[] = null;
|
targets: Target[] = null;
|
||||||
|
|
||||||
|
@ -18,16 +19,18 @@ export class TargetSelectorComponent implements OnInit {
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.targets = new Array();
|
this.targets = new Array();
|
||||||
for (let i = 0; i < 10; i++) {
|
this.targets.push(this.target);
|
||||||
const t: Target = {
|
// for (let i = 0; i < 10; i++) {
|
||||||
id: i,
|
// const t: Target = {
|
||||||
displayName: 'Target' + i,
|
// id: i,
|
||||||
};
|
// displayName: 'Target' + i,
|
||||||
this.targets.push(t);
|
// };
|
||||||
}
|
// this.targets.push(t);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
targetSelected(t: Target) {
|
targetSelected(t: Target) {
|
||||||
this.targetSelectEvent.emit(t);
|
this.targetSelectEvent.emit(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user