From 7928c9ba4c277f6fa11bfd3b963d63d538229ac7 Mon Sep 17 00:00:00 2001 From: snoop Date: Tue, 30 Jan 2018 18:27:48 +0900 Subject: [PATCH 1/2] fixed infrapage --- .../commons/ui/material/material.module.ts | 4 ++-- ...le.ts => discovery-page-routing.module.ts} | 7 +++--- .../discovery/discovery-page.component.html | 3 +++ ...ent.scss => discovery-page.component.scss} | 0 ...ec.ts => discovery-page.component.spec.ts} | 12 +++++----- .../discovery/discovery-page.component.ts | 15 ++++++++++++ .../pages/discovery/discovery-page.module.ts | 17 ++++++++++++++ .../pages/discovery/discovery.component.html | 5 ---- .../pages/discovery/discovery.component.ts | 15 ------------ src/app/pages/discovery/discovery.module.ts | 23 ------------------- src/app/pages/infra/infra-page.component.html | 11 +++++---- src/app/pages/pages-routing.module.ts | 2 +- 12 files changed, 54 insertions(+), 60 deletions(-) rename src/app/pages/discovery/{discovery-routing.module.ts => discovery-page-routing.module.ts} (60%) create mode 100644 src/app/pages/discovery/discovery-page.component.html rename src/app/pages/discovery/{discovery.component.scss => discovery-page.component.scss} (100%) rename src/app/pages/discovery/{discovery.component.spec.ts => discovery-page.component.spec.ts} (52%) create mode 100644 src/app/pages/discovery/discovery-page.component.ts create mode 100644 src/app/pages/discovery/discovery-page.module.ts delete mode 100644 src/app/pages/discovery/discovery.component.html delete mode 100644 src/app/pages/discovery/discovery.component.ts delete mode 100644 src/app/pages/discovery/discovery.module.ts diff --git a/src/app/commons/ui/material/material.module.ts b/src/app/commons/ui/material/material.module.ts index 22f6bfd..1659aa0 100644 --- a/src/app/commons/ui/material/material.module.ts +++ b/src/app/commons/ui/material/material.module.ts @@ -7,7 +7,7 @@ import { MatToolbarModule, MatSnackBarModule, MatSidenavModule, MatTabsModule, MatSelectModule, MatRadioModule, MatAutocompleteModule, MatFormFieldModule, MatChipsModule, - MatDialogModule, + MatDialogModule, MatGridListModule } from '@angular/material'; const MATERIAL_MODULES: any[] = [ @@ -17,7 +17,7 @@ const MATERIAL_MODULES: any[] = [ MatToolbarModule, MatSnackBarModule, MatSidenavModule, MatTabsModule, MatSelectModule, MatRadioModule, MatAutocompleteModule, MatFormFieldModule, MatChipsModule, - MatDialogModule, + MatDialogModule, MatGridListModule ]; @NgModule({ diff --git a/src/app/pages/discovery/discovery-routing.module.ts b/src/app/pages/discovery/discovery-page-routing.module.ts similarity index 60% rename from src/app/pages/discovery/discovery-routing.module.ts rename to src/app/pages/discovery/discovery-page-routing.module.ts index 4d35ef3..06e62d9 100644 --- a/src/app/pages/discovery/discovery-routing.module.ts +++ b/src/app/pages/discovery/discovery-page-routing.module.ts @@ -1,11 +1,11 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; -import { DiscoveryComponent } from './discovery.component'; +import { DiscoveryPageComponent } from './discovery-page.component'; const routes: Routes = [ { path: '', - component: DiscoveryComponent, + component: DiscoveryPageComponent, } ]; @@ -13,4 +13,5 @@ const routes: Routes = [ imports: [RouterModule.forChild(routes)], exports: [RouterModule] }) -export class DiscoveryRoutingModule { } + +export class DiscoveryPageRoutingModule { } diff --git a/src/app/pages/discovery/discovery-page.component.html b/src/app/pages/discovery/discovery-page.component.html new file mode 100644 index 0000000..836bd4d --- /dev/null +++ b/src/app/pages/discovery/discovery-page.component.html @@ -0,0 +1,3 @@ +

+ discovery-page works! +

diff --git a/src/app/pages/discovery/discovery.component.scss b/src/app/pages/discovery/discovery-page.component.scss similarity index 100% rename from src/app/pages/discovery/discovery.component.scss rename to src/app/pages/discovery/discovery-page.component.scss diff --git a/src/app/pages/discovery/discovery.component.spec.ts b/src/app/pages/discovery/discovery-page.component.spec.ts similarity index 52% rename from src/app/pages/discovery/discovery.component.spec.ts rename to src/app/pages/discovery/discovery-page.component.spec.ts index 7a7d088..b9bd349 100644 --- a/src/app/pages/discovery/discovery.component.spec.ts +++ b/src/app/pages/discovery/discovery-page.component.spec.ts @@ -1,20 +1,20 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { DiscoveryComponent } from './discovery.component'; +import { DiscoveryPageComponent } from './discovery-page.component'; -describe('DiscoveryComponent', () => { - let component: DiscoveryComponent; - let fixture: ComponentFixture; +describe('DiscoveryPageComponent', () => { + let component: DiscoveryPageComponent; + let fixture: ComponentFixture; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ DiscoveryComponent ] + declarations: [ DiscoveryPageComponent ] }) .compileComponents(); })); beforeEach(() => { - fixture = TestBed.createComponent(DiscoveryComponent); + fixture = TestBed.createComponent(DiscoveryPageComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/src/app/pages/discovery/discovery-page.component.ts b/src/app/pages/discovery/discovery-page.component.ts new file mode 100644 index 0000000..fe82733 --- /dev/null +++ b/src/app/pages/discovery/discovery-page.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'of-discovery-page', + templateUrl: './discovery-page.component.html', + styleUrls: ['./discovery-page.component.scss'] +}) +export class DiscoveryPageComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/src/app/pages/discovery/discovery-page.module.ts b/src/app/pages/discovery/discovery-page.module.ts new file mode 100644 index 0000000..354d4ea --- /dev/null +++ b/src/app/pages/discovery/discovery-page.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { DiscoveryPageComponent } from './discovery-page.component'; +import { DiscoveryPageRoutingModule } from './discovery-page-routing.module'; + +import { DiscoveryModule } from '../../packages/discovery/discovery.module'; + +@NgModule({ + imports: [ + CommonModule, + DiscoveryPageRoutingModule, + DiscoveryModule + ], + declarations: [DiscoveryPageComponent] +}) +export class DiscoveryPageModule { } diff --git a/src/app/pages/discovery/discovery.component.html b/src/app/pages/discovery/discovery.component.html deleted file mode 100644 index c340618..0000000 --- a/src/app/pages/discovery/discovery.component.html +++ /dev/null @@ -1,5 +0,0 @@ -

- discovery works! -

- - \ No newline at end of file diff --git a/src/app/pages/discovery/discovery.component.ts b/src/app/pages/discovery/discovery.component.ts deleted file mode 100644 index 3820d71..0000000 --- a/src/app/pages/discovery/discovery.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'of-discovery', - templateUrl: './discovery.component.html', - styleUrls: ['./discovery.component.scss'] -}) -export class DiscoveryComponent implements OnInit { - - constructor() { } - - ngOnInit() { - } - -} diff --git a/src/app/pages/discovery/discovery.module.ts b/src/app/pages/discovery/discovery.module.ts deleted file mode 100644 index 9c78a4b..0000000 --- a/src/app/pages/discovery/discovery.module.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; - -import { DiscoveryComponent } from './discovery.component'; -import { DiscoveryRoutingModule } from './discovery-routing.module'; - -import { DiscoveryModule as DisModule } from '../../packages/discovery/discovery.module'; - -// import { MaterialModule } from 'app/commons/ui/material/material.module'; - -@NgModule({ - imports: [ - CommonModule, - DiscoveryRoutingModule, - DisModule, - // MaterialModule - ], - exports: [ - // MaterialModule - ], - declarations: [DiscoveryComponent] -}) -export class DiscoveryModule { } diff --git a/src/app/pages/infra/infra-page.component.html b/src/app/pages/infra/infra-page.component.html index 2cbe0e6..b639af6 100644 --- a/src/app/pages/infra/infra-page.component.html +++ b/src/app/pages/infra/infra-page.component.html @@ -7,11 +7,12 @@ -

