Skip to content

Commit

Permalink
chore(app-shell): Generate file structure for features
Browse files Browse the repository at this point in the history
  • Loading branch information
pkurochka committed Mar 9, 2018
1 parent 8407ffc commit 7f27941
Show file tree
Hide file tree
Showing 51 changed files with 546 additions and 37 deletions.
8 changes: 7 additions & 1 deletion src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { SitesPageComponent } from './sites/containers/sites-page/sites-page.component';
import { NotFoundPageComponent } from './core/containers/not-found-page/not-found-page.component';

const routes: Routes = [];
const routes: Routes = [
{ path: '', redirectTo: 'sites', pathMatch: 'full' },
{ path: 'sites', component: SitesPageComponent },
{ path: '**', component: NotFoundPageComponent },
];

@NgModule({
imports: [RouterModule.forRoot(routes)],
Expand Down
28 changes: 0 additions & 28 deletions src/app/app.component.html

This file was deleted.

13 changes: 6 additions & 7 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,26 @@ import { StoreDevtoolsModule } from '@ngrx/store-devtools';
import { ChartsModule } from 'ng2-charts/ng2-charts';

import { AppRoutingModule } from './app-routing.module';
import { MaterialModule } from './materal/material.module';
import { CoreModule } from './core/core.module';
import { SitesModule } from './sites/sites.module';

import { AppComponent } from './app.component';
import { AppComponent } from './core/containers/app/app.component';
import { reducers, metaReducers } from './reducers';
import { AppEffects } from './effects/app.effects';
import { environment } from '../environments/environment';


@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
BrowserAnimationsModule,
AppRoutingModule,
MaterialModule,
StoreModule.forRoot(reducers, { metaReducers }),
!environment.production ? StoreDevtoolsModule.instrument() : [],
EffectsModule.forRoot([AppEffects]),
ChartsModule
ChartsModule,
CoreModule,
SitesModule
],
providers: [],
bootstrap: [AppComponent]
Expand Down
3 changes: 3 additions & 0 deletions src/app/core/components/navbar/navbar.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<mat-toolbar color="primary">
<span>SmartGreen analytics</span>
</mat-toolbar>
File renamed without changes.
15 changes: 15 additions & 0 deletions src/app/core/components/navbar/navbar.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'sga-navbar',
templateUrl: './navbar.component.html',
styleUrls: ['./navbar.component.scss']
})
export class NavbarComponent implements OnInit {

constructor() { }

ngOnInit() {
}

}
2 changes: 2 additions & 0 deletions src/app/core/containers/app/app.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<sga-navbar></sga-navbar>
<router-outlet></router-outlet>
Empty file.
File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions src/app/core/containers/not-found-page/not-found-page.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Component, ChangeDetectionStrategy } from '@angular/core';

