diff --git a/dmp-frontend/src/app/app.component.ts b/dmp-frontend/src/app/app.component.ts index aa430ebb5..3342a1ce6 100644 --- a/dmp-frontend/src/app/app.component.ts +++ b/dmp-frontend/src/app/app.component.ts @@ -7,7 +7,6 @@ import { JsonObjest } from '../app/entities/JsonObject.class'; @Component({ selector: 'app-root', template: ` - `, diff --git a/dmp-frontend/src/app/app.module.ts b/dmp-frontend/src/app/app.module.ts index 58cb2a3c7..3fe832bb4 100644 --- a/dmp-frontend/src/app/app.module.ts +++ b/dmp-frontend/src/app/app.module.ts @@ -25,6 +25,8 @@ import { ProjectsModule } from './projects/project.module'; import { PaginationService } from './services/pagination.service'; import { EestoreService } from './services/eestore.service'; import { DatasetsModule } from './datasets/dataset.module'; +import { DmpModule } from './dmps/dmp.module'; +import { TabModule } from './tabs/tab.module'; @NgModule({ declarations: [ @@ -43,10 +45,12 @@ import { DatasetsModule } from './datasets/dataset.module'; FormsModule, HttpModule, HttpClientModule, + TabModule, ProjectsModule, + DmpModule, DatasetsModule, AppRoutingModule, - DataTableModule + DataTableModule ], providers: [ServerService, dataModelBuilder, AuthGuard, PaginationService, TokenService, LocalStorageService, RestBase, EestoreService], diff --git a/dmp-frontend/src/app/datasets/dataset.component.ts b/dmp-frontend/src/app/datasets/dataset.component.ts index 0836fb96d..5cb427a8e 100644 --- a/dmp-frontend/src/app/datasets/dataset.component.ts +++ b/dmp-frontend/src/app/datasets/dataset.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, Input, ViewChild, NgZone } from '@angular/core'; +import { Component, OnInit, Input, ViewChild, NgZone ,Output ,EventEmitter} from '@angular/core'; import {GoogleSignInSuccess} from 'angular-google-signin'; import { Router, ActivatedRoute } from '@angular/router'; import { ServerService } from '../../app/services/server.service'; @@ -36,6 +36,19 @@ export class DatasetsComponent implements OnInit{ @ViewChild(DataTable) projectsTable; + dataSetValue:boolean + @Input() + get dataSetVisibe(){ + return this.dataSetValue; + } + @Output() + public dataSetValueChange = new EventEmitter(); + + set dataSetVisibe(value:any){ + this.dataSetValue = value + this.dataSetValueChange.emit(this.dataSetValue) + } + constructor( private serverService: ServerService, private route: ActivatedRoute, @@ -47,7 +60,7 @@ export class DatasetsComponent implements OnInit{ ngOnInit() { //this.projects = this.serverService.getDummyProjects(); this.datasets = []; - this.serverService.getAllDatasets().subscribe( + this.serverService.getAllDataSet().subscribe( response => { console.log("response"); diff --git a/dmp-frontend/src/app/dmps/dmp-routing.module.ts b/dmp-frontend/src/app/dmps/dmp-routing.module.ts new file mode 100644 index 000000000..e4af83e00 --- /dev/null +++ b/dmp-frontend/src/app/dmps/dmp-routing.module.ts @@ -0,0 +1,21 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; + +import { DmpComponent } from './dmp.component'; +import { DynamicFormComponent } from '../form/dynamic-form.component'; +import { AuthGuard } from '../guards/auth.guard'; + +const projectsRoutes: Routes = [ + { path: 'tabs/dmps', component: DmpComponent }, + { path: 'dynamic-form/:id', component: DynamicFormComponent, canActivate: [AuthGuard] } +]; + +@NgModule({ + imports: [ + RouterModule.forChild(projectsRoutes) + ], + exports: [ + RouterModule + ] +}) +export class DmpRoutingModule { } \ No newline at end of file diff --git a/dmp-frontend/src/app/dmps/dmp.component.ts b/dmp-frontend/src/app/dmps/dmp.component.ts new file mode 100644 index 000000000..dd670130f --- /dev/null +++ b/dmp-frontend/src/app/dmps/dmp.component.ts @@ -0,0 +1,160 @@ +import { Component, OnInit, Input, Output, EventEmitter, ViewChild } from '@angular/core'; +import {GoogleSignInSuccess} from 'angular-google-signin'; +import { Router, ActivatedRoute } from '@angular/router'; +import { ServerService } from '../../app/services/server.service'; +import { Dmp } from '../entities/model/Dmp'; +import { Dataset } from '../entities/model/dataset'; +import { Project } from '../entities/model/project'; +import { DataTable, DataTableTranslations, DataTableResource } from 'angular-4-data-table-bootstrap-4'; +import { DropdownField } from '../../app/form/fields/dropdown/field-dropdown'; +import { Param } from '../entities/model/param'; +import { ModalComponent } from '../modal/modal.component'; +import { HttpErrorResponse } from '@angular/common/http'; +import { FormGroup, FormControl } from '@angular/forms'; //na dw an xreiazontai +import { NgForm } from '@angular/forms'; + +@Component({ + selector: 'dmps', + templateUrl: 'dmps.html', + providers: [ServerService] +}) + +export class DmpComponent implements OnInit{ + @Input() dmps: Dmp[]; + dmp:any; + dmpResource :DataTableResource; + @Input() dmpCount = 0; + @Input() projectsDropDown:DropdownField; + //@Input() dataSetVisibe:boolean; + @Input() projects: Project[]; + + @ViewChild(DataTable) dmpsTable; + @ViewChild(DataTable) datasetsTable; + @ViewChild('isignOutBtn') isignOutBtn; + + constructor( + private serverService: ServerService, + private route: ActivatedRoute, + private router: Router){ + this.projectsDropDown = new DropdownField(); + this.projectsDropDown.options = []; + this.projects = []; + this.dmp = { + label: '', + abbreviation:'', + reference:'', + uri:'', + definition:'' + } + } + + ngOnInit() { + //this.projects = this.serverService.getDummyProjects(); + gapi.load('auth2', function() { + gapi.auth2.init({}); + }); + this.dmps = []; + this.serverService.getDmpOfUser().subscribe( + response => { + debugger; + + response.forEach(resp => { + let pr = new Dmp(); + pr.id = resp.id; + pr.id = resp.label; + pr.name = resp.abbreviation; + pr.dataset = resp.definition; + this.dmps.push(pr); + var params = {limit:8,offset:0, sortAsc:false} + this.afterLoad(); + this.dmpResource.query(params).then(dmps => this.dmps = dmps); + } + ); + }, + (err: HttpErrorResponse) => { + if (err.error instanceof Error) { + // A client-side or network error occurred. Handle it accordingly. + console.log('An error occurred:', err.error.message); + } else { + // The backend returned an unsuccessful response code. + // The response body may contain clues as to what went wrong, + if(err.status == 401){ + this.isignOutBtn.nativeElement.click(); + } + console.log(`Backend returned code ${err.status}, body was: ${err.error}`); + } + } + ); + + this.serverService.getAllProjects().subscribe( + response => { + console.log("response"); + console.log(response); + //let params = new Param(); + response.forEach((dmp) => { + let params = new Param(); + params.key = dmp.id; + params.value = dmp.label; + this.projectsDropDown.options.push(params); + }); + + } + ) + } + +reloadDmps(params) { + this.dmpResource = new DataTableResource(this.dmps); + this.dmpResource.query(params).then(projects => this.dmps = projects); +} + +afterLoad(){ + this.dmpResource = new DataTableResource(this.dmps); + this.dmpResource.count().then(count => this.dmpCount = count); +} + +myFunction() { + var input, filter, table, tr, td, i; + input = document.getElementById("myInput"); + filter = input.value.toUpperCase(); + table = document.getElementById("projects-grid"); + tr = table.getElementsByTagName("tr"); + for (i = 0; i < tr.length; i++) { + td = tr[i].getElementsByTagName("td")[3]; + if (td) { + if (td.innerText.toUpperCase().indexOf(filter) > -1) { + tr[i].style.display = ""; + } else { + tr[i].style.display = "none"; + } + } + } +} + + +SaveNewDmp(){ debugger; + console.log(this.dmp, this.dmp.projectsDropDownKey); + //this.http.post('http://someurl', JSON.stringify(this.project)) + this.serverService.createDmpForProject(this.dmp, this.dmp.projectsDropDownKey) + .subscribe( + response =>{ + console.log("response"); + console.log(response); + } + ); +} + + // special params: + translations = { + indexColumn: 'Index column', + expandColumn: 'Expand column', + selectColumn: 'Select column', + paginationLimit: 'Max results', + paginationRange: 'Result range' +}; + +signOut() { +     this.serverService.logOut(); +} + + +} diff --git a/dmp-frontend/src/app/dmps/dmp.module.ts b/dmp-frontend/src/app/dmps/dmp.module.ts new file mode 100644 index 000000000..704ced605 --- /dev/null +++ b/dmp-frontend/src/app/dmps/dmp.module.ts @@ -0,0 +1,24 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import {DataTableModule } from 'angular-4-data-table-bootstrap-4'; + +import { DmpComponent } from './dmp.component'; + +import { DmpRoutingModule } from './dmp-routing.module'; +import { DatasetsModule } from '../datasets/dataset.module'; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + DmpRoutingModule, + DataTableModule, + DatasetsModule + ], + declarations: [ + DmpComponent + ], + providers: [ ] +}) +export class DmpModule {} \ No newline at end of file diff --git a/dmp-frontend/src/app/dmps/dmps.html b/dmp-frontend/src/app/dmps/dmps.html new file mode 100644 index 000000000..93da07a85 --- /dev/null +++ b/dmp-frontend/src/app/dmps/dmps.html @@ -0,0 +1,116 @@ + + +
+
+ Filter: + +
+ + + + + + + + + + + + + + + + + + + +
+ Selected: + +
+ + + + +
+ + + + + + + + + + +Sign out + \ No newline at end of file diff --git a/dmp-frontend/src/app/form/dynamic-form.component.ts b/dmp-frontend/src/app/form/dynamic-form.component.ts index a3c18ff6b..77378e34a 100644 --- a/dmp-frontend/src/app/form/dynamic-form.component.ts +++ b/dmp-frontend/src/app/form/dynamic-form.component.ts @@ -169,7 +169,7 @@ export class DynamicFormComponent implements OnInit { //this.dataModel.groups = this.dataModel.groups.slice(this.pager.startIndex, this.pager.endIndex + 1); } -signOut2() { +signOut2() {     var auth2 = gapi.auth2.getAuthInstance();     auth2.signOut().then(function () {       console.log('User signed out.'); @@ -178,8 +178,7 @@ signOut2() { this.tokenService.setToken(null); //kanonika prepei na mpei mesa sthn function.....   } - onValueChanged(data?: any) { - debugger; + onValueChanged(data?: any) { if (!this.form) { return; } const form = this.form; diff --git a/dmp-frontend/src/app/guards/auth.guard.ts b/dmp-frontend/src/app/guards/auth.guard.ts index 3922dd4f2..4b77957ef 100644 --- a/dmp-frontend/src/app/guards/auth.guard.ts +++ b/dmp-frontend/src/app/guards/auth.guard.ts @@ -1,16 +1,18 @@ import { Injectable } from '@angular/core'; import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; +import { TokenService, TokenProvider } from '../services/token.service'; @Injectable() export class AuthGuard implements CanActivate { - constructor(private router: Router) { } + constructor(private router: Router, private tokenService: TokenService) { } canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { - if (localStorage.getItem('currentUser')) { + //if (localStorage.getItem('currentUser')) { it always returns true + if(this.tokenService.getToken()!=null){ // logged in so return true return true; - } + } // not logged in so redirect to login page with the return url this.router.navigate(['/login-page'], { queryParams: { returnUrl: state.url }}); diff --git a/dmp-frontend/src/app/login/login-page.ts b/dmp-frontend/src/app/login/login-page.ts index 8ba3fd9a6..8a3c002e1 100644 --- a/dmp-frontend/src/app/login/login-page.ts +++ b/dmp-frontend/src/app/login/login-page.ts @@ -66,7 +66,7 @@ export class LoginComponent implements OnInit, AfterViewInit { this.tokenService.setUsername(profile.getName()); this.tokenService.setEmail(profile.getEmail()); - this.ngZone.run(() => this.router.navigateByUrl('projects')); + this.ngZone.run(() => this.router.navigateByUrl('tabs')); window.location.reload(); diff --git a/dmp-frontend/src/app/modal/modal.component.ts b/dmp-frontend/src/app/modal/modal.component.ts index 946845951..cb135700c 100644 --- a/dmp-frontend/src/app/modal/modal.component.ts +++ b/dmp-frontend/src/app/modal/modal.component.ts @@ -1,10 +1,12 @@ -import { Component, OnInit, Input, ViewChild, ElementRef } from '@angular/core'; +import { Component, OnInit, Input,Output,EventEmitter, ViewChild, ElementRef, NgZone } from '@angular/core'; import { ServerService } from '../../app/services/server.service'; import { DropdownField } from '../../app/form/fields/dropdown/field-dropdown'; import { Param } from '../entities/model/param'; import { Dataset } from '../entities/model/dataset'; import { Project } from '../entities/model/project'; import { DataTable, DataTableTranslations, DataTableResource } from 'angular-4-data-table-bootstrap-4'; +import { Router, ActivatedRoute } from '@angular/router'; + declare var jquery:any; declare var $ :any; @@ -16,21 +18,49 @@ declare var $ :any; export class ModalComponent implements OnInit { @Input() datasetDropDown: DropdownField; - @Input() dataSetVisibe:boolean; + // public dataSetVisibe:boolean; @Input() datasets: Dataset[]; - @Input() project: Project; + public project: Project; datasetResource :DataTableResource; @Input() datasetCount = 0; - @Input('show-modal') showModal: boolean; + @ViewChild('modalDmps') modalDmps; - @ViewChild('modalDmps') modalDmps; + @Input() + public item:any + showValue:boolean + @Input() + get show(){ + return this.showValue; + } + @Output() + public showChange = new EventEmitter(); + + set show(value:any){ + this.showValue = value + this.showChange.emit(this.showValue) + } - constructor(private serverService: ServerService) { + dataSetValue:boolean + @Input() + get dataSetVisibe(){ + return this.dataSetValue; + } + @Output() + public dataSetValueChange = new EventEmitter(); + + set dataSetVisibe(value:any){ + this.dataSetValue = value; + this.dataSetValueChange.emit(this.dataSetValue) + } + + constructor(private serverService: ServerService, private router: Router, private ngZone: NgZone) { this.datasetDropDown = new DropdownField(); this.datasetDropDown.options = []; - this.dataSetVisibe= false; + //this.dataSetVisibe= false; this.datasets = []; this.project = new Project(); + + } ngOnInit() { @@ -49,38 +79,33 @@ export class ModalComponent implements OnInit { } ) - + if(this.show) this.showModal() } - show(gridRow){ - this.project.label = gridRow.label; - this.project.abbreviation = gridRow.abbreviation; - this.project.uri = gridRow.uri; + + + showModal(){ + this.project.label = this.item.label; + this.project.abbreviation = this.item.abbreviation; + this.project.uri = this.item.uri; + this.project.id = this.item.id; $("#exampleModalDmps").modal("show"); } - showDatasets(dmpId, event) { - debugger; - this.dataSetVisibe = true; - this.serverService.getAllDatasets().subscribe( - response => { - console.log("response"); - console.log(response); - //let params = new Param(); - response.forEach((dataset) => { - let dt = new Dataset(); - dt.id = dataset.id; - dt.name = dataset.label; - dt.uriDataset = dataset.uri; - this.datasets.push(dt); - var params = { limit: 8, offset: 0, sortAsc: false } - this.afterLoad(); - this.datasetResource.query(params).then(datasets => this.datasets = datasets); - }); - }); - + closeModal(){ + $("#exampleModalDmps").modal("hide"); + this.show = false; } + showDatasets(dmpId, event) { + debugger; + this.dataSetVisibe = true; + $("#exampleModalDmps").modal("hide"); + this.show = false; + // this.ngZone.run(() => this.router.navigateByUrl('dataset')); //change router + + } + afterLoad(){ this.datasetResource = new DataTableResource(this.datasets); this.datasetResource.count().then(count => this.datasetCount = count); diff --git a/dmp-frontend/src/app/modal/modal.html b/dmp-frontend/src/app/modal/modal.html index bef0cb8b8..4944d2848 100644 --- a/dmp-frontend/src/app/modal/modal.html +++ b/dmp-frontend/src/app/modal/modal.html @@ -16,37 +16,37 @@
- - + +
- +
- +
- +
- +
- +
- +
@@ -55,4 +55,4 @@ - + diff --git a/dmp-frontend/src/app/projects/project-routing.module.ts b/dmp-frontend/src/app/projects/project-routing.module.ts index 77d2e8c2e..1ed32d2ab 100644 --- a/dmp-frontend/src/app/projects/project-routing.module.ts +++ b/dmp-frontend/src/app/projects/project-routing.module.ts @@ -7,7 +7,7 @@ import { DynamicFormComponent } from '../form/dynamic-form.component'; import { AuthGuard } from '../guards/auth.guard'; const projectsRoutes: Routes = [ - { path: 'projects', component: ProjectsComponent }, + { path: 'tabs/projects', component: ProjectsComponent }, // canActivate: [AuthGuard] { path: 'dynamic-form/:id', component: DynamicFormComponent, canActivate: [AuthGuard] } ]; diff --git a/dmp-frontend/src/app/projects/project.html b/dmp-frontend/src/app/projects/project.html index c5214f4a0..bf5661d32 100644 --- a/dmp-frontend/src/app/projects/project.html +++ b/dmp-frontend/src/app/projects/project.html @@ -1,3 +1,10 @@ + + + +
Filter: @@ -99,10 +106,10 @@
- + - + -Sign out +Sign out \ No newline at end of file diff --git a/dmp-frontend/src/app/projects/projects.component.ts b/dmp-frontend/src/app/projects/projects.component.ts index 00f3ff835..a412d324c 100644 --- a/dmp-frontend/src/app/projects/projects.component.ts +++ b/dmp-frontend/src/app/projects/projects.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, Input, ViewChild } from '@angular/core'; +import { Component, OnInit, Input, Output, EventEmitter, ViewChild } from '@angular/core'; import {GoogleSignInSuccess} from 'angular-google-signin'; import { Router, ActivatedRoute } from '@angular/router'; import { ServerService } from '../../app/services/server.service'; @@ -12,24 +12,11 @@ import { ModalComponent } from '../modal/modal.component'; import { HttpErrorResponse } from '@angular/common/http'; import { FormGroup, FormControl } from '@angular/forms'; //na dw an xreiazontai import { NgForm } from '@angular/forms'; +import { TokenService, TokenProvider } from '../services/token.service'; @Component({ selector: 'projects', templateUrl: 'project.html', -// template: ` -//

Projects

- -// - -// -// `, providers: [ServerService] }) @@ -40,11 +27,13 @@ export class ProjectsComponent implements OnInit{ datasetResource :DataTableResource; @Input() projectCount = 0; @Input() datasetDropDown:DropdownField; - @Input() dataSetVisibe:boolean; + //@Input() dataSetVisibe:boolean; @Input() datasets: Dataset[]; project: any; modalEditedRow: ModalComponent; - + public item:any; + public show:boolean = false; + public dataSetVisibe:boolean = false; @ViewChild(DataTable) projectsTable; @ViewChild(DataTable) datasetsTable; @ViewChild('isignOutBtn') isignOutBtn; @@ -52,10 +41,9 @@ export class ProjectsComponent implements OnInit{ constructor( private serverService: ServerService, private route: ActivatedRoute, - private router: Router){ + private router: Router, private tokenService: TokenService){ this.datasetDropDown = new DropdownField(); this.datasetDropDown.options = []; - this.dataSetVisibe= false; this.datasets = []; this.project = { label: '', @@ -64,10 +52,13 @@ export class ProjectsComponent implements OnInit{ uri:'', definition:'' } - this.modalEditedRow = new ModalComponent(serverService); } ngOnInit() { + + gapi.load('auth2', function() { + gapi.auth2.init({}); + }); //this.projects = this.serverService.getDummyProjects(); this.projects = []; this.serverService.getProjectOfUer().subscribe( //getProjects() @@ -93,7 +84,7 @@ export class ProjectsComponent implements OnInit{ } ); }, - (err: HttpErrorResponse) => {debugger; + (err: HttpErrorResponse) => { if (err.error instanceof Error) { // A client-side or network error occurred. Handle it accordingly. console.log('An error occurred:', err.error.message); @@ -106,7 +97,7 @@ export class ProjectsComponent implements OnInit{ console.log(`Backend returned code ${err.status}, body was: ${err.error}`); } } - ); + ); } reloadProjects(params) { @@ -136,35 +127,8 @@ getDMPs(){ ) } -showDatasets(dmpId, event){debugger; - this.dataSetVisibe = true; - this.serverService.getAllDatasets().subscribe( - response =>{ - console.log("response"); - console.log(response); - //let params = new Param(); - response.forEach((dataset) => { - let dt = new Dataset(); - dt.id = dataset.id; - dt.name = dataset.label; - dt.uriDataset = dataset.uri; - this.datasets.push(dt); - var params = {limit:8,offset:0, sortAsc:false} - this.afterLoad(); - this.datasetResource.query(params).then(datasets => this.datasets = datasets); - }, - (err: HttpErrorResponse) => { - if (err.error instanceof Error) { - // A client-side or network error occurred. Handle it accordingly. - console.log('An error occurred:', err.error.message); - } else { - // The backend returned an unsuccessful response code. - // The response body may contain clues as to what went wrong, - console.log(`Backend returned code ${err.status}, body was: ${err.error}`); - } - } - ); - }); +showDatasets(){debugger; //dmpId, event + //this.dataSetVisibe = true; } @@ -187,7 +151,8 @@ myFunction() { } editRow(item){ - this.modalEditedRow.show(item); + this.show = true; + this.item = item; } SaveNewProject(){ @@ -211,6 +176,10 @@ SaveNewProject(){ paginationRange: 'Result range' }; +signOut() { +     this.serverService.logOut(); +} + } diff --git a/dmp-frontend/src/app/services/rest-base.ts b/dmp-frontend/src/app/services/rest-base.ts index 411c91503..7e07858cd 100644 --- a/dmp-frontend/src/app/services/rest-base.ts +++ b/dmp-frontend/src/app/services/rest-base.ts @@ -15,15 +15,15 @@ export class RestBase { this.xml2jsonOBJ = new X2JS(); } - protocol: string = "http"; - hostname: string ="dl010.madgik.di.uoa.gr" ;//"localhost";//"dl010.madgik.di.uoa.gr";// - port: number = 8080;//8080;// - webappname: string = "dmp-backend-2";//"dmp-backend-new";// + // protocol: string = "http"; + // hostname: string ="dl010.madgik.di.uoa.gr" ;//"localhost";//"dl010.madgik.di.uoa.gr";// + // port: number = 8080;//8080;// + // webappname: string = "dmp-backend-1";//"dmp-backend-new";// - /*protocol: string = "http"; + protocol: string = "http"; hostname: string ="dionysus.di.uoa.gr" ; port: number = 7070; - webappname: string = "dmp-backend-1";//"dmp-backend-new";//*/ + webappname: string = "dmp-backend";//"dmp-backend-new";// proxyPath : string = this.protocol+"://"+this.hostname+":"+this.port+"/"+this.webappname+"/proxy/"; diff --git a/dmp-frontend/src/app/services/server.service.ts b/dmp-frontend/src/app/services/server.service.ts index 728128bcc..d7eb6ef8a 100644 --- a/dmp-frontend/src/app/services/server.service.ts +++ b/dmp-frontend/src/app/services/server.service.ts @@ -96,8 +96,23 @@ export class ServerService { return this.restBase.post("project/createofuser", data); } + public getAllDataSet(){ + return this.restBase.get("dataset/getAll"); + } - signOut2() { + public getDmpOfUser(){ + return this.restBase.get("dmp/getofuser"); + } + + public createDmpForProject(data:any, projectid: string){ + return this.restBase.post("dmp/createforproject", data); + // return this.restBase.post('dmp/createforproject', data, { + // params: new HttpParams().set('projectid', projectid), + // }) + } + + + logOut() {     var auth2 = gapi.auth2.getAuthInstance();     auth2.signOut().then(function () { diff --git a/dmp-frontend/src/app/tabs/tab.module.ts b/dmp-frontend/src/app/tabs/tab.module.ts new file mode 100644 index 000000000..14bc91ec0 --- /dev/null +++ b/dmp-frontend/src/app/tabs/tab.module.ts @@ -0,0 +1,22 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import {DataTableModule } from 'angular-4-data-table-bootstrap-4'; + +import { TabComponent } from './tabs.component'; + +import { TabRoutingModule } from './tabs-routing.module'; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + TabRoutingModule, + DataTableModule + ], + declarations: [ + TabComponent + ], + providers: [ ] +}) +export class TabModule {} \ No newline at end of file diff --git a/dmp-frontend/src/app/tabs/tabs-routing.module.ts b/dmp-frontend/src/app/tabs/tabs-routing.module.ts new file mode 100644 index 000000000..fee546906 --- /dev/null +++ b/dmp-frontend/src/app/tabs/tabs-routing.module.ts @@ -0,0 +1,19 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; + +import { TabComponent } from './tabs.component'; +import { AuthGuard } from '../guards/auth.guard'; + +const tabsRoutes: Routes = [ + { path: 'tabs', component: TabComponent, canActivate: [AuthGuard] }, +]; + +@NgModule({ + imports: [ + RouterModule.forChild(tabsRoutes) + ], + exports: [ + RouterModule + ] +}) +export class TabRoutingModule { } \ No newline at end of file diff --git a/dmp-frontend/src/app/tabs/tabs.component.ts b/dmp-frontend/src/app/tabs/tabs.component.ts new file mode 100644 index 000000000..a7623cbdc --- /dev/null +++ b/dmp-frontend/src/app/tabs/tabs.component.ts @@ -0,0 +1,15 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'my-app', + template: ` +

Angular Router

+ + + ` +}) +export class TabComponent { +} \ No newline at end of file