diff --git a/src/app/commons/component/layout/menu/app.menu.component.ts b/src/app/commons/component/layout/menu/app.menu.component.ts index bdfbe21..fa7c7a2 100644 --- a/src/app/commons/component/layout/menu/app.menu.component.ts +++ b/src/app/commons/component/layout/menu/app.menu.component.ts @@ -24,7 +24,7 @@ export class AppMenuComponent implements OnInit { label: 'Infra', icon: 'all_inclusive', items: [ { label: 'Map', icon: 'map', routerLink: ['/map'] }, { label: 'Sensors', icon: 'compare_arrows', routerLink: ['/sensors'] }, - { label: 'Probes', icon: 'dock', routerLink: ['/probes'] }, + { label: 'Probes', icon: 'dock', routerLink: ['/probes/list'] }, ] }, { diff --git a/src/app/commons/component/layout/tabbar/app.tabbar.component.html b/src/app/commons/component/layout/tabbar/app.tabbar.component.html index cd724c1..7f2265b 100644 --- a/src/app/commons/component/layout/tabbar/app.tabbar.component.html +++ b/src/app/commons/component/layout/tabbar/app.tabbar.component.html @@ -1,5 +1 @@ - - - - - \ No newline at end of file + diff --git a/src/app/commons/component/layout/tabbar/app.tabbar.component.ts b/src/app/commons/component/layout/tabbar/app.tabbar.component.ts index df90a6f..7cfc418 100644 --- a/src/app/commons/component/layout/tabbar/app.tabbar.component.ts +++ b/src/app/commons/component/layout/tabbar/app.tabbar.component.ts @@ -1,4 +1,4 @@ -import { Component, AfterViewInit, Input } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { Language } from 'angular-l10n'; @@ -6,17 +6,11 @@ import { Language } from 'angular-l10n'; selector: 'of-tabbar', templateUrl: './app.tabbar.component.html', }) -export class TabbarComponent implements AfterViewInit { +export class TabbarComponent implements OnInit { @Input() tabs: any; constructor(public router: Router) { } - ngAfterViewInit() { - } - - handleChange(event) { - const path: string = this.tabs[event.index].path; - if (path.length === 0) { return; } - this.router.navigate([path]); + ngOnInit() { } } diff --git a/src/app/pages/probe/probe-page-routing.module.ts b/src/app/pages/probe/probe-page-routing.module.ts index 8b21c97..69a82fd 100644 --- a/src/app/pages/probe/probe-page-routing.module.ts +++ b/src/app/pages/probe/probe-page-routing.module.ts @@ -9,9 +9,9 @@ const routes: Routes = [ path: '', component: ProbePageComponent, children: [ - { path: ':id', component: ProbeDetailComponent }, - // { path: ':id/targets', loadChildren: 'app/pages/targets/targets-page.module#TargetsPageModule'}, - // { path: ':id/history', component: null }, + { path: ':id/info', component: ProbeDetailComponent }, + { path: ':id/targets', loadChildren: 'app/pages/targets/targets-page.module#TargetsPageModule'}, + { path: ':id/history', component: null }, ] } ]; diff --git a/src/app/pages/probe/probe-page.component.html b/src/app/pages/probe/probe-page.component.html index 7dfee1f..2bbc1b7 100644 --- a/src/app/pages/probe/probe-page.component.html +++ b/src/app/pages/probe/probe-page.component.html @@ -1 +1,3 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/src/app/pages/probe/probe-page.component.ts b/src/app/pages/probe/probe-page.component.ts index 2ce47b2..f6fa0d7 100644 --- a/src/app/pages/probe/probe-page.component.ts +++ b/src/app/pages/probe/probe-page.component.ts @@ -15,10 +15,16 @@ export class ProbePageComponent implements OnInit { ngOnInit() { const id = this.router.url.split('probe/')[1].split('/')[0]; + // this.tabs = [ + // { label: 'Probe Info', path: '/probe/' + id, icon: 'fa-check' }, + // { label: 'Targets', path: '/probe/' + id + '/targets', icon: 'fa-check' }, + // { label: 'History', path: '/probe/' + id + '/history', icon: 'fa-check', disabled: true }, + // ]; + this.tabs = [ - { label: 'Probe Info', path: '/probe/' + id, icon: 'fa-check' }, - { label: 'Targets', path: '/probe/' + id + '/targets', icon: 'fa-check' }, - { label: 'History', path: '/probe/' + id + '/history', icon: 'fa-check', disabled: true }, + { label: 'Info', routerLink: ['/probe/', id, 'info'], path: '/probe/' + id, icon: 'fa-check' }, + { label: 'Targets', routerLink: ['/probe/', id, 'targets'], icon: 'fa-check' }, + { label: 'History', routerLink: ['/probe/', id, 'history'], icon: 'fa-check', disabled: true }, ]; } diff --git a/src/app/pages/probes/probes-page-routing.module.ts b/src/app/pages/probes/probes-page-routing.module.ts index 1c2d220..da563a2 100644 --- a/src/app/pages/probes/probes-page-routing.module.ts +++ b/src/app/pages/probes/probes-page-routing.module.ts @@ -10,7 +10,7 @@ const routes: Routes = [ path: '', component: ProbesPageComponent, children: [ - { path: '', component: ProbeListComponent }, + { path: 'list', component: ProbeListComponent }, { path: 'noauth', component: NoauthListComponent }, { path: 'download', component: DownloadComponent }, ] diff --git a/src/app/pages/probes/probes-page.component.html b/src/app/pages/probes/probes-page.component.html index 7dfee1f..7910fd3 100644 --- a/src/app/pages/probes/probes-page.component.html +++ b/src/app/pages/probes/probes-page.component.html @@ -1 +1,3 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/src/app/pages/probes/probes-page.component.ts b/src/app/pages/probes/probes-page.component.ts index 0e0d71e..612a93a 100644 --- a/src/app/pages/probes/probes-page.component.ts +++ b/src/app/pages/probes/probes-page.component.ts @@ -7,11 +7,12 @@ import { Component, OnInit } from '@angular/core'; export class ProbesPageComponent { tabs = [ - { label: 'Probe', path: '/probes' }, - { label: 'Unauthorized', path: '/probes/noauth' }, - { label: 'Download', path: '/probes/download' }, + { label: 'PROBES', routerLink: ['/probes/list'] }, + { label: 'UNAUTHORIZED', routerLink: ['/probes/noauth'] }, + { label: 'DOWNLOAD', routerLink: ['/probes/download'] }, ]; + constructor() { } } diff --git a/src/app/pages/targets/targets-page-routing.module.ts b/src/app/pages/targets/targets-page-routing.module.ts new file mode 100644 index 0000000..ecc2dd4 --- /dev/null +++ b/src/app/pages/targets/targets-page-routing.module.ts @@ -0,0 +1,18 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import { ListComponent as ProbeListComponent } from 'packages/probe/component/list/list.component'; +import { TargetsPageComponent } from 'app/pages/targets/targets-page.component'; + +const routes: Routes = [ + { + path: '', + component: TargetsPageComponent, + } +]; + + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class TargetsPageRoutingModule { } diff --git a/src/app/pages/targets/targets-page.component.html b/src/app/pages/targets/targets-page.component.html new file mode 100644 index 0000000..3511189 --- /dev/null +++ b/src/app/pages/targets/targets-page.component.html @@ -0,0 +1,2 @@ +
targets page
+ \ No newline at end of file diff --git a/src/app/pages/targets/targets-page.component.spec.ts b/src/app/pages/targets/targets-page.component.spec.ts new file mode 100644 index 0000000..931ca6d --- /dev/null +++ b/src/app/pages/targets/targets-page.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TargetsPageComponent } from './targets-page.component'; + +describe('TargetsComponent', () => { + let component: TargetsPageComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ TargetsPageComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TargetsPageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/targets/targets-page.component.ts b/src/app/pages/targets/targets-page.component.ts new file mode 100644 index 0000000..d1dbd44 --- /dev/null +++ b/src/app/pages/targets/targets-page.component.ts @@ -0,0 +1,14 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'of-pages-targets', + templateUrl: './targets-page.component.html', +}) +export class TargetsPageComponent implements OnInit { + + constructor() { + } + + ngOnInit() { + } +} diff --git a/src/app/pages/targets/targets-page.module.ts b/src/app/pages/targets/targets-page.module.ts new file mode 100644 index 0000000..67ee500 --- /dev/null +++ b/src/app/pages/targets/targets-page.module.ts @@ -0,0 +1,18 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +// import { TargetModule } from 'packages/target/target.module'; +import { TargetsPageRoutingModule } from './targets-page-routing.module'; +import { TargetsPageComponent } from './targets-page.component'; + +@NgModule({ + imports: [ + CommonModule, + TargetsPageRoutingModule, + // TargetModule, + ], + declarations: [ + TargetsPageComponent + ] +}) +export class TargetsPageModule { } diff --git a/src/packages/noauth/component/list/list.component.html b/src/packages/noauth/component/list/list.component.html index 7c49aee..6fba338 100644 --- a/src/packages/noauth/component/list/list.component.html +++ b/src/packages/noauth/component/list/list.component.html @@ -1 +1,31 @@ -
unauthorized probes
\ No newline at end of file + + + + + Probe Key + Description + Created at + + + + + + + + {{probe.tempProbeKey}} + {{probe.description}} + {{probe.createDate | date: 'dd/MM/yyyy'}} + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/packages/noauth/component/list/list.component.ts b/src/packages/noauth/component/list/list.component.ts index 25dbc13..1a80200 100644 --- a/src/packages/noauth/component/list/list.component.ts +++ b/src/packages/noauth/component/list/list.component.ts @@ -2,27 +2,31 @@ import { Component, OnInit, AfterViewInit, ViewChild } from '@angular/core'; import { AfterContentInit } from '@angular/core/src/metadata/lifecycle_hooks'; import { Router } from '@angular/router'; import { Store, select } from '@ngrx/store'; - import { AuthSelector } from 'packages/member/store'; import { RPCClientError } from '@loafer/ng-rpc/protocol'; import { Domain } from 'packages/domain/model'; - import * as ListStore from '../../store/noauth-probe'; import { NoAuthProbeSelector } from '../../store'; import { NoAuthProbe } from '../../model'; +import { ConfirmationService, Message } from 'primeng/primeng'; +import { MessageService } from 'primeng/components/common/messageservice'; @Component({ selector: 'of-noauth-list', templateUrl: './list.component.html', + providers: [ConfirmationService, MessageService] }) export class ListComponent implements OnInit, AfterContentInit { noAuthProbes$ = this.store.pipe(select(NoAuthProbeSelector.select('noAuthProbes'))); - + noauthProbes: NoAuthProbe[]; selected: NoAuthProbe = null; + msgs: Message[]; constructor( private router: Router, - private store: Store + private store: Store, + private confirmationService: ConfirmationService, + private messageService: MessageService ) { } @@ -43,20 +47,53 @@ export class ListComponent implements OnInit, AfterContentInit { } ngOnInit() { + // Temporary Data + this.noauthProbes = new Array(); + for (let i = 0; i < 10; i++) { + const p: NoAuthProbe = { + id: i, + tempProbeKey: 'TempKey' + i, + createDate: new Date(), + description: 'Description' + i, + }; + this.noauthProbes.push(p); + } } handleSelect(selected: NoAuthProbe) { this.selected = selected; } + onAcceptOrDeny(isAccept: boolean) { + this.msgs = []; + const title = isAccept ? + 'Are you sure to accept this Probe?' : 'Are you sure to deny this Probe'; + const message = isAccept ? + 'Start collecting data as a Probe.' : 'It will be permanently deleted.'; + + this.confirmationService.confirm({ + header: title, + message: message, + icon: isAccept ? 'fa-check' : 'fa fa-trash', + accept: () => { + isAccept ? this.handleAccept() : this.handleDeny(); + this.msgs.push({ severity: 'error', summary: 'Failed', detail: '연동 안했지롱' }); + }, + reject: () => { + } + }); + } + handleAccept() { this.store.dispatch(new ListStore.Accept(this.selected)); this.noAuthProbes$.subscribe( (noAuthProbes: NoAuthProbe[]) => { - + if (noAuthProbes) { + this.msgs.push({ severity: 'success', summary: 'Success', detail: '개굿' }); + } }, (error: RPCClientError) => { - console.log(error.response.message); + this.msgs.push({ severity: 'error', summary: 'Failed', detail: error.response.message }); } ); } @@ -65,10 +102,12 @@ export class ListComponent implements OnInit, AfterContentInit { this.store.dispatch(new ListStore.Deny(this.selected)); this.noAuthProbes$.subscribe( (noAuthProbes: NoAuthProbe[]) => { - + if (noAuthProbes) { + this.msgs.push({ severity: 'success', summary: 'Success', detail: '개굿' }); + } }, (error: RPCClientError) => { - console.log(error.response.message); + this.msgs.push({ severity: 'error', summary: 'Failed', detail: error.response.message }); } ); } diff --git a/src/packages/probe/component/detail/detail.component.ts b/src/packages/probe/component/detail/detail.component.ts index 5b845ce..9221a4f 100644 --- a/src/packages/probe/component/detail/detail.component.ts +++ b/src/packages/probe/component/detail/detail.component.ts @@ -5,7 +5,7 @@ import { RPCClientError } from '@loafer/ng-rpc/protocol'; import * as DetailStore from '../../store/detail'; import { DetailSelector } from '../../store'; import { Probe } from '../../model'; -import { ConfirmationService, Message } from 'primeng/primeng'; +import { ConfirmationService } from 'primeng/primeng'; import * as CIDR from 'ip-cidr'; // import { SettingComponent as DiscoverySettingComponent } from 'packages/discovery/component/setting/setting.component'; diff --git a/src/packages/probe/component/download/download.component.html b/src/packages/probe/component/download/download.component.html index 20360fb..dd7e5b2 100644 --- a/src/packages/probe/component/download/download.component.html +++ b/src/packages/probe/component/download/download.component.html @@ -1,15 +1,16 @@ -
-
-
- -
-
- -
-
-
Windows Manual
-
Ubuntu Manual
-
CentOS Manual
-
-
-
\ No newline at end of file + + + + Content 1 + + + Content 2 + + + Content 3 + + \ No newline at end of file diff --git a/src/packages/probe/component/download/download.component.scss b/src/packages/probe/component/download/download.component.scss index 7baf0a7..e69de29 100644 --- a/src/packages/probe/component/download/download.component.scss +++ b/src/packages/probe/component/download/download.component.scss @@ -1,36 +0,0 @@ -.tab { - border: 1px solid #ccc; - background-color: #f1f1f1; - height: 100%; -} - -/* Style the buttons that are used to open the tab content */ -.tab button { - display: block; - background-color: inherit; - color: black; - padding: 22px 16px; - width: 100%; - border: none; - outline: none; - text-align: left; - cursor: pointer; - transition: 0.3s; -} - -/* Change background color of buttons on hover */ -.tab button:hover { - background-color: #ddd; -} - -/* Create an active/current "tab button" class */ -.tab button.active { - background-color: #ccc; -} - -/* Style the tab content */ -.tabcontent { - padding: 0px 12px; - border: 1px solid #ccc; - height: 100%; -} \ No newline at end of file diff --git a/src/packages/probe/component/download/download.component.ts b/src/packages/probe/component/download/download.component.ts index 7be7387..d9c5b3a 100644 --- a/src/packages/probe/component/download/download.component.ts +++ b/src/packages/probe/component/download/download.component.ts @@ -7,21 +7,8 @@ import { Component, OnInit } from '@angular/core'; }) export class DownloadComponent implements OnInit { - selected: string = undefined; - - OS_LIST = [ - 'Windows', - 'Ubuntu', - 'CentOS', - ]; - constructor() { } ngOnInit() { } - - handleTabSelection(osName: string) { - console.log(osName); - this.selected = osName; - } } diff --git a/src/packages/probe/component/list/list.component.html b/src/packages/probe/component/list/list.component.html index dcc4ddd..ad4f437 100644 --- a/src/packages/probe/component/list/list.component.html +++ b/src/packages/probe/component/list/list.component.html @@ -1,14 +1,11 @@ - + - - Recent Sales - Probe Name IP OS CIDR - Targets + Targets Authroized at Authroized by diff --git a/src/packages/probe/component/list/list.component.ts b/src/packages/probe/component/list/list.component.ts index 1e286d4..075e38e 100644 --- a/src/packages/probe/component/list/list.component.ts +++ b/src/packages/probe/component/list/list.component.ts @@ -18,9 +18,6 @@ import { ListSelector } from '../../store'; export class ListComponent implements OnInit, AfterContentInit { probes$ = this.store.pipe(select(ListSelector.select('probes'))); probes: Probe[]; - cols: any[]; - - selectedProbe: Probe; constructor( private router: Router, @@ -70,6 +67,6 @@ export class ListComponent implements OnInit, AfterContentInit { } onRowSelect(event) { - this.router.navigate(['probe', event.data.id]); + this.router.navigate(['probe', event.data.id, 'info']); } }