login - create new project
This commit is contained in:
parent
e4f302fd62
commit
d342ebb247
|
@ -27,7 +27,8 @@
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<h5>Sign in with</h5>
|
<h5>Sign in with</h5>
|
||||||
</div>
|
</div>
|
||||||
<google-signin [clientId]="myClientId" (googleSignInSuccess)="onGoogleSignInSuccess($event)"></google-signin>
|
<!-- <google-signin [clientId]="myClientId" (googleSignInSuccess)="onGoogleSignInSuccess($event)"></google-signin> -->
|
||||||
|
<div class="g-signin2" id="googleBtn"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Component, OnInit, NgZone } from '@angular/core';
|
import { Component, OnInit, NgZone, AfterViewInit, ElementRef } from '@angular/core';
|
||||||
import { GoogleSignInSuccess } from 'angular-google-signin';
|
import { GoogleSignInSuccess } from 'angular-google-signin';
|
||||||
import { Router, ActivatedRoute } from '@angular/router';
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
import { TokenService, TokenProvider } from '../services/token.service';
|
import { TokenService, TokenProvider } from '../services/token.service';
|
||||||
|
@ -8,15 +8,16 @@ import { TokenService, TokenProvider } from '../services/token.service';
|
||||||
templateUrl: './login-page.html',
|
templateUrl: './login-page.html',
|
||||||
providers: []
|
providers: []
|
||||||
})
|
})
|
||||||
export class LoginComponent implements OnInit{
|
export class LoginComponent implements OnInit, AfterViewInit {
|
||||||
returnUrl: string;
|
returnUrl: string;
|
||||||
|
token: any;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private ngZone: NgZone,
|
private ngZone: NgZone,
|
||||||
private tokenService : TokenService
|
private tokenService: TokenService,
|
||||||
|
private element: ElementRef
|
||||||
) {
|
) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,41 +27,61 @@ export class LoginComponent implements OnInit{
|
||||||
//this.authenticationService.logout();
|
//this.authenticationService.logout();
|
||||||
|
|
||||||
// get return url from route parameters or default to '/'
|
// get return url from route parameters or default to '/'
|
||||||
this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/';
|
|
||||||
|
//this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/';
|
||||||
}
|
}
|
||||||
private myClientId: string = '524432312250-vhgidft856v8qftsc81kls4c74v87d8o.apps.googleusercontent.com';
|
//private myClientId: string = '524432312250-vhgidft856v8qftsc81kls4c74v87d8o.apps.googleusercontent.com';
|
||||||
|
private myClientId: string = '1010962018903-glegmqudqtl1lub0150vacopbu06lgsg.apps.googleusercontent.com';
|
||||||
|
|
||||||
onGoogleSignInSuccess(event: GoogleSignInSuccess) {
|
public auth2: any;
|
||||||
let googleUser: gapi.auth2.GoogleUser = event.googleUser;
|
|
||||||
let id: string = googleUser.getId();
|
|
||||||
let profile: gapi.auth2.BasicProfile = googleUser.getBasicProfile();
|
|
||||||
this.tokenService.setToken(googleUser.getAuthResponse().id_token);
|
|
||||||
|
|
||||||
console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.
|
private scope = [
|
||||||
console.log('Name: ' + profile.getName());
|
'profile',
|
||||||
console.log('token: ' + this.tokenService.getToken());
|
'email'
|
||||||
|
].join(' ');
|
||||||
|
|
||||||
|
public googleInit() {
|
||||||
|
|
||||||
|
gapi.load('auth2', () => {debugger;
|
||||||
|
this.auth2 = gapi.auth2.init({
|
||||||
|
client_id: this.myClientId,
|
||||||
|
cookie_policy: 'single_host_origin',
|
||||||
|
scope: this.scope
|
||||||
|
});
|
||||||
|
var buttonElement = this.element.nativeElement.querySelector('#googleBtn');
|
||||||
|
this.attachSignin(buttonElement);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public attachSignin(element) {debugger;
|
||||||
|
this.auth2.attachClickHandler(element, {},
|
||||||
|
(googleUser) => {
|
||||||
|
this.token = googleUser.getAuthResponse().id_token;
|
||||||
|
|
||||||
|
let profile = googleUser.getBasicProfile();
|
||||||
|
|
||||||
this.tokenService.setProvider(TokenProvider.google);
|
|
||||||
this.tokenService.setLoggedIn(true);
|
this.tokenService.setLoggedIn(true);
|
||||||
this.tokenService.setEmail(profile.getEmail());
|
this.tokenService.setToken(this.token);
|
||||||
|
this.tokenService.setProvider(TokenProvider.google);
|
||||||
this.tokenService.setUsername(profile.getName());
|
this.tokenService.setUsername(profile.getName());
|
||||||
|
this.tokenService.setEmail(profile.getEmail());
|
||||||
|
|
||||||
localStorage.setItem('currentUser', this.tokenService.getToken());
|
|
||||||
/* AYTA FEYGOUN, xanontai me to refresh tis selidas
|
|
||||||
|
|
||||||
localStorage.setItem('currentUser', JSON.stringify(googleUser));
|
|
||||||
var currentUser = JSON.parse(localStorage.getItem('currentUser'));
|
|
||||||
console.log('current user local storage:' +currentUser)
|
|
||||||
*/
|
|
||||||
|
|
||||||
// STO LOGOUT, KATHARIZEIS TO tokenService (apo opoudipote... e;inai apo pantou prosvasimo, kai den xanei tis times toy oso exeis to browser anoixto.)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//this.router.navigateByUrl('dynamic-form');
|
|
||||||
this.ngZone.run(() => this.router.navigateByUrl('projects'));
|
this.ngZone.run(() => this.router.navigateByUrl('projects'));
|
||||||
//this.router.navigate(['/projects']);
|
|
||||||
}
|
window.location.reload();
|
||||||
|
|
||||||
|
}, function (error) {
|
||||||
|
console.log(JSON.stringify(error, undefined, 2));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ngAfterViewInit() {
|
||||||
|
this.googleInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
<div style="margin: auto; max-width: 1000px; margin-top:50px">
|
<div style="margin: auto; max-width: 1000px; margin-top:50px">
|
||||||
<data-table id="films-grid" headerTitle="My Projects" [items]="projects" [itemCount]="projectCount" (reload)="reloadProjects($event)"
|
<data-table id="films-grid" headerTitle="My Projects" [items]="projects" [itemCount]="projectCount" (reload)="reloadProjects($event)"
|
||||||
[limit]="8" [sortBy]="'rating'" [sortAsc]="false" [selectColumn]="true" [multiSelect]="false" [substituteRows]="false"
|
[limit]="8" [sortBy]="'rating'" [sortAsc]="false" [selectColumn]="true" [multiSelect]="false" [substituteRows]="false"
|
||||||
|
@ -32,11 +31,20 @@
|
||||||
</data-table-column>
|
</data-table-column>
|
||||||
<data-table-column [property]="'abbreviation'" [header]="'Abbreviation'" [sortable]="true">
|
<data-table-column [property]="'abbreviation'" [header]="'Abbreviation'" [sortable]="true">
|
||||||
</data-table-column>
|
</data-table-column>
|
||||||
<data-table-column [property]="'id'" [header]="'Id'" [sortable]="true">
|
<data-table-column [property]="'startDate'" [header]="'Start Date'" [sortable]="true">
|
||||||
</data-table-column>
|
</data-table-column>
|
||||||
<data-table-column [property]="'uri'" [header]="'Uri'" [sortable]="true">
|
<data-table-column [property]="'endDate'" [header]="'End Date'" [sortable]="true">
|
||||||
</data-table-column>
|
</data-table-column>
|
||||||
<data-table-column [property]="'definition'" [header]="'Definition'" [sortable]="true">
|
<data-table-column [property]="'active'" [header]="'Status'" [width]="100" [resizable]="true">
|
||||||
|
<template #dataTableHeader let-item="item">
|
||||||
|
<span>Active</span>
|
||||||
|
</template>
|
||||||
|
<template #dataTableCell let-item="item">
|
||||||
|
<span style="color: grey">
|
||||||
|
<span class="fa fa-check" *ngIf="item.active"></span>
|
||||||
|
<span class="fa fa-times" *ngIf="!item.active"></span>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
</data-table-column>
|
</data-table-column>
|
||||||
</data-table>
|
</data-table>
|
||||||
<div style="margin-top: 10px">
|
<div style="margin-top: 10px">
|
||||||
|
@ -44,7 +52,57 @@
|
||||||
<span *ngIf="projectsTable.selectedRow == null"><i>No item selected</i></span>
|
<span *ngIf="projectsTable.selectedRow == null"><i>No item selected</i></span>
|
||||||
<span [textContent]="projectsTable.selectedRow && projectsTable.selectedRow.item.name"></span>
|
<span [textContent]="projectsTable.selectedRow && projectsTable.selectedRow.item.name"></span>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="btn btn-info">New Project</button>
|
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#exampleModal">New Project</button>
|
||||||
</div>
|
</div>
|
||||||
<router-outlet></router-outlet>
|
|
||||||
|
|
||||||
|
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="exampleModalLabel">Create New Project</h5>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="label-name" class="form-control-label">Label:</label>
|
||||||
|
<input type="text" class="form-control" id="label-name">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="abbreviation-text" class="form-control-label">Abbreviation:</label>
|
||||||
|
<input class="form-control" id="abbreviation-text">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="reference-text" class="form-control-label">Reference:</label>
|
||||||
|
<input class="form-control" id="reference-text">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="uri-text" class="form-control-label">Uri:</label>
|
||||||
|
<input class="form-control" id="uri-text">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="start-date" class="form-control-label">Start Date:</label>
|
||||||
|
<input class="form-control" id="startDate-date">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="end-date" class="form-control-label">End Date:</label>
|
||||||
|
<input class="form-control" id="endDate-date">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="code-name" class="form-control-label">Code:</label>
|
||||||
|
<input type="text" class="form-control" id="code-name" disabled>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||||
|
<button type="button" class="btn btn-primary">Save project</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a href="#" (click)="signOut2();">Sign out</a>
|
||||||
|
<router-outlet></router-outlet>
|
|
@ -78,7 +78,7 @@ export class dataModelBuilder {
|
||||||
newfield = new CheckBoxField({
|
newfield = new CheckBoxField({
|
||||||
label: element.title.__cdata,
|
label: element.title.__cdata,
|
||||||
key: element._id,
|
key: element._id,
|
||||||
value: element.value,
|
value: false,
|
||||||
order: element._ordinal,
|
order: element._ordinal,
|
||||||
rules: element.visible.rule != undefined ? element.visible.rule : rule,
|
rules: element.visible.rule != undefined ? element.visible.rule : rule,
|
||||||
visible: element._defaultVisibility,
|
visible: element._defaultVisibility,
|
||||||
|
|
|
@ -18,7 +18,7 @@ export class RestBase {
|
||||||
protocol: string = "http";
|
protocol: string = "http";
|
||||||
hostname: string ="dl010.madgik.di.uoa.gr" ;//"localhost";//"dl010.madgik.di.uoa.gr";//
|
hostname: string ="dl010.madgik.di.uoa.gr" ;//"localhost";//"dl010.madgik.di.uoa.gr";//
|
||||||
port: number = 8080;//8080;//
|
port: number = 8080;//8080;//
|
||||||
webappname: string = "dmp-backend";//"dmp-backend-new";//
|
webappname: string = "dmp-backend-1";//"dmp-backend-new";//
|
||||||
|
|
||||||
|
|
||||||
proxyPath : string = this.protocol+"://"+this.hostname+":"+this.port+"/"+this.webappname+"/proxy/";
|
proxyPath : string = this.protocol+"://"+this.hostname+":"+this.port+"/"+this.webappname+"/proxy/";
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<script src="https://cdn.rawgit.com/afeld/bootstrap-toc/v0.4.1/dist/bootstrap-toc.min.js"></script>
|
<script src="https://cdn.rawgit.com/afeld/bootstrap-toc/v0.4.1/dist/bootstrap-toc.min.js"></script>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Digital Management Plans - Manager</title>
|
<title>Data Management Plans - Manager</title>
|
||||||
<base href="/">
|
<base href="/">
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
<div class="panel panel-default" style="margin-top: 30px; margin-bottom: 30px; margin-right: 30px; margin-left: 30px;">
|
<div class="panel panel-default" style="margin-top: 30px; margin-bottom: 30px; margin-right: 30px; margin-left: 30px;">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h3 class="panel-title" style="text-align: center;">Digital Management Plan</h3>
|
<h3 class="panel-title" style="text-align: center;">Data Management Plan</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue