modify ing
This commit is contained in:
parent
2eb902c1cd
commit
8e5773b590
|
@ -1,6 +1,6 @@
|
||||||
import { Component, OnInit, AfterViewInit, AfterContentInit } from '@angular/core';
|
import { Component, OnInit, AfterViewInit, AfterContentInit } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { MetaSensorDisplayItem } from 'packages/meta/sensor-display-item/model/MetaSensorDisplayItem';
|
import { MetaSensorDisplayItem } from '@overflow/commons-typescript/model/meta';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'of-sensor-item-list',
|
selector: 'of-sensor-item-list',
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { StoreModule } from '@ngrx/store';
|
import { StoreModule } from '@ngrx/store';
|
||||||
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
|
|
||||||
import {
|
|
||||||
StoreRouterConnectingModule,
|
|
||||||
RouterStateSerializer,
|
|
||||||
} from '@ngrx/router-store';
|
|
||||||
import { EffectsModule } from '@ngrx/effects';
|
import { EffectsModule } from '@ngrx/effects';
|
||||||
import { combineReducers, ActionReducer, ActionReducerMap, MetaReducer } from '@ngrx/store';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
REDUCERS,
|
REDUCERS,
|
||||||
|
|
|
@ -2,9 +2,9 @@ import { Injectable } from '@angular/core';
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
import { RPCService } from '@loafer/ng-rpc/service';
|
import { RPCService } from '@loafer/ng-rpc/service';
|
||||||
import { SensorItemDependency } from '../model/SensorItemDependency';
|
import { SensorItemDependency } from '@overflow/commons-typescript/model/sensor-item';
|
||||||
import { MetaSensorItemKey } from 'packages/meta/sensor-item-key/model/MetaSensorItemKey';
|
import { MetaSensorItemKey } from '@overflow/commons-typescript/model/meta';
|
||||||
import { MetaSensorDisplayItem } from '../../meta/sensor-display-item/model/MetaSensorDisplayItem';
|
import { MetaSensorDisplayItem } from '@overflow/commons-typescript/model/meta';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable } from 'rxjs/Observable';
|
|
||||||
|
|
||||||
import { RPCService } from '@loafer/ng-rpc/service';
|
import { RPCService } from '@loafer/ng-rpc/service';
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import {
|
import {
|
||||||
createSelector,
|
createSelector,
|
||||||
createFeatureSelector,
|
createFeatureSelector,
|
||||||
ActionReducerMap,
|
|
||||||
} from '@ngrx/store';
|
} from '@ngrx/store';
|
||||||
|
|
||||||
import { StateSelector } from 'packages/core/ngrx/store';
|
import { StateSelector } from 'packages/core/ngrx/store';
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Action } from '@ngrx/store';
|
import { Action } from '@ngrx/store';
|
||||||
|
|
||||||
import { RPCClientError } from '@loafer/ng-rpc/protocol';
|
import { RPCClientError } from '@loafer/ng-rpc/protocol';
|
||||||
import { MetaSensorItemKey } from 'packages/meta/sensor-item-key/model/MetaSensorItemKey';
|
import { MetaSensorItemKey } from '@overflow/commons-typescript/model/meta';
|
||||||
import { MetaSensorDisplayItem } from 'packages/meta/sensor-display-item/model/MetaSensorDisplayItem';
|
import { MetaSensorDisplayItem } from '@overflow/commons-typescript/model/meta';
|
||||||
|
|
||||||
|
|
||||||
export enum ActionType {
|
export enum ActionType {
|
||||||
|
|
|
@ -16,9 +16,6 @@ import 'rxjs/add/operator/take';
|
||||||
|
|
||||||
import { RPCClientError } from '@loafer/ng-rpc/protocol';
|
import { RPCClientError } from '@loafer/ng-rpc/protocol';
|
||||||
|
|
||||||
import { DomainMember } from 'packages/domain/model';
|
|
||||||
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ReadAllByDisplayItem,
|
ReadAllByDisplayItem,
|
||||||
ReadAllByDisplayItemSuccess,
|
ReadAllByDisplayItemSuccess,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { RPCClientError } from '@loafer/ng-rpc/protocol';
|
import { RPCClientError } from '@loafer/ng-rpc/protocol';
|
||||||
import { MetaSensorItemKey } from 'packages/meta/sensor-item-key/model/MetaSensorItemKey';
|
import { MetaSensorItemKey } from '@overflow/commons-typescript/model/meta';
|
||||||
|
|
||||||
|
|
||||||
export interface State {
|
export interface State {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Component, ViewChild, OnInit, Input, AfterContentInit, OnDestroy } from '@angular/core';
|
import { Component, ViewChild, OnInit, Input, AfterContentInit, OnDestroy } from '@angular/core';
|
||||||
import { Router, ActivatedRoute } from '@angular/router';
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
import { Sensor } from 'packages/sensor/model';
|
import { Sensor } from '@overflow/commons-typescript/model/sensor';
|
||||||
import { Infra } from 'packages/infra/model';
|
import { Infra } from '@overflow/commons-typescript/model/infra';
|
||||||
import { Store, select } from '@ngrx/store';
|
import { Store, select } from '@ngrx/store';
|
||||||
import { DetailSelector as InfraDetailSelector } from 'packages/infra/store';
|
import { DetailSelector as InfraDetailSelector } from 'packages/infra/store';
|
||||||
import * as InfraDetailStore from 'packages/infra/store/detail';
|
import * as InfraDetailStore from 'packages/infra/store/detail';
|
||||||
|
@ -12,7 +12,7 @@ import * as SensorListStore from 'packages/sensor/store/list';
|
||||||
import { PageParams, Page } from 'app/commons/model';
|
import { PageParams, Page } from 'app/commons/model';
|
||||||
import { ModifySelector } from 'packages/target/store';
|
import { ModifySelector } from 'packages/target/store';
|
||||||
import * as TargetModifyStore from 'packages/target/store/modify';
|
import * as TargetModifyStore from 'packages/target/store/modify';
|
||||||
import { Target } from '../../model';
|
import { Target } from '@overflow/commons-typescript/model/target';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
import { Component, OnInit, AfterViewInit, AfterContentInit, Input, OnDestroy } from '@angular/core';
|
import { Component, OnInit, AfterContentInit, OnDestroy } from '@angular/core';
|
||||||
import { Router, ActivatedRoute } from '@angular/router';
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
import { Infra } from 'packages/infra/model';
|
import { Infra } from '@overflow/commons-typescript/model/infra';
|
||||||
import { Store, select } from '@ngrx/store';
|
import { Store, select } from '@ngrx/store';
|
||||||
import { ListSelector } from 'packages/infra/store';
|
import { ListSelector } from 'packages/infra/store';
|
||||||
import * as InfraListStore from 'packages/infra/store/list';
|
import * as InfraListStore from 'packages/infra/store/list';
|
||||||
import { Page, PageParams } from 'app/commons/model';
|
import { Page, PageParams } from 'app/commons/model';
|
||||||
import { RPCClientError } from '@loafer/ng-rpc/protocol';
|
import { RPCClientError } from '@loafer/ng-rpc/protocol';
|
||||||
import { Probe } from 'packages/probe/model';
|
import { Probe } from '@overflow/commons-typescript/model/probe';
|
||||||
|
|
||||||
import * as ProbeDetailStore from 'packages/probe/store/detail';
|
import { Target } from '@overflow/commons-typescript/model/target';
|
||||||
import { DetailSelector as ProbeDetailSelector } from 'packages/probe/store';
|
|
||||||
import { Target } from '../../model';
|
|
||||||
import { Subscription } from 'rxjs/Subscription';
|
import { Subscription } from 'rxjs/Subscription';
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import 'rxjs/add/operator/map';
|
||||||
|
|
||||||
import { RPCService } from '@loafer/ng-rpc/service';
|
import { RPCService } from '@loafer/ng-rpc/service';
|
||||||
|
|
||||||
import { Target } from '../model';
|
import { Target } from '@overflow/commons-typescript/model/target';
|
||||||
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import { Action } from '@ngrx/store';
|
import { Action } from '@ngrx/store';
|
||||||
|
|
||||||
import { RPCClientError } from '@loafer/ng-rpc/protocol';
|
import { RPCClientError } from '@loafer/ng-rpc/protocol';
|
||||||
|
import { Target } from '@overflow/commons-typescript/model/target';
|
||||||
import { Target } from '../../model';
|
|
||||||
|
|
||||||
export enum ActionType {
|
export enum ActionType {
|
||||||
Modify = '[Target.modify] Modify',
|
Modify = '[Target.modify] Modify',
|
||||||
|
|
|
@ -13,7 +13,6 @@ import 'rxjs/add/operator/exhaustMap';
|
||||||
import 'rxjs/add/operator/map';
|
import 'rxjs/add/operator/map';
|
||||||
import 'rxjs/add/operator/take';
|
import 'rxjs/add/operator/take';
|
||||||
|
|
||||||
import { Target } from '../../model';
|
|
||||||
import { TargetService } from '../../service/target.service';
|
import { TargetService } from '../../service/target.service';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -1,45 +1,43 @@
|
||||||
import {
|
import {
|
||||||
Actions,
|
Actions,
|
||||||
ActionType,
|
ActionType,
|
||||||
} from './modify.action';
|
} from './modify.action';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
State,
|
State,
|
||||||
initialState,
|
initialState,
|
||||||
} from './modify.state';
|
} from './modify.state';
|
||||||
|
|
||||||
import { Target } from '../../model';
|
export function reducer(state = initialState, action: Actions): State {
|
||||||
|
switch (action.type) {
|
||||||
|
case ActionType.Modify: {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
error: null,
|
||||||
|
pending: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export function reducer(state = initialState, action: Actions): State {
|
case ActionType.ModifySuccess: {
|
||||||
switch (action.type) {
|
return {
|
||||||
case ActionType.Modify: {
|
...state,
|
||||||
return {
|
error: null,
|
||||||
...state,
|
pending: false,
|
||||||
error: null,
|
target: action.payload
|
||||||
pending: true,
|
};
|
||||||
};
|
}
|
||||||
}
|
|
||||||
|
|
||||||
case ActionType.ModifySuccess: {
|
case ActionType.ModifyFailure: {
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
error: null,
|
error: action.payload,
|
||||||
pending: false,
|
pending: false,
|
||||||
target: action.payload
|
target: null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
case ActionType.ModifyFailure: {
|
default: {
|
||||||
return {
|
return state;
|
||||||
...state,
|
|
||||||
error: action.payload,
|
|
||||||
pending: false,
|
|
||||||
target: null,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
default: {
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { RPCClientError } from '@loafer/ng-rpc/protocol';
|
import { RPCClientError } from '@loafer/ng-rpc/protocol';
|
||||||
import { Target } from '../../model';
|
import { Target } from '@overflow/commons-typescript/model/target';
|
||||||
|
|
||||||
export interface State {
|
export interface State {
|
||||||
error: RPCClientError | null;
|
error: RPCClientError | null;
|
||||||
|
|
|
@ -1,12 +1,6 @@
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { StoreModule } from '@ngrx/store';
|
import { StoreModule } from '@ngrx/store';
|
||||||
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
|
|
||||||
import {
|
|
||||||
StoreRouterConnectingModule,
|
|
||||||
RouterStateSerializer,
|
|
||||||
} from '@ngrx/router-store';
|
|
||||||
import { EffectsModule } from '@ngrx/effects';
|
import { EffectsModule } from '@ngrx/effects';
|
||||||
import { combineReducers, ActionReducer, ActionReducerMap, MetaReducer } from '@ngrx/store';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
REDUCERS,
|
REDUCERS,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user