-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Control de errores, validaciones, guard
- Loading branch information
martinbobbio1@gmail.com
committed
Nov 9, 2018
1 parent
febc233
commit 77879bd
Showing
30 changed files
with
334 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
//Modules | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { FormsModule } from '@angular/forms'; | ||
import { RouterModule } from '@angular/router'; | ||
|
||
//Graphics Angular | ||
import { ChartsModule } from 'ng2-charts'; | ||
|
||
//Components | ||
import { NopagefoundComponent } from '../components/nopagefound/nopagefound.component'; | ||
import { HeaderComponent } from '../components/header/header.component'; | ||
import { SidebarComponent } from '../components/sidebar/sidebar.component'; | ||
import { BreadcumbsComponent } from '../components/breadcumbs/breadcumbs.component'; | ||
import { IncrementorComponent } from '../components/incrementor/incrementor.component'; | ||
import { ModalUploadComponent } from '../components/modal-upload/modal-upload.component'; | ||
import { GraphicDonutComponent } from '../components/graphic-donut/graphic-donut.component'; | ||
import { GraphicBarComponent } from '../components/graphic-bar/graphic-bar.component'; | ||
import { PipesModule } from '../pipes/pipes.module'; | ||
|
||
@NgModule({ | ||
imports:[ | ||
RouterModule, | ||
CommonModule, | ||
PipesModule, | ||
FormsModule, | ||
ChartsModule | ||
], | ||
declarations:[ | ||
NopagefoundComponent, | ||
HeaderComponent, | ||
SidebarComponent, | ||
BreadcumbsComponent, | ||
IncrementorComponent, | ||
ModalUploadComponent, | ||
GraphicDonutComponent, | ||
GraphicBarComponent, | ||
], | ||
exports:[ | ||
NopagefoundComponent, | ||
HeaderComponent, | ||
SidebarComponent, | ||
BreadcumbsComponent, | ||
IncrementorComponent, | ||
ModalUploadComponent, | ||
GraphicDonutComponent, | ||
GraphicBarComponent, | ||
] | ||
}) | ||
|
||
export class ComponentsModule{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<h4>{{title}}</h4> | ||
|
||
<div style="display:block"> | ||
<canvas baseChart [datasets]="barChartData" [labels]="barChartLabels" chartType="bar"></canvas> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Component, OnInit, Input } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-graphic-bar', | ||
templateUrl: './graphic-bar.component.html', | ||
styles: [] | ||
}) | ||
export class GraphicBarComponent implements OnInit { | ||
|
||
@Input('chartLabels') barChartLabels:string[] = []; | ||
@Input('chartData') barChartData:number[] = []; | ||
@Input() title:string; | ||
|
||
constructor() { } | ||
|
||
ngOnInit() { | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
.error-box { | ||
height: 100%; | ||
position: fixed; | ||
background: url(../../../assets/images/background/error-bg.jpg) no-repeat center center #fff; | ||
width: 100%; } | ||
.error-box .footer { | ||
width: 100%; | ||
left: 0px; | ||
right: 0px; } | ||
|
||
.error-body { | ||
padding-top: 5%; } | ||
.error-body h1 { | ||
font-size: 210px; | ||
font-weight: 900; | ||
text-shadow: 4px 4px 0 #ffffff, 6px 6px 0 #263238; | ||
line-height: 210px; } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<section id="wrapper" class="error-page"> | ||
<div class="error-box"> | ||
<div class="error-body text-center"> | ||
<h1>404</h1> | ||
<h3 class="text-uppercase">Page Not Found !</h3> | ||
<p class="text-muted m-t-30 m-b-30">Do you find a mouse</p> | ||
<a routerLink="/login" class="btn btn-info btn-rounded waves-effect waves-light m-b-40">Back to Login</a> </div> | ||
<footer class="footer text-center">© {{year}} Admin Pro.</footer> | ||
</div> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { CanActivate, Router } from '@angular/router'; | ||
import { UserService } from '../services/user/user.service'; | ||
|
||
@Injectable() | ||
export class AdminGuard implements CanActivate { | ||
|
||
constructor(public _userService:UserService, public router:Router){} | ||
|
||
canActivate(){ | ||
|
||
if(this._userService.user.role === 'ADMIN_ROLE') return true; | ||
else{ | ||
this._userService.logout(); | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.