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 { UserWorkspaceComponent } from './user-workspace/user-workspace.component';
import { MainSignInComponent } from './login/main-sign-in/main-sign-in.component'; import { MainSignInComponent } from './login/main-sign-in/main-sign-in.component';
import { DmpDetailedComponent } from './viewers/dmp-detailed/dmp-detailed.component'; import { DmpDetailedComponent } from './viewers/dmp-detailed/dmp-detailed.component';
import { ProjectDetailedComponent } from './viewers/project-detailed/project-detailed.component';
const appRoutes: Routes = [ const appRoutes: Routes = [
@ -19,6 +20,7 @@ const appRoutes: Routes = [
{ path: 'dataset', component: DatasetsComponent }, { path: 'dataset', component: DatasetsComponent },
{ path: 'login', component: MainSignInComponent}, { path: 'login', component: MainSignInComponent},
{ path: 'projects', component: ProjectsComponent}, { path: 'projects', component: ProjectsComponent},
{ path: 'project', component: ProjectDetailedComponent},
{ path: 'dmps', component: DmpComponent}, { path: 'dmps', component: DmpComponent},
{ path: 'dmp', component: DmpDetailedComponent }, { path: 'dmp', component: DmpDetailedComponent },
{ path: 'workspace', component: UserWorkspaceComponent}, { 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 { Ng4LoadingSpinnerModule } from 'ng4-loading-spinner';
import { BreadcrumbComponent } from './widgets/breadcrumb/breadcrumb.component'; import { BreadcrumbComponent } from './widgets/breadcrumb/breadcrumb.component';
import { DmpDetailedComponent } from './viewers/dmp-detailed/dmp-detailed.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, DatasetTableFilterPipe,
DatasetStatusFilterPipe, DatasetStatusFilterPipe,
StatusToString, StatusToString,
BreadcrumbComponent, DmpDetailedComponent BreadcrumbComponent, DmpDetailedComponent, ProjectDetailedComponent
], ],
imports: [ imports: [
BrowserModule, BrowserModule,

View File

@ -268,6 +268,10 @@ export class DmpComponent implements OnInit{
this.router.navigate(['/dmp'], { queryParams: { "dmpid":dmp.id, "label":dmp.label }}); 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 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:20px;">{{dmp?.version}}</td>
<td style="width:300px;">{{dmp?.previous}}</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?.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?.created | date:'yyyy-MM-dd HH:mm:ss Z'}}</td>
<td>{{dmp?.status | statusToString }}</td> <td>{{dmp?.status | statusToString }}</td>

View File

@ -98,7 +98,7 @@ export class DynamicFormComponent implements OnInit {
var formValues = ""; var formValues = "";
if (data.properties) { if (data.properties) {
console.log("Found already submitted form, loading that one!"); console.log("Found already submitted form, loading that one!");
simple_notifier("info",null,"Resumed previous form");
formValues = JSON.parse(data.properties); formValues = JSON.parse(data.properties);
flatList = flatten(formValues); flatList = flatten(formValues);
//this.patchForm(flatList); //this.patchForm(flatList);
@ -246,10 +246,15 @@ export class DynamicFormComponent implements OnInit {
(data) => { (data) => {
console.log("Updated dataset"); console.log("Updated dataset");
simple_notifier("success",null,"Saved form progress");
if (final) if (final){
this._location.back(); 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) => { (err) => {
simple_notifier("danger",null,"Could not save form progress"); simple_notifier("danger",null,"Could not save form progress");

View File

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

View File

@ -1,5 +1,7 @@
import { Component, OnInit } from '@angular/core'; 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({ @Component({
selector: 'dmp-detailed', selector: 'dmp-detailed',
templateUrl: './dmp-detailed.component.html', templateUrl: './dmp-detailed.component.html',
@ -7,12 +9,33 @@ import { Component, OnInit } from '@angular/core';
}) })
export class DmpDetailedComponent implements OnInit { export class DmpDetailedComponent implements OnInit {
constructor() { constructor(private serverService: ServerService, private router: Router, private _location: Location, private route: ActivatedRoute) {
} }
dmp : any;
ngOnInit() { 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) { constructor(private router: Router, private route: ActivatedRoute) {
router.events.subscribe( router.events.subscribe(
event =>{ event =>{
console.log("Router event captured") //console.log("Router event captured")
console.log(event) //console.log(event)
if(event instanceof NavigationEnd){ if(event instanceof NavigationEnd){
//this.breadcrumbData.push("") //console.log(event.urlAfterRedirects);
console.log(event.urlAfterRedirects); //console.log(this.route);
console.log(this.route);
//this.breadcrumbData.length = 0;
this.route.children.forEach( child => { this.route.children.forEach( child => {
let guessed = this.guessMenuItemFromActivatedRoute(child, event); let guessed = this.guessMenuItemFromActivatedRoute(child, event);
this.adaptBreadcrumbByMenuItem(guessed.menuItem, guessed.isBaseComponent); this.adaptBreadcrumbByMenuItem(guessed.menuItem, guessed.isBaseComponent);
@ -77,6 +71,11 @@ export class BreadcrumbComponent implements OnInit {
isBaseComponent = false; isBaseComponent = false;
} }
if(componentName == "ProjectDetailedComponent"){
label = "Details of Project '"+params["label"]+"'";
isBaseComponent = false;
}
if(label != null) if(label != null)
menuItem = {"label": label, "routerLink": url, "queryParams" : params }; 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) { 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); return notify(type, title, message, null, null, null, null, null, null, null, null, null, null);
}); });