# Conflicts:
#	dmp-frontend/src/app/app.module.ts
#	dmp-frontend/src/app/homepage/homepage.component.html
This commit is contained in:
Diamantis Tziotzios 2017-12-14 19:15:24 +02:00
commit f08fcda7f5
31 changed files with 1860 additions and 148 deletions

View File

@ -8,6 +8,8 @@ import entities.DMP;
import entities.Organisation; import entities.Organisation;
import entities.Project; import entities.Project;
import entities.responses.IDLabelPair; import entities.responses.IDLabelPair;
import models.dmp.DataManagementPlanTableRequest;
import models.project.ProjectTableRequest;
public interface DMPDao extends Dao<DMP, UUID> { public interface DMPDao extends Dao<DMP, UUID> {
@ -17,4 +19,6 @@ public interface DMPDao extends Dao<DMP, UUID> {
List<DMP> getDMPsOfUser(String userID); List<DMP> getDMPsOfUser(String userID);
public List<DMP> getWithCriteria(DataManagementPlanTableRequest dataManagementPlanTableRequest);
} }

View File

@ -6,6 +6,9 @@ import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.persistence.TypedQuery; import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import org.hibernate.query.Query; import org.hibernate.query.Query;
@ -14,6 +17,8 @@ import entities.DMP;
import entities.Project; import entities.Project;
import entities.UserInfo; import entities.UserInfo;
import entities.responses.IDLabelPair; import entities.responses.IDLabelPair;
import models.dmp.DataManagementPlanTableRequest;
import models.project.ProjectTableRequest;
public class DMPDaoImpl extends JpaDao<DMP, UUID> implements DMPDao { public class DMPDaoImpl extends JpaDao<DMP, UUID> implements DMPDao {
@ -53,12 +58,18 @@ public class DMPDaoImpl extends JpaDao<DMP, UUID> implements DMPDao {
catch(Exception ex) { //no need to distinguish between exceptions for the moment catch(Exception ex) { //no need to distinguish between exceptions for the moment
ex.printStackTrace(); ex.printStackTrace();
return null; return null;
} }
} }
@Override
public List<DMP> getWithCriteria(DataManagementPlanTableRequest dataManagementPlanTableRequest) {
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<DMP> criteriaQuery = criteriaBuilder .createQuery(DMP.class);
Root<DMP> root = criteriaQuery.from(DMP.class);
TypedQuery<DMP> typedQuery = entityManager.createQuery(criteriaQuery);
typedQuery.setFirstResult(dataManagementPlanTableRequest.getOffset());
typedQuery.setMaxResults(dataManagementPlanTableRequest.getLength());
return typedQuery.getResultList();
}
} }

View File

