Merge branch 'master' of gitlab.eudat.eu:dmp/OpenAIRE-EUDAT-DMP-service-pilot

This commit is contained in:
annampak 2017-11-06 11:57:31 +02:00
commit cc4bbabfba
25 changed files with 379 additions and 454 deletions

View File

@ -1,5 +0,0 @@
Manifest-Version: 1.0
Built-By: nikolas
Build-Jdk: 1.8.0_91
Created-By: Maven Integration for Eclipse

View File

@ -1,7 +0,0 @@
#Generated by Maven Integration for Eclipse
#Thu Sep 14 13:20:15 EEST 2017
version=0.0.1-SNAPSHOT
groupId=dmp-backend
m2e.projectName=dmp-backend
m2e.projectLocation=/home/nikolas/git/OpenAIRE-EUDAT-DMP-service-pilot/dmp-backend
artifactId=dmp-backend

View File

@ -1,254 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>dmp-backend</groupId>
<artifactId>dmp-backend</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<dmp-backend-commons.version>0.0.1-SNAPSHOT</dmp-backend-commons.version>
<org.springframework.version>4.3.8.RELEASE</org.springframework.version>
<com.sun.jersey.version>1.19.1</com.sun.jersey.version>
<org.apache.tomcat.tomcat-jdbc.version>7.0.35</org.apache.tomcat.tomcat-jdbc.version>
<hibernate.version>5.2.9.Final</hibernate.version>
<commons-codec.version>1.9</commons-codec.version>
<org.junit.version>4.11</org.junit.version>
<log4j.version>1.2.17</log4j.version>
<slf4j.version>1.7.12</slf4j.version>
<jetty.version>9.0.7.v20131107</jetty.version> <!-- Adapt this to a version found on http://repo.maven.apache.org/maven2/org/eclipse/jetty/jetty-maven-plugin/ -->
<logback.version>1.1.1</logback.version>
<javax.inject.version>1</javax.inject.version>
<javax.servlet.servlet-api.version>3.0.1</javax.servlet.servlet-api.version>
<!-- <jcloverslf4j.version>1.7.6</jcloverslf4j.version> -->
</properties>
<dependencies>
<!-- <dependency> -->
<!-- <groupId>dmp-backend</groupId> -->
<!-- <artifactId>dmp-backend-commons</artifactId> -->
<!-- <version>${dmp-backend-commons.version}</version> -->
<!-- </dependency> -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>${hibernate.version}</version>
</dependency>
<!-- g/a spring -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${javax.servlet.servlet-api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!-- MY SPRING -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!-- Spring Security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>4.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>4.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>4.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.1</version>
</dependency>
<!-- Jackson core and databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.8.4</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.8.4</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.4</version>
</dependency>
<!-- Json <-> XML transformations -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20160810</version>
</dependency>
<!-- tomcat jdbc -->
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
<version>${org.apache.tomcat.tomcat-jdbc.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${org.junit.version}</version>
<scope>test</scope>
</dependency>
<!-- PostGreSql base libs dependencies -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4.1212</version>
</dependency>
<!-- LogBack dependencies -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${commons-codec.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
<scope>runtime</scope>
</dependency>
<!-- Various libs -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>analyze</id>
<goals>
<goal>analyze-only</goal>
</goals>
<configuration>
<failOnWarning>false</failOnWarning>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<finalName>${project.artifactId}</finalName>
</build>
</project>

View File

@ -104,11 +104,11 @@ public class DMP implements Serializable {
@Column(name = "\"Status\"", nullable = false)
private Short status;
@Column(name = "\"Created\"", nullable = false)
@Column(name = "\"Created\"")
private Date created = null;
@Column(name = "\"Modified\"", nullable = false)
private Date modified = null;
@Column(name = "\"Modified\"")
private Date modified = new Date();
public Short getStatus() {

View File

@ -2,6 +2,7 @@ package rest.entities;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@ -149,7 +150,9 @@ public class DMPs {
public @ResponseBody ResponseEntity<Object> updateDMP(@RequestBody DMP dmp) {
DMP previousDmp = dMPDao.read(dmp.getId());
addForeignElems(previousDmp, dmp);
addNullAndForeignElems(previousDmp, dmp);
try {
DMP updatedDMP = dMPDao.update(dmp);
@ -162,92 +165,6 @@ public class DMPs {
}
/*
@RequestMapping(method = RequestMethod.POST, value = { "/dmp/set/full" }, consumes = "application/json", produces="application/json")
public @ResponseBody ResponseEntity<Object> setFullDMP(@RequestBody DMP dmp) {
//This function is a little bit tricky to implement (due to the irregular ORM mappings of the hibernate).
// Please make changes only if you are sure about what you're altering.
Dataset dataset = SerializationUtils.clone(dmp.getDataset());
dmp.setDataset(null);
int failsDMP = 0;
String reasonDmp = "";
DMP storedDMP = null;
//try first to create DMP
try {
storedDMP = dMPDao.create(dmp);
}
catch(Exception e) {
e.printStackTrace();
failsDMP++;
reasonDmp += e.getMessage();
//try updating DMP
try {
storedDMP = dMPDao.update(dmp);
}
catch(Exception ex) {
reasonDmp += (System.lineSeparator()+e.getMessage());
failsDMP++;
ex.printStackTrace();
}
}
if(failsDMP==2)
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Could not create or update DMP! Reason: " + reasonDmp);
dataset.setDmp(storedDMP); //very important!
int failsDataset = 0;
String reasonDataset = "";
Dataset storedDataset = null;
if(dataset != null) {
//try first to create DMP
try {
storedDataset = datasetDao.create(dataset);
}
catch(Exception e) {
e.printStackTrace();
failsDataset++;
reasonDataset += e.getMessage();
//try updating DMP
try {
storedDataset = datasetDao.update(dataset);
}
catch(Exception ex) {
reasonDataset += (System.lineSeparator()+e.getMessage());
failsDataset++;
ex.printStackTrace();
}
}
}
String respBody;
try {
respBody = objectMapper.writeValueAsString(storedDMP.getId());
}
catch(JsonProcessingException ex) {
respBody = "{\"id\":\""+storedDMP.getId()+"\"}";
}
if(failsDataset != 2) {
if(failsDMP==0)
return ResponseEntity.status(HttpStatus.CREATED).body(respBody);
else if(failsDMP==1)
return ResponseEntity.status(HttpStatus.CREATED).body("Updated DMP with id: " + storedDMP.getId());
else
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Could not create DMP! Reason:"+ reasonDmp);
}
else {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Could not create DMP! Failed to create or update its Dataset. Reason: "+reasonDataset);
}
}
*/
@ -284,6 +201,7 @@ public class DMPs {
DMP d = dMPDao.read(dmp.getId());
d.setStatus(new Short("-1"));
try {
int code = updateDMP(dmp).getStatusCodeValue();
if(code>199 && code<300)
@ -352,11 +270,16 @@ public class DMPs {
users.add(userInfo);
dmp.setUsers(users);
dmp.setCreated(new Date());
dmp.setModified(new Date());
dmp.setStatus(new Short("0"));
DMP newdmp = dMPDao.create(dmp);
return ResponseEntity.status(HttpStatus.OK).body(SerializerProvider.toJson(newdmp));
}
catch(Exception ex) {
ex.printStackTrace();
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
}
@ -404,7 +327,14 @@ public class DMPs {
private static void addForeignElems(DMP existing, DMP newone) {
private static void addNullAndForeignElems(DMP existing, DMP newone) {
newone.setModified(new Date());
if(newone.getStatus()==null)
newone.setStatus(existing.getStatus());
if(newone.getCreated()==null)
newone.setCreated(existing.getCreated());
newone.setDataset(existing.getDataset());
newone.setOrganisations(existing.getOrganisations());
newone.setResearchers(existing.getResearchers());

View File

@ -2,6 +2,7 @@ package rest.entities;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@ -124,6 +125,9 @@ public class Datasets {
public @ResponseBody ResponseEntity<Object> createDataset(@RequestBody Dataset dataset) {
dataset.setId(null);
dataset.setCreated(new Date());
dataset.setModified(new Date());
dataset.setStatus(new Short("0"));
try {
dataset = datasetDao.create(dataset);
return ResponseEntity.status(HttpStatus.CREATED).body(SerializerProvider.toJson(dataset));

View File

@ -594,6 +594,58 @@
"resolved": "https://registry.npmjs.org/angular2-draggable/-/angular2-draggable-1.0.7.tgz",
"integrity": "sha1-NeH4HIzPPdljDyMmVYuILMEvDyk="
},
"angular2-number-picker": {
"version": "0.8.8",
"resolved": "https://registry.npmjs.org/angular2-number-picker/-/angular2-number-picker-0.8.8.tgz",
"integrity": "sha1-YmlNjaSBfarjZU43O8zevYKZKCw=",
"requires": {
"@angular/common": "2.4.10",
"@angular/compiler": "2.4.10",
"@angular/core": "2.4.10",
"@angular/forms": "2.4.10",
"@angular/platform-browser": "2.4.10",
"@angular/platform-browser-dynamic": "2.4.10",
"rxjs": "5.4.3",
"zone.js": "0.7.8"
},
"dependencies": {
"@angular/common": {
"version": "2.4.10",
"resolved": "https://registry.npmjs.org/@angular/common/-/common-2.4.10.tgz",
"integrity": "sha1-o6aC0iKPow7CPdDrV8joh/uiaZc="
},
"@angular/compiler": {
"version": "2.4.10",
"resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-2.4.10.tgz",
"integrity": "sha1-9R/TSCCyoCx8th+89JhzxYBW+ww="
},
"@angular/core": {
"version": "2.4.10",
"resolved": "https://registry.npmjs.org/@angular/core/-/core-2.4.10.tgz",
"integrity": "sha1-C4MgplBlll2ZhkWx9c0892m0Qeo="
},
"@angular/forms": {
"version": "2.4.10",
"resolved": "https://registry.npmjs.org/@angular/forms/-/forms-2.4.10.tgz",
"integrity": "sha1-BiEzqq3h87PJYvFZMgjFQbYi/QY="
},
"@angular/platform-browser": {
"version": "2.4.10",
"resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-2.4.10.tgz",
"integrity": "sha1-y/JWCBSPtP/vlsxQBbpdez4JOQY="
},
"@angular/platform-browser-dynamic": {
"version": "2.4.10",
"resolved": "https://registry.npmjs.org/@angular/platform-browser-dynamic/-/platform-browser-dynamic-2.4.10.tgz",
"integrity": "sha1-jfJd7CsGrcaQzJvCZEjezK682Ow="
},
"zone.js": {
"version": "0.7.8",
"resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.7.8.tgz",
"integrity": "sha1-Tz/og01EWX8mOQU6D6Q43zT//e0="
}
}
},
"ansi-escapes": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-2.0.0.tgz",
@ -5433,6 +5485,11 @@
"integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=",
"dev": true
},
"ng-sidebar": {
"version": "6.0.4",
"resolved": "https://registry.npmjs.org/ng-sidebar/-/ng-sidebar-6.0.4.tgz",
"integrity": "sha1-QtxRdV6FPBiBs7iFg1T0yEWpbzM="
},
"ngx-webstorage": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/ngx-webstorage/-/ngx-webstorage-1.8.0.tgz",

View File

@ -26,10 +26,12 @@
"angular-google-signin": "^0.1.5",
"angular2-datatable": "^0.6.0",
"angular2-draggable": "^1.0.7",
"angular2-number-picker": "^0.8.8",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"flat": "^4.0.0",
"jquery": "^3.2.1",
"ng-sidebar": "^6.0.4",
"ngx-webstorage": "^1.8.0",
"rxjs": "^5.4.2",
"zone.js": "^0.8.17"

View File

@ -35,3 +35,104 @@
.cursor{
cursor: pointer;
}
.navbar-title
{
position: absolute;
width: 100%;
left: 0;
text-align: center;
margin:0 auto;
}
.navbar-toggle {
z-index:3;
}
.arrange-horizontally > * {
display: inline-block;
/*text-align: center;*/
white-space: nowrap
}
.arrange-vertically > * {
display: block;
}
/* FOR THE SIDEBAR */
.parent_div{
height:100%;
width:100%;
float:left;
}
.child_div{
height:100%;
/*
width:100%;
*/
float:left;
}
.sidenav {
/*
position: absolute;
padding-bottom: 500px;
*/
z-index: 1;
overflow-x: hidden;
height: 100%;
width: 0px;
top: 0px;
left: 0px;
background-color: #111;
transition: 0.5s;
padding-top: 60px;
}
.sidenav.expanded{
width: 15%;
}
#appBody {
width : 100%;
transition: 0.5s;
}
#appBody.expanded{
width: 85%;
}
.sidenav a {
padding: 8px 8px 8px 32px;
text-decoration: none;
font-size: 25px;
color: #818181;
display: block;
transition: 0.3s;
}
.sidenav a:hover {
color: #f1f1f1;
}
.sidenav .closebtn {
position: absolute;
top: 0;
right: 25px;
font-size: 36px;
margin-left: 50px;
}
#main {
transition: margin-left .5s;
padding: 16px;
}
@media screen and (max-height: 450px) {
.sidenav {padding-top: 15px;}
.sidenav a {font-size: 18px;}
}

View File

@ -1,55 +1,66 @@
<div>
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
</div>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse">
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<div class="nav navbar-nav">
<div class="nav navbar-nav navbar-left" >
<button class="btn btn-primary navbar-btn navbar-left" [ngClass]="{true:'visible', false:'invisible'}[tokenService.isLoggedIn() == true]" (click)='slideNav()'>
<span style="font-size:20px;cursor:pointer" >&#9776;</span>
</button>
</div>
</div>
<div class="navbar-left">
<h3 class="navbar-title">Data Management Plans Creator</h3>
</div>
<div class="navbar-center">
<h3>Data Management Plans Creator</h3>
</div>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown" [ngClass]="{true:'invisible'}[loggedInAs == null]">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Quick links <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
<li [ngClass]="{false:'invisible'}[tokenService.isLoggedIn() == true]"><a>{{tokenService.getEmail()}}</a></li>
<li class="cursor" [ngClass]="{false:'invisible'}[tokenService.isLoggedIn() == true]" (click)="logout()"><a>Logout</a></li>
<li class="cursor" [ngClass]="{true:'invisible'}[tokenService.isLoggedIn() == true]" (click)="login()" ><a>Login</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown" [ngClass]="{true:'invisible'}[loggedInAs == null]">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Quick links <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
<li [ngClass]="{false:'invisible'}[tokenService.isLoggedIn() == true]"><a>{{tokenService.getEmail()}}</a></li>
<li class="cursor" [ngClass]="{false:'invisible'}[tokenService.isLoggedIn() == true]" (click)="logout()"><a>Logout</a></li>
<li class="cursor" [ngClass]="{true:'invisible'}[tokenService.isLoggedIn() == true]" (click)="login()" ><a>Login</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
</div>
<div class="parent_div">
<div id="appSidebar" class="sidenav child_div">
<!--<a href="javascript:void(0)" class="closebtn" (click)='slideNav()'>&times;</a>-->
<a href="#">About</a>
<a href="#">Services</a>
<a href="#">Clients</a>
<a href="#">Contact</a>
</div>
<div id="appBody" class="child_div">
<router-outlet [ngClass]="{true:'visible'}[tokenService.isLoggedIn() == true]" ></router-outlet>
<!--
<main-window [ngClass]="{false:'invisible'}[tokenService.isLoggedIn() == true]"></main-window>
-->
<!--this should be invisible -->
<app-main-sign-in [ngClass]="'invisible'"></app-main-sign-in>
</div>
</div>
</div>

View File

@ -6,6 +6,7 @@ import { TokenService, TokenProvider } from './services/login/token.service';
import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { MainSignInComponent } from './login/main-sign-in/main-sign-in.component';
declare var $ :any;
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
@ -16,6 +17,7 @@ export class AppComponent implements OnInit {
fields: any[];
sliderExpanded : boolean = false;
constructor(private tokenService : TokenService, private router: Router) {
@ -23,11 +25,20 @@ export class AppComponent implements OnInit {
ngOnInit() {
}
slideNav(){
$("#appSidebar").toggleClass("expanded");
$("#appBody").toggleClass("expanded");
}
//loggedInAs : string = null;
showLogin : boolean = false;

View File

@ -22,12 +22,12 @@ import { AppRoutingModule } from './app-routing.module';
import { AuthGuard } from './guards/auth.guard';
import { PageNotFoundComponent } from './not-found.component';
import { TocComponent } from './form/tableOfContents/toc.component';
import { ProjectsModule } from './projects/project.module';
import { PaginationService } from './services/pagination.service';
import { EestoreService } from './services/eestore.service';
import { GlobalInterceptor } from './services/interceptor';
import { DatasetsModule } from './datasets/dataset.module';
import { DmpModule } from './dmps/dmp.module';
import { TabModule } from './tabs/tab.module';
import { AngularDraggableModule } from 'angular2-draggable';
@ -38,6 +38,33 @@ import { MainSignInComponent } from './login/main-sign-in/main-sign-in.component
import { HTTP_INTERCEPTORS } from '@angular/common/http';
import { CommonModule } from '@angular/common';
import { DatasetTableFilterPipe } from './pipes/dataset-table-filter.pipe';
import { DatasetStatusFilterPipe } from './pipes/dataset-status-filter.pipe';
import { DatasetsComponent } from './datasets/dataset.component';
import { DatasetRoutingModule } from './datasets/dataset-routing.module';
import { DmpComponent } from './dmps/dmp.component';
import { DmpTableFilterPipe } from './pipes/dmp-table-filter.pipe';
import { DmpVersionFilterPipe } from './pipes/dmp-version-filter.pipe';
import { DmpRoutingModule } from './dmps/dmp-routing.module';
import { ProjectTableFilterPipe } from './pipes/project-table-filter.pipe';
import { ProjectsComponent } from './projects/projects.component';
import { ProjectRoutingModule } from './projects/project-routing.module';
import { ProjectDetailComponent } from './projects/project.detail';
import { ModalComponent } from './modal/modal.component';
import { StatusToString } from './pipes/various/status-to-string';
import { SidebarModule } from 'ng-sidebar';
@NgModule({
declarations: [
AppComponent,
@ -45,10 +72,21 @@ import { HTTP_INTERCEPTORS } from '@angular/common/http';
DynamicFormFieldComponent,
DynamicFormGroupComponent,
TocComponent,
//LoginComponent,
GooggleSignInComponent,
MainSignInComponent,
PageNotFoundComponent
PageNotFoundComponent,
ModalComponent,
ProjectDetailComponent,
ProjectsComponent,
DmpComponent,
DatasetsComponent,
ProjectTableFilterPipe,
DmpVersionFilterPipe,
DmpTableFilterPipe,
DatasetTableFilterPipe,
DatasetStatusFilterPipe,
StatusToString
],
imports: [
BrowserModule,
@ -57,12 +95,14 @@ import { HTTP_INTERCEPTORS } from '@angular/common/http';
HttpModule,
HttpClientModule,
TabModule,
ProjectsModule,
DmpModule,
DatasetsModule,
DmpRoutingModule,
CommonModule,
DatasetRoutingModule,
ProjectRoutingModule,
AppRoutingModule,
AngularDraggableModule,
DataTableModule
DataTableModule,
SidebarModule.forRoot()
],
providers: [{
@ -71,7 +111,6 @@ import { HTTP_INTERCEPTORS } from '@angular/common/http';
multi: true,
},
ServerService, dataModelBuilder, AuthGuard, PaginationService, TokenService, LocalStorageService, RestBase, EestoreService,NativeLoginService
],
bootstrap: [AppComponent]
})

View File

@ -5,10 +5,10 @@ import { ServerService } from '../../app/services/server.service';
import { Project } from '../entities/model/project';
import { Dataset } from '../entities/model/dataset';
import { Dmp } from '../entities/model/dmp';
//import { DataTable, DataTableTranslations, DataTableResource } from 'angular-4-data-table-bootstrap-4';
import {DataTable} from 'angular2-datatable';
import { DropdownField } from '../../app/form/fields/dropdown/field-dropdown';
import { Param } from '../entities/model/param';
import { StatusToString } from '../pipes/various/status-to-string';
declare var $: any;

View File

@ -1,6 +1,8 @@
<table class="table table-striped" [mfData]="tableData | datasetTableFilter : filterQuery | datasetstatusFilter: statusFilter" #mf="mfDataTable" [mfRowsOnPage]="rowsOnPage"
[(mfSortBy)]="sortBy" [(mfSortOrder)]="sortOrder">
<thead>
<tr>
<th colspan="1">
@ -36,17 +38,20 @@
<mfDefaultSorter by="description">Description</mfDefaultSorter>
</th>
<th>
<mfDefaultSorter by="status">Status</mfDefaultSorter>
</th>
<mfDefaultSorter by="created">Created at</mfDefaultSorter>
</th>
<th>
<mfDefaultSorter>Actions </mfDefaultSorter>
<mfDefaultSorter by="status">Status</mfDefaultSorter>
</th>
<th>
Actions
</th>
</tr>
</thead>
<tbody>
<tr class="grayout-empty-table" *ngIf="!mf.data[0]">
<td colspan="5">No elements</td>
<td colspan="7">No elements</td>
</tr>
<tr *ngFor="let dataset of mf.data" class="hover">
@ -55,7 +60,8 @@
<td>{{dataset?.uri}}</td>
<td>{{dataset?.profile?.label}}</td>
<td>{{dataset?.description}}</td>
<td>{{dataset?.status}}</td>
<td>{{dataset?.created | date:'yyyy-MM-dd HH:mm:ss Z'}}</td>
<td>{{dataset?.status | statusToString }}</td>
<td><a class="editGridColumn" (click)="editRow(dataset, $event)"><i class="fa fa-pencil fa-fw" data-toggle="tooltip" title="edit Properties" id="editDataset"></i>
<i class="fa fa-eraser fa-fw" data-toggle="tooltip" title="delete Dataset"></i>
<i class="fa fa-list-alt fa-fw" data-toggle="tooltip" title="describe dataset" id="describeDataset"></i></a></td>

View File

@ -1,3 +1,4 @@
/*
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
@ -5,6 +6,7 @@ import {DataTableModule} from 'angular2-datatable';
import { DatasetTableFilterPipe } from '../pipes/dataset-table-filter.pipe';
import { DatasetStatusFilterPipe } from '../pipes/dataset-status-filter.pipe';
import { DatasetsComponent } from './dataset.component';
import { DatasetRoutingModule } from './dataset-routing.module';
@ -19,6 +21,7 @@ import { DatasetRoutingModule } from './dataset-routing.module';
],
declarations: [
DatasetsComponent,
StatusToString,
DatasetTableFilterPipe,
DatasetStatusFilterPipe
//ProjectDetailComponent
@ -29,3 +32,5 @@ import { DatasetRoutingModule } from './dataset-routing.module';
]
})
export class DatasetsModule {}
*/

View File

@ -5,7 +5,7 @@ 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 {DataTable} from 'angular2-datatable';
import { DropdownField } from '../../app/form/fields/dropdown/field-dropdown';
import { Param } from '../entities/model/param';
@ -14,6 +14,7 @@ import { HttpErrorResponse } from '@angular/common/http';
import { FormGroup, FormControl } from '@angular/forms'; //na dw an xreiazontai
import { NgForm } from '@angular/forms';
import { DatasetsComponent } from '../datasets/dataset.component';
import { StatusToString } from '../pipes/various/status-to-string';
declare var $ :any;
@ -49,7 +50,7 @@ export class DmpComponent implements OnInit{
showIDs : boolean = false;
// END ALTERNATIVE
//@Input() dmps: Dmp[];
dmp:any;
@Input() dmpTableVisible: boolean;
@Input() dmpCount = 0;
@ -60,12 +61,7 @@ export class DmpComponent implements OnInit{
dmpIdforDatasets: string;
dmpLabelforDatasets:string;
@ViewChild(DatasetsComponent) datasetsComponent:DatasetsComponent;
/*dmpResource :DataTableResource<Dmp>;
@ViewChild(DataTable) dmpsTable;
@ViewChild(DataTable) datasetsTable;
*/
@ViewChild('isignOutBtn') isignOutBtn;
constructor(
@ -75,13 +71,13 @@ export class DmpComponent implements OnInit{
this.projectsDropDown = new DropdownField();
this.projectsDropDown.options = [];
this.statusDropDown = new DropdownField();
this.statusDropDown.options =[];
this.statusDropDown.options= [{key:'0', value:"active"},{key:'1', value:"inactive"}]
this.statusDropDown.options= [{key:'0', value:"Active"},{key:'1', value:"Inactive"}]
//this.projects = [];
this.dmpTableVisible = false;
this.dataSetVisibe = false;
this.dmp = {
id:null,
id: null,
label: '',
previous:'',
version:'',
@ -92,7 +88,7 @@ export class DmpComponent implements OnInit{
}
ngOnInit() {
//this.projects = this.serverService.getDummyProjects();
this.serverService.getDmpOfUser().subscribe(
response => {
this.tableData = response;
@ -104,7 +100,6 @@ export class DmpComponent implements OnInit{
this.serverService.getAllProjects().subscribe(
response => {
console.log(response);
//let params = new Param();
response.forEach((dmp) => {
let params = new Param();
@ -150,11 +145,9 @@ newDMP(){
}
updateDMP(){
console.log(this.dmp, this.dmp.projectsDropDownKey);
this.dmp.project = {"id":this.dmp.project};
this.serverService.updateDmp(this.dmp)
.subscribe(
response =>{
@ -167,7 +160,6 @@ updateDMP(){
}
SaveDmp(){
debugger;
if (this.dmp.id == null)
this.newDMP();
else
@ -220,6 +212,7 @@ newDmp(item){
// this.dmp.profile = "";
this.dmp.profileData = "";
this.dmp.project = "";
$("#newDmpModal").modal("show");
}

View File

@ -1,3 +1,4 @@
/*
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
@ -27,3 +28,5 @@ import { DatasetsModule } from '../datasets/dataset.module';
providers: [ ]
})
export class DmpModule {}
*/

View File

@ -10,23 +10,19 @@
<input class="form-control" [(ngModel)]="filterQuery" placeholder='Search in Labels' />
</th>
<th colspan="1">
<input class="form-control" [(ngModel)]="versionFilter" placeholder='Filter' />
</th>
<th>
<button class="btn btn-default " (click)="getDmps()">
<span class="glyphicon glyphicon-refresh"></span>
</button>
</button>
</th>
</tr>
<tr>
<th class = "rowFilterTopBorder">
<th class = "rowFilterTopBorder" colspan="3">
<button type="button" class="btn btn-info btnMoreFilters" data-toggle="collapse" data-target="#demo">More filters</button>
<div id="demo" class="collapse">
<input class="form-control" [(ngModel)]="filterQuery" placeholder='Search in Labels' />
<input type="number" [(ngModel)]="versionFilter" placeholder='Version'/>
</div>
</th>
</tr>
<tr>
<th [ngClass]="{true:'visible', false:'invisible'}[showIDs]">
<mfDefaultSorter by="id">ID</mfDefaultSorter>
@ -46,11 +42,14 @@
<th>
<mfDefaultSorter by="description">Description</mfDefaultSorter>
</th>
<th>
<mfDefaultSorter by="created">Created at</mfDefaultSorter>
</th>
<th>
<mfDefaultSorter by="status">Status</mfDefaultSorter>
</th>
<th>
<mfDefaultSorter>Actions </mfDefaultSorter>
Actions
</th>
</tr>
@ -61,13 +60,14 @@
</tr>
<tr *ngFor="let dmp of mf.data" class="hover">
<td [ngClass]="{true:'visible', false:'invisible'}[showIDs]">{{dmp.id}}</td>
<td [ngClass]="{true:'visible', false:'invisible'}[showIDs]">{{dmp?.id}}</td>
<td>{{dmp?.label}}</td>
<td>{{dmp?.version}}</td>
<td>{{dmp?.previous}}</td>
<td>{{dmp?.project?.label}}</td>
<td>{{dmp?.description}}</td>
<td>{{dmp?.status}}</td>
<td>{{dmp?.created | date:'yyyy-MM-dd HH:mm:ss Z'}}</td>
<td>{{dmp?.status | statusToString }}</td>
<td><a class="editGridColumn" (click)="editRow(dmp, $event)"><i class="fa fa-pencil fa-fw" data-toggle="tooltip" title="edit properties" id="editDMP"></i>
<i class="fa fa-clone fa-fw" data-toggle="tooltip" title="create new version" id="changeVersionDMP"></i>
<i class="fa fa-eraser fa-fw" data-toggle="tooltip" title="delete DMP"></i>
@ -77,7 +77,7 @@
</tbody>
<tfoot>
<tr>
<td colspan="5">
<td colspan="7">
<button type="button" class="btn btn-info btncustom" (click)="newDmp(item)">New Dmp</button>
<mfBootstrapPaginator [rowsOnPageSet]="[5,20,40]"></mfBootstrapPaginator>
</td>

View File

@ -0,0 +1,26 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: "statusToString"
})
export class StatusToString implements PipeTransform {
transform(input: any) : any {
if(input < 0) {
return "Deleted";
}
else if(input == 0) {
return "Active";
}
else if(input == 1) {
return "Inactive";
}
else {
return input.toString();
}
}
}

View File

@ -5,7 +5,6 @@ import { Router, ActivatedRoute, ParamMap } from '@angular/router';
@Component({
template: `
<h2>HEROES</h2>
<div *ngIf="project">
<h3>"{{ project.name }}"</h3>
<div>

View File

@ -1,6 +1,5 @@
<meta name="google-signin-client_id" content="524432312250-vhgidft856v8qftsc81kls4c74v87d8o.apps.googleusercontent.com">
<table class="table table-striped" [mfData]="tableData | projectTableFilter : filterQuery"
#mf="mfDataTable" [mfRowsOnPage]="rowsOnPage" [(mfSortBy)]="sortBy" [(mfSortOrder)]="sortOrder">
<thead>

View File

@ -1,3 +1,4 @@
/*
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
@ -28,3 +29,5 @@ import { ModalComponent } from '../modal/modal.component';
providers: [ ]
})
export class ProjectsModule {}
*/

View File

@ -14,6 +14,9 @@ import { HttpErrorResponse } from '@angular/common/http';
import { FormGroup, FormControl } from '@angular/forms'; //na dw an xreiazontai
import { NgForm } from '@angular/forms';
import { ProjectTableFilterPipe } from '../pipes/project-table-filter.pipe';
declare var $ :any;
@Component({

View File

@ -18,19 +18,19 @@ export class RestBase {
/*
protocol: string = "http";
hostname: string ="dl010.madgik.di.uoa.gr" ;//"localhost";//"dl010.madgik.di.uoa.gr";//
port: number = 8080;//8080;//
webappname: string = "dmp-backend";//"dmp-backend-new";//
*/
/* protocol: string = "http";
protocol: string = "http";
hostname: string = "dionysus.di.uoa.gr" ;
port: number = 7070;
webappname: string = "dmp-backend";*/
webappname: string = "dmp-backend";