This commit is contained in:
Nikolaos Laskaris 2017-11-22 14:25:01 +02:00
parent ae461a4362
commit 0d6a0f06b0
12 changed files with 77 additions and 18 deletions

View File

@ -11,6 +11,7 @@ import { AppComponent } from './app.component';
import { UserWorkspaceComponent } from './user-workspace/user-workspace.component';
import { MainSignInComponent } from './login/main-sign-in/main-sign-in.component';
import { DmpDetailedComponent } from './viewers/dmp-detailed/dmp-detailed.component';
import { ProjectDetailedComponent } from './viewers/project-detailed/project-detailed.component';
const appRoutes: Routes = [
@ -19,6 +20,7 @@ const appRoutes: Routes = [
{ path: 'dataset', component: DatasetsComponent },
{ path: 'login', component: MainSignInComponent},
{ path: 'projects', component: ProjectsComponent},
{ path: 'project', component: ProjectDetailedComponent},
{ path: 'dmps', component: DmpComponent},
{ path: 'dmp', component: DmpDetailedComponent },
{ path: 'workspace', component: UserWorkspaceComponent},

View File

@ -71,6 +71,7 @@ import { AutocompleteRemoteComponent } from './form/fields/autocomplete-remote/a
import { Ng4LoadingSpinnerModule } from 'ng4-loading-spinner';
import { BreadcrumbComponent } from './widgets/breadcrumb/breadcrumb.component';
import { DmpDetailedComponent } from './viewers/dmp-detailed/dmp-detailed.component';
import { ProjectDetailedComponent } from './viewers/project-detailed/project-detailed.component';
@ -102,7 +103,7 @@ import { DmpDetailedComponent } from './viewers/dmp-detailed/dmp-detailed.compon
DatasetTableFilterPipe,
DatasetStatusFilterPipe,
StatusToString,
BreadcrumbComponent, DmpDetailedComponent
BreadcrumbComponent, DmpDetailedComponent, ProjectDetailedComponent
],
imports: [
BrowserModule,

View File

@ -268,6 +268,10 @@ export class DmpComponent implements OnInit{
this.router.navigate(['/dmp'], { queryParams: { "dmpid":dmp.id, "label":dmp.label }});
}
viewDetailedProject(dmp){
console.log(dmp)
this.router.navigate(['/project'], { queryParams: { "projectid":dmp.project.id, "label":dmp.project.label }});
}
}

View File

@ -68,7 +68,7 @@
<td class="url-like" (click)="viewDetailedDMP(dmp)">{{(dmp?.label?.length > 40) ? (dmp?.label | slice:0:40)+'...':(dmp?.label) }}</td>
<td style="width:20px;">{{dmp?.version}}</td>
<td style="width:300px;">{{dmp?.previous}}</td>
<td>{{(dmp?.project?.label?.length > 40) ? (dmp?.project?.label | slice:0:40)+'...':(dmp?.project?.label) }}</td>
<td class="url-like" (click)="viewDetailedProject(dmp)">{{(dmp?.project?.label?.length > 40) ? (dmp?.project?.label | slice:0:40)+'...':(dmp?.project?.label) }}</td>
<td>{{(dmp?.description?.length > 40) ? (dmp?.description | slice:0:40)+'...':(dmp?.description) }}</td>
<td>{{dmp?.created | date:'yyyy-MM-dd HH:mm:ss Z'}}</td>
<td>{{dmp?.status | statusToString }}</td>

View File

@ -98,7 +98,7 @@ export class DynamicFormComponent implements OnInit {
var formValues = "";
if (data.properties) {
console.log("Found already submitted form, loading that one!");
simple_notifier("info",null,"Resumed previous form");
formValues = JSON.parse(data.properties);
flatList = flatten(formValues);
//this.patchForm(flatList);
@ -246,10 +246,15 @@ export class DynamicFormComponent implements OnInit {
(data) => {
console.log("Updated dataset");
simple_notifier("success",null,"Saved form progress");
if (final)
if (final){
this._location.back();
//this.router.navigate(['/welcome'], { queryParams: { /*returnUrl: this.state.url*/ }});
simple_notifier("success",null,"Finalized form progress");
}
else{
simple_notifier("success",null,"Saved form progress");
}
},
(err) => {
simple_notifier("danger",null,"Could not save form progress");

View File

@ -1,3 +1,5 @@
<!--
<p>
Under construction
</p>
-->

View File

@ -1,5 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute, ParamMap, Params } from '@angular/router';
import {Location} from '@angular/common';
import { ServerService } from '../../../app/services/server.service';
@Component({
selector: 'dmp-detailed',
templateUrl: './dmp-detailed.component.html',
@ -7,12 +9,33 @@ import { Component, OnInit } from '@angular/core';
})
export class DmpDetailedComponent implements OnInit {
constructor() {
constructor(private serverService: ServerService, private router: Router, private _location: Location, private route: ActivatedRoute) {
}
dmp : any;
ngOnInit() {
let sub = this.route.queryParams.subscribe(params => {
let dmpid = params.dmpid;
this.serverService.getDmp(dmpid).subscribe(
response => {
this.dmp = response;
debugger;
},
error => {
console.log("Could not load dmp");
}
)
});
}
}

View File

@ -0,0 +1,3 @@
<p>
Details of project -- Under construction
</p>

View File

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'project-detailed',
templateUrl: './project-detailed.component.html',
styleUrls: ['./project-detailed.component.css']
})
export class ProjectDetailedComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}

View File

@ -20,17 +20,11 @@ export class BreadcrumbComponent implements OnInit {
constructor(private router: Router, private route: ActivatedRoute) {
router.events.subscribe(
event =>{
console.log("Router event captured")
console.log(event)
//console.log("Router event captured")
//console.log(event)
if(event instanceof NavigationEnd){
//this.breadcrumbData.push("")
console.log(event.urlAfterRedirects);
console.log(this.route);
//this.breadcrumbData.length = 0;
//console.log(event.urlAfterRedirects);
//console.log(this.route);
this.route.children.forEach( child => {
let guessed = this.guessMenuItemFromActivatedRoute(child, event);
this.adaptBreadcrumbByMenuItem(guessed.menuItem, guessed.isBaseComponent);
@ -77,6 +71,11 @@ export class BreadcrumbComponent implements OnInit {
isBaseComponent = false;
}
if(componentName == "ProjectDetailedComponent"){
label = "Details of Project '"+params["label"]+"'";
isBaseComponent = false;
}
if(label != null)
menuItem = {"label": label, "routerLink": url, "queryParams" : params };

View File

@ -8,6 +8,11 @@ var sign_out_google = (function() {
var simple_notifier = (function(type, title, message) {
setTimeout(function() {
$(".alert").remove();
}, 11000);
return notify(type, title, message, null, null, null, null, null, null, null, null, null, null);
});