Merge branch 'master' of https://git.loafle.net/overflow/overflow-webapp
This commit is contained in:
commit
9730a00827
|
@ -4,15 +4,19 @@ import { StoreDevtoolsModule } from '@ngrx/store-devtools';
|
||||||
import {
|
import {
|
||||||
StoreRouterConnectingModule,
|
StoreRouterConnectingModule,
|
||||||
RouterStateSerializer,
|
RouterStateSerializer,
|
||||||
|
RouterReducerState,
|
||||||
} from '@ngrx/router-store';
|
} from '@ngrx/router-store';
|
||||||
import { EffectsModule } from '@ngrx/effects';
|
import { EffectsModule } from '@ngrx/effects';
|
||||||
import { combineReducers, ActionReducer, ActionReducerMap, MetaReducer } from '@ngrx/store';
|
import { combineReducers, ActionReducer, ActionReducerMap, MetaReducer } from '@ngrx/store';
|
||||||
|
|
||||||
|
|
||||||
import { environment } from '../environments/environment';
|
import { environment } from '../environments/environment';
|
||||||
import { AppState } from './app.state';
|
|
||||||
|
|
||||||
import { SimpleRouterStateSerializer } from './commons/router/state/serializer/simple-router-state-serializer';
|
import { SimpleRouterStateSerializer } from './commons/router/state/serializer/simple-router-state-serializer';
|
||||||
|
|
||||||
|
export interface AppState {
|
||||||
|
}
|
||||||
|
|
||||||
export const reducers: ActionReducerMap<AppState> = {
|
export const reducers: ActionReducerMap<AppState> = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -44,6 +48,7 @@ export const reducers: ActionReducerMap<AppState> = {
|
||||||
*/
|
*/
|
||||||
StoreDevtoolsModule.instrument({
|
StoreDevtoolsModule.instrument({
|
||||||
name: 'overFlow WebApp DevTools',
|
name: 'overFlow WebApp DevTools',
|
||||||
|
maxAge: 50,
|
||||||
logOnly: environment.production,
|
logOnly: environment.production,
|
||||||
}),
|
}),
|
||||||
EffectsModule.forRoot([]),
|
EffectsModule.forRoot([]),
|
||||||
|
@ -58,4 +63,4 @@ export const reducers: ActionReducerMap<AppState> = {
|
||||||
],
|
],
|
||||||
|
|
||||||
})
|
})
|
||||||
export class AppReducerModule { }
|
export class AppStoreModule { }
|
|
@ -6,7 +6,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
import { HttpClientModule } from '@angular/common/http';
|
import { HttpClientModule } from '@angular/common/http';
|
||||||
|
|
||||||
import { AppRoutingModule } from './app-routing.module';
|
import { AppRoutingModule } from './app-routing.module';
|
||||||
import { AppReducerModule } from './app-reducer.module';
|
import { AppStoreModule } from './app-store.module';
|
||||||
import { MaterialModule } from './commons/ui/material/material.module';
|
import { MaterialModule } from './commons/ui/material/material.module';
|
||||||
import { CovalentModule } from './commons/ui/covalent/covalent.module';
|
import { CovalentModule } from './commons/ui/covalent/covalent.module';
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ import { RPCService } from './commons/service/rpc.service';
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
BrowserAnimationsModule,
|
BrowserAnimationsModule,
|
||||||
AppRoutingModule,
|
AppRoutingModule,
|
||||||
AppReducerModule,
|
AppStoreModule,
|
||||||
MaterialModule,
|
MaterialModule,
|
||||||
CovalentModule,
|
CovalentModule,
|
||||||
HttpClientModule,
|
HttpClientModule,
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
export interface AppState {
|
|
||||||
|
|
||||||
}
|
|
|
@ -20,7 +20,7 @@ export const menus = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'Sensors',
|
'name': 'Sensors',
|
||||||
'link': '',
|
'link': '/sensors',
|
||||||
'icon': 'indeterminate_check_box',
|
'icon': 'indeterminate_check_box',
|
||||||
'chip': false,
|
'chip': false,
|
||||||
'open': false,
|
'open': false,
|
||||||
|
@ -56,7 +56,7 @@ export const menus = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'Dashboards',
|
'name': 'Dashboards',
|
||||||
'link': '',
|
'link': '/dashboard',
|
||||||
'icon': 'indeterminate_check_box',
|
'icon': 'indeterminate_check_box',
|
||||||
'chip': { 'value': 3, 'color': 'accent'},
|
'chip': { 'value': 3, 'color': 'accent'},
|
||||||
'open': false,
|
'open': false,
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
||||||
|
import { Store } from '@ngrx/store';
|
||||||
|
|
||||||
|
import * as AuthStore from '../store/auth';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'of-member-signin',
|
selector: 'of-member-signin',
|
||||||
|
@ -17,6 +20,7 @@ export class SigninComponent implements OnInit {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private router: Router,
|
private router: Router,
|
||||||
|
private store: Store<AuthStore.State>,
|
||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
|
|
15
src/app/packages/member/guard/auth.guard.spec.ts
Normal file
15
src/app/packages/member/guard/auth.guard.spec.ts
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import { TestBed, async, inject } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { AuthGuard } from './auth.guard';
|
||||||
|
|
||||||
|
describe('AuthGuard', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
providers: [AuthGuard]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should ...', inject([AuthGuard], (guard: AuthGuard) => {
|
||||||
|
expect(guard).toBeTruthy();
|
||||||
|
}));
|
||||||
|
});
|
49
src/app/packages/member/guard/auth.guard.ts
Normal file
49
src/app/packages/member/guard/auth.guard.ts
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import {
|
||||||
|
CanActivate,
|
||||||
|
CanActivateChild,
|
||||||
|
ActivatedRouteSnapshot,
|
||||||
|
RouterStateSnapshot
|
||||||
|
} from '@angular/router';
|
||||||
|
import { Store } from '@ngrx/store';
|
||||||
|
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
import 'rxjs/add/operator/take';
|
||||||
|
import 'rxjs/add/operator/map';
|
||||||
|
|
||||||
|
import * as AuthStore from '../store/auth';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class AuthGuard implements CanActivate, CanActivateChild {
|
||||||
|
constructor(
|
||||||
|
private store: Store<AuthStore.State>
|
||||||
|
) { }
|
||||||
|
|
||||||
|
canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> {
|
||||||
|
return this.store
|
||||||
|
.select(AuthStore.isSignin)
|
||||||
|
.map(isSignin => {
|
||||||
|
if (!isSignin) {
|
||||||
|
this.store.dispatch(new AuthStore.SigninRedirect());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
.take(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
canActivateChild(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> {
|
||||||
|
return this.store
|
||||||
|
.select(AuthStore.isSignin)
|
||||||
|
.map(isSignin => {
|
||||||
|
if (!isSignin) {
|
||||||
|
this.store.dispatch(new AuthStore.SigninRedirect());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
.take(1);
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,28 +8,15 @@ import {
|
||||||
import { EffectsModule } from '@ngrx/effects';
|
import { EffectsModule } from '@ngrx/effects';
|
||||||
import { combineReducers, ActionReducer, ActionReducerMap, MetaReducer } from '@ngrx/store';
|
import { combineReducers, ActionReducer, ActionReducerMap, MetaReducer } from '@ngrx/store';
|
||||||
|
|
||||||
import * as AuthStore from './store/auth';
|
import { State as MemberState } from './store/state';
|
||||||
import * as SignupStore from './store/signup';
|
import { reducers as memberReducers } from './store/reducer';
|
||||||
|
import { EFFECTS } from './store/effect';
|
||||||
|
|
||||||
|
import { MODULE } from './member.constant';
|
||||||
export interface State {
|
|
||||||
auth: AuthStore.State;
|
|
||||||
signup: SignupStore.Signup;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const reducers = {
|
|
||||||
auth: AuthStore.reducer,
|
|
||||||
signup: SignupStore.reducer,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const EFFECTS = [
|
|
||||||
AuthStore.Effects,
|
|
||||||
SignupStore.Effects,
|
|
||||||
];
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
StoreModule.forFeature('', reducers),
|
StoreModule.forFeature(MODULE.name, memberReducers),
|
||||||
EffectsModule.forFeature(EFFECTS),
|
EffectsModule.forFeature(EFFECTS),
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
3
src/app/packages/member/member.constant.ts
Normal file
3
src/app/packages/member/member.constant.ts
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
export const MODULE = {
|
||||||
|
name: 'Member'
|
||||||
|
};
|
|
@ -10,6 +10,7 @@ import { SigninComponent } from './component/signin.component';
|
||||||
import { SignupComponent } from './component/signup.component';
|
import { SignupComponent } from './component/signup.component';
|
||||||
import { ResetPasswordComponent } from './component/reset-password.component';
|
import { ResetPasswordComponent } from './component/reset-password.component';
|
||||||
import { MemberService } from './service/member.service';
|
import { MemberService } from './service/member.service';
|
||||||
|
import { AuthGuard } from './guard/auth.guard';
|
||||||
|
|
||||||
import { MemberStoreModule } from './member-store.module';
|
import { MemberStoreModule } from './member-store.module';
|
||||||
|
|
||||||
|
@ -32,6 +33,7 @@ export const COMPONENTS = [
|
||||||
declarations: COMPONENTS,
|
declarations: COMPONENTS,
|
||||||
exports: COMPONENTS,
|
exports: COMPONENTS,
|
||||||
providers: [
|
providers: [
|
||||||
|
AuthGuard,
|
||||||
MemberService,
|
MemberService,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Action } from '@ngrx/store';
|
import { Action } from '@ngrx/store';
|
||||||
|
|
||||||
import { Member } from '../model/member';
|
import { Member } from '../../model/member';
|
||||||
|
|
||||||
export enum ActionType {
|
export enum ActionType {
|
||||||
Signin = '[member.auth] Signin',
|
Signin = '[member.auth] Signin',
|
||||||
|
@ -21,7 +21,7 @@ export class Signin implements Action {
|
||||||
export class SigninSuccess implements Action {
|
export class SigninSuccess implements Action {
|
||||||
readonly type = ActionType.SigninSuccess;
|
readonly type = ActionType.SigninSuccess;
|
||||||
|
|
||||||
constructor(public payload: { member: Member }) {}
|
constructor(public payload: Member) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SigninFailure implements Action {
|
export class SigninFailure implements Action {
|
|
@ -13,8 +13,8 @@ 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 { Member } from '../model/member';
|
import { Member } from '../../model/member';
|
||||||
import { MemberService } from '../service/member.service';
|
import { MemberService } from '../../service/member.service';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Signin,
|
Signin,
|
||||||
|
@ -39,7 +39,7 @@ export class Effects {
|
||||||
.exhaustMap(payload =>
|
.exhaustMap(payload =>
|
||||||
this.memberService
|
this.memberService
|
||||||
.signin(payload.email, payload.password)
|
.signin(payload.email, payload.password)
|
||||||
.map(member => new SigninSuccess({ member }))
|
.map(member => new SigninSuccess(member))
|
||||||
.catch(error => of(new SigninFailure(error)))
|
.catch(error => of(new SigninFailure(error)))
|
||||||
);
|
);
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {
|
||||||
initialState,
|
initialState,
|
||||||
} from './auth.state';
|
} from './auth.state';
|
||||||
|
|
||||||
import { Member } from '../model/member';
|
import { Member } from '../../model/member';
|
||||||
|
|
||||||
export function reducer(state = initialState, action: Actions): State {
|
export function reducer(state = initialState, action: Actions): State {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
|
@ -26,7 +26,7 @@ export function reducer(state = initialState, action: Actions): State {
|
||||||
isSignin: true,
|
isSignin: true,
|
||||||
error: null,
|
error: null,
|
||||||
isPending: false,
|
isPending: false,
|
||||||
member: action.payload.member,
|
member: action.payload,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Member } from '../model/member';
|
import { Member } from '../../model/member';
|
||||||
|
|
||||||
export interface State {
|
export interface State {
|
||||||
isSignin: boolean;
|
isSignin: boolean;
|
7
src/app/packages/member/store/effect.ts
Normal file
7
src/app/packages/member/store/effect.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import * as AuthStore from './auth';
|
||||||
|
import * as SignupStore from './signup';
|
||||||
|
|
||||||
|
export const EFFECTS = [
|
||||||
|
AuthStore.Effects,
|
||||||
|
SignupStore.Effects,
|
||||||
|
];
|
7
src/app/packages/member/store/reducer.ts
Normal file
7
src/app/packages/member/store/reducer.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import * as AuthStore from './auth';
|
||||||
|
import * as SignupStore from './signup';
|
||||||
|
|
||||||
|
export const reducers = {
|
||||||
|
auth: AuthStore.reducer,
|
||||||
|
signup: SignupStore.reducer,
|
||||||
|
};
|
|
@ -1,6 +1,6 @@
|
||||||
import { Action } from '@ngrx/store';
|
import { Action } from '@ngrx/store';
|
||||||
|
|
||||||
import { Member } from '../model/member';
|
import { Member } from '../../model/member';
|
||||||
|
|
||||||
export enum ActionType {
|
export enum ActionType {
|
||||||
Signup = '[member.signup] Signup',
|
Signup = '[member.signup] Signup',
|
||||||
|
@ -11,13 +11,13 @@ export enum ActionType {
|
||||||
export class Signup implements Action {
|
export class Signup implements Action {
|
||||||
readonly type = ActionType.Signup;
|
readonly type = ActionType.Signup;
|
||||||
|
|
||||||
constructor(public payload: {member: Member}) {}
|
constructor(public payload: Member) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SignupSuccess implements Action {
|
export class SignupSuccess implements Action {
|
||||||
readonly type = ActionType.SignupSuccess;
|
readonly type = ActionType.SignupSuccess;
|
||||||
|
|
||||||
constructor(public payload: { member: Member }) {}
|
constructor(public payload: Member) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SignupFailure implements Action {
|
export class SignupFailure implements Action {
|
|
@ -13,8 +13,8 @@ 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 { Member } from '../model/member';
|
import { Member } from '../../model/member';
|
||||||
import { MemberService } from '../service/member.service';
|
import { MemberService } from '../../service/member.service';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Signup,
|
Signup,
|
||||||
|
@ -36,10 +36,10 @@ export class Effects {
|
||||||
signup$: Observable<Action> = this.actions$
|
signup$: Observable<Action> = this.actions$
|
||||||
.ofType(ActionType.Signup)
|
.ofType(ActionType.Signup)
|
||||||
.map((action: Signup) => action.payload)
|
.map((action: Signup) => action.payload)
|
||||||
.exhaustMap(payload =>
|
.exhaustMap(member =>
|
||||||
this.memberService
|
this.memberService
|
||||||
.signup(payload.member)
|
.signup(member)
|
||||||
.map(member => new SignupSuccess({ member }))
|
.map(_member => new SignupSuccess(_member))
|
||||||
.catch(error => of(new SignupFailure(error)))
|
.catch(error => of(new SignupFailure(error)))
|
||||||
);
|
);
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {
|
||||||
initialState,
|
initialState,
|
||||||
} from './signup.state';
|
} from './signup.state';
|
||||||
|
|
||||||
import { Member } from '../model/member';
|
import { Member } from '../../model/member';
|
||||||
|
|
||||||
export function reducer(state = initialState, action: Actions): State {
|
export function reducer(state = initialState, action: Actions): State {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
|
@ -25,7 +25,7 @@ export function reducer(state = initialState, action: Actions): State {
|
||||||
...state,
|
...state,
|
||||||
error: null,
|
error: null,
|
||||||
isPending: false,
|
isPending: false,
|
||||||
member: action.payload.member,
|
member: action.payload,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Member } from '../model/member';
|
import { Member } from '../../model/member';
|
||||||
|
|
||||||
export interface State {
|
export interface State {
|
||||||
error: string | null;
|
error: string | null;
|
8
src/app/packages/member/store/state.ts
Normal file
8
src/app/packages/member/store/state.ts
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
import * as AuthStore from './auth';
|
||||||
|
import * as SignupStore from './signup';
|
||||||
|
|
||||||
|
export interface State {
|
||||||
|
auth: AuthStore.State;
|
||||||
|
signup: SignupStore.Signup;
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,45 @@
|
||||||
<p>
|
<div class="example-container mat-elevation-z8" >
|
||||||
list works!
|
<mat-table #table [dataSource]="dataSource" matSort>
|
||||||
</p>
|
|
||||||
|
<ng-container matColumnDef="name">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> Name </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let element"> {{element.name}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="ip">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> IP </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let element"> {{element.ip}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="os">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> OS </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let element"> {{element.os}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="cidr">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> CIDR </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let element"> {{element.cidr}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="targetCnt">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> Targets </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let element"> {{element.targetCnt}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="date">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> Date </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let element"> {{element.date}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="authBy">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> AuthBy </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let element"> {{element.authBy}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<mat-header-row *matHeaderRowDef="displayedColumns" ></mat-header-row>
|
||||||
|
<mat-row *matRowDef="let row; columns: displayedColumns;" (click)="handleRowClick(row)"></mat-row>
|
||||||
|
</mat-table>
|
||||||
|
|
||||||
|
<mat-paginator [length]="length" [pageSize]="pageSize" [pageSizeOptions]="pageSizeOptions" (page)="pageEvent = $event">
|
||||||
|
</mat-paginator>
|
||||||
|
</div>
|
|
@ -0,0 +1,14 @@
|
||||||
|
.example-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-width: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mat-table {
|
||||||
|
overflow: auto;
|
||||||
|
max-height: 500px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mat-header-cell.mat-sort-header-sorted {
|
||||||
|
color: black;
|
||||||
|
}
|
|
@ -1,15 +1,63 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit, AfterViewInit, ViewChild } from '@angular/core';
|
||||||
|
import { MatTableDataSource, MatSort } from '@angular/material';
|
||||||
|
import { AfterContentInit } from '@angular/core/src/metadata/lifecycle_hooks';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
|
export interface Probe {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
ip: string;
|
||||||
|
os: string;
|
||||||
|
cidr: string;
|
||||||
|
targetCnt: number;
|
||||||
|
date: string;
|
||||||
|
authBy: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'of-list',
|
selector: 'of-sensor-item-list',
|
||||||
templateUrl: './list.component.html',
|
templateUrl: './list.component.html',
|
||||||
styleUrls: ['./list.component.scss']
|
styleUrls: ['./list.component.scss']
|
||||||
})
|
})
|
||||||
export class ListComponent implements OnInit {
|
export class ListComponent implements OnInit, AfterContentInit {
|
||||||
|
|
||||||
constructor() { }
|
displayedColumns = ['name', 'ip', 'os', 'cidr', 'targetCnt', 'date', 'authBy'];
|
||||||
|
dataSource: MatTableDataSource<Probe>;
|
||||||
|
@ViewChild(MatSort) sort: MatSort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the sort after the view init since this component will
|
||||||
|
* be able to query its view for the initialized sort.
|
||||||
|
*/
|
||||||
|
ngAfterContentInit() {
|
||||||
|
// temporary data
|
||||||
|
const data: Probe[] = new Array();
|
||||||
|
for (let i = 0; i < 10; i++) {
|
||||||
|
const p: Probe = {
|
||||||
|
id: String('id' + i),
|
||||||
|
name: String('name' + i),
|
||||||
|
ip: String('ip' + i),
|
||||||
|
os: String('os' + i),
|
||||||
|
cidr: String('cidr' + i),
|
||||||
|
targetCnt: i,
|
||||||
|
date: String('date' + i),
|
||||||
|
authBy: String('insanity')
|
||||||
|
};
|
||||||
|
data.push(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.dataSource = new MatTableDataSource(data);
|
||||||
|
this.dataSource.sort = this.sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(private router: Router) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleRowClick(obj: Probe) {
|
||||||
|
this.router.navigate(['probe', obj.id]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { MaterialModule } from 'app/commons/ui/material/material.module';
|
import { MaterialModule } from 'app/commons/ui/material/material.module';
|
||||||
|
import { ListComponent } from './component/list/list.component';
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@ -9,8 +10,10 @@ import { MaterialModule } from 'app/commons/ui/material/material.module';
|
||||||
MaterialModule,
|
MaterialModule,
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
|
ListComponent
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
|
ListComponent
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class SensorItemModule { }
|
export class SensorItemModule { }
|
||||||
|
|
17
src/app/pages/dashboard/dashboard-page-routing.module.ts
Normal file
17
src/app/pages/dashboard/dashboard-page-routing.module.ts
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
|
import {DashboardPageComponent} from './dashboard-page.component';
|
||||||
|
|
||||||
|
const routes: Routes = [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: DashboardPageComponent,
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [RouterModule.forChild(routes)],
|
||||||
|
exports: [RouterModule]
|
||||||
|
})
|
||||||
|
|
||||||
|
export class DashboardPageRoutingModule { }
|
3
src/app/pages/dashboard/dashboard-page.component.html
Normal file
3
src/app/pages/dashboard/dashboard-page.component.html
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<p>
|
||||||
|
dashboard-page works!
|
||||||
|
</p>
|
25
src/app/pages/dashboard/dashboard-page.component.spec.ts
Normal file
25
src/app/pages/dashboard/dashboard-page.component.spec.ts
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { DashboardPageComponent } from './dashboard-page.component';
|
||||||
|
|
||||||
|
describe('DashboardPageComponent', () => {
|
||||||
|
let component: DashboardPageComponent;
|
||||||
|
let fixture: ComponentFixture<DashboardPageComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ DashboardPageComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(DashboardPageComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
15
src/app/pages/dashboard/dashboard-page.component.ts
Normal file
15
src/app/pages/dashboard/dashboard-page.component.ts
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'of-dashboard-page',
|
||||||
|
templateUrl: './dashboard-page.component.html',
|
||||||
|
styleUrls: ['./dashboard-page.component.scss']
|
||||||
|
})
|
||||||
|
export class DashboardPageComponent implements OnInit {
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
17
src/app/pages/dashboard/dashboard-page.module.ts
Normal file
17
src/app/pages/dashboard/dashboard-page.module.ts
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { DashboardPageRoutingModule } from './dashboard-page-routing.module';
|
||||||
|
import { MaterialModule } from 'app/commons/ui/material/material.module';
|
||||||
|
import {DashboardPageComponent} from './dashboard-page.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
DashboardPageRoutingModule,
|
||||||
|
MaterialModule,
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
DashboardPageComponent
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class DashboardPageModule { }
|
|
@ -1,29 +1,36 @@
|
||||||
<div fxLayout="row" fxLayoutAlign="space-between stretch" fxFlexFil fxFill fxLayoutGap="1px">
|
<div fxLayout="row" fxLayoutAlign="space-between stretch" fxFlexFil fxFill fxLayoutGap="1px">
|
||||||
<div fxFlex="70" fxLayout="column" class="mat-elevation-z2 activity-list-container">
|
<div fxFlex="70" fxLayout="column" class="mat-elevation-z2 activity-list-container">
|
||||||
|
<perfect-scrollbar>
|
||||||
|
|
||||||
<div fxLayout="row" fxLayoutAlign="space-between center">
|
<div fxLayoutAlign="start center" fxLayout="row">
|
||||||
<of-host-summary-card></of-host-summary-card>
|
<div *ngFor="let dash of dashCard" fxFlex.lt-sm="70">
|
||||||
<of-app-summary-card></of-app-summary-card>
|
<of-dashboard-card [dashData]="dash"></of-dashboard-card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <div fxLayoutAlign="start center" fxLayout="row">
|
|
||||||
<div *ngFor="let dash of dashCard" fxFlex.lt-sm="70">
|
|
||||||
<of-dashboard-card [dashData]="dash"></of-dashboard-card>
|
|
||||||
</div>
|
</div>
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<div fxLayout="row" fxLayoutWrap [style.margin]="'20px 0px'">
|
<div fxLayout="row" fxLayoutAlign="space-between center">
|
||||||
<of-sensor-summary fxFlex="40" fxFlex.lt-sm="100" fxFlex.sm="100" fxFlex.md="70"></of-sensor-summary>
|
<of-host-summary-card></of-host-summary-card>
|
||||||
<of-sensor-item-filter fxFlex="60"></of-sensor-item-filter>
|
<of-app-summary-card></of-app-summary-card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div fxLayout="row" fxLayoutWrap fxLayoutAlign="end">
|
<div fxLayout="row" fxLayoutWrap [style.margin]="'20px 0px'">
|
||||||
<!-- <of-sensor-item-table></of-sensor-item-table> -->
|
<of-sensor-summary fxFlex="40" fxFlex.lt-sm="100" fxFlex.sm="100" fxFlex.md="70"></of-sensor-summary>
|
||||||
|
<of-sensor-item-filter fxFlex="60"></of-sensor-item-filter>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div fxLayout="row" [style.margin]="'20px 0px'">
|
||||||
|
<of-sensor-item-list fxFlex="100"></of-sensor-item-list>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div fxLayout="row" fxLayoutWrap fxLayoutAlign="end">
|
||||||
<button mat-raised-button (click)="openDialog()">대시보드에 추가</button>
|
<button mat-raised-button (click)="openDialog()">대시보드에 추가</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</perfect-scrollbar>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div fxFlex="30" fxLayout="column" class="mat-elevation-z2 activity-add">
|
<div fxFlex="30" fxLayout="column" class="mat-elevation-z2 activity-add">
|
||||||
<div fxFlex="10" fxLayout="row" fxLayoutAlign="space-between center">
|
<div fxFlex="10" fxLayout="row" fxLayoutAlign="space-between center">
|
||||||
<h3 class="mat-headline" fxFlex="80">Activities</h3>
|
<h3 class="mat-headline" fxFlex="80">Activities</h3>
|
||||||
|
@ -43,6 +50,4 @@
|
||||||
</div>
|
</div>
|
||||||
</perfect-scrollbar>
|
</perfect-scrollbar>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
</div>
|
</div>
|
|
@ -13,6 +13,7 @@ import { NgxChartsModule } from '@swimlane/ngx-charts';
|
||||||
import { HostSummaryCardComponent } from '../../commons/component/host-summary-card/host-summary-card.component';
|
import { HostSummaryCardComponent } from '../../commons/component/host-summary-card/host-summary-card.component';
|
||||||
import { AppSummaryCardComponent } from '../../commons/component/app-summary-card/app-summary-card.component';
|
import { AppSummaryCardComponent } from '../../commons/component/app-summary-card/app-summary-card.component';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
|
import { SensorItemModule } from '../../packages/sensor-item/sensor-item.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -22,7 +23,8 @@ import { FormsModule } from '@angular/forms';
|
||||||
MaterialModule,
|
MaterialModule,
|
||||||
PerfectScrollbarModule,
|
PerfectScrollbarModule,
|
||||||
NgxChartsModule,
|
NgxChartsModule,
|
||||||
FormsModule
|
FormsModule,
|
||||||
|
SensorItemModule,
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
OverviewPageComponent,
|
OverviewPageComponent,
|
||||||
|
|
|
@ -11,11 +11,13 @@ const routes: Routes = [
|
||||||
{ path: 'home', loadChildren: './home/home-page.module#HomePageModule' },
|
{ path: 'home', loadChildren: './home/home-page.module#HomePageModule' },
|
||||||
{ path: 'probes', loadChildren: './probes/probes-page.module#ProbesPageModule' },
|
{ path: 'probes', loadChildren: './probes/probes-page.module#ProbesPageModule' },
|
||||||
{ path: 'probe', loadChildren: './probe/probe-page.module#ProbePageModule' },
|
{ path: 'probe', loadChildren: './probe/probe-page.module#ProbePageModule' },
|
||||||
|
{ path: 'sensors', loadChildren: './sensors/sensors-page.module#SensorsPageModule' },
|
||||||
{ path: 'discovery', loadChildren: './discovery/discovery-page.module#DiscoveryPageModule' },
|
{ path: 'discovery', loadChildren: './discovery/discovery-page.module#DiscoveryPageModule' },
|
||||||
{ path: 'map', loadChildren: './infra/infra-page.module#InfraPageModule' },
|
{ path: 'map', loadChildren: './infra/infra-page.module#InfraPageModule' },
|
||||||
{ path: 'sensor-setting', loadChildren: './sensor-setting/sensor-setting-page.module#SensorSettingPageModule' },
|
{ path: 'sensor-setting', loadChildren: './sensor-setting/sensor-setting-page.module#SensorSettingPageModule' },
|
||||||
{ path: 'target', loadChildren: './target/target-page.module#TargetPageModule' },
|
{ path: 'target', loadChildren: './target/target-page.module#TargetPageModule' },
|
||||||
{ path: 'overview', loadChildren: './overview/overview-page.module#OverviewPageModule' },
|
{ path: 'overview', loadChildren: './overview/overview-page.module#OverviewPageModule' },
|
||||||
|
{ path: 'dashboard', loadChildren: './dashboard/dashboard-page.module#DashboardPageModule' },
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
19
src/app/pages/sensors/sensors-page-routing.module.ts
Normal file
19
src/app/pages/sensors/sensors-page-routing.module.ts
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
|
import { SensorsPageComponent } from './sensors-page.component';
|
||||||
|
|
||||||
|
const routes: Routes = [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: SensorsPageComponent,
|
||||||
|
children: [
|
||||||
|
// { path: '', component: SensorListComponent },
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [RouterModule.forChild(routes)],
|
||||||
|
exports: [RouterModule]
|
||||||
|
})
|
||||||
|
export class SensorsPageRoutingModule { }
|
3
src/app/pages/sensors/sensors-page.component.html
Normal file
3
src/app/pages/sensors/sensors-page.component.html
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<p>
|
||||||
|
sensors works!
|
||||||
|
</p>
|
0
src/app/pages/sensors/sensors-page.component.scss
Normal file
0
src/app/pages/sensors/sensors-page.component.scss
Normal file
25
src/app/pages/sensors/sensors-page.component.spec.ts
Normal file
25
src/app/pages/sensors/sensors-page.component.spec.ts
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { SensorsPageComponent } from './sensors-page.component';
|
||||||
|
|
||||||
|
describe('SensorsComponent', () => {
|
||||||
|
let component: SensorsPageComponent;
|
||||||
|
let fixture: ComponentFixture<SensorsPageComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ SensorsPageComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(SensorsPageComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
21
src/app/pages/sensors/sensors-page.component.ts
Normal file
21
src/app/pages/sensors/sensors-page.component.ts
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'of-pages-sensors',
|
||||||
|
templateUrl: './sensors-page.component.html',
|
||||||
|
styleUrls: ['./sensors-page.component.scss']
|
||||||
|
})
|
||||||
|
export class SensorsPageComponent implements OnInit {
|
||||||
|
|
||||||
|
tabs = [
|
||||||
|
{ label: 'Overview', path: '/sensors' },
|
||||||
|
{ label: 'History', path: '/sensors/history' },
|
||||||
|
{ label: 'Settings', path: '/sensors/setting' },
|
||||||
|
];
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
17
src/app/pages/sensors/sensors-page.module.ts
Normal file
17
src/app/pages/sensors/sensors-page.module.ts
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { MaterialModule } from '../../commons/ui/material/material.module';
|
||||||
|
import { SensorsPageComponent } from './sensors-page.component';
|
||||||
|
import { SensorsPageRoutingModule } from './sensors-page-routing.module';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
MaterialModule,
|
||||||
|
SensorsPageRoutingModule
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
SensorsPageComponent
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class SensorsPageModule { }
|
Loading…
Reference in New Issue
Block a user