@ -6,6 +6,7 @@ import java.util.UUID;
import dao.Dao; import dao.Dao;
import entities.Project; import entities.Project;
import entities.responses.IDLabelPair; import entities.responses.IDLabelPair;
import models.project.ProjectTableRequest;
public interface ProjectDao extends Dao<Project, UUID> { public interface ProjectDao extends Dao<Project, UUID> {
@ -15,4 +16,6 @@ public interface ProjectDao extends Dao<Project, UUID> {
public List<Project> getProjectsOfUser(String userID); public List<Project> getProjectsOfUser(String userID);
public List<Project> getWithCriteria(ProjectTableRequest projectTableRequest);
} }

View File

@ -5,13 +5,18 @@ import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.persistence.TypedQuery; import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import org.hibernate.query.Query; import org.hibernate.query.Query;
import dao.JpaDao; import dao.JpaDao;
import entities.DMP; import entities.DMP;
import entities.Project; import entities.Project;
import entities.Registry;
import entities.responses.IDLabelPair; import entities.responses.IDLabelPair;
import models.project.ProjectTableRequest;
public class ProjectDaoImpl extends JpaDao<Project, UUID> implements ProjectDao { public class ProjectDaoImpl extends JpaDao<Project, UUID> implements ProjectDao {
@ -55,6 +60,17 @@ public class ProjectDaoImpl extends JpaDao<Project, UUID> implements ProjectDao
} }
@Override
public List<Project> getWithCriteria(ProjectTableRequest projectTableRequest) {
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<Project> criteriaQuery = criteriaBuilder .createQuery(Project.class);
Root<Project> root = criteriaQuery.from(Project.class);
TypedQuery<Project> typedQuery = entityManager.createQuery(criteriaQuery);
typedQuery.setFirstResult(projectTableRequest.getOffset());
typedQuery.setMaxResults(projectTableRequest.getLength());
return typedQuery.getResultList();
}

View File

@ -0,0 +1,20 @@
package managers;
import org.springframework.beans.factory.annotation.Autowired;
import dao.entities.DMPDao;
import dao.entities.DatasetDao;
import dao.entities.ProjectDao;
import models.dashboard.DashBoardStatistics;
public class DashBoardManager {
public DashBoardStatistics getStatistics(DatasetDao datasetRepository,DMPDao dataManagementPlanRepository,ProjectDao projectRepository){
DashBoardStatistics statistics = new DashBoardStatistics();
statistics.setTotalDataManagementPlanCount(dataManagementPlanRepository.count());
statistics.setTotalDataSetCount(datasetRepository.count());
statistics.setTotalProjectCount(projectRepository.count());
return statistics;
}
}

View File

@ -0,0 +1,29 @@
package managers;
import java.util.List;
import java.util.UUID;
import dao.entities.DMPDao;
import dao.entities.ProjectDao;
import models.dmp.DataManagementPlanTableRequest;
import models.helpers.DataTableData;
import models.project.Project;
import models.project.ProjectTableRequest;
import utilities.builders.DomainModelConverter;
public class DataManagementPlanManager {
public DataTableData<models.dmp.DataManagementPlan> getPaged(DMPDao dmpsRepository,DataManagementPlanTableRequest dataManagementPlanTableRequest) throws IllegalAccessException, InstantiationException{
List<models.dmp.DataManagementPlan> datamanagementPlans = new DomainModelConverter<entities.DMP, models.dmp.DataManagementPlan>().fromDataModel( dmpsRepository.getWithCriteria(dataManagementPlanTableRequest),models.dmp.DataManagementPlan.class);
DataTableData<models.dmp.DataManagementPlan> dataTable = new DataTableData<models.dmp.DataManagementPlan>();
dataTable.setData(datamanagementPlans);
dataTable.setTotalCount(dmpsRepository.count());
return dataTable;
}
public models.dmp.DataManagementPlan getSingle(DMPDao dmpsRepository,String id) throws InstantiationException, IllegalAccessException{
models.dmp.DataManagementPlan datamanagementPlan = new models.dmp.DataManagementPlan();
datamanagementPlan.fromDataModel(dmpsRepository.read(UUID.fromString(id)));
return datamanagementPlan;
}
}

View File

@ -0,0 +1,27 @@
package managers;
import java.util.List;
import java.util.UUID;
import dao.entities.ProjectDao;
import models.helpers.DataTableData;
import models.project.Project;
import models.project.ProjectTableRequest;
import utilities.builders.DomainModelConverter;
public class ProjectManager {
public DataTableData<models.project.Project> getPaged(ProjectDao projectRepository,ProjectTableRequest projectTableRequest) throws IllegalAccessException, InstantiationException{
List<models.project.Project> projects = new DomainModelConverter<entities.Project, Project>().fromDataModel( projectRepository.getWithCriteria(projectTableRequest),models.project.Project.class);
DataTableData<models.project.Project> dataTable = new DataTableData<models.project.Project>();
dataTable.setData(projects);
dataTable.setTotalCount(projectRepository.count());
return dataTable;
}
public models.project.Project getSingle(ProjectDao projectRepository,String id) throws InstantiationException, IllegalAccessException{
models.project.Project project = new models.project.Project();
project.fromDataModel(projectRepository.read(UUID.fromString(id)));
return project;
}
}

View File

@ -0,0 +1,7 @@
package models.criteria;
import entities.DMP;
public class DataManagementPlanCriteria extends Criteria<DMP>{
}

View File

@ -0,0 +1,7 @@
package models.criteria;
import entities.Project;
public class ProjectCriteria extends Criteria<Project>{
}

View File

@ -0,0 +1,29 @@
package models.dashboard;
public class DashBoardStatistics {
private Long totalDataManagementPlanCount;
private Long totalProjectCount;
private Long totalDataSetCount;
public Long getTotalDataManagementPlanCount() {
return totalDataManagementPlanCount;
}
public void setTotalDataManagementPlanCount(Long totalDataManagementPlanCount) {
this.totalDataManagementPlanCount = totalDataManagementPlanCount;
}
public Long getTotalProjectCount() {
return totalProjectCount;
}
public void setTotalProjectCount(Long totalProjectCount) {
this.totalProjectCount = totalProjectCount;
}
public Long getTotalDataSetCount() {
return totalDataSetCount;
}
public void setTotalDataSetCount(Long totalDataSetCount) {
this.totalDataSetCount = totalDataSetCount;
}
}

View File

@ -103,7 +103,7 @@ public class DataManagementPlan implements DataModel<DMP>{
this.project = new models.dmp.Project(); this.project = new models.dmp.Project();
this.project.fromDataModel(entity.getProject()); this.project.fromDataModel(entity.getProject());
this.creator = new models.dmp.UserInfo(); this.creator = new models.dmp.UserInfo();
this.creator.fromDataModel(entity.getCreator()); if(entity.getCreator()!=null)this.creator.fromDataModel(entity.getCreator());
} }
@Override @Override

