diff --git a/backend/src/main/java/appSpring/restController/UserRestController.java b/backend/src/main/java/appSpring/restController/UserRestController.java index a988920..0efc10c 100644 --- a/backend/src/main/java/appSpring/restController/UserRestController.java +++ b/backend/src/main/java/appSpring/restController/UserRestController.java @@ -35,6 +35,7 @@ public class UserRestController { public interface UserDetail extends User.Basic, User.Act, User.Fin, Fine.Basic, Action.Basic {} + public interface UserBasic extends User.LoginInt {} @Autowired private UserService userService; @@ -84,7 +85,7 @@ public ResponseEntity getUser(@PathVariable int id, Authentication authent } @CrossOrigin(origins = "http://localhost:4200") - @JsonView(UserDetail.class) + @JsonView(UserBasic.class) @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) public ResponseEntity deleteUser(@PathVariable Integer id, HttpSession session, Authentication authentication) { diff --git a/backend/target/appSpring-0.0.1.jar b/backend/target/appSpring-0.0.1.jar index edb645a..1c899f0 100644 Binary files a/backend/target/appSpring-0.0.1.jar and b/backend/target/appSpring-0.0.1.jar differ diff --git a/backend/target/appSpring-0.0.1.jar.original b/backend/target/appSpring-0.0.1.jar.original index 0ca9392..08a8a41 100644 Binary files a/backend/target/appSpring-0.0.1.jar.original and b/backend/target/appSpring-0.0.1.jar.original differ diff --git a/frontend/src/app/app.component.ts b/frontend/src/app/app.component.ts index 314b013..e0e263c 100644 --- a/frontend/src/app/app.component.ts +++ b/frontend/src/app/app.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import {Component, OnDestroy} from '@angular/core'; @Component({ @@ -6,9 +6,13 @@ import { Component } from '@angular/core'; templateUrl: 'app.component.html', styleUrls: ['./app.component.css'] }) -export class AppComponent { +export class AppComponent implements OnDestroy { constructor() { - localStorage.clear(); } + + ngOnDestroy() { + console.log('Killing proccesses...'); + } + } diff --git a/frontend/src/app/component/admin/admin-routing.module.ts b/frontend/src/app/component/admin/admin-routing.module.ts index e23eb1d..2589259 100644 --- a/frontend/src/app/component/admin/admin-routing.module.ts +++ b/frontend/src/app/component/admin/admin-routing.module.ts @@ -30,8 +30,8 @@ const adminRoutes: Routes = [ {path: 'loans', component: ManageLoansComponent}, {path: 'fines', component: ManageFinesComponent}, {path: 'users', component: ManageUsersComponent}, - {path: 'user/:id', component: EditUserComponent}, - {path: 'user/new', component: CreateUserComponent}, + {path: 'users/new', component: CreateUserComponent}, + {path: 'users/:id', component: EditUserComponent}, {path: '', component: DashboardComponent} ] } diff --git a/frontend/src/app/component/admin/admin.component.html b/frontend/src/app/component/admin/admin.component.html index 2407017..b58c8e1 100644 --- a/frontend/src/app/component/admin/admin.component.html +++ b/frontend/src/app/component/admin/admin.component.html @@ -1,13 +1,10 @@
- -
- -
+
Copyright © 2017 BREMS. Todos los derechos reservados.
diff --git a/frontend/src/app/component/admin/admin.component.ts b/frontend/src/app/component/admin/admin.component.ts index 7ccc087..e50156e 100644 --- a/frontend/src/app/component/admin/admin.component.ts +++ b/frontend/src/app/component/admin/admin.component.ts @@ -1,7 +1,17 @@ -import { Component } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; + +import {SessionService} from '../../service/session.service'; +import {UserService} from '../../service/user.service'; @Component({ templateUrl: './admin.component.html' }) -export class AdminComponent { +export class AdminComponent implements OnInit { + + constructor(private sessionService: SessionService) { + } + + ngOnInit() { + } + } diff --git a/frontend/src/app/component/admin/admin.module.ts b/frontend/src/app/component/admin/admin.module.ts index 3d909be..0995dcd 100644 --- a/frontend/src/app/component/admin/admin.module.ts +++ b/frontend/src/app/component/admin/admin.module.ts @@ -1,5 +1,7 @@ import {NgModule} from '@angular/core'; import {CommonModule} from '@angular/common'; +import {NgbModule} from '@ng-bootstrap/ng-bootstrap'; +import {FormsModule} from '@angular/forms'; import {AdminComponent} from './admin.component'; @@ -18,7 +20,9 @@ import {DashboardComponent} from './dashboard/dashboard.component'; @NgModule({ imports: [ CommonModule, - AdminRoutingModule + AdminRoutingModule, + NgbModule, + FormsModule ], declarations: [ AdminComponent, diff --git a/frontend/src/app/component/admin/dashboard/dashboard.component.css b/frontend/src/app/component/admin/dashboard/dashboard.component.css deleted file mode 100644 index e69de29..0000000 diff --git a/frontend/src/app/component/admin/dashboard/dashboard.component.spec.ts b/frontend/src/app/component/admin/dashboard/dashboard.component.spec.ts deleted file mode 100644 index 9c996c3..0000000 --- a/frontend/src/app/component/admin/dashboard/dashboard.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { DashboardComponent } from './dashboard.component'; - -describe('DashboardComponent', () => { - let component: DashboardComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ DashboardComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(DashboardComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/frontend/src/app/component/admin/dashboard/dashboard.component.ts b/frontend/src/app/component/admin/dashboard/dashboard.component.ts index d18e3f6..030f9d9 100644 --- a/frontend/src/app/component/admin/dashboard/dashboard.component.ts +++ b/frontend/src/app/component/admin/dashboard/dashboard.component.ts @@ -1,15 +1,20 @@ import { Component, OnInit } from '@angular/core'; +import {Router} from '@angular/router'; + +import {SessionService} from '../../../service/session.service'; @Component({ selector: 'app-dashboard', - templateUrl: './dashboard.component.html', - styleUrls: ['./dashboard.component.css'] + templateUrl: 'dashboard.component.html' }) export class DashboardComponent implements OnInit { - constructor() { } + constructor(private router: Router, private sessionService: SessionService) { } ngOnInit() { + if (!this.sessionService.checkCredentials()) { + this.router.navigate(["/login"]); + } } } diff --git a/frontend/src/app/component/admin/header/header.component.css b/frontend/src/app/component/admin/header/header.component.css deleted file mode 100644 index e6d2e63..0000000 --- a/frontend/src/app/component/admin/header/header.component.css +++ /dev/null @@ -1,35 +0,0 @@ -header .logo img { - height: 4vw; - width: 5vw; - padding-right: 10px; - margin-right: 10px; - border-right: 1px solid #3b3a3b; -} - -a.logo { - height: 4vw; - text-align: left; -} - -.main-header .logo .logo-mini { - display: inline-block; -} - -.logo span.logo-mini { - font-size: 0.9vw; - vertical-align: top; - margin-top: -4.5vw; - margin-left: 5.5vw; - width: 11vw; - height: 4vw; -} -.logo span.br { - margin-top: -6.7vw; -} - -.skin-blue .main-header .logo { - background-color: rgba(180, 175, 0, 0.52); - color: #fff; - border-bottom: 0 solid transparent; - font-weight: bold; -} diff --git a/frontend/src/app/component/admin/header/header.component.html b/frontend/src/app/component/admin/header/header.component.html index 04f6674..8921fad 100644 --- a/frontend/src/app/component/admin/header/header.component.html +++ b/frontend/src/app/component/admin/header/header.component.html @@ -1,11 +1,8 @@
- - -