Skip to content

Commit

Permalink
src
Browse files Browse the repository at this point in the history
  • Loading branch information
VanessaHuertas committed May 18, 2018
1 parent 96d4cda commit c431f00
Show file tree
Hide file tree
Showing 56 changed files with 978 additions and 0 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<div *ngIf="alerta">
<h2>{{ alerta.tipoAlerta }}</h2>

<div><span>Cantidad Alertas: </span>{{ alerta.cantidadAlertas }}</div>

<div>
<label>Tipo Alerta:
<input [(ngModel)]="alerta.tipoAlerta" placeholder="Tipo Alerta">
</label>
</div>

<button (click)="goBack()">Retroceder</button>

</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { AlertaDetailComponent } from './alerta-detail.component';

describe('AlertaDetailComponent', () => {
let component: AlertaDetailComponent;
let fixture: ComponentFixture<AlertaDetailComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AlertaDetailComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(AlertaDetailComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Component, OnInit, Input} from '@angular/core';
import { Alerta } from '../alerta';
import { ActivatedRoute } from '@angular/router';
import { Location } from '@angular/common';

import { AlertaService } from '../alerta.service';

@Component({
selector: 'app-alerta-detail',
templateUrl: './alerta-detail.component.html',
styleUrls: ['./alerta-detail.component.css']
})
export class AlertaDetailComponent implements OnInit {

@Input() alerta: Alerta;

constructor(
private route: ActivatedRoute,
private alertaService: AlertaService,
private location: Location
) { }

ngOnInit(): void {
this.getAlerta();
}

getAlerta(): void {
const cantidadAlertas = +this.route.snapshot.paramMap.get('cantidadAlertas');
this.alertaService.getAlerta(cantidadAlertas).subscribe(alerta => this.alerta = alerta);
}

goBack(): void {
this.location.back();
}
}
15 changes: 15 additions & 0 deletions Front/SoftSecurity/src/app/alerta.service.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { TestBed, inject } from '@angular/core/testing';

import { AlertaService } from './alerta.service';

describe('AlertaService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [AlertaService]
});
});

it('should be created', inject([AlertaService], (service: AlertaService) => {
expect(service).toBeTruthy();
}));
});
26 changes: 26 additions & 0 deletions Front/SoftSecurity/src/app/alerta.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Injectable } from '@angular/core';
import { Alerta } from './alerta';
import { ALERTAS } from './alertas';
import { Observable, of } from 'rxjs';

@Injectable({
providedIn: 'root'
})

export class AlertaService {

constructor() { }

getAlertas(): Observable<Alerta[]> {
// TODO: send the message _after_ fetching the heroes
//this.mensajeService.add(`AlertaService: fetched alertas`);
return of(ALERTAS);
}

getAlerta(cantidadAlertas: number): Observable<Alerta> {
// TODO: send the message _after_ fetching the heroes
//this.mensajeService.add(`HeroService: fetched hero cantidadAlertas=${cantidadAlertas}`);
return of(ALERTAS.find(alerta => alerta.cantidadAlertas === cantidadAlertas));
}

}
4 changes: 4 additions & 0 deletions Front/SoftSecurity/src/app/alerta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export class Alerta {
cantidadAlertas: number;
tipoAlerta: string;
}
Empty file.
3 changes: 3 additions & 0 deletions Front/SoftSecurity/src/app/alerta/alerta.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<p>
alerta works!
</p>
25 changes: 25 additions & 0 deletions Front/SoftSecurity/src/app/alerta/alerta.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { AlertaComponent } from './alerta.component';

describe('AlertaComponent', () => {
let component: AlertaComponent;
let fixture: ComponentFixture<AlertaComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AlertaComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(AlertaComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
15 changes: 15 additions & 0 deletions Front/SoftSecurity/src/app/alerta/alerta.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-alerta',
templateUrl: './alerta.component.html',
styleUrls: ['./alerta.component.css']
})
export class AlertaComponent implements OnInit {

constructor() { }

ngOnInit() {
}

}
6 changes: 6 additions & 0 deletions Front/SoftSecurity/src/app/alertas.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Alerta } from './alerta';