- The Shiba Inu is the smallest of the six original and distinct spitz breeds of dog from Japan. - A small, agile dog that copes very well with mountainous terrain, the Shiba Inu was originally - bred for hunting. -

+ + 1 + 2 + 3 + 4 +
diff --git a/src/app/pages/pages-routing.module.ts b/src/app/pages/pages-routing.module.ts index 05bb1c9..88ec4fc 100644 --- a/src/app/pages/pages-routing.module.ts +++ b/src/app/pages/pages-routing.module.ts @@ -11,7 +11,7 @@ const routes: Routes = [ { path: 'home', loadChildren: './home/home-page.module#HomePageModule' }, { path: 'probes', loadChildren: './probes/probes-page.module#ProbesPageModule' }, - { path: 'discovery', loadChildren: './discovery/discovery.module#DiscoveryModule' }, + { path: 'discovery', loadChildren: './discovery/discovery-page.module#DiscoveryPageModule' }, { path: 'map', loadChildren: './infra/infra-page.module#InfraPageModule' }, ] } From 24efc692e2c6790ae90d94b95ae070028cc2183c Mon Sep 17 00:00:00 2001 From: insanity Date: Tue, 30 Jan 2018 18:52:03 +0900 Subject: [PATCH 2/2] layout arrange --- .../sub-menubar/sub-menubar.component.ts | 8 ++--- src/app/pages/pages.component.html | 2 +- src/app/pages/pages.component.ts | 31 +++++++++++++++++-- .../pages/probes/probes-page.component.html | 2 +- src/app/pages/probes/probes-page.component.ts | 6 ++++ 5 files changed, 39 insertions(+), 10 deletions(-) diff --git a/src/app/commons/layouts/sub-menubar/sub-menubar.component.ts b/src/app/commons/layouts/sub-menubar/sub-menubar.component.ts index f38dfa9..c8a3e0e 100644 --- a/src/app/commons/layouts/sub-menubar/sub-menubar.component.ts +++ b/src/app/commons/layouts/sub-menubar/sub-menubar.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, Input } from '@angular/core'; import { Router } from '@angular/router'; @Component({ @@ -8,11 +8,7 @@ import { Router } from '@angular/router'; }) export class SubMenubarComponent implements OnInit { - tabs = [ - {label: 'Probe', path: '/probes'}, - {label: 'Unauthorized', path: '/probes/noauth'}, - {label: 'Download', path: '/probes/download'}, - ]; + @Input() tabs: any; constructor(public router: Router) { } diff --git a/src/app/pages/pages.component.html b/src/app/pages/pages.component.html index 783ac93..05b90c1 100644 --- a/src/app/pages/pages.component.html +++ b/src/app/pages/pages.component.html @@ -26,7 +26,7 @@ -
+
diff --git a/src/app/pages/pages.component.ts b/src/app/pages/pages.component.ts index fcaeb8c..5cbea97 100644 --- a/src/app/pages/pages.component.ts +++ b/src/app/pages/pages.component.ts @@ -1,11 +1,12 @@ import { Component, OnInit, Input, OnChanges } from '@angular/core'; +import { MediaChange, ObservableMedia } from '@angular/flex-layout'; @Component({ selector: 'of-pages', templateUrl: './pages.component.html', styleUrls: ['./pages.component.scss'] }) -export class PagesComponent implements OnInit { +export class PagesComponent implements OnInit, OnChanges { @Input() isVisible = true; visibility = 'shown'; @@ -15,13 +16,39 @@ export class PagesComponent implements OnInit { matDrawerShow = true; sideNavMode = 'side'; - constructor() { } + constructor(private media: ObservableMedia) { } ngOnInit() { + this.media.subscribe((mediaChange: MediaChange) => { + this.toggleView(); + }); + } + ngOnChanges() { + this.visibility = this.isVisible ? 'shown' : 'hidden'; } getRouteAnimation(outlet) { return outlet.activatedRouteData.animation; } + + toggleView() { + if (this.media.isActive('gt-md')) { + this.sideNavMode = 'side'; + this.sideNavOpened = true; + this.matDrawerOpened = false; + this.matDrawerShow = true; + } else if (this.media.isActive('gt-xs')) { + this.sideNavMode = 'side'; + this.sideNavOpened = false; + this.matDrawerOpened = true; + this.matDrawerShow = true; + } else if (this.media.isActive('lt-sm')) { + this.sideNavMode = 'over'; + this.sideNavOpened = false; + this.matDrawerOpened = false; + this.matDrawerShow = false; + } + } + } diff --git a/src/app/pages/probes/probes-page.component.html b/src/app/pages/probes/probes-page.component.html index f50f543..93fb5f1 100644 --- a/src/app/pages/probes/probes-page.component.html +++ b/src/app/pages/probes/probes-page.component.html @@ -1,4 +1,4 @@
- +
\ 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 4c0b500..5dc01a9 100644 --- a/src/app/pages/probes/probes-page.component.ts +++ b/src/app/pages/probes/probes-page.component.ts @@ -7,6 +7,12 @@ import { Component, OnInit } from '@angular/core'; }) export class ProbesPageComponent implements OnInit { + tabs = [ + { label: 'Probe', path: '/probes' }, + { label: 'Unauthorized', path: '/probes/noauth' }, + { label: 'Download', path: '/probes/download' }, + ]; + constructor() { } ngOnInit() {