no message

This commit is contained in:
Ioannis Kalyvas 2018-07-23 16:09:19 +03:00
parent 78b91ee3e0
commit c25c9d72cf
29 changed files with 314 additions and 204 deletions

View File

@ -15,7 +15,7 @@ import java.util.*;
@NamedEntityGraph( @NamedEntityGraph(
name = "dataManagementPlanListingModel", name = "dataManagementPlanListingModel",
attributeNodes = {@NamedAttributeNode("organisations"), @NamedAttributeNode("researchers"), attributeNodes = {@NamedAttributeNode("organisations"), @NamedAttributeNode("researchers"),
@NamedAttributeNode("project"), @NamedAttributeNode("creator"), @NamedAttributeNode("profile"), @NamedAttributeNode("dataset")} @NamedAttributeNode("project"),@NamedAttributeNode("users"), @NamedAttributeNode("creator"), @NamedAttributeNode("profile"), @NamedAttributeNode("dataset")}
), ),
@NamedEntityGraph( @NamedEntityGraph(
name = "fullyDetailed", name = "fullyDetailed",

View File

@ -22,7 +22,7 @@ import java.util.UUID;
@NamedEntityGraph( @NamedEntityGraph(
name = "projectListingItem", name = "projectListingItem",
attributeNodes = {@NamedAttributeNode(value = "dmps", subgraph = "dmps"), @NamedAttributeNode(value = "content")}, attributeNodes = {@NamedAttributeNode(value = "dmps", subgraph = "dmps"), @NamedAttributeNode(value = "content")},
subgraphs = @NamedSubgraph(name = "dmps", attributeNodes = {@NamedAttributeNode("creator"), @NamedAttributeNode("users")}) subgraphs = @NamedSubgraph(name = "dmps", attributeNodes = {@NamedAttributeNode("creator"),@NamedAttributeNode("project"), @NamedAttributeNode("users")})
) )
}) })
public class Project implements DataEntity<Project, UUID> { public class Project implements DataEntity<Project, UUID> {

View File

@ -1,14 +1,19 @@
import eu.eudat.data.entities.DataRepository; import eu.eudat.data.entities.DataRepository;
import eu.eudat.query.engine.builder.QueryBuilder; import eu.eudat.query.engine.builder.QueryBuilder;
import eu.eudat.query.engine.builder.QueryBuilderImpl; import eu.eudat.query.engine.builder.QueryBuilderImpl;
import eu.eudat.query.engine.predicates.ComparisonPredicate;
/** /**
* Created by ikalyvas on 7/5/2018. * Created by ikalyvas on 7/5/2018.
*/ */
public class Main { public class Main {
public static void main(String[] args){
new Main().Test();
}
public void Test(){ public void Test(){
QueryBuilder<DataRepository> queryBuilder = new QueryBuilderImpl<>(); QueryBuilder<DataRepository> queryBuilder = new QueryBuilderImpl<>(DataRepository.class);
queryBuilder.where((entity, comparisonExpression) -> comparisonExpression.field("id").greaterThan(5)); queryBuilder.<ComparisonPredicate>where((comparisonExpression) -> comparisonExpression.field("id").greaterThan(5) );
//queryBuilder.and(((entity, expression) -> expression.field("id").greaterThan(4)),((entity, expression) -> expression.field("id").greaterThan(5))); queryBuilder.<ComparisonPredicate>where((comparisonExpression) -> comparisonExpression.field("label").equal("mitsos") );
queryBuilder.toList();
} }
} }

View File

@ -1,16 +1,16 @@
package eu.eudat.query.engine.builder; package eu.eudat.query.engine.builder;
import eu.eudat.query.engine.expressions.Expression; import eu.eudat.query.engine.expressions.Expression;
import eu.eudat.query.engine.predicates.AndPredicate; import eu.eudat.query.engine.predicates.Predicate;
import eu.eudat.query.engine.predicates.ComparisonPredicate;
import java.util.List;
/** /**
* Created by ikalyvas on 7/5/2018. * Created by ikalyvas on 7/5/2018.
*/ */
public interface QueryBuilder<T> { public interface QueryBuilder<T> {
Expression where(ComparisonPredicate<T> wherePredicate); <P extends Predicate> Expression where(P wherePredicate);
Expression and(AndPredicate<T> andPredicate);
List<T> toList();
} }

View File

@ -1,22 +1,50 @@
package eu.eudat.query.engine.builder; package eu.eudat.query.engine.builder;
import eu.eudat.query.engine.expressions.ComparisonExpression;
import eu.eudat.query.engine.expressions.Expression; import eu.eudat.query.engine.expressions.Expression;
import eu.eudat.query.engine.predicates.AndPredicate; import eu.eudat.query.engine.predicates.Predicate;
import eu.eudat.query.engine.predicates.ComparisonPredicate;
import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
/** /**
* Created by ikalyvas on 7/5/2018. * Created by ikalyvas on 7/5/2018.
*/ */
public class QueryBuilderImpl<T> implements QueryBuilder<T> { public class QueryBuilderImpl<T> implements QueryBuilder<T> {
private List<Expression> expressions = new LinkedList<>();
private Class<T> tClass;
@Override public QueryBuilderImpl(Class<T> tClass) {
public Expression where(ComparisonPredicate wherePredicate) { this.tClass = tClass;
return null;
} }
@Override @Override
public Expression and(AndPredicate<T> andPredicate) { public <P extends Predicate> Expression where(P wherePredicate) {
ComparisonExpression comparisonExpression = new ComparisonExpression();
Expression expression = wherePredicate.apply(comparisonExpression);
this.expressions.add(expression);
return expression;
}
@Override
public List<T> toList() {
String query = "Select * from ";
Optional<Annotation> optionalAnnotation = Arrays.stream(this.tClass.getAnnotations())
.filter(x-> x.annotationType().equals(javax.persistence.Table.class))
.findFirst();
javax.persistence.Table annotation = optionalAnnotation.isPresent() ? (javax.persistence.Table)optionalAnnotation.get() : null;
query += annotation.name()+" ";
for (Expression expression : expressions) {
if(expressions.indexOf(expression) > 0) query+= " and ";
else query += " where ";
query += expression.evaluate();
}
System.out.println(query);
return null; return null;
} }
} }

View File

@ -40,4 +40,8 @@ public class ComparisonExpression extends AbstractFieldExpression<ComparisonExpr
return this; return this;
} }
@Override
public String evaluate() {
return this.getField() +" " + type.toString() + " " + value ;
}
} }