export const ALERTAS: Alerta[] = [
{ cantidadAlertas: 4, tipoAlerta: 'puerta Abierta'},
{ cantidadAlertas: 7, tipoAlerta: 'contrasenha Incorrecta'}
];
13 changes: 13 additions & 0 deletions Front/SoftSecurity/src/app/app-routing.module.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { AppRoutingModule } from './app-routing.module';

describe('AppRoutingModule', () => {
let appRoutingModule: AppRoutingModule;

beforeEach(() => {
appRoutingModule = new AppRoutingModule();
});

it('should create an instance', () => {
expect(appRoutingModule).toBeTruthy();
});
});
21 changes: 21 additions & 0 deletions Front/SoftSecurity/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { SoftsecurityComponent } from './softsecurity/softsecurity.component';
import { AlertaDetailComponent } from './alerta-detail/alerta-detail.component';


const routes: Routes = [
{ path: '', redirectTo: '/dashboard', pathMatch: 'full' },
{ path: 'detail/:id', component: AlertaDetailComponent },
{ path: 'alertas', component: SoftsecurityComponent }
];

@NgModule({
imports: [ RouterModule.forRoot(routes) ],
exports: [ RouterModule ]
})

export class AppRoutingModule {}



32 changes: 32 additions & 0 deletions Front/SoftSecurity/src/app/app.component.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* Application-wide Styles */
h1 {
color: #5a001b;
font-family: Arial, Helvetica, sans-serif;
font-size: 800%;
}
h2, h3 {
color: #444;
font-family: Arial, Helvetica, sans-serif;
font-weight: lighter;
font-size: 2em;
margin-top: 0;
padding-top: 0;
}
nav a {
padding: 5px 10px;
text-decoration: none;
margin-top: 10px;
display: inline-block;
background-color: #eee;
border-radius: 4px;
}
nav a:visited, a:link {
color: #607D8B;
}
nav a:hover {
color: #039be5;
background-color: #CFD8DC;
}
nav a.active {
color: #039be5;
}
19 changes: 19 additions & 0 deletions Front/SoftSecurity/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!--The content below is only a placeholder and can be replaced.-->
<body>

<div style="text-align:center">
<h1>{{title}}</h1>
<nav>
<br>
<a routerLink="/alertas"> Alertas</a>
</nav>
<router-outlet></router-outlet>
<app-mapa></app-mapa>
</div>

</body>





27 changes: 27 additions & 0 deletions Front/SoftSecurity/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent
],
}).compileComponents();
}));
it('should create the app', async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
it(`should have as title 'app'`, async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('app');
}));
it('should render title in a h1 tag', async(() => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!');
}));
});
10 changes: 10 additions & 0 deletions Front/SoftSecurity/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Component } from '@angular/core';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'SoftSecurity';
}
33 changes: 33 additions & 0 deletions Front/SoftSecurity/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';
import { SoftsecurityComponent } from './softsecurity/softsecurity.component';

import { FormsModule } from '@angular/forms';
import { AlertaDetailComponent } from './alerta-detail/alerta-detail.component';
import { AppRoutingModule } from './/app-routing.module';
import { MapaComponent } from './mapa/mapa.component';
import { AlertaComponent } from './alerta/alerta.component';
import { FalloComponent } from './fallo/fallo.component';
import { FalloDetailComponent } from './fallo-detail/fallo-detail.component';

@NgModule({
declarations: [
AppComponent,
SoftsecurityComponent,
AlertaDetailComponent,
MapaComponent,
AlertaComponent,
FalloComponent,
FalloDetailComponent
],
imports: [
BrowserModule,
FormsModule,
AppRoutingModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<p>
fallo-detail works!
</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { FalloDetailComponent } from './fallo-detail.component';

describe('FalloDetailComponent', () => {
let component: FalloDetailComponent;
let fixture: ComponentFixture<FalloDetailComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FalloDetailComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(FalloDetailComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
15 changes: 15 additions & 0 deletions Front/SoftSecurity/src/app/fallo-detail/fallo-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: 'app-fallo-detail',
templateUrl: './fallo-detail.component.html',
styleUrls: ['./fallo-detail.component.css']
})
export class FalloDetailComponent implements OnInit {

constructor() { }

ngOnInit() {
}

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

0 comments on commit c431f00

Please sign in to comment.