@Component({
selector: 'sga-not-found-page',
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<mat-card>
<mat-card-title>404: Not Found</mat-card-title>
<mat-card-content>
<p>Hey! It looks like this page doesn't exist yet.</p>
</mat-card-content>
<mat-card-actions>
<button mat-raised-button color="primary" routerLink="/">Take Me Home</button>
</mat-card-actions>
</mat-card>
`,
styles: [
`
:host {
text-align: center;
}
`,
],
})
export class NotFoundPageComponent { }
25 changes: 25 additions & 0 deletions src/app/core/core.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import { MaterialModule } from '../materal/material.module';

import { AppComponent } from './containers/app/app.component';
import { NotFoundPageComponent } from './containers/not-found-page/not-found-page.component';
import { NavbarComponent } from './components/navbar/navbar.component';

const COMPONENTS = [
AppComponent ,
NavbarComponent,
NotFoundPageComponent
];

@NgModule({
imports: [
CommonModule,
RouterModule,
MaterialModule
],
declarations: COMPONENTS,
exports: COMPONENTS
})
export class CoreModule { }
5 changes: 4 additions & 1 deletion src/app/materal/material.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { NgModule } from '@angular/core';
import { MatToolbarModule, MatCardModule, MatButtonModule } from '@angular/material';

const MODULES = [

MatToolbarModule,
MatCardModule,
MatButtonModule
];

@NgModule({
Expand Down
10 changes: 10 additions & 0 deletions src/app/shared/models/equip.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { ITimeserie } from './timeserie';

export interface IEquip {
equip_name: string;
time: string;
S3avg: number;
S4avg: number;
TempAvg: number;
timeseries?: ITimeserie[];
}
7 changes: 7 additions & 0 deletions src/app/shared/models/site.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { IEquip } from './equip';

export interface ISite {
site: string;
equips?: IEquip[];
preview?: string;
}
4 changes: 4 additions & 0 deletions src/app/shared/models/timeserie.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface ITimeserie {
hour: number;
temperature: number;
}
11 changes: 11 additions & 0 deletions src/app/sites/actions/sites.actions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Action } from '@ngrx/store';

export enum SitesActionTypes {
SitesAction = '[Sites] Action'
}

export class Sites implements Action {
readonly type = SitesActionTypes.SitesAction;
}

export type SitesActions = Sites;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<p>
equip-analytics works!
</p>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'sga-equip-analytics',
templateUrl: './equip-analytics.component.html',
styleUrls: ['./equip-analytics.component.scss']
})
export class EquipAnalyticsComponent implements OnInit {

constructor() { }

ngOnInit() {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<p>
site-detail works!
</p>
Empty file.
15 changes: 15 additions & 0 deletions src/app/sites/components/site-detail/site-detail.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'sga-site-detail',
templateUrl: './site-detail.component.html',
styleUrls: ['./site-detail.component.scss']
})
export class SiteDetailComponent implements OnInit {

constructor() { }

ngOnInit() {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<p>
site-preview-list works!
</p>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'sga-site-preview-list',
templateUrl: './site-preview-list.component.html',
styleUrls: ['./site-preview-list.component.scss']
})
export class SitePreviewListComponent implements OnInit {

constructor() { }

ngOnInit() {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<p>
site-preview works!
</p>
Empty file.
15 changes: 15 additions & 0 deletions src/app/sites/components/site-preview/site-preview.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'sga-site-preview',
templateUrl: './site-preview.component.html',
styleUrls: ['./site-preview.component.scss']
})
export class SitePreviewComponent implements OnInit {

constructor() { }

ngOnInit() {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<p>
equipment-analytics-page works!
</p>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { EquipmentAnalyticsPageComponent } from './equipment-analytics-page.component';
import { Store, StoreModule } from '@ngrx/store';

describe('EquipmentAnalyticsPageComponent', () => {
let component: EquipmentAnalyticsPageComponent;
let fixture: ComponentFixture<EquipmentAnalyticsPageComponent>;
let store: Store<any>;

beforeEach(async() => {
TestBed.configureTestingModule({
imports: [ StoreModule.forRoot({}) ],
declarations: [ EquipmentAnalyticsPageComponent ]
});

await TestBed.compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(EquipmentAnalyticsPageComponent);
component = fixture.componentInstance;
store = TestBed.get(Store);

spyOn(store, 'dispatch').and.callThrough();
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Component, OnInit } from '@angular/core';
import { Store } from '@ngrx/store';
import { SitesState } from '../../reducers/index';

@Component({
selector: 'sga-equipment-analytics-page',
templateUrl: './equipment-analytics-page.component.html',
styleUrls: ['./equipment-analytics-page.component.scss']
})
export class EquipmentAnalyticsPageComponent implements OnInit {

constructor(private store: Store<SitesState>) { }

ngOnInit() {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<p>
site-details-page works!
</p>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { SiteDetailsPageComponent } from './site-details-page.component';
import { Store, StoreModule } from '@ngrx/store';

describe('SiteDetailsPageComponent', () => {
let component: SiteDetailsPageComponent;
let fixture: ComponentFixture<SiteDetailsPageComponent>;
let store: Store<any>;

beforeEach(async() => {
TestBed.configureTestingModule({
imports: [ StoreModule.forRoot({}) ],
declarations: [ SiteDetailsPageComponent ]
});

await TestBed.compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(SiteDetailsPageComponent);
component = fixture.componentInstance;
store = TestBed.get(Store);

spyOn(store, 'dispatch').and.callThrough();
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Component, OnInit } from '@angular/core';
import { Store } from '@ngrx/store';
import { SitesState } from '../../reducers/index';

@Component({
selector: 'sga-site-details-page',
templateUrl: './site-details-page.component.html',
styleUrls: ['./site-details-page.component.scss']
})
export class SiteDetailsPageComponent implements OnInit {

constructor(private store: Store<SitesState>) { }

ngOnInit() {
}

}
3 changes: 3 additions & 0 deletions src/app/sites/containers/sites-page/sites-page.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<p>
sites-page works!
</p>
Empty file.
Loading

0 comments on commit 7f27941

Please sign in to comment.