View File

@ -4,4 +4,5 @@ package eu.eudat.query.engine.expressions;
* Created by ikalyvas on 7/5/2018. * Created by ikalyvas on 7/5/2018.
*/ */
public interface Expression { public interface Expression {
String evaluate();
} }

View File

@ -1,11 +0,0 @@
package eu.eudat.query.engine.predicates;
import eu.eudat.query.engine.expressions.ComparisonExpression;
import eu.eudat.query.engine.expressions.Expression;
/**
* Created by ikalyvas on 7/5/2018.
*/
public interface AndPredicate<T> {
<E extends Expression> Expression and(ComparisonPredicate<T>... predicates);
}

View File

@ -1,9 +1,10 @@
package eu.eudat.query.engine.predicates; package eu.eudat.query.engine.predicates;
import eu.eudat.query.engine.expressions.ComparisonExpression; import eu.eudat.query.engine.expressions.ComparisonExpression;
import eu.eudat.query.engine.expressions.Expression;
/** /**
* Created by ikalyvas on 7/5/2018. * Created by ikalyvas on 7/5/2018.
*/ */
public interface ComparisonPredicate<T> extends Predicate<T, ComparisonExpression> { public interface ComparisonPredicate extends Predicate<ComparisonExpression> {
} }

View File

@ -1,11 +1,11 @@
package eu.eudat.query.engine.predicates; package eu.eudat.query.engine.predicates;
import eu.eudat.query.engine.expressions.ComparisonExpression;
import eu.eudat.query.engine.expressions.Expression; import eu.eudat.query.engine.expressions.Expression;
/** /**
* Created by ikalyvas on 7/5/2018. * Created by ikalyvas on 7/5/2018.
*/ */
public interface Predicate<T,E extends Expression> { public interface Predicate<E extends Expression> {
Expression where(T entity, E expression); Expression apply( E expression);
} }

View File

