+SENSOR_DETAIL_COMPONENT
+
diff --git a/@overflow/sensor/component/list/list.component.html b/@overflow/sensor/component/list/list.component.html
index 18f6f16..b7d1009 100644
--- a/@overflow/sensor/component/list/list.component.html
+++ b/@overflow/sensor/component/list/list.component.html
@@ -77,7 +77,7 @@
diff --git a/@overflow/sensor/component/list/list.component.ts b/@overflow/sensor/component/list/list.component.ts
index 6509d91..b0ae8ad 100644
--- a/@overflow/sensor/component/list/list.component.ts
+++ b/@overflow/sensor/component/list/list.component.ts
@@ -11,6 +11,7 @@ export class SensorListComponent implements OnChanges {
@Input() page: Page
;
@Output() addSensor = new EventEmitter();
+ @Output() select = new EventEmitter();
totalLength: number;
targetSensors: Object;
diff --git a/@overflow/sensor/container/sensor-list-container.component.html b/@overflow/sensor/container/sensor-list-container.component.html
index 1f9f7ad..58b4952 100644
--- a/@overflow/sensor/container/sensor-list-container.component.html
+++ b/@overflow/sensor/container/sensor-list-container.component.html
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/src/app/commons/guard/auth.guard.ts b/src/app/commons/guard/auth.guard.ts
index efe44a7..e8f1372 100644
--- a/src/app/commons/guard/auth.guard.ts
+++ b/src/app/commons/guard/auth.guard.ts
@@ -6,55 +6,60 @@ import {
RouterStateSnapshot,
Router,
} from '@angular/router';
-import { Store } from '@ngrx/store';
-
-import { Observable } from 'rxjs/Observable';
-import 'rxjs/add/operator/take';
-import 'rxjs/add/operator/map';
+import { Store, select } from '@ngrx/store';
+import { Observable } from 'rxjs';
+import { map, take } from 'rxjs/operators';
import { CookieService } from 'ngx-cookie-service';
-import * as AuthStore from '@overflow/member/store/auth';
-import { AuthSelector } from '@overflow/member/store';
+import { AuthContainerSelector } from '@overflow/shared/auth/store';
+import * as MemberEntityStore from '@overflow/member/store/entity/member';
+import * as SigninContaifnerStore from '../store/container/signin';
@Injectable()
export class AuthGuard implements CanActivate, CanActivateChild {
constructor(
- private store: Store,
+ private store: Store,
private router: Router,
private cookieService: CookieService,
) { }
canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable {
- return this.store
- .select(AuthSelector.select('signined'))
- .map(signined => {
+ return this.store.pipe(
+ select(AuthContainerSelector.selectSignined),
+ map(signined => {
if (!signined) {
if (this.cookieService.check('authToken')) {
- this.store.dispatch(new AuthStore.SigninCookie({authToken: this.cookieService.get('authToken'), returnURL: state.url}));
+ this.store.dispatch(new MemberEntityStore.SigninCookie({authToken: this.cookieService.get('authToken'), returnURL: state.url}));
} else {
- // this.store.dispatch(new AuthStore.SigninRedirect(state.url));
- this.router.navigateByUrl(state.url);
+ this.store.dispatch(new SigninContaifnerStore.SigninRedirect({returnURL: state.url}));
}
return false;
}
return true;
- })
- .take(1);
+ }),
+ take(1)
+ );
}
canActivateChild(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable {
- return this.store
- .select(AuthSelector.select('signined'))
- .map(signined => {
+ return this.store.pipe(
+ select(AuthContainerSelector.selectSignined),
+ map(signined => {
if (!signined) {
- this.store.dispatch(new AuthStore.SigninRedirect(state.url));
+ if (this.cookieService.check('authToken')) {
+ this.store.dispatch(new MemberEntityStore.SigninCookie({authToken: this.cookieService.get('authToken'), returnURL: state.url}));
+ } else {
+ this.store.dispatch(new SigninContaifnerStore.SigninRedirect({returnURL: state.url}));
+ }
return false;
}
return true;
- })
- .take(1);
+ }),
+ take(1)
+ );
}
+
}
diff --git a/src/app/commons/store/container/signin/app-signin.action.ts b/src/app/commons/store/container/signin/app-signin.action.ts
new file mode 100644
index 0000000..77226a5
--- /dev/null
+++ b/src/app/commons/store/container/signin/app-signin.action.ts
@@ -0,0 +1,15 @@
+import { Action } from '@ngrx/store';
+
+export enum ActionType {
+ SigninRedirect = '[app.signin] SigninRedirect',
+}
+
+export class SigninRedirect implements Action {
+ readonly type = ActionType.SigninRedirect;
+
+ constructor(public payload: {returnURL: string}) {}
+}
+
+export type Actions =
+ | SigninRedirect
+;
diff --git a/src/app/commons/store/signin-init/signin-init.effect.spec.ts b/src/app/commons/store/container/signin/app-signin.effect.spec.ts
similarity index 73%
rename from src/app/commons/store/signin-init/signin-init.effect.spec.ts
rename to src/app/commons/store/container/signin/app-signin.effect.spec.ts
index 6214021..30b413f 100644
--- a/src/app/commons/store/signin-init/signin-init.effect.spec.ts
+++ b/src/app/commons/store/container/signin/app-signin.effect.spec.ts
@@ -1,8 +1,8 @@
import { TestBed, inject } from '@angular/core/testing';
-import { Effects } from './signin-init.effect';
+import { Effects } from './app-signin.effect';
-describe('SigninInit.Effects', () => {
+describe('app-signin-container.Effects', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [Effects]
diff --git a/src/app/commons/store/container/signin/app-signin.effect.ts b/src/app/commons/store/container/signin/app-signin.effect.ts
new file mode 100644
index 0000000..c83dbe5
--- /dev/null
+++ b/src/app/commons/store/container/signin/app-signin.effect.ts
@@ -0,0 +1,72 @@
+import { Injectable } from '@angular/core';
+import { Router } from '@angular/router';
+
+import { Effect, Actions, ofType } from '@ngrx/effects';
+
+import { map, tap } from 'rxjs/operators';
+
+import { CookieService } from 'ngx-cookie-service';
+import { RPCService } from '@loafer/ng-rpc';
+
+import {
+ SigninSuccess,
+ SigninCookieSuccess,
+ ActionType as AuthActionType,
+} from '@overflow/shared/auth/store/container/auth';
+
+import {
+ SigninRedirect,
+ ActionType,
+} from './app-signin.action';
+
+import { DomainMember } from '@overflow/commons-typescript/model/domain';
+
+
+@Injectable()
+export class Effects {
+
+ constructor(
+ private actions$: Actions,
+ private rpcService: RPCService,
+ private cookieService: CookieService,
+ private router: Router
+ ) { }
+
+ @Effect({ dispatch: false })
+ signinSuccess$ = this.actions$.pipe(
+ ofType(AuthActionType.SigninSuccess),
+ map((action: SigninSuccess) => action.payload),
+ tap((info: {authToken: string, domainMember: DomainMember, returnURL: string}) => {
+ const expires = new Date();
+ expires.setDate(expires.getDate() + 1);
+ this.cookieService.set('authToken', info.authToken, expires, '/');
+ const queryString = `authToken=${info.authToken}`;
+ this.rpcService.connect(queryString);
+
+ this.router.navigateByUrl(info.returnURL);
+ })
+ );
+
+ @Effect({ dispatch: false })
+ signinCookieSuccess$ = this.actions$.pipe(
+ ofType(AuthActionType.SigninCookieSuccess),
+ map((action: SigninCookieSuccess) => action.payload),
+ tap((info: {domainMember: DomainMember, returnURL: string}) => {
+ const authToken = this.cookieService.get('authToken');
+ const queryString = `authToken=${authToken}`;
+ this.rpcService.connect(queryString);
+
+ this.router.navigateByUrl(info.returnURL);
+ })
+ );
+
+ @Effect({ dispatch: false })
+ signinRedirect$ = this.actions$.pipe(
+ ofType(ActionType.SigninRedirect),
+ map((action: SigninRedirect) => action.payload),
+ tap((info: {returnURL: string}) => {
+ this.router.navigate(['/auth/signin'], {queryParams: {returnURL: info.returnURL}});
+ })
+ );
+
+}
diff --git a/src/app/commons/store/container/signin/index.ts b/src/app/commons/store/container/signin/index.ts
new file mode 100644
index 0000000..a2747c0
--- /dev/null
+++ b/src/app/commons/store/container/signin/index.ts
@@ -0,0 +1,2 @@
+export * from './app-signin.action';
+export * from './app-signin.effect';
diff --git a/src/app/commons/store/index.ts b/src/app/commons/store/index.ts
index 64ea21e..67a90b3 100644
--- a/src/app/commons/store/index.ts
+++ b/src/app/commons/store/index.ts
@@ -1,6 +1,6 @@
import { ActionReducerMap } from '@ngrx/store';
-import * as SigninInitStore from './signin-init';
+import * as SigninContainerStore from './container/signin';
export interface State {
}
@@ -9,5 +9,5 @@ export const REDUCERS: ActionReducerMap = {
};
export const EFFECTS = [
- SigninInitStore.Effects,
+ SigninContainerStore.Effects,
];
diff --git a/src/app/commons/store/signin-init/index.ts b/src/app/commons/store/signin-init/index.ts
deleted file mode 100644
index 3ac331f..0000000
--- a/src/app/commons/store/signin-init/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from './signin-init.effect';
diff --git a/src/app/commons/store/signin-init/signin-init.effect.ts b/src/app/commons/store/signin-init/signin-init.effect.ts
deleted file mode 100644
index 368c51d..0000000
--- a/src/app/commons/store/signin-init/signin-init.effect.ts
+++ /dev/null
@@ -1,68 +0,0 @@
-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 { CookieService } from 'ngx-cookie-service';
-
-import { RPCService } from '@loafer/ng-rpc';
-
-import {
- SigninSuccess,
- SigninCookieSuccess,
- ActionType,
-} from '@overflow/member/store/auth';
-
-@Injectable()
-export class Effects {
-
- constructor(
- private actions$: Actions,
- private rpcService: RPCService,
- private cookieService: CookieService,
- ) { }
-
- @Effect({ dispatch: false })
- signinSuccess$ = this.actions$
- .ofType(ActionType.SigninSuccess)
- .map((action: SigninSuccess) => action.payload)
- .do(
- (result) => {
- const authToken = result.authToken;
- // console.log(`authToken: ${authToken}`);
-
- const expires = new Date();
- expires.setDate(expires.getDate() + 1);
- this.cookieService.set('authToken', authToken, expires, '/');
-
- const queryString = `authToken=${authToken}`;
-
- this.rpcService.connect(queryString);
- }
- );
-
- @Effect({ dispatch: false })
- signinCookieSuccess$ = this.actions$
- .ofType(ActionType.SigninCookieSuccess)
- .map((action: SigninCookieSuccess) => action.payload)
- .do(
- (result) => {
- const authToken = this.cookieService.get('authToken');
- // console.log(`authToken: ${authToken}`);
- const queryString = `authToken=${authToken}`;
-
- this.rpcService.connect(queryString);
- }
- );
-}
diff --git a/src/app/pages/discovery/discovery-page.component.html b/src/app/pages/discovery/discovery-page.component.html
index 07af687..f7fa9b0 100644
--- a/src/app/pages/discovery/discovery-page.component.html
+++ b/src/app/pages/discovery/discovery-page.component.html
@@ -3,7 +3,7 @@
diff --git a/src/app/pages/discovery/discovery-page.component.ts b/src/app/pages/discovery/discovery-page.component.ts
index c13da36..338306e 100644
--- a/src/app/pages/discovery/discovery-page.component.ts
+++ b/src/app/pages/discovery/discovery-page.component.ts
@@ -7,7 +7,7 @@ import { ActivatedRoute } from '@angular/router';
})
export class DiscoveryPageComponent implements OnInit {
- hostId: number;
+ probeHostID: number;
constructor(
private route: ActivatedRoute
@@ -15,8 +15,7 @@ export class DiscoveryPageComponent implements OnInit {
ngOnInit() {
this.route.params.subscribe((params: any) => {
- this.hostId = params['probeHostID'];
- // console.log('probeHostID : ' + probeHostID);
+ this.probeHostID = params['probeHostID'];
});
}
}
diff --git a/src/app/pages/probes/noauth-probe/noauth-probe-page-routing.module.ts b/src/app/pages/probes/noauth-probe/noauth-probe-page-routing.module.ts
index c8225f6..5babd78 100644
--- a/src/app/pages/probes/noauth-probe/noauth-probe-page-routing.module.ts
+++ b/src/app/pages/probes/noauth-probe/noauth-probe-page-routing.module.ts
@@ -2,7 +2,6 @@ import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { NoAuthProbePageComponent } from './noauth-probe-page.component';
import { ProbeListComponent } from '@overflow/probe/component/list/list.component';
-import { NoAuthProbeListComponent } from '@overflow/noauth-probe/component/list/list.component';
import { ProbeDownloadComponent } from '@overflow/probe/component/download/download.component';
const routes: Routes = [
diff --git a/src/app/pages/sensors/sensor/sensor-page.component.html b/src/app/pages/sensors/sensor/sensor-page.component.html
index e84003f..9dbaeb4 100644
--- a/src/app/pages/sensors/sensor/sensor-page.component.html
+++ b/src/app/pages/sensors/sensor/sensor-page.component.html
@@ -1,8 +1,4 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+
\ No newline at end of file
diff --git a/src/app/pages/sensors/sensor/sensor-page.component.ts b/src/app/pages/sensors/sensor/sensor-page.component.ts
index 75a6f73..4cd4deb 100644
--- a/src/app/pages/sensors/sensor/sensor-page.component.ts
+++ b/src/app/pages/sensors/sensor/sensor-page.component.ts
@@ -4,13 +4,19 @@ import { Sensor } from '@overflow/commons-typescript/model/sensor';
import { BreadcrumbService } from '@app/commons/service/breadcrumb.service';
import { Target } from '@overflow/commons-typescript/model/target';
+enum CONTAINER_TYPES {
+ List = 1,
+ Detail,
+ Setting,
+}
+
@Component({
selector: 'of-pages-sensor',
templateUrl: './sensor-page.component.html',
})
export class SensorPageComponent {
- isDetail: boolean;
+ containerType: CONTAINER_TYPES;
sensorID: string;
constructor(
@@ -31,7 +37,11 @@ export class SensorPageComponent {
this.breadcrumbService.setItems([
{ label: 'Sensor', routerLink: ['/sensor/list'], }
]);
- this.isDetail = false;
+ if (this.router.url === '/sensor/list') {
+ this.containerType = CONTAINER_TYPES.List;
+ } else {
+ this.containerType = CONTAINER_TYPES.Setting;
+ }
}
onDetailContainer(sensorID: string) {
@@ -40,7 +50,7 @@ export class SensorPageComponent {
{ label: 'Sensor', routerLink: ['/sensor/list'] },
{ label: this.sensorID }
]);
- this.isDetail = true;
+ this.containerType = CONTAINER_TYPES.Detail;
}
onSensorSelect(sensor: Sensor) {