View File

@ -0,0 +1,36 @@
package models.dmp;
import models.criteria.DataManagementPlanCriteria;
public class DataManagementPlanTableRequest {
private Integer length;
private Integer offset;
private DataManagementPlanCriteria criteria;
public Integer getLength() {
return length;
}
public void setLength(Integer length) {
this.length = length;
}
public Integer getOffset() {
return offset;
}
public void setOffset(Integer offset) {
this.offset = offset;
}
public DataManagementPlanCriteria getCriteria() {
return criteria;
}
public void setCriteria(DataManagementPlanCriteria criteria) {
this.criteria = criteria;
}
}

View File

@ -0,0 +1,21 @@
package models.helpers;
import java.util.List;
public class DataTableData<T> {
private Long totalCount;
private List<T> data;
public Long getTotalCount() {
return totalCount;
}
public void setTotalCount(Long totalCount) {
this.totalCount = totalCount;
}
public List<T> getData() {
return data;
}
public void setData(List<T> data) {
this.data = data;
}
}

View File

@ -0,0 +1,201 @@
package models.project;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import entities.DMP;
import entities.UserInfo;
import models.DataModel;
import models.dmp.DataManagementPlan;
public class Project implements DataModel<entities.Project>{
private UUID id;
private List<DataManagementPlan> dmps;
private String label;
private String abbreviation;
private String reference;
private String uri;
private String definition;
private Date startdate;
private Date enddate;
private Short status;
private UserInfo creationUser;
private Date created;
private Date modified;
private String description;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public List<DataManagementPlan> getDmps() {
return dmps;
}
public void setDmps(List<DataManagementPlan> dmps) {
this.dmps = dmps;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getAbbreviation() {
return abbreviation;
}
public void setAbbreviation(String abbreviation) {
this.abbreviation = abbreviation;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getDefinition() {
return definition;
}
public void setDefinition(String definition) {
this.definition = definition;
}
public Date getStartdate() {
return startdate;
}
public void setStartdate(Date startdate) {
this.startdate = startdate;
}
public Date getEnddate() {
return enddate;
}
public void setEnddate(Date enddate) {
this.enddate = enddate;
}
public Short getStatus() {
return status;
}
public void setStatus(Short status) {
this.status = status;
}
public UserInfo getCreationUser() {
return creationUser;
}
public void setCreationUser(UserInfo creationUser) {
this.creationUser = creationUser;
}
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
public Date getModified() {
return modified;
}
public void setModified(Date modified) {
this.modified = modified;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public void fromDataModel(entities.Project entity) throws InstantiationException, IllegalAccessException {
this.id = entity.getId();
this.label = entity.getLabel();
this.abbreviation = entity.getAbbreviation();
this.reference = entity.getReference();
this.uri = entity.getUri();
this.definition = entity.getDefinition();
this.startdate = entity.getStartdate();
this.enddate = entity.getEnddate();
this.status = entity.getStatus();
this.created = entity.getCreated();
this.modified = entity.getModified();
this.description = entity.getDescription();
}
@Override
public entities.Project toDataModel() {
entities.Project entity = new entities.Project();
entity.setId(this.id);
entity.setAbbreviation(this.abbreviation);
entity.setLabel(this.label);
entity.setReference(this.reference);
entity.setUri(this.uri);
entity.setDefinition(this.definition);
entity.setStartdate(this.startdate);
entity.setCreated(this.created == null? new Date():this.created);
entity.setEnddate(this.enddate);
entity.setStatus(this.status);
entity.setModified(new Date());
entity.setDescription(this.description);
return entity;
}
}

View File

@ -0,0 +1,36 @@
package models.project;
import models.criteria.ProjectCriteria;
public class ProjectTableRequest {
private int length;
private int offset;
private ProjectCriteria criteria;
public int getLength() {
return length;
}
public void setLength(int length) {
this.length = length;
}
public int getOffset() {
return offset;
}
public void setOffset(int offset) {
this.offset = offset;
}
public ProjectCriteria getCriteria() {
return criteria;
}
public void setCriteria(ProjectCriteria criteria) {
this.criteria = criteria;
}
}

View File

@ -11,6 +11,10 @@ import models.criteria.OrganisationCriteria;
import models.criteria.ResearcherCriteria; import models.criteria.ResearcherCriteria;
import models.criteria.ServiceCriteria; import models.criteria.ServiceCriteria;
import models.dmp.DataManagementPlan; import models.dmp.DataManagementPlan;
import models.dmp.DataManagementPlanTableRequest;
import models.helpers.DataTableData;
import models.project.ProjectTableRequest;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
@ -38,9 +42,12 @@ import dao.entities.ServiceDao;
import dao.entities.UserInfoDao; import dao.entities.UserInfoDao;
import entities.DMP; import entities.DMP;
import entities.Dataset; import entities.Dataset;
import entities.Project;
import entities.UserInfo; import entities.UserInfo;
import entities.responses.IDLabelPair; import entities.responses.IDLabelPair;
import helpers.SerializerProvider; import helpers.SerializerProvider;
import managers.DataManagementPlanManager;
import managers.ProjectManager;
import utilities.builders.DomainModelConverter; import utilities.builders.DomainModelConverter;
@ -66,6 +73,42 @@ public class DMPs {
// FETCH BY DMP(S) // FETCH BY DMP(S)
@RequestMapping(method = RequestMethod.POST, value = { "/dmps/getPaged" }, consumes = "application/json", produces="application/json")
public @ResponseBody ResponseEntity<DataTableData<models.dmp.DataManagementPlan>> getPaged(@RequestBody DataManagementPlanTableRequest dataManagementPlanTableRequest) {
try {
DataTableData<models.dmp.DataManagementPlan> dataTable = new DataManagementPlanManager().getPaged(dMPDao, dataManagementPlanTableRequest);
return ResponseEntity.status(HttpStatus.OK).body(dataTable);
} catch (Exception ex) {
ex.printStackTrace();
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null);
}
}
@RequestMapping(method = RequestMethod.GET, value = { "/dmps/getSingle/{id}" }, produces="application/json")
public @ResponseBody ResponseEntity<models.dmp.DataManagementPlan> getPaged(@PathVariable String id) {
try {
models.dmp.DataManagementPlan project = new DataManagementPlanManager().getSingle(dMPDao, id);
return ResponseEntity.status(HttpStatus.OK).body(project);
} catch (Exception ex) {
ex.printStackTrace();
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null);
}
}
@Transactional
@RequestMapping(method = RequestMethod.POST, value = { "/dmps/add" }, consumes = "application/json", produces="application/json")
public @ResponseBody ResponseEntity<entities.DMP> addDmp(@RequestBody models.dmp.DataManagementPlan dataManagementPlan) {
entities.DMP createdProject = dMPDao.update(dataManagementPlan.toDataModel());
return ResponseEntity.status(HttpStatus.CREATED).body(createdProject);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@RequestMapping(method = RequestMethod.GET, value = { "/dmps" }, produces="text/plain") @RequestMapping(method = RequestMethod.GET, value = { "/dmps" }, produces="text/plain")
public @ResponseBody ResponseEntity<Object> listDMPs(){ public @ResponseBody ResponseEntity<Object> listDMPs(){
try { try {

View File

@ -0,0 +1,51 @@
package rest.entities;
import java.util.Map;
import java.util.UUID;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import dao.entities.DMPDao;
import dao.entities.DMPProfileDao;
import dao.entities.DataRepositoryDao;
import dao.entities.DatasetDao;
import dao.entities.DatasetProfileDao;
import dao.entities.DatasetProfileRulesetDao;
import dao.entities.DatasetProfileViewstyleDao;
import dao.entities.OrganisationDao;
import dao.entities.ProjectDao;
import dao.entities.RegistryDao;
import dao.entities.ResearcherDao;
import dao.entities.ServiceDao;
import managers.DashBoardManager;
import managers.UserManager;
import models.dashboard.DashBoardStatistics;
@RestController
@CrossOrigin
public class DashBoardController {
@Autowired private DatasetDao datasetDao;
@Autowired private DMPDao dMPDao;
@Autowired private ProjectDao projectDao;
@RequestMapping(method = RequestMethod.GET, value = { "/dashboard/getStatistics" }, produces="application/json")
public ResponseEntity<Object> getStatistics(){
try {
DashBoardStatistics statistics = new DashBoardManager().getStatistics(datasetDao, dMPDao, projectDao);
return ResponseEntity.status(HttpStatus.OK).body(statistics);
}
catch(Exception ex) {
ex.printStackTrace();
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
}
}
}

View File

@ -61,6 +61,9 @@ import entities.UserInfo;
import entities.responses.IDLabelPair; import entities.responses.IDLabelPair;
import helpers.SerializerProvider; import helpers.SerializerProvider;
import helpers.Transformers; import helpers.Transformers;
import managers.ProjectManager;
import models.helpers.DataTableData;
import models.project.ProjectTableRequest;
import proxy.config.exceptions.HugeResultSet; import proxy.config.exceptions.HugeResultSet;
import proxy.config.exceptions.NoURLFound; import proxy.config.exceptions.NoURLFound;
import proxy.fetching.RemoteFetcher; import proxy.fetching.RemoteFetcher;
@ -88,6 +91,43 @@ public class Projects {
@Autowired private RemoteFetcher remoteFetcher; @Autowired private RemoteFetcher remoteFetcher;
@RequestMapping(method = RequestMethod.POST, value = { "/projects/getPaged" }, consumes = "application/json", produces="application/json")
public @ResponseBody ResponseEntity<DataTableData<models.project.Project>> getPaged(@RequestBody ProjectTableRequest projectTableRequest) {
try {
DataTableData<models.project.Project> dataTable = new ProjectManager().getPaged(projectDao, projectTableRequest);
return ResponseEntity.status(HttpStatus.OK).body(dataTable);
} catch (Exception ex) {
ex.printStackTrace();
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null);
}
}
@RequestMapping(method = RequestMethod.GET, value = { "/projects/getSingle/{id}" }, produces="application/json")
public @ResponseBody ResponseEntity<models.project.Project> getPaged(@PathVariable String id) {
try {
models.project.Project project = new ProjectManager().getSingle(projectDao, id);
return ResponseEntity.status(HttpStatus.OK).body(project);
} catch (Exception ex) {
ex.printStackTrace();
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null);
}
}
@Transactional
@RequestMapping(method = RequestMethod.POST, value = { "/projects/add" }, consumes = "application/json", produces="application/json")
public @ResponseBody ResponseEntity<entities.Project> addProject(@RequestBody models.project.Project project) {
Project createdProject = projectDao.update(project.toDataModel());
return ResponseEntity.status(HttpStatus.CREATED).body(createdProject);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@RequestMapping(method = RequestMethod.GET, value = { "/external/projects" }, produces="application/json") @RequestMapping(method = RequestMethod.GET, value = { "/external/projects" }, produces="application/json")
public @ResponseBody ResponseEntity<Object> listExternalProjects(@RequestParam(value="query", required=false) String query ){ public @ResponseBody ResponseEntity<Object> listExternalProjects(@RequestParam(value="query", required=false) String query ){
try { try {

View File

@ -24,7 +24,7 @@
<csrf disabled="true"/> <csrf disabled="true"/>
<custom-filter after="BASIC_AUTH_FILTER" ref="tokenAuthenticationFilter" /> <custom-filter after="BASIC_AUTH_FILTER" ref="tokenAuthenticationFilter" />
<intercept-url pattern="/**" access="isAuthenticated()" /> <intercept-url pattern="/**" access="true" />
<http-basic/> <http-basic/>
</http> </http>

0
dmp-frontend/2.4.2 Normal file
View File

File diff suppressed because it is too large Load Diff

View File

@ -109,6 +109,10 @@ import { DataManagementPlanListingComponent } from './dmps/dmp-listing.component
import { ProjectEditorComponent } from './projects/editor/project-editor.component'; import { ProjectEditorComponent } from './projects/editor/project-editor.component';
import { DataManagementPlanEditorComponent } from './dmps/editor/dmp-editor.component'; import { DataManagementPlanEditorComponent } from './dmps/editor/dmp-editor.component';
import { FigurecardComponent } from './figurecard/figurecard.component';
@NgModule({ @NgModule({
declarations: [ declarations: [
AppComponent, AppComponent,
@ -146,8 +150,8 @@ import { DataManagementPlanEditorComponent } from './dmps/editor/dmp-editor.comp
DynamicFieldCheckBoxComponent, DynamicFieldCheckBoxComponent,
BreadcrumbComponent, DmpDetailedComponent, ProjectDetailedComponent, BreadcrumbComponent, DmpDetailedComponent, ProjectDetailedComponent,
ProjectEditorComponent, ProjectEditorComponent,
DataManagementPlanEditorComponent DataManagementPlanEditorComponent,
FigurecardComponent
], ],
imports: [ imports: [
BrowserModule, BrowserModule,

View File

@ -0,0 +1,51 @@
.figure-card{
display: inline-block;
position: relative;
width: 100%;
margin: 25px 0;
}
.card-content{
text-align: right;
padding: 15px 20px 13px 20px;
}
.card-header {
float: left;
text-align: center;
/*background: linear-gradient(60deg, #ffa726, #fb8c00);*/
/*box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(255, 152, 0, 0.4);*/
margin: -20px 15px 0;
border-radius: 3px;
padding: 15px;
position: relative;
}
.card-header i {
font-size: 36px;
line-height: 56px;
width: 56px;
height: 56px;
color: #fff;
}
.category{
color: #999;
}
.card-footer{
margin: 0 20px 10px;
padding-top: 10px;
border-top: 1px solid #eee;
color: #999;
font-size: 12px;
position: relative;
}
.card-footer i {
font-size: 16px;
position: relative;
top: 4px;
color: #999;
}

View File

@ -0,0 +1,13 @@
<div class="figure-card card">
<div class="card-header" [ngStyle]="{ 'background': linearColor, 'box-shadow': boxShadow }">
<i class="material-icons">{{ headerIcon }}</i>
</div>
<div class="card-content">
<p class="category">{{ category }}</p>
<h3 class="title">{{ title }}</h3>
</div>
<div class="card-footer">
<a style="cursor:pointer;"><i class="material-icons text-danger">{{ footerIcon }}</i> {{ footContent }}</a>
</div>
</div>

View File

@ -0,0 +1,21 @@
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-figurecard',
templateUrl: './figurecard.component.html',
styleUrls: ['./figurecard.component.css']
})
export class FigurecardComponent implements OnInit {
@Input() headerIcon: string;
@Input() category: string;
@Input() title: string;
@Input() footerIcon: string;
@Input() footContent: string;
@Input() linearColor: string;
@Input() boxShadow: string;
constructor() { }
ngOnInit() {
}
}

View File

@ -0,0 +1,44 @@
.card{
padding: 25px 20px 20px 20px;
display: flex;
flex-direction: column;
align-items: center;
}
.card h6, p {
color: #999;
}
.icon{
margin-top: 20px;
width: 130px;
height: 130px;
border: 1px solid #e5e5e5;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
}
.icon i{
font-size: 55px;
color: #e91e63;
}
.card-title{
margin-top: 30px;
margin-bottom: 3px;
}
.card-description{
margin-bottom: 20px;
}
.card-dataset{
display: flex;
flex-direction: column;
padding: 20px;
position: relative;
margin-top: 40px;
}

View File

@ -1,8 +1,169 @@
<!-- <div class="jumbotron">
<div class="jumbotron">
<h2>Hello {{ userInfo?.name!=null ? userInfo?.name : userInfo?.email }}</h2> <h2>Hello {{ userInfo?.name!=null ? userInfo?.name : userInfo?.email }}</h2>
<p>Welcome {{ userInfo?.created != userInfo?.lastloggedin ? "back" : "" }} to the <a href="https://en.wikipedia.org/wiki/Data_management_plan">Data Management Plans</a> composer application. </p> <p>Welcome {{ userInfo?.created != userInfo?.lastloggedin ? "back" : "" }} to the <a href="https://en.wikipedia.org/wiki/Data_management_plan">Data Management Plans</a> composer application. </p>
<!-- <!--
<p><a class="btn btn-primary btn-lg" href="#" role="button">Learn more</a></p> <p><a class="btn btn-primary btn-lg" href="#" role="button">Learn more</a></p>
--> -->
</div> <!--</div> -->
<div class="main-panel" id="main-panel">
<div class="container">
<div class="row page-title">
<div class="col-md-8 col-md-offset-2">
<div class="row">
<div class="col-md-4 page-title">
<div class="card card-raised">
<h6>Projects</h6>
<div class="icon">
<i class="material-icons">list</i>
</div>
<h3 class="card-title">52</h3>
<p class="card-description text-center">
This is good if your company size is between 2 and 10 Persons.
</p>
<button md-raised-button class="btn btn-rose btn-round">OPEN PROJECTS</button>
</div>
</div>
<div class="col-md-4 page-title">
<div class="card card-raised">
<h6>DMPs</h6>
<div class="icon">
<i class="material-icons">mode_edit</i>
</div>
<h3 class="card-title">33</h3>
<p class="card-description text-center">
This is good if your company size is between 2 and 10 Persons.
</p>
<button md-raised-button class="btn btn-rose btn-round">OPEN DMPs</button>
</div>
</div>
<div class="col-md-4 page-title">
<div class="card card-raised">
<h6>Datasets</h6>
<div class="icon">
<i class="material-icons">subject</i>
</div>
<h3 class="card-title">3</h3>
<p class="card-description text-center">
This is good if your company size is between 2 and 10 Persons.
</p>
<button md-raised-button class="btn btn-rose btn-round">OPEN DATASETS</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<!-- <app-navbar title="Dashboard"></app-navbar> -->
<div class="row" style="margin-top: 30px">
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 col-md-offset-1">
<app-figurecard
title="184"
headerIcon="list"
category="Projects"
footContent="open projects"
footerIcon="open_in_new"
linearColor="linear-gradient(60deg, #ffa726, #fb8c00)"
boxShadow="0 4px 20px 0 rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(255, 152, 0, 0.4)">
</app-figurecard>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<app-figurecard
title="75.521"
headerIcon="mode_edit"
category="DMPs"
footContent="open DMPs"
footerIcon="open_in_new"
linearColor="linear-gradient(60deg, #ef5350, #e53935)"
boxShadow="0 4px 20px 0px rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(244, 67, 54, 0.4)">
</app-figurecard>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<app-figurecard
title="+245"
headerIcon="subject"
category="Datasets"
footContent="open datasets"
footerIcon="open_in_new"
linearColor="linear-gradient(60deg, #26c6da, #00acc1)"
boxShadow="0 4px 20px 0px rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(0, 188, 212, 0.4)">
</app-figurecard>
</div>
</div>
</div>
<div class="container">
<!-- <app-navbar title="Table List"></app-navbar> -->
<div class="row">
<div class="col-mat-12">
<div class="card-dataset">
<div class="card-header">
<i class="material-icons">assignment</i>
<a style = "cursor:pointer;"><i class="material-icons">add_circle</i></a>
</div>
<div class="card-content">
<h4 class="card-title">Active Datasets</h4>
<div class="table-responsive">
<table class="table">
<thead class="text-primary">
<tr>
<th>First Name</th>
<th>Country</th>
<th>City</th>
<th>Salary</th>
</tr>
</thead>
<tbody>
<tr>
<td>Dakota Rice</td>
<td>Niger</td>
<td>Oud-Turnhout</td>
<td class="text-primary">$36,738</td>
</tr>
<tr>
<td>Minerva Hooper</td>
<td>Curaçao</td>
<td>Sinaai-Waas</td>
<td class="text-primary">$23,789</td>
</tr>
<tr>
<td>Sage Rodriguez</td>
<td>Netherlands</td>
<td>Baileux</td>
<td class="text-primary">$56,142</td>
</tr>
<tr>
<td>Philip Chaney</td>
<td>Korea, South</td>
<td>Overland Park</td>
<td class="text-primary">$38,735</td>
</tr>
<tr>
<td>Doris Greene</td>
<td>Malawi</td>
<td>Feldkirchen in Kärnten</td>
<td class="text-primary">$63,542</td>
</tr>
<tr>
<td>Mason Porter</td>
<td>Chile</td>
<td>Gloucester</td>
<td class="text-primary">$78,615</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -1,6 +1,7 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router'; import { Router, ActivatedRoute } from '@angular/router';
import { ServerService } from '../../app/services/server.service'; import { ServerService } from '../../app/services/server.service';
import { RestBase } from '../../app/services/rest-base';
@Component({ @Component({
selector: 'homepage', selector: 'homepage',
@ -12,7 +13,7 @@ export class HomepageComponent implements OnInit{
private userInfo: any; private userInfo: any;
constructor(private serverService: ServerService, private route: ActivatedRoute, private router: Router){ constructor(private serverService: ServerService, private route: ActivatedRoute, private router: Router, private restbase: RestBase){
} }
@ -25,8 +26,12 @@ export class HomepageComponent implements OnInit{
error => { error => {
} }
); );
} }
getStatistics(){
return this.restbase.get("datasetprofile/getAll");
}
} }

View File

@ -22,6 +22,7 @@ import {
MatProgressSpinnerModule, MatProgressSpinnerModule,
DateAdapter, DateAdapter,
MatTooltipModule, MatTooltipModule,
MatCheckboxModule,
MatTabsModule MatTabsModule
} from '@angular/material'; } from '@angular/material';
import { CdkTableModule } from '@angular/cdk/table'; import { CdkTableModule } from '@angular/cdk/table';
@ -54,6 +55,7 @@ import { SnackBarNotificationComponent } from '../components/notificaiton/snack-
MatProgressBarModule, MatProgressBarModule,
MatProgressSpinnerModule, MatProgressSpinnerModule,
MatTooltipModule, MatTooltipModule,
MatCheckboxModule,
MatTabsModule MatTabsModule
], ],

View File

@ -51,6 +51,7 @@
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head> </head>
<body> <body>

View File

@ -71,4 +71,33 @@ body {
.cursor-link{ .cursor-link{
cursor: pointer; cursor: pointer;
} }
/* dashboard */
.card{
box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.14);
border-radius: 6px;
color: rgba(0,0,0, 0.87);
background: #fff;
}
.card-raised{
box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.42), 0 4px 25px 0px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 0, 0, 0.2);
}
@media screen and (max-width: 990px){
#sidebar, #nav-right, #nav-left-button{
display: none;
}
#menu{
display: inline;
}
#main-panel{
padding-left: 0;
-webkit-transition: all 400ms;
-moz-transition: all 400ms;
-ms-transition: all 400ms;
-o-transition: all 400ms;
transition: all 400ms;
}
}