@ -1,6 +1,7 @@
package eu.eudat.logic.managers; package eu.eudat.logic.managers;
import eu.eudat.logic.builders.entity.UserInfoBuilder; import eu.eudat.configurations.dynamicproject.DynamicProjectConfiguration;
import eu.eudat.configurations.dynamicproject.entities.Property;
import eu.eudat.data.dao.criteria.DynamicFieldsCriteria; import eu.eudat.data.dao.criteria.DynamicFieldsCriteria;
import eu.eudat.data.dao.criteria.OrganisationCriteria; import eu.eudat.data.dao.criteria.OrganisationCriteria;
import eu.eudat.data.dao.criteria.ProjectCriteria; import eu.eudat.data.dao.criteria.ProjectCriteria;
@ -9,10 +10,10 @@ import eu.eudat.data.dao.entities.*;
import eu.eudat.data.entities.*; import eu.eudat.data.entities.*;
import eu.eudat.data.query.items.item.dmp.DataManagementPlanCriteriaRequest; import eu.eudat.data.query.items.item.dmp.DataManagementPlanCriteriaRequest;
import eu.eudat.data.query.items.table.dmp.DataManagementPlanTableRequest; import eu.eudat.data.query.items.table.dmp.DataManagementPlanTableRequest;
import eu.eudat.configurations.dynamicproject.DynamicProjectConfiguration;
import eu.eudat.configurations.dynamicproject.entities.Property;
import eu.eudat.exceptions.datamanagementplan.DMPWithDatasetsException; import eu.eudat.exceptions.datamanagementplan.DMPWithDatasetsException;
import eu.eudat.exceptions.security.UnauthorisedException; import eu.eudat.exceptions.security.UnauthorisedException;
import eu.eudat.logic.builders.entity.UserInfoBuilder;
import eu.eudat.logic.services.ApiContext;
import eu.eudat.models.HintedModelFactory; import eu.eudat.models.HintedModelFactory;
import eu.eudat.models.data.dmp.DataManagementPlan; import eu.eudat.models.data.dmp.DataManagementPlan;
import eu.eudat.models.data.dmp.DataManagementPlanNewVersionModel; import eu.eudat.models.data.dmp.DataManagementPlanNewVersionModel;
@ -23,7 +24,6 @@ import eu.eudat.models.data.listingmodels.DataManagementPlanListingModel;
import eu.eudat.models.data.listingmodels.DatasetListingModel; import eu.eudat.models.data.listingmodels.DatasetListingModel;
import eu.eudat.models.data.security.Principal; import eu.eudat.models.data.security.Principal;
import eu.eudat.queryable.QueryableList; import eu.eudat.queryable.QueryableList;
import eu.eudat.logic.services.ApiContext;
import org.springframework.http.*; import org.springframework.http.*;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
@ -41,12 +41,19 @@ public class DataManagementPlanManager {
QueryableList<DMP> authItems = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getAuthenticated(items, userInfo); QueryableList<DMP> authItems = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getAuthenticated(items, userInfo);
QueryableList<DMP> pagedItems = PaginationManager.applyPaging(authItems, dataManagementPlanTableRequest); QueryableList<DMP> pagedItems = PaginationManager.applyPaging(authItems, dataManagementPlanTableRequest);
DataTableData<DataManagementPlanListingModel> dataTable = new DataTableData<DataManagementPlanListingModel>(); DataTableData<DataManagementPlanListingModel> dataTable = new DataTableData<>();
CompletableFuture itemsFuture = pagedItems CompletableFuture itemsFuture = pagedItems.withHint(HintedModelFactory.getHint(DataManagementPlanListingModel.class))
.selectAsync(item -> new DataManagementPlanListingModel().fromDataModel(item)).whenComplete((resultList, throwable) -> { .selectAsync(item -> {
dataTable.setData(resultList); item.setDataset(
}); item.getDataset().stream()
.filter(dataset -> dataset.getDmp().getCreator().getId().equals(userInfo.getId())
|| dataset.isPublic()
|| dataset.getDmp().getUsers().stream()
.filter(x -> x.getId().equals(userInfo.getId())).collect(Collectors.toList()).size() > 0).collect(Collectors.toSet()));
return new DataManagementPlanListingModel().fromDataModel(item);
})
.whenComplete((resultList, throwable) -> dataTable.setData(resultList));
CompletableFuture countFuture = authItems.countAsync().whenComplete((count, throwable) -> { CompletableFuture countFuture = authItems.countAsync().whenComplete((count, throwable) -> {
dataTable.setTotalCount(count); dataTable.setTotalCount(count);

View File

@ -4,7 +4,9 @@ import eu.eudat.data.entities.DMP;
import eu.eudat.models.DataModel; import eu.eudat.models.DataModel;
import eu.eudat.models.data.dmp.Organisation; import eu.eudat.models.data.dmp.Organisation;
import eu.eudat.logic.utilities.helpers.LabelBuilder; import eu.eudat.logic.utilities.helpers.LabelBuilder;
import eu.eudat.models.data.urls.DatasetUrlListing;
import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -18,7 +20,7 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
private String organisations; private String organisations;
private String version; private String version;
private UUID groupId; private UUID groupId;
private Integer numOfDatasets; private List<DatasetUrlListing> datasets;
public String getId() { public String getId() {
return id; return id;
@ -84,12 +86,12 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
this.groupId = groupId; this.groupId = groupId;
} }
public Integer getNumOfDatasets() { public List<DatasetUrlListing> getDatasets() {
return numOfDatasets; return datasets;
} }
public void setNumOfDatasets(Integer numOfDatasets) { public void setDatasets(List<DatasetUrlListing> datasets) {
this.numOfDatasets = numOfDatasets; this.datasets = datasets;
} }
@Override @Override
@ -102,7 +104,7 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
this.creationTime = entity.getCreated().toString(); this.creationTime = entity.getCreated().toString();
this.version = "" + entity.getVersion(); this.version = "" + entity.getVersion();
this.groupId = entity.getGroupId(); this.groupId = entity.getGroupId();
this.numOfDatasets = entity.getDataset().size(); this.datasets = entity.getDataset().stream().map(x-> new DatasetUrlListing().fromDataModel(x)).collect(Collectors.toList());
return this; return this;
} }

View File

@ -0,0 +1,25 @@
package eu.eudat.models.data.urls;
import eu.eudat.data.entities.Dataset;
/**
* Created by ikalyvas on 7/23/2018.
*/
public class DatasetUrlListing extends UrlListing<Dataset, DatasetUrlListing> {
@Override
public DatasetUrlListing fromDataModel(Dataset entity) {
this.setLabel(entity.getLabel());
this.setUrl(entity.getId().toString());
return this;
}
@Override
public Dataset toDataModel() throws Exception {
return null;
}
@Override
public String getHint() {
return null;
}
}

View File

@ -71,5 +71,5 @@ http-logger.initial-delay = 0
http-logger.delay = 10 http-logger.delay = 10
http-logger.server-address = http://logstash:31311 http-logger.server-address = http://logstash:31311
#############################Elastic Search###################################### #############################Elastic Search######################################
elasticsearch.host = localhost elasticsearch.host = elasticsearch-dmp
elasticsearch.port = 9201 elasticsearch.port = 9200

View File

@ -9,7 +9,7 @@
<help-content position="left"></help-content> <help-content position="left"></help-content>
</div> </div>
<div class="col-md-8"> <div class="col-md-8">
<app-breadcrumb *ngIf="hasBreadCrumb | async"></app-breadcrumb> <app-breadcrumb *ngIf="this.isAuthenticated() && (hasBreadCrumb | async)"></app-breadcrumb>
<router-outlet (activate)='onActivate($event)' (deactivate)='onDeactivate($event)'></router-outlet> <router-outlet (activate)='onActivate($event)' (deactivate)='onDeactivate($event)'></router-outlet>
</div> </div>
<div class="col-md-2"> <div class="col-md-2">

View File

@ -4,6 +4,7 @@ import { TranslateService } from '@ngx-translate/core';
import { LanguageResolverService } from './services/language-resolver/language-resolver.service'; import { LanguageResolverService } from './services/language-resolver/language-resolver.service';
import { BreadCrumbResolverService } from './services/breadcrumb/breadcrumb-resolver.service'; import { BreadCrumbResolverService } from './services/breadcrumb/breadcrumb-resolver.service';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
import { AuthService } from './services/auth/auth.service';
declare const gapi: any; declare const gapi: any;
@ -20,10 +21,11 @@ export class AppComponent implements OnInit {
hasBreadCrumb = Observable.of(false); hasBreadCrumb = Observable.of(false);
sideNavOpen = false; sideNavOpen = false;
constructor( constructor(
private router: Router, private router: Router,
private route: ActivatedRoute, private route: ActivatedRoute,
private authentication: AuthService,
private translate: TranslateService, private translate: TranslateService,
private languageService: LanguageResolverService, private languageService: LanguageResolverService,
private breadCrumbResolverService: BreadCrumbResolverService private breadCrumbResolverService: BreadCrumbResolverService
@ -60,6 +62,10 @@ export class AppComponent implements OnInit {
} }
public isAuthenticated(): boolean {
return !(!this.authentication.current())
}
goToDMPs() { goToDMPs() {
this.router.navigate(['/dmps'], { queryParams: { /*refresh : Math.random() ,returnUrl: this.state.url*/ } }); this.router.navigate(['/dmps'], { queryParams: { /*refresh : Math.random() ,returnUrl: this.state.url*/ } });
} }

View File

@ -13,10 +13,10 @@
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status == 1" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;" <button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status == 1" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;"
(click)="downloadXML();" type="button">Download XML</button> (click)="downloadXML();" type="button">Download XML</button>
<div class="fill-space"></div> <div class="fill-space"></div>
<button mat-button (click)="redirectToProject()"> <!-- <button mat-button (click)="redirectToProject()">
<mat-icon>arrow_right_alt</mat-icon>{{'DATASET-WIZARD.ACTIONS.GO-TO-PROJECT' | translate}}</button> <mat-icon>arrow_right_alt</mat-icon>{{'DATASET-WIZARD.ACTIONS.GO-TO-PROJECT' | translate}}</button>
<button mat-button (click)="redirectToDmp()"> <button mat-button (click)="redirectToDmp()">
<mat-icon>arrow_right_alt</mat-icon>{{'DATASET-WIZARD.ACTIONS.GO-TO-DMP' | translate}}</button> <mat-icon>arrow_right_alt</mat-icon>{{'DATASET-WIZARD.ACTIONS.GO-TO-DMP' | translate}}</button> -->
</div> </div>
<mat-horizontal-stepper [linear]="isLinear" #stepper> <mat-horizontal-stepper [linear]="isLinear" #stepper>
@ -175,7 +175,7 @@
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>
<mat-card-title class="thick"> <mat-card-title class="thick">
{{'DATASET-EDITOR.FIELDS.TAG' | translate}} {{'DATASET-EDITOR.FIELDS.TAGS' | translate}}
</mat-card-title> </mat-card-title>
</mat-card-header> </mat-card-header>
<app-external-item-listing *ngIf="formGroup.get('tags') && tagsTemplate && externalSourcesConfiguration" [options]="externalSourcesConfiguration.tags" <app-external-item-listing *ngIf="formGroup.get('tags') && tagsTemplate && externalSourcesConfiguration" [options]="externalSourcesConfiguration.tags"

View File

@ -172,6 +172,29 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
this.datasetWizardModel.dmp = data; this.datasetWizardModel.dmp = data;
this.formGroup = this.datasetWizardModel.buildForm(); this.formGroup = this.datasetWizardModel.buildForm();
this.loadDatasetProfiles(); this.loadDatasetProfiles();
this.breadCrumbs = Observable.of([
{
parentComponentName: null,
label: "Datasets",
url: "/datasets",
notFoundResolver: [
{
parentComponentName: null,
label: this.datasetWizardModel.dmp.project.label,
url: "/projects/edit/" + this.datasetWizardModel.dmp.project.id
},
{
parentComponentName: null,
label: this.datasetWizardModel.dmp.label,
url: "/dmps/edit/" + this.datasetWizardModel.dmp.id,
}]
},
{
parentComponentName: null,
label: "New Dataset",
url: "/datasets/new"
}])
}); });
}); });
} else { } else {

View File

@ -12,10 +12,10 @@
</mat-card-title> </mat-card-title>
<div class="fill-space"></div> <div class="fill-space"></div>
<div *ngIf="!isNew" flexLayout="row"> <div *ngIf="!isNew" flexLayout="row">
<div fxFlex> <!-- <div fxFlex>
<button mat-button type="button" (click)="redirectToProject()"> <button mat-button type="button" (click)="redirectToProject()">
<mat-icon>arrow_right_alt</mat-icon>{{'DMP-EDITOR.ACTIONS.GO-TO-PROJECT' | translate}}</button> <mat-icon>arrow_right_alt</mat-icon>{{'DMP-EDITOR.ACTIONS.GO-TO-PROJECT' | translate}}</button>
</div> </div> -->
<div fxFlex> <div fxFlex>
<button mat-button type="button" (click)="redirectToDatasets()"> <button mat-button type="button" (click)="redirectToDatasets()">
<mat-icon>arrow_right_alt</mat-icon>{{'DMP-EDITOR.ACTIONS.GO-TO-DATASETS' | translate}}</button> <mat-icon>arrow_right_alt</mat-icon>{{'DMP-EDITOR.ACTIONS.GO-TO-DATASETS' | translate}}</button>
@ -52,7 +52,7 @@
[configuration]="projectAutoCompleteConfiguration" titleKey="label" [control]="formGroup.get('project')" [required]="true"> [configuration]="projectAutoCompleteConfiguration" titleKey="label" [control]="formGroup.get('project')" [required]="true">
</auto-complete> </auto-complete>
<app-dynamic-fields-project [formGroup]="formGroup"></app-dynamic-fields-project> <!-- <app-dynamic-fields-project [formGroup]="formGroup"></app-dynamic-fields-project> -->
<td-chips color="accent" [items]="filteredProfiles" formControlName="profiles" placeholder="{{'DMP-EDITOR.FIELDS.PROFILES' | translate}}" <td-chips color="accent" [items]="filteredProfiles" formControlName="profiles" placeholder="{{'DMP-EDITOR.FIELDS.PROFILES' | translate}}"
(inputChange)="filterProfiles($event)" requireMatch required> (inputChange)="filterProfiles($event)" requireMatch required>

View File

@ -117,11 +117,22 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
}); });
} else { } else {
this.dataManagementPlan = new DataManagementPlanModel(); this.dataManagementPlan = new DataManagementPlanModel();
setTimeout(() => { setTimeout(async () => {
this.formGroup = this.dataManagementPlan.buildForm(); this.formGroup = this.dataManagementPlan.buildForm();
if (this.formGroup.get("profile") && this.formGroup.get("profile").value) { if (this.formGroup.get("profile") && this.formGroup.get("profile").value) {
this.textCtrl.patchValue(this.formGroup.get("profile").value); this.textCtrl.patchValue(this.formGroup.get("profile").value);
} }
this.breadCrumbs = Observable.of([
{
parentComponentName: "DataManagementPlanListingComponent",
label: 'DMPs',
url: "dmps",
},
{
parentComponentName: null,
label: "New DMP",
url: "/dmps/new"
}])
}); });
} }

View File

@ -45,11 +45,11 @@
<mat-cell *matCellDef="let row"> {{row.version}}</mat-cell> <mat-cell *matCellDef="let row"> {{row.version}}</mat-cell>
</ng-container> </ng-container>
<!-- Column Definition: Datasets(count) --> <!-- Column Definition: Datasets -->
<ng-container cdkColumnDef="numOfDatasets"> <ng-container cdkColumnDef="datasets">
<mat-header-cell *matHeaderCellDef mat-sort-header="|count|dataset">{{'DMP-LISTING.COLUMNS.DATASETS' | translate}}</mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header="|count|dataset">{{'DMP-LISTING.COLUMNS.DATASETS' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row" (click)="$event.stopPropagation();"> <mat-cell *matCellDef="let row" (click)="$event.stopPropagation()">
<a (click)="showDatasets(row.id, row.label);">{{row.numOfDatasets}}</a> <app-url-listing [items]="row.datasets" [urlLimit]="5" [parameters]="{ datasetLabel: row.label }"></app-url-listing>
</mat-cell> </mat-cell>
</ng-container> </ng-container>

View File

@ -35,7 +35,7 @@ export class DataManagementPlanListingComponent implements OnInit, IBreadCrumbCo
breadCrumbs: Observable<BreadcrumbItem[]> = Observable.of([]); breadCrumbs: Observable<BreadcrumbItem[]> = Observable.of([]);
dataSource: DataManagementPlanDataSource | null; dataSource: DataManagementPlanDataSource | null;
displayedColumns: String[] = ['name', 'project', 'creationTime', 'organisations', 'version', 'numOfDatasets', 'actions']; displayedColumns: String[] = ['name', 'project', 'creationTime', 'organisations', 'version', 'datasets', 'actions'];
itemId: string; itemId: string;
projectId: string; projectId: string;
showProject: boolean; showProject: boolean;
@ -180,7 +180,14 @@ export class DataManagementPlanDataSource extends DataSource<DataManagementPlanL
.map(result => { .map(result => {
if (!result) { return []; } if (!result) { return []; }
if (this._paginator.pageIndex === 0) { this.totalCount = result.totalCount; } if (this._paginator.pageIndex === 0) { this.totalCount = result.totalCount; }
return result.data; return result.data.map(item => {
item["datasets"].map(dmp => {
dmp.url = "datasets/edit/" + dmp.url;
dmp.all = "datasets/dmp/" + item.id
return dmp;
})
return item;
});
}); });
} }

View File

@ -1,35 +1,35 @@
<div class="main-panel" id="main-panel"> <div class="main-panel" id="main-panel">
<div class="container"> <div class="container">
<div class="row" style="margin-top: 30px"> <div class="row" style="margin-top: 30px">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 col-md-offset-1"> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 col-md-offset-1">
<h3 *ngIf="!this.isAuthenticated()">{{ 'HOMEPAGE.OPEN-DMPS.STATS' | translate }}</h3> <h3 *ngIf="!this.isAuthenticated()">{{ 'HOMEPAGE.OPEN-DMPS.STATS' | translate }}</h3>
<h3 *ngIf="this.isAuthenticated()">{{ 'HOMEPAGE.MY-DMPS.STATS' | translate }}</h3> <h3 *ngIf="this.isAuthenticated()">{{ 'HOMEPAGE.MY-DMPS.STATS' | translate }}</h3>
</div> </div>
</div>
<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={{dashboardStatisticsData.totalProjectCount}} headerIcon="list" [category]="this.isAuthenticated() ? 'My Projects' : 'Projects'"
[hasFootContent]="this.isAuthenticated()" [footContent]="this.isAuthenticated() ? 'Open My Projects' : 'Open Projects'"
routelLink='/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={{dashboardStatisticsData.totalDataManagementPlanCount}} headerIcon="mode_edit" [category]="this.isAuthenticated() ? 'My DMPs' : 'DMPs'"
[hasFootContent]="this.isAuthenticated()" [footContent]="this.isAuthenticated() ? 'Open My DMPs' : 'Open DMPs'"
routelLink='/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={{dashboardStatisticsData.totalDataSetCount}} headerIcon="subject" [category]="this.isAuthenticated() ? 'My Datasets' : 'Datasets'"
[hasFootContent]="this.isAuthenticated()" [footContent]="this.isAuthenticated() ? 'Open My Datasets' : 'Open Datasets'"
routelLink='/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 *ngIf="this.isAuthenticated()" class="row" style="margin-top: 30px">
<div class="col-lg-9 col-md-12 col-sm-12 col-xs-12 col-md-offset-1">
<app-recent-activity></app-recent-activity>
</div>
</div>
</div> </div>
</div> <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={{dashboardStatisticsData.totalProjectCount}} headerIcon="list" [category]="this.isAuthenticated() ? 'My Projects' : 'Projects'"
[hasFootContent]="this.isAuthenticated()" [footContent]="this.isAuthenticated() ? 'Open My Projects' : 'Open Projects'"
routelLink='/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={{dashboardStatisticsData.totalDataManagementPlanCount}} headerIcon="mode_edit" [category]="this.isAuthenticated() ? 'My DMPs' : 'DMPs'"
[hasFootContent]="this.isAuthenticated()" [footContent]="this.isAuthenticated() ? 'Open My DMPs' : 'Open DMPs'" routelLink='/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={{dashboardStatisticsData.totalDataSetCount}} headerIcon="subject" [category]="this.isAuthenticated() ? 'My Datasets' : 'Datasets'"
[hasFootContent]="this.isAuthenticated()" [footContent]="this.isAuthenticated() ? 'Open My Datasets' : 'Open Datasets'"
routelLink='/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 *ngIf="this.isAuthenticated()" class="row" style="margin-top: 30px">
<div class="col-lg-9 col-md-12 col-sm-12 col-xs-12 col-md-offset-1">
<app-recent-activity></app-recent-activity>
</div>
</div>
</div>
</div>

View File

@ -42,7 +42,7 @@
<!-- Column Definition: End --> <!-- Column Definition: End -->
<ng-container cdkColumnDef="dmps"> <ng-container cdkColumnDef="dmps">
<mat-header-cell *matHeaderCellDef mat-sort-header="dmps">{{'PROJECT-LISTING.COLUMNS.DMPS' | translate}}</mat-header-cell> <mat-header-cell *matHeaderCellDef>{{'PROJECT-LISTING.COLUMNS.DMPS' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row" (click)="$event.stopPropagation()"> <mat-cell *matCellDef="let row" (click)="$event.stopPropagation()">
<app-url-listing [items]="row.dmps" [urlLimit]="5" [parameters]="{ projectLabel: row.label }"></app-url-listing> <app-url-listing [items]="row.dmps" [urlLimit]="5" [parameters]="{ projectLabel: row.label }"></app-url-listing>
</mat-cell> </mat-cell>

View File

@ -31,7 +31,7 @@ export class BreadcrumbComponent implements OnInit {
buildBreadCrumb(route: ActivatedRoute): Observable<BreadcrumbItem[]> { buildBreadCrumb(route: ActivatedRoute): Observable<BreadcrumbItem[]> {
return this.breadCrumbService.resolve(route); return this.breadCrumbService.resolve(route).map(x => { x.unshift({ label: "Home", url: "/welcome" }); return x; });
} }
navigate(url, params) { navigate(url, params) {

View File

@ -1,68 +1,68 @@
<div class="container row"> <div class="container row">
<div class="col-md-3"> <div class="col-md-3">
<mat-card class="example-card"> <mat-card class="example-card">
<mat-card-header> <mat-card-header>
<mat-card-title> <mat-card-title>
{{'RECENT-ACTIVITY.MY-TITLE-PROJECT' | translate}} {{'RECENT-ACTIVITY.MY-TITLE-PROJECT' | translate}}
</mat-card-title> </mat-card-title>
</mat-card-header> </mat-card-header>
<mat-card-content> <mat-card-content>
<mat-nav-list *ngIf="projectActivities!=null"> <mat-nav-list *ngIf="projectActivities!=null">
<mat-list-item (click)="redirect(activity.id,RecentActivityTypes.PROJECT)" *ngFor="let activity of projectActivities"> <mat-list-item (click)="redirect(activity.id,RecentActivityTypes.PROJECT)" *ngFor="let activity of projectActivities">
<p mat-line> <p mat-line>
{{activity.label}} {{activity.label}}
</p> </p>
<p mat-line> <p mat-line>
{{activity.timestamp | date:'shortDate'}} {{activity.timestamp | date:'shortDate'}}
</p> </p>
</mat-list-item> </mat-list-item>
</mat-nav-list> </mat-nav-list>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<mat-card class="example-card"> <mat-card class="example-card">
<mat-card-header> <mat-card-header>
<mat-card-title> <mat-card-title>
{{'RECENT-ACTIVITY.MY-TITLE-DMP' | translate}} {{'RECENT-ACTIVITY.MY-TITLE-DMP' | translate}}
</mat-card-title> </mat-card-title>
</mat-card-header> </mat-card-header>
<mat-card-content> <mat-card-content>
<mat-nav-list *ngIf="dmpActivities!=null"> <mat-nav-list *ngIf="dmpActivities!=null">
<mat-list-item (click)="redirect(activity.id,RecentActivityTypes.DMP)" *ngFor="let activity of dmpActivities"> <mat-list-item (click)="redirect(activity.id,RecentActivityTypes.DMP)" *ngFor="let activity of dmpActivities">
<p mat-line> <p mat-line>
{{activity.label}} {{activity.label}}
</p> </p>
<p mat-line> <p mat-line>
{{activity.timestamp | date:'shortDate'}} {{activity.timestamp | date:'shortDate'}}
</p> </p>
</mat-list-item> </mat-list-item>
</mat-nav-list> </mat-nav-list>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<mat-card class="example-card"> <mat-card class="example-card">
<mat-card-header> <mat-card-header>
<mat-card-title> <mat-card-title>
{{'RECENT-ACTIVITY.MY-TITLE-DATASET' | translate}} {{'RECENT-ACTIVITY.MY-TITLE-DATASET' | translate}}
</mat-card-title> </mat-card-title>
</mat-card-header> </mat-card-header>
<mat-card-content> <mat-card-content>
<mat-nav-list *ngIf="datasetActivities!=null"> <mat-nav-list *ngIf="datasetActivities!=null">
<mat-list-item (click)="redirect(activity.id,RecentActivityTypes.DATASET)" *ngFor="let activity of datasetActivities"> <mat-list-item (click)="redirect(activity.id,RecentActivityTypes.DATASET)" *ngFor="let activity of datasetActivities">
<p mat-line> <p mat-line>
{{activity.label}} {{activity.label}}
</p> </p>
<p mat-line> <p mat-line>
{{activity.timestamp | date:'shortDate'}} {{activity.timestamp | date:'shortDate'}}
</p> </p>
</mat-list-item> </mat-list-item>
</mat-nav-list> </mat-nav-list>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
</div> </div>
</div> </div>

View File

@ -24,7 +24,7 @@ export class WelcomepageComponent implements OnInit, IBreadCrumbComponent {
} }
ngOnInit() { ngOnInit() {
this.breadCrumbs = Observable.of([{ parentComponentName: null, label: 'Home', url: "/welcome" }]) //this.breadCrumbs = Observable.of([{ parentComponentName: null, label: 'Home', url: "/welcome" }])
} }
} }

View File

@ -213,7 +213,8 @@
"EXTERNAL-DATASETS": "External Datasets", "EXTERNAL-DATASETS": "External Datasets",
"EXTERNAL-DATASET-TYPE": "External Datasets Type", "EXTERNAL-DATASET-TYPE": "External Datasets Type",
"EXTERNAL-DATASET-INFO": "External Datasets Info", "EXTERNAL-DATASET-INFO": "External Datasets Info",
"DATAREPOSITORIES-INFO": "Data Repositories Info" "DATAREPOSITORIES-INFO": "Data Repositories Info",
"TAGS": "Tags"
}, },
"ACTIONS": { "ACTIONS": {
"SAVE": "Save", "SAVE": "Save",

View File

@ -28,7 +28,7 @@ services:
container_name: dmp-backend container_name: dmp-backend
ports: ['0.0.0.0:8080:8080'] ports: ['0.0.0.0:8080:8080']
links: links:
- logstash:logstash # - logstash:logstash
- elasticsearch-dmp:elasticsearch-dmp - elasticsearch-dmp:elasticsearch-dmp
networks: ['stack','elasticsearch-dmp'] networks: ['stack','elasticsearch-dmp']
@ -48,7 +48,7 @@ services:
container_name: elasticsearch-dmp container_name: elasticsearch-dmp
volumes: volumes:
- ./elastic-config/elasticsearch-custom.yml:/usr/share/elasticsearch/config/elasticsearch.yml - ./elastic-config/elasticsearch-custom.yml:/usr/share/elasticsearch/config/elasticsearch.yml
environment: ['http.host=0.0.0.0','transport.host=0.0.0.0'] environment: ['http.host=0.0.0.0','transport.host=0.0.0.0','discovery.type=single-node']
ports: ['0.0.0.0:9201:9200','0.0.0.0:9301:9300'] ports: ['0.0.0.0:9201:9200','0.0.0.0:9301:9300']
networks: ['elasticsearch-dmp'] networks: ['elasticsearch-dmp']
volumes: volumes:
@ -56,31 +56,31 @@ services:
##########################ELK-STACK###################################################################### ##########################ELK-STACK######################################################################
elasticsearch: # elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:${TAG} # image: docker.elastic.co/elasticsearch/elasticsearch:${TAG}
container_name: elasticsearch # container_name: elasticsearch
environment: ['http.host=0.0.0.0', 'transport.host=127.0.0.1', 'ELASTIC_PASSWORD=${ELASTIC_PASSWORD}'] # environment: ['http.host=0.0.0.0', 'transport.host=127.0.0.1', 'ELASTIC_PASSWORD=${ELASTIC_PASSWORD}']
ports: ['0.0.0.0:9200:9200'] # ports: ['0.0.0.0:9200:9200']
networks: ['stack'] # networks: ['stack']
volumes: # volumes:
- esdata:/usr/share/elasticsearch/data # - esdata:/usr/share/elasticsearch/data
kibana: # kibana:
image: docker.elastic.co/kibana/kibana:${TAG} # image: docker.elastic.co/kibana/kibana:${TAG}
container_name: kibana # container_name: kibana
ports: ['0.0.0.0:5601:5601'] # ports: ['0.0.0.0:5601:5601']
networks: ['stack'] # networks: ['stack']
depends_on: ['elasticsearch'] # depends_on: ['elasticsearch']
logstash: # logstash:
image: docker.elastic.co/logstash/logstash:${TAG} # image: docker.elastic.co/logstash/logstash:${TAG}
container_name: logstash # container_name: logstash
volumes: # volumes:
- ./ELK.Docker/config/logstash.conf:/usr/share/logstash/pipeline/logstash.conf # - ./ELK.Docker/config/logstash.conf:/usr/share/logstash/pipeline/logstash.conf
ports: ['0.0.0.0:31311:31311'] # ports: ['0.0.0.0:31311:31311']
networks: ['stack'] # networks: ['stack']
depends_on: ['elasticsearch', 'setup_logstash'] # depends_on: ['elasticsearch', 'setup_logstash']
#filebeat: #filebeat:
# image: docker.elastic.co/beats/filebeat:${TAG} # image: docker.elastic.co/beats/filebeat:${TAG}
@ -97,23 +97,23 @@ services:
# depends_on: ['elasticsearch', 'setup_heartbeat'] # depends_on: ['elasticsearch', 'setup_heartbeat']
# Run a short-lived container to set up Logstash. # Run a short-lived container to set up Logstash.
setup_logstash: # setup_logstash:
image: centos:7 # image: centos:7
container_name: setup_logstash # container_name: setup_logstash
volumes: ['./ELK.Docker/scripts/setup-logstash.sh:/usr/local/bin/setup-logstash.sh:ro'] # volumes: ['./ELK.Docker/scripts/setup-logstash.sh:/usr/local/bin/setup-logstash.sh:ro']
command: ['/bin/bash', '-c', 'cat /usr/local/bin/setup-logstash.sh | tr -d "\r" | bash'] # command: ['/bin/bash', '-c', 'cat /usr/local/bin/setup-logstash.sh | tr -d "\r" | bash']
environment: ['ELASTIC_PASSWORD=${ELASTIC_PASSWORD}'] # environment: ['ELASTIC_PASSWORD=${ELASTIC_PASSWORD}']
networks: ['stack'] # networks: ['stack']
depends_on: ['elasticsearch'] # depends_on: ['elasticsearch']
setup_kibana: # setup_kibana:
image: centos:7 # image: centos:7
container_name: setup_kibana # container_name: setup_kibana
volumes: ['./ELK.Docker/scripts/setup-kibana.sh:/usr/local/bin/setup-kibana.sh:ro'] # volumes: ['./ELK.Docker/scripts/setup-kibana.sh:/usr/local/bin/setup-kibana.sh:ro']
command: ['/bin/bash', '-c', 'cat /usr/local/bin/setup-kibana.sh | tr -d "\r" | bash'] # command: ['/bin/bash', '-c', 'cat /usr/local/bin/setup-kibana.sh | tr -d "\r" | bash']
environment: ['ELASTIC_PASSWORD=${ELASTIC_PASSWORD}'] # environment: ['ELASTIC_PASSWORD=${ELASTIC_PASSWORD}']
networks: ['stack'] # networks: ['stack']
depends_on: ['elasticsearch'] # depends_on: ['elasticsearch']
#setup_filebeat: #setup_filebeat:
# image: docker.elastic.co/beats/filebeat:${TAG} # image: docker.elastic.co/beats/filebeat:${TAG}