no message

dmp-editor
Ioannis Kalyvas 6 years ago
parent 2c3095cb7a
commit 5de4c1ada0

@ -291,19 +291,25 @@ public class Dataset implements DataEntity<Dataset, UUID> {
@Override
public void update(Dataset entity) {
this.setRegistries(entity.getRegistries());
this.getDatasetDataRepositories().removeAll(this.getDatasetDataRepositories());
this.getDatasetDataRepositories().addAll(entity.getDatasetDataRepositories().stream().map(item->{
item.setDataset(this);
return item;
}).collect(Collectors.toList()));
if(this.getDatasetDataRepositories()==null) this.setDatasetDataRepositories(new HashSet<>());
if(!this.getDatasetDataRepositories().containsAll(entity.getDatasetDataRepositories())){
this.getDatasetDataRepositories().removeAll(this.getDatasetDataRepositories());
this.getDatasetDataRepositories().addAll(entity.getDatasetDataRepositories().stream().map(item->{
item.setDataset(this);
return item;
}).collect(Collectors.toList()));
}
this.setDescription(entity.getDescription());
this.setLabel(entity.getLabel());
this.setProperties(entity.getProperties());
this.getDatasetExternalDatasets().removeAll(this.getDatasetExternalDatasets());
this.getDatasetExternalDatasets().addAll(entity.getDatasetExternalDatasets().stream().map(item -> {
item.setDataset(this);
return item;
}).collect(Collectors.toList()));
if(this.getDatasetExternalDatasets()==null) this.setDatasetExternalDatasets(new HashSet<>());
if(!this.getDatasetExternalDatasets().containsAll(entity.getDatasetExternalDatasets())) {
this.getDatasetExternalDatasets().removeAll(this.getDatasetExternalDatasets());
this.getDatasetExternalDatasets().addAll(entity.getDatasetExternalDatasets().stream().map(item -> {
item.setDataset(this);
return item;
}).collect(Collectors.toList()));
}
this.setStatus(entity.getStatus());
this.setProfile(entity.getProfile());
this.setModified(new Date());

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>logging</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<parent>
<groupId>eu.eudat</groupId>
<artifactId>dmp-backend</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.0.6.RELEASE</version>
</dependency>
</dependencies>
</project>

@ -0,0 +1,41 @@
package eu.eudat.core.logger;
/**
* Created by ikalyvas on 5/30/2018.
*/
public interface Logger {
<T> void debug(T model);
<T> void debug(T model,String message);
<T> void debug(String message);
<T extends Exception> void debug(T exception);
<T extends Exception> void debug(T exception,String message);
<T> void warn(T model);
<T> void warn(T model,String message);
<T> void warn(String message);
<T extends Exception> void warn(T exception);
<T extends Exception> void warn(T exception,String message);
<T> void info(T model);
<T> void info(T model,String message);
<T extends RuntimeException> void info(T exception);
<T extends RuntimeException> void info(T exception,String message);
<T> void error(T loggingModel);
<T extends Exception> void error(T exception);
<T extends Exception> void error(T exception,String message);
}

@ -0,0 +1,55 @@
package eu.eudat.core.logger.common;
import org.json.JSONObject;
import org.springframework.core.env.Environment;
import types.LoggingOutputType;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/**
* Created by ikalyvas on 5/30/2018.
*/
public abstract class AbstractBatchLogger {
private Map<String, Object> concurrentHashMap = new ConcurrentHashMap<String, Object>();
public AbstractBatchLogger(Environment environment) {
ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
executor.scheduleAtFixedRate(() -> this.outputData(), Long.parseLong(environment.getProperty("http-logger.initial-delay")), Long.parseLong(environment.getProperty("http-logger.delay")), TimeUnit.SECONDS);
}
public abstract LoggingOutputType logOutputType();
public <T> void put(String key, T data) {
this.concurrentHashMap.put(key, data);
}
public void clear() {
this.concurrentHashMap.clear();
}
private Map<String, Object> getAndClear() {
Map<String, Object> map = new HashMap<>();
map.putAll(this.concurrentHashMap);
this.concurrentHashMap.keySet().removeAll(map.keySet());
return map;
}
public String tranformLog() {
Map<String ,Collection<Object>> transformedMap = new HashMap<>();
transformedMap.put("data",this.getAndClear().values());
if (this.logOutputType().equals(LoggingOutputType.JSON))
return this.concurrentHashMap.values().size() > 0 ? new JSONObject(transformedMap).toString() : null;
if (this.logOutputType().equals(LoggingOutputType.FILE))
return this.concurrentHashMap.toString(); //TODO actual implementation of file Logger
else throw new RuntimeException("Unsupported LoggingOutputType type");
}
public abstract void outputData();
}

@ -0,0 +1,196 @@
package eu.eudat.core.logger.remote.http;
import eu.eudat.core.logger.Logger;
import eu.eudat.core.logger.common.AbstractBatchLogger;
import eu.eudat.core.models.LoggingModel;
import eu.eudat.core.models.exception.ExceptionLoggingModel;
import eu.eudat.core.models.simple.SimpleAuditModel;
import eu.eudat.core.models.simple.SimpleLoggingModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import types.LoggingOutputType;
import types.LoggingType;
/**
* Created by ikalyvas on 5/30/2018.
*/
@Service("logger")
public class HttpRemoteLogger extends AbstractBatchLogger implements Logger {
private RestTemplate rest;
private HttpHeaders headers;
private Environment environment;
@Autowired
public HttpRemoteLogger(Environment environment) {
super(environment);
this.rest = new RestTemplate();
this.headers = new HttpHeaders();
this.environment = environment;
headers.add("Content-Type", "application/json");
headers.add("Accept", "*/*");
}
@Override
public void outputData() {
String log = this.tranformLog();
if (log != null && !log.isEmpty()) {
HttpEntity<String> requestEntity = new HttpEntity(log, headers);
ResponseEntity<String> responseEntity = rest.exchange(this.environment.getProperty("http-logger.server-address"), HttpMethod.POST, requestEntity, String.class);
}
}
@Override
public LoggingOutputType logOutputType() {
return LoggingOutputType.JSON;
}
@Override
public <T> void debug(T model) {
LoggingModel<T> loggingModel = new SimpleLoggingModel<>();
loggingModel.setData(model);
loggingModel.setType(LoggingType.DEBUG);
this.put(String.valueOf(model.hashCode()), loggingModel);
}
@Override
public <T> void debug(T model, String message) {
LoggingModel<T> loggingModel = new SimpleLoggingModel<>();
loggingModel.setData(model);
loggingModel.setMessage(message);
loggingModel.setType(LoggingType.DEBUG);
this.put(String.valueOf(model.hashCode()), loggingModel);
}
@Override
public <T> void debug(String message) {
LoggingModel<T> loggingModel = new SimpleLoggingModel<>();
loggingModel.setMessage(message);
loggingModel.setType(LoggingType.DEBUG);
this.put(String.valueOf(message.hashCode()), loggingModel);
}
@Override
public <T extends Exception> void debug(T exception) {
ExceptionLoggingModel<T> loggingModel = new ExceptionLoggingModel<>();
loggingModel.setData(exception);
loggingModel.setType(LoggingType.DEBUG);
this.put(String.valueOf(exception.hashCode()), loggingModel);
}
@Override
public <T extends Exception> void debug(T exception, String message) {
ExceptionLoggingModel<T> loggingModel = new ExceptionLoggingModel<>();
loggingModel.setData(exception);
loggingModel.setMessage(message);
loggingModel.setType(LoggingType.DEBUG);
this.put(String.valueOf(exception.hashCode()), loggingModel);
}
@Override
public <T> void warn(T model) {
LoggingModel<T> loggingModel = new SimpleLoggingModel<>();
loggingModel.setData(model);
loggingModel.setType(LoggingType.WARNING);
this.put(String.valueOf(model.hashCode()), loggingModel);
}
@Override
public <T> void warn(T model, String message) {
LoggingModel<T> loggingModel = new SimpleLoggingModel<>();
loggingModel.setData(model);
loggingModel.setMessage(message);
loggingModel.setType(LoggingType.WARNING);
this.put(String.valueOf(model.hashCode()), loggingModel);
}
@Override
public <T> void warn(String message) {
LoggingModel<T> loggingModel = new SimpleLoggingModel<>();
loggingModel.setMessage(message);
loggingModel.setType(LoggingType.WARNING);
this.put(String.valueOf(message.hashCode()), loggingModel);
}
@Override
public <T extends Exception> void warn(T exception) {
ExceptionLoggingModel<T> exceptionLoggingModel = new ExceptionLoggingModel<>();
exceptionLoggingModel.setData(exception);
exceptionLoggingModel.setType(LoggingType.WARNING);
this.put(String.valueOf(exception.hashCode()), exceptionLoggingModel);
}
@Override
public <T extends Exception> void warn(T exception, String message) {
ExceptionLoggingModel<T> exceptionLoggingModel = new ExceptionLoggingModel<>();
exceptionLoggingModel.setData(exception);
exceptionLoggingModel.setMessage(message);
exceptionLoggingModel.setType(LoggingType.WARNING);
this.put(String.valueOf(exception.hashCode()), exceptionLoggingModel);
}
@Override
public <T> void info(T model) {
SimpleAuditModel<T> simpleAuditModel = new SimpleAuditModel<>();
simpleAuditModel.setData(model);
simpleAuditModel.setType(LoggingType.INFO);
this.put(String.valueOf(model.hashCode()), simpleAuditModel);
}
@Override
public <T> void info(T model, String message) {
SimpleAuditModel<T> simpleAuditModel = new SimpleAuditModel<>();
simpleAuditModel.setData(model);
simpleAuditModel.setMessage(message);
simpleAuditModel.setType(LoggingType.INFO);
this.put(String.valueOf(model.hashCode()), simpleAuditModel);
}
@Override
public <T extends RuntimeException> void info(T exception) {
ExceptionLoggingModel<T> exceptionLoggingModel = new ExceptionLoggingModel<>();
exceptionLoggingModel.setData(exception);
exceptionLoggingModel.setType(LoggingType.INFO);
this.put(String.valueOf(exception.hashCode()), exceptionLoggingModel);
}
@Override
public <T extends RuntimeException> void info(T exception, String message) {
ExceptionLoggingModel<T> exceptionLoggingModel = new ExceptionLoggingModel<>();
exceptionLoggingModel.setData(exception);
exceptionLoggingModel.setMessage(message);
exceptionLoggingModel.setType(LoggingType.INFO);
this.put(String.valueOf(exception.hashCode()), exceptionLoggingModel);
}
@Override
public <T> void error(T model) {
LoggingModel<T> loggingModel = new SimpleLoggingModel<>();
loggingModel.setType(LoggingType.DEBUG);
this.put(String.valueOf(model.hashCode()), loggingModel);
}
@Override
public <T extends Exception> void error(T exception) {
ExceptionLoggingModel<T> exceptionLoggingModel = new ExceptionLoggingModel<>();
exceptionLoggingModel.setData(exception);
exceptionLoggingModel.setType(LoggingType.ERROR);
this.put(String.valueOf(exception.hashCode()), exceptionLoggingModel);
}
@Override
public <T extends Exception> void error(T exception, String message) {
ExceptionLoggingModel<T> exceptionLoggingModel = new ExceptionLoggingModel<>();
exceptionLoggingModel.setData(exception);
exceptionLoggingModel.setMessage(message);
exceptionLoggingModel.setType(LoggingType.ERROR);
this.put(String.valueOf(exception.hashCode()), exceptionLoggingModel);
}
}

@ -0,0 +1,8 @@
package eu.eudat.core.models;
/**
* Created by ikalyvas on 5/30/2018.
*/
public abstract class AuditModel<T> extends LoggingModel<T>{
}

@ -0,0 +1,36 @@
package eu.eudat.core.models;
import types.LoggingType;
/**
* Created by ikalyvas on 5/30/2018.
*/
public abstract class LoggingModel<T> {
private T data;
private LoggingType type;
private String message;
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
public LoggingType getType() {
return type;
}
public void setType(LoggingType type) {
this.type = type;
}
}

@ -0,0 +1,9 @@
package eu.eudat.core.models.exception;
import eu.eudat.core.models.LoggingModel;
/**
* Created by ikalyvas on 5/30/2018.
*/
public class ExceptionLoggingModel<E extends Exception> extends LoggingModel<E> {
}

@ -0,0 +1,9 @@
package eu.eudat.core.models.simple;
import eu.eudat.core.models.AuditModel;
/**
* Created by ikalyvas on 5/30/2018.
*/
public class SimpleAuditModel<T> extends AuditModel<T> {
}

@ -0,0 +1,9 @@
package eu.eudat.core.models.simple;
import eu.eudat.core.models.LoggingModel;
/**
* Created by ikalyvas on 5/30/2018.
*/
public class SimpleLoggingModel<T> extends LoggingModel<T> {
}

@ -0,0 +1,29 @@
package types;
/**
* Created by ikalyvas on 5/30/2018.
*/
public enum LoggingOutputType {
FILE(0), JSON(1);
private Integer value;
private LoggingOutputType(Integer value) {
this.value = value;
}
public Integer getValue() {
return value;
}
public static LoggingOutputType fromInteger(Integer value) {
switch (value) {
case 0:
return FILE;
case 1:
return JSON;
default:
throw new RuntimeException("Unsupported Logging LoggingOutputType");
}
}
}

@ -0,0 +1,33 @@
package types;
/**
* Created by ikalyvas on 5/30/2018.
*/
public enum LoggingType {
WARNING(0), ERROR(1), INFO(2), DEBUG(3);
private Integer value;
private LoggingType(Integer value) {
this.value = value;
}
public Integer getValue() {
return value;
}
public static LoggingType fromInteger(Integer value) {
switch (value) {
case 0:
return WARNING;
case 1:
return ERROR;
case 2:
return INFO;
case 3:
return DEBUG;
default:
throw new RuntimeException("Unsupported LoggingType");
}
}
}

@ -17,6 +17,7 @@
<module>queryable</module>
<module>web</module>
<module>data</module>
<module>logging</module>
</modules>
@ -66,7 +67,7 @@
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<artifactId>hibernate-eu.eudat.core</artifactId>
<version>${hibernate.version}</version>
</dependency>
@ -98,21 +99,21 @@
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackeu.eudat.corecore/jackeu.eudat.corecore -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<groupId>com.fasterxml.jackson.eu.eudat.core</groupId>
<artifactId>jackson-eu.eudat.core</artifactId>
<version>2.9.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackeu.eudat.corecore/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<groupId>com.fasterxml.jackson.eu.eudat.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.4</version>
</dependency>
<!-- g/a spring -->
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackeu.eudat.corecore/jackson-databind -->
@ -147,10 +148,10 @@
<artifactId>org.apache.poi.xwpf.converter.pdf</artifactId>
<version>1.0.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/fr.opensagres.xdocreport/org.apache.poi.xwpf.converter.core -->
<!-- https://mvnrepository.com/artifact/fr.opensagres.xdocreport/org.apache.poi.xwpf.convereu.eudat.corecore -->
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>org.apache.poi.xwpf.converter.core</artifactId>
<artifactId>org.apache.poi.xwpf.converter.eu.eudat.core</artifactId>
<version>1.0.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/fr.opensagres.xdocreport/fr.opensagres.xdocreport.itext.extension -->

@ -21,6 +21,11 @@
<artifactId>data</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>dmp-backend</groupId>
<artifactId>logging</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>dmp-backend</groupId>
<artifactId>queryable</artifactId>

@ -1,5 +1,6 @@
package eu.eudat.controllers;
import eu.eudat.core.logger.Logger;
import eu.eudat.exceptions.security.UnauthorisedException;
import eu.eudat.managers.UserManager;
import eu.eudat.models.helpers.responses.ResponseItem;
@ -35,12 +36,16 @@ public class Login {
private B2AccessTokenValidator b2AccessTokenValidator;
private Logger logger;
@Autowired
public Login(CustomAuthenticationProvider customAuthenticationProvider, AuthenticationServiceImpl authenticationServiceImpl, TwitterTokenValidator twitterTokenValidator, B2AccessTokenValidator b2AccessTokenValidator) {
public Login(CustomAuthenticationProvider customAuthenticationProvider, AuthenticationServiceImpl authenticationServiceImpl,
TwitterTokenValidator twitterTokenValidator, B2AccessTokenValidator b2AccessTokenValidator,Logger logger) {
this.customAuthenticationProvider = customAuthenticationProvider;
this.authenticationServiceImpl = authenticationServiceImpl;
this.twitterTokenValidator = twitterTokenValidator;
this.b2AccessTokenValidator = b2AccessTokenValidator;
this.logger = logger;
}
@Transactional
@ -111,9 +116,11 @@ public class Login {
ResponseEntity<ResponseItem<Principal>> logout(Principal principal) {
try {
this.authenticationServiceImpl.Logout(principal.getToken());
this.logger.info(principal,"Logged Out");
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Principal>().status(ApiMessageCode.NO_MESSAGE));
} catch (Exception ex) {
this.logger.debug(ex,ex.getMessage());
ex.printStackTrace();
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<Principal>().status(ApiMessageCode.DEFAULT_ERROR_MESSAGE).message(ex.getMessage()));
}

@ -103,18 +103,20 @@ public class ProjectManager {
public static void createOrUpdate(FileStorageService fileStorageService, ProjectDao projectRepository, ContentDao contentRepository, UserInfoDao userInfoRepository, eu.eudat.models.project.Project project, Principal principal) throws ParseException, IOException {
eu.eudat.data.entities.Project projectEntity = project.toDataModel();
for (ContentFile file : project.getFiles()) {
try {
ContentFile storedFile = fileStorageService.copyFromTempFileSystem(file);
Content content = new ContentBuilder().extension(file.getType())
.label(file.getFilename())
.locationType(Content.LocationType.INTERNAL.getValue())
.parentType(Content.ParentType.PROJECT.getValue())
.uri("LOCAL:" + storedFile.getId())
.build();
projectEntity.setContent(contentRepository.createOrUpdate(content));
} catch (TempFileNotFoundException e) {
continue;
if(project.getFiles() != null) {
for (ContentFile file : project.getFiles()) {
try {
ContentFile storedFile = fileStorageService.copyFromTempFileSystem(file);
Content content = new ContentBuilder().extension(file.getType())
.label(file.getFilename())
.locationType(Content.LocationType.INTERNAL.getValue())
.parentType(Content.ParentType.PROJECT.getValue())
.uri("LOCAL:" + storedFile.getId())
.build();
projectEntity.setContent(contentRepository.createOrUpdate(content));
} catch (TempFileNotFoundException e) {
continue;
}
}
}
projectEntity.setType(eu.eudat.data.entities.Project.ProjectType.INTERNAL.getValue());

@ -65,4 +65,8 @@ files.storage.final = final
#################################################################################
project.configuration.project.name = Project
project.configuration.funder.name = Funder
project.configuration.grant.name = Grant
project.configuration.grant.name = Grant
#################################################################################
http-logger.initial-delay = 0
http-logger.delay = 10
http-logger.server-address = http://localhost:31311

@ -40,6 +40,7 @@ import { LanguageService } from './services/language/language.service';
import { UsersModule } from './users/users.module';
import { HelpContentComponent } from './shared/help-content/help-content.component';
import { AuthGuard } from './shared/guards/auth.guard';
import { UrlUtilities } from './utilities/UrlUtilities';
@NgModule({
declarations: [
@ -96,7 +97,7 @@ import { AuthGuard } from './shared/guards/auth.guard';
clientId: "eudatdmptool",
clientSecret: "A3b*1*92",
oauthUrl: "https://b2access-integration.fz-juelich.de:443/oauth2-as/oauth2-authz",
redirectUri: "http://dl043.madgik.di.uoa.gr:8080/api/oauth/authorized/b2access",
redirectUri: "http://dl043.madgik.di.uoa.gr/api/oauth/authorized/b2access",
accessTokenUri: "https://b2access-integration.fz-juelich.de:443/oauth2/token"
}
}),
@ -106,7 +107,7 @@ import { AuthGuard } from './shared/guards/auth.guard';
AuthGuard,
AuthService,
BaseHttpService,
UrlUtilities,
DashboardService,
HelpContentService,
LanguageService,

@ -46,90 +46,131 @@
<form *ngIf="formGroup" [formGroup]="formGroup">
<ng-template matStepLabel>{{'DATASET-WIZARD.SECOND-STEP.TITLE' | translate}}</ng-template>
<app-external-item-listing *ngIf="formGroup.get('dataRepositories') && dataRepositoriesTemplate" [options]="externalSourcesConfiguration.dataRepositories"
placeholder="{{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES' | translate}}" [parentTemplate]='dataRepositoriesTemplate'
[displayFunction]='dataRepositoryDisplayFunc' [formGroup]="formGroup.get('dataRepositories')" [autoCompleteConfiguration]="dataRepositoriesAutoCompleteConfiguration"
(onItemChange)="dataRepositoriesOnItemChange($event)">
</app-external-item-listing>
<ng-template #dataRepositoriesTemplate let-suggestion>
<div>
<p>
{{suggestion.get('name').value}}
</p>
</div>
<div>
<mat-form-field>
<input matInput placeholder="{{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES-INFO' | translate}}" type="text" name="info" [formControl]="suggestion.get('info')">
</mat-form-field>
</div>
</ng-template>
<app-external-item-listing *ngIf="formGroup.get('externalDatasets') && externalDatasetsTemplate" [options]="externalSourcesConfiguration.externalDatasets"
placeholder="{{'DATASET-EDITOR.FIELDS.EXTERNAL-DATASETS' | translate}}" [parentTemplate]='externalDatasetsTemplate'
[displayFunction]='externalDatasetDisplayFunc' [formGroup]="formGroup.get('externalDatasets')" [autoCompleteConfiguration]="externalDatasetAutoCompleteConfiguration"
(onItemChange)="externalDatasetsOnItemChange($event)">
</app-external-item-listing>
<ng-template #externalDatasetsTemplate let-suggestion>
<div>
<p>
{{suggestion.get('label').value}}
</p>
</div>
<div>
<mat-form-field>
<input matInput placeholder="{{'DATASET-EDITOR.FIELDS.EXTERNAL-DATASET-INFO' | translate}}" type="text" name="info" [formControl]="suggestion.get('info')">
</mat-form-field>
</div>
<div>
<mat-form-field>
<mat-select placeholder="{{'DATASET-WIZARD.EDITOR.FIELDS.EXTERNAL-DATASET-TYPE' | translate}}" [formControl]="suggestion.get('type')">
<mat-option [value]="0">{{'TYPES.EXTERNAL-DATASET-TYPE.SOURCE' | translate}}</mat-option>
<mat-option [value]="1">{{'TYPES.EXTERNAL-DATASET-TYPE.OUTPUT' | translate}}</mat-option>
</mat-select>
</mat-form-field>
</div>
</ng-template>
<app-external-item-listing *ngIf="formGroup.get('registries') && registriesTemplate" [options]="externalSourcesConfiguration.registries"
placeholder="{{'DATASET-EDITOR.FIELDS.REGISTRIES' | translate}}" [parentTemplate]='registriesTemplate' [displayFunction]='registriesDisplayFunc'
[formGroup]="formGroup.get('registries')" [autoCompleteConfiguration]="registriesAutoCompleteConfiguration" (onItemChange)="registriesOnItemChange($event)">
</app-external-item-listing>
<ng-template #registriesTemplate let-suggestion>
<div>
<p>
{{suggestion.get('label').value}}
</p>
</div>
</ng-template>
<app-external-item-listing *ngIf="formGroup.get('services') && servicesTemplate" [options]="externalSourcesConfiguration.services"
placeholder="{{'DATASET-EDITOR.FIELDS.SERVICES' | translate}}" [parentTemplate]='servicesTemplate' [displayFunction]='servicesDisplayFunc'
[formGroup]="formGroup.get('services')" [autoCompleteConfiguration]="servicesAutoCompleteConfiguration" (onItemChange)="servicesOnItemChange($event)">
</app-external-item-listing>
<ng-template #servicesTemplate let-suggestion>
<div>
<p>
{{suggestion.get('label').value}}
</p>
</div>
</ng-template>
<mat-card>
<mat-card-header>
<mat-card-title class="thick">
{{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES' | translate}}
</mat-card-title>
</mat-card-header>
<app-external-item-listing *ngIf="formGroup.get('dataRepositories') && dataRepositoriesTemplate && externalSourcesConfiguration"
[options]="externalSourcesConfiguration.dataRepositories" placeholder="{{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES' | translate}}"
[parentTemplate]='dataRepositoriesTemplate' [displayFunction]='dataRepositoryDisplayFunc' [formGroup]="formGroup.get('dataRepositories')"
[autoCompleteConfiguration]="dataRepositoriesAutoCompleteConfiguration" (onItemChange)="dataRepositoriesOnItemChange($event)">
</app-external-item-listing>
<ng-template #dataRepositoriesTemplate let-suggestion let-i="index" let-callback="function">
<div>
<p>
{{i+1}}) {{suggestion.get('name').value}}
</p>
</div>
<div>
<mat-form-field>
<input matInput placeholder="{{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES-INFO' | translate}}" type="text" name="info" [formControl]="suggestion.get('info')">
</mat-form-field>
</div>
<div>
<button mat-button (click)="callback(i)">
<mat-icon>close</mat-icon>
</button>
</div>
</ng-template>
</mat-card>
<mat-card>
<mat-card-header>
<mat-card-title class="thick">
{{'DATASET-EDITOR.FIELDS.EXTERNAL-DATASETS' | translate}}
</mat-card-title>
</mat-card-header>
<app-external-item-listing *ngIf="formGroup.get('externalDatasets') && externalDatasetsTemplate && externalSourcesConfiguration"
[options]="externalSourcesConfiguration.externalDatasets" placeholder="{{'DATASET-EDITOR.FIELDS.EXTERNAL-DATASETS' | translate}}"
[parentTemplate]='externalDatasetsTemplate' [displayFunction]='externalDatasetDisplayFunc' [formGroup]="formGroup.get('externalDatasets')"
[autoCompleteConfiguration]="externalDatasetAutoCompleteConfiguration" (onItemChange)="externalDatasetsOnItemChange($event)">
</app-external-item-listing>
<ng-template #externalDatasetsTemplate let-suggestion let-i="index" let-callback="function">
<div>
<p>
{{i+1}}) {{suggestion.get('label').value}}
</p>
</div>
<div>
<mat-form-field>
<input matInput placeholder="{{'DATASET-EDITOR.FIELDS.EXTERNAL-DATASET-INFO' | translate}}" type="text" name="info" [formControl]="suggestion.get('info')">
</mat-form-field>
</div>
<div>
<mat-form-field>
<mat-select placeholder="{{'DATASET-WIZARD.EDITOR.FIELDS.EXTERNAL-DATASET-TYPE' | translate}}" [formControl]="suggestion.get('type')">
<mat-option [value]="0">{{'TYPES.EXTERNAL-DATASET-TYPE.SOURCE' | translate}}</mat-option>
<mat-option [value]="1">{{'TYPES.EXTERNAL-DATASET-TYPE.OUTPUT' | translate}}</mat-option>
</mat-select>
</mat-form-field>
</div>
<div>
<button mat-button (click)="callback(i)">
<mat-icon>close</mat-icon>
</button>
</div>
</ng-template>
</mat-card>
<mat-card>
<mat-card-header>
<mat-card-title class="thick">
{{'DATASET-EDITOR.FIELDS.REGISTRIES' | translate}}
</mat-card-title>
</mat-card-header>
<app-external-item-listing *ngIf="formGroup.get('registries') && registriesTemplate && externalSourcesConfiguration" [options]="externalSourcesConfiguration.registries"
placeholder="{{'DATASET-EDITOR.FIELDS.REGISTRIES' | translate}}" [parentTemplate]='registriesTemplate' [displayFunction]='registriesDisplayFunc'
[formGroup]="formGroup.get('registries')" [autoCompleteConfiguration]="registriesAutoCompleteConfiguration" (onItemChange)="registriesOnItemChange($event)">
</app-external-item-listing>
<ng-template #registriesTemplate let-suggestion let-i="index" let-callback="function">
<div>
<p>
{{i+1}}) {{suggestion.get('label').value}}
</p>
</div>
<div>
<button mat-button (click)="callback(i)">
<mat-icon>close</mat-icon>
</button>
</div>
</ng-template>
</mat-card>
<mat-card>
<mat-card-header>
<mat-card-title class="thick">
{{'DATASET-EDITOR.FIELDS.SERVICES' | translate}}
</mat-card-title>
</mat-card-header>
<app-external-item-listing *ngIf="formGroup.get('services') && servicesTemplate && externalSourcesConfiguration" [options]="externalSourcesConfiguration.services"
placeholder="{{'DATASET-EDITOR.FIELDS.SERVICES' | translate}}" [parentTemplate]='servicesTemplate' [displayFunction]='servicesDisplayFunc'
[formGroup]="formGroup.get('services')" [autoCompleteConfiguration]="servicesAutoCompleteConfiguration" (onItemChange)="servicesOnItemChange($event)">
</app-external-item-listing>
<ng-template #servicesTemplate let-suggestion let-i="index" let-callback="function">
<div>
<p>
{{i+1}}) {{suggestion.get('label').value}}
</p>
</div>
<div>
<button mat-button (click)="callback(i)">
<mat-icon>close</mat-icon>
</button>
</div>
</ng-template>
</mat-card>
<div class="navigation-buttons-container">
<button matStepperPrevious mat-raised-button color="primary">{{'DATASET-WIZARD.ACTIONS.BACK' | translate}}</button>

@ -1,46 +1,50 @@
.full-width {
width: 100%;
width: 100%;
}
.flex-container {
display: flex;
display: flex;
}
.input-table {
table-layout: fixed;
table-layout: fixed;
}
.table-card .mat-grid-tile {
background: rgba(0, 0, 0, 0.32);
background: rgba(0, 0, 0, 0.32);
}
.dataset-wizard {
.full-width {
width: 100%;
}
mat-form-field {
width: 100%;
padding: 3px;
}
td-chips {
margin-top: 20px;
}
.navigation-buttons-container {
margin-top: 20px;
}
.mat-card {
margin: 16px 0;
}
.fill-space {
flex: 1 1 auto;
}
p {
margin: 16px;
}
.left-button {
float: left;
}
.description-area {
height: 100px;
}
}
.full-width {
width: 100%;
}
mat-form-field {
width: 100%;
padding: 3px;
}
td-chips {
margin-top: 20px;
}
.navigation-buttons-container {
margin-top: 20px;
}
.mat-card {
margin: 16px 0;
}
.fill-space {
flex: 1 1 auto;
}
p {
margin: 16px;
}
.left-button {
float: left;
}
.description-area {
height: 100px;
}
}
mat-card-title.thick {
font-weight: bold;
}

@ -196,11 +196,13 @@ export class DatasetWizardComponent {
save() {
if (!this.isFormValid()) { return; }
this.formGroup.get("status").setValue("0");
this.submit();
}
saveFinalize() {
if (!this.isFormValid()) { return; }
this.formGroup.get("status").setValue("1");
this.submit();
}

@ -1,24 +1,24 @@
<div class="project-editor">
<form *ngIf="formGroup" (ngSubmit)="formSubmit()" [formGroup]="formGroup">
<!-- <mat-card>
<form *ngIf="formGroup" (ngSubmit)="formSubmit()" [formGroup]="formGroup">
<!-- <mat-card>
<mat-card-title *ngIf="isNew">{{'DATASET-EDITOR.TITLE.NEW' | translate}}</mat-card-title>
<mat-card-title *ngIf="!isNew">{{'DATASET-EDITOR.TITLE.EDIT' | translate}} {{dataset.label}}</mat-card-title>
<mat-card-content> -->
<mat-form-field class="full-width">
<input matInput placeholder="{{'DATASET-EDITOR.FIELDS.NAME' | translate}}" type="text" name="label" formControlName="label"
required>
<mat-error *ngIf="formGroup.get('label').errors?.backendError">{{baseErrorModel.label}}</mat-error>
<mat-error *ngIf="formGroup.get('label').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<mat-form-field class="full-width">
<input matInput placeholder="{{'DATASET-EDITOR.FIELDS.NAME' | translate}}" type="text" name="label" formControlName="label"
required>
<mat-error *ngIf="formGroup.get('label').errors?.backendError">{{baseErrorModel.label}}</mat-error>
<mat-error *ngIf="formGroup.get('label').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<mat-form-field class="full-width">
<input matInput placeholder="{{'DATASET-EDITOR.FIELDS.URI' | translate}}" type="text" name="uri" formControlName="uri">
<mat-error *ngIf="formGroup.get('uri').errors?.backendError">{{baseErrorModel.uri}}</mat-error>
<mat-error *ngIf="formGroup.get('uri').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<mat-form-field class="full-width">
<input matInput placeholder="{{'DATASET-EDITOR.FIELDS.URI' | translate}}" type="text" name="uri" formControlName="uri">
<mat-error *ngIf="formGroup.get('uri').errors?.backendError">{{baseErrorModel.uri}}</mat-error>
<mat-error *ngIf="formGroup.get('uri').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<!-- <table class="input-table full-width">
<!-- <table class="input-table full-width">
<tr>
<td>
<mat-form-field>
@ -43,14 +43,13 @@
</tr>
</table> -->
<mat-form-field class="full-width">
<textarea matInput class="description-area" placeholder="{{'DATASET-EDITOR.FIELDS.DESCRIPTION' | translate}}" formControlName="description"
required></textarea>
<mat-error *ngIf="formGroup.get('description').errors?.backendError">{{errorModel.description}}</mat-error>
<mat-error *ngIf="formGroup.get('description').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<mat-form-field class="full-width">
<textarea matInput class="description-area" placeholder="{{'DATASET-EDITOR.FIELDS.DESCRIPTION' | translate}}" formControlName="description"></textarea>
<mat-error *ngIf="formGroup.get('description').errors?.backendError">{{errorModel.description}}</mat-error>
<mat-error *ngIf="formGroup.get('description').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<!-- <td-chips color="accent" [items]="filtereddataRepositories" formControlName="dataRepositories" placeholder="{{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES' | translate}}"
<!-- <td-chips color="accent" [items]="filtereddataRepositories" formControlName="dataRepositories" placeholder="{{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES' | translate}}"
(inputChange)="filterdataRepositories($event)" requireMatch>
<ng-template td-chip let-chip="chip">
<div class="tc-grey-100 bgc-teal-700" td-chip-avatar>{{chip.name.substring(0, 1).toUpperCase()}}</div>
@ -92,8 +91,8 @@
<mat-progress-bar [style.height.px]="2" *ngIf="filteringResearchersAsync" mode="indeterminate"></mat-progress-bar>
</td-chips> -->
<!-- </mat-card-content>
<!-- </mat-card-content>
</mat-card> -->
</form>
<!-- <div *ngIf="formGroup"> {{ formGroup.value | json }}</div> -->
</div>
</form>
<!-- <div *ngIf="formGroup"> {{ formGroup.value | json }}</div> -->
</div>

@ -1,96 +1,96 @@
<div class="container-fluid">
<h3>{{'DATASET-LISTING.TITLE' | translate}} {{titlePrefix}}</h3>
<app-datasets-criteria-component></app-datasets-criteria-component>
<mat-card class="mat-card">
<mat-card-header>
<mat-progress-bar *ngIf="dataSource?.isLoadingResults" mode="query"></mat-progress-bar>
</mat-card-header>
<mat-table [dataSource]="dataSource" matSort (matSortChange)="refresh()">
<!-- Column Definition: Name -->
<ng-container cdkColumnDef="label">
<mat-header-cell *matHeaderCellDef mat-sort-header="label">{{'DATASET-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.label}}</mat-cell>
</ng-container>
<!-- Column Definition: Dmp -->
<ng-container cdkColumnDef="dmp">
<mat-header-cell *matHeaderCellDef mat-sort-header="|join|dmp:label">{{'DATASET-LISTING.COLUMNS.DMP' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.dmp}} </mat-cell>
</ng-container>
<!-- Column Definition: Profile -->
<ng-container cdkColumnDef="profile">
<mat-header-cell *matHeaderCellDef mat-sort-header="|join|profile:label">{{'DATASET-LISTING.COLUMNS.PROFILE' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.profile}} </mat-cell>
</ng-container>
<!-- Column Definition: DataRepositories -->
<ng-container cdkColumnDef="dataRepositories">
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.DATAREPOSITORIES' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.dataRepositories}} </mat-cell>
</ng-container>
<!-- Column Definition: DataRepositories -->
<ng-container cdkColumnDef="registries">
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.REGISTRIES' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.registries}} </mat-cell>
</ng-container>
<!-- Column Definition: DataRepositories -->
<ng-container cdkColumnDef="services">
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.SERVICES' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.services}} </mat-cell>
</ng-container>
<!-- Column Definition: Status -->
<!-- <ng-container cdkColumnDef="status">
<h3>{{'DATASET-LISTING.TITLE' | translate}} {{titlePrefix}}</h3>
<app-datasets-criteria-component></app-datasets-criteria-component>
<mat-card class="mat-card">
<mat-card-header>
<mat-progress-bar *ngIf="dataSource?.isLoadingResults" mode="query"></mat-progress-bar>
</mat-card-header>
<mat-table [dataSource]="dataSource" matSort (matSortChange)="refresh()">
<!-- Column Definition: Name -->
<ng-container cdkColumnDef="label">
<mat-header-cell *matHeaderCellDef mat-sort-header="label">{{'DATASET-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.label}}</mat-cell>
</ng-container>
<!-- Column Definition: Dmp -->
<ng-container cdkColumnDef="dmp">
<mat-header-cell *matHeaderCellDef mat-sort-header="|join|dmp:label">{{'DATASET-LISTING.COLUMNS.DMP' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.dmp}} </mat-cell>
</ng-container>
<!-- Column Definition: Profile -->
<ng-container cdkColumnDef="profile">
<mat-header-cell *matHeaderCellDef mat-sort-header="|join|profile:label">{{'DATASET-LISTING.COLUMNS.PROFILE' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.profile}} </mat-cell>
</ng-container>
<!-- Column Definition: DataRepositories -->
<ng-container cdkColumnDef="dataRepositories">
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.DATAREPOSITORIES' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.dataRepositories}} </mat-cell>
</ng-container>
<!-- Column Definition: DataRepositories -->
<ng-container cdkColumnDef="registries">
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.REGISTRIES' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.registries}} </mat-cell>
</ng-container>
<!-- Column Definition: DataRepositories -->
<ng-container cdkColumnDef="services">
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.SERVICES' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.services}} </mat-cell>
</ng-container>
<!-- Column Definition: Status -->
<!-- <ng-container cdkColumnDef="status">
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.STATUS' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.status}}
</mat-cell>
</ng-container> -->
<!-- Column Definition: Description -->
<ng-container cdkColumnDef="description">
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.DESCRIPTION' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.description}} </mat-cell>
</ng-container>
<!-- Column Definition: Created -->
<ng-container cdkColumnDef="created">
<mat-header-cell *matHeaderCellDef mat-sort-header="created">{{'DATASET-LISTING.COLUMNS.CREATED' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.created | date:'shortDate'}}</mat-cell>
</ng-container>
<!-- Column Definition: Submission Time -->
<ng-container cdkColumnDef="actions">
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.ACTIONS' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row" (click)="$event.stopPropagation()">
<mat-menu #actionsMenu="matMenu">
<button *ngIf="row.status == 0" mat-menu-item>
<mat-icon>mode_edit</mat-icon>{{'DATASET-LISTING.ACTIONS.EDIT' | translate}}</button>
<button *ngIf="row.status != 0" mat-menu-item>
<mat-icon>public</mat-icon>{{'DATASET-LISTING.ACTIONS.MAKE-IT-PUBLIC' | translate}}</button>
</mat-menu>
<button mat-icon-button [matMenuTriggerFor]="actionsMenu">
<mat-icon>more_vert</mat-icon>
</button>
</mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns" (click)="rowClick(row.id)"></mat-row>
<!-- (click)="rowClick(row.id)" -->
</mat-table>
<mat-paginator #paginator [length]="dataSource?.totalCount" [pageSizeOptions]="[10, 25, 100]">
</mat-paginator>
</mat-card>
<button *ngIf="dmpId" mat-fab class="mat-fab-bottom-right" color="primary" [routerLink]="['/datasets/new/'+dmpId] ">
<mat-icon class="mat-24">add</mat-icon>
</button>
</div>
<!-- Column Definition: Description -->
<ng-container cdkColumnDef="description">
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.DESCRIPTION' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.description}} </mat-cell>
</ng-container>
<!-- Column Definition: Created -->
<ng-container cdkColumnDef="created">
<mat-header-cell *matHeaderCellDef mat-sort-header="created">{{'DATASET-LISTING.COLUMNS.CREATED' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.created | date:'shortDate'}}</mat-cell>
</ng-container>
<!-- Column Definition: Submission Time -->
<ng-container cdkColumnDef="actions">
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.ACTIONS' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row" (click)="$event.stopPropagation()">
<mat-menu #actionsMenu="matMenu">
<button *ngIf="row.status == 0" (click)="rowClick(row.id)" mat-menu-item>
<mat-icon>mode_edit</mat-icon>{{'DATASET-LISTING.ACTIONS.EDIT' | translate}}</button>
<button *ngIf="row.status != 0" (click)="makeItPublic(row.id)" mat-menu-item>
<mat-icon>public</mat-icon>{{'DATASET-LISTING.ACTIONS.MAKE-IT-PUBLIC' | translate}}</button>
</mat-menu>
<button mat-icon-button [matMenuTriggerFor]="actionsMenu">
<mat-icon>more_vert</mat-icon>
</button>
</mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns" (click)="rowClick(row.id)"></mat-row>
<!-- (click)="rowClick(row.id)" -->
</mat-table>
<mat-paginator #paginator [length]="dataSource?.totalCount" [pageSizeOptions]="[10, 25, 100]">
</mat-paginator>
</mat-card>
<button *ngIf="dmpId" mat-fab class="mat-fab-bottom-right" color="primary" [routerLink]="['/datasets/new/'+dmpId] ">
<mat-icon class="mat-24">add</mat-icon>
</button>
</div>

@ -4,9 +4,12 @@
<mat-card>
<mat-card-header>
<mat-card-title *ngIf="isNew">{{'DMP-EDITOR.TITLE.NEW' | translate}}</mat-card-title>
<mat-card-title *ngIf="!isNew">{{formGroup.get('label').value}}</mat-card-title>
<mat-card-title *ngIf="!isNew">
<h3>{{formGroup.get('label').value}} </h3>
</mat-card-title>
<div class="fill-space"></div>
<mat-menu #actionsMenu="matMenu">
<button mat-menu-item (click)="redirectToProject()">
@ -22,24 +25,7 @@
<mat-icon>more_vert</mat-icon>
</button>
</mat-card-header>
</mat-card>
<mat-card>
<mat-card-content>
<mat-form-field class="full-width">
<input type="text" placeholder="{{'DMP-EDITOR.FIELDS.PROFILE' | translate}}" [formControl]="textCtrl" matInput [matAutocomplete]="auto">
<mat-autocomplete #auto="matAutocomplete" [displayWith]="displayWith">
<mat-option *ngFor="let option of filteredOptions | async" [value]="option" (click)="selectOption(option)">
{{ option.label }}
</mat-option>
</mat-autocomplete>
</mat-form-field>
</mat-card-content>
</mat-card>
<mat-card>
<mat-card-content>
<mat-form-field class="full-width">
<input matInput placeholder="{{'DMP-EDITOR.FIELDS.NAME' | translate}}" type="text" name="label" formControlName="label" required>
<mat-error *ngIf="formGroup.get('label').errors?.backendError">{{baseErrorModel.label}}</mat-error>
@ -115,6 +101,17 @@
<mat-icon aria-label="Example icon-button with a heart icon">add_circle</mat-icon>
</button>
</div>
<h3 mat-subheader>{{'DMP-EDITOR.FIELDS.PROFILE' | translate}}</h3>
<mat-form-field class="full-width">
<input type="text" placeholder="{{'DMP-EDITOR.FIELDS.PROFILE' | translate}}" [formControl]="textCtrl" matInput [matAutocomplete]="auto">
<mat-autocomplete #auto="matAutocomplete" [displayWith]="displayWith">
<mat-option *ngFor="let option of filteredOptions | async" [value]="option" (click)="selectOption(option)">
{{ option.label }}
</mat-option>
</mat-autocomplete>
</mat-form-field>
<app-dynamic-dmp-field-resolver class="full-width" *ngIf="dataManagementPlan.definition" [formGroup]="formGroup" [dataManagementPlanProfile]="dataManagementPlan.definition"></app-dynamic-dmp-field-resolver>
<mat-form-field class="full-width">

@ -14,7 +14,6 @@ export class DynamicFieldsProjectComponent implements OnInit {
formGroup: FormGroup;
ngOnInit(): void {
console.log(this.formGroup)
}
findDependencies(id: number) {

@ -1,5 +1,5 @@
<div class="container-fluid">
<h3>{{'DMP-LISTING.TITLE' | translate}}</h3>
<h3>{{'DMP-LISTING.TITLE' | translate}} {{titlePrefix}}</h3>
<app-dmp-criteria-component [showProject]="showProject"></app-dmp-criteria-component>
<mat-card class="mat-card">
@ -48,7 +48,9 @@
<!-- Column Definition: Datasets(count) -->
<ng-container cdkColumnDef="numOfDatasets">
<mat-header-cell *matHeaderCellDef mat-sort-header="|count|dataset">{{'DMP-LISTING.COLUMNS.DATASETS' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.numOfDatasets}}</mat-cell>
<mat-cell *matCellDef="let row" (click)="$event.stopPropagation();">
<a (click)="showDatasets(row.id, row.label);">{{row.numOfDatasets}}</a>
</mat-cell>
</ng-container>
<ng-container cdkColumnDef="actions">
@ -78,7 +80,7 @@
</mat-paginator>
</mat-card>
<button mat-fab class="mat-fab-bottom-right" color="primary" [routerLink]=" ['./new'] ">
<button *ngIf="!this.projectId" mat-fab class="mat-fab-bottom-right" color="primary" [routerLink]=" ['./new'] ">
<mat-icon class="mat-24">add</mat-icon>
</button>
</div>

@ -35,6 +35,7 @@ export class DataManagementPlanListingComponent implements OnInit {
itemId: string;
projectId: string;
showProject: boolean;
titlePrefix: string;
constructor(
private dataManagementPlanService: DataManagementPlanService,
private router: Router,
@ -64,6 +65,10 @@ export class DataManagementPlanListingComponent implements OnInit {
this.refresh();
this.criteria.setRefreshCallback(() => this.refresh());
}
if (this.projectId != null)
if (params['projectLabel'] != undefined)
this.titlePrefix = "for " + params['projectLabel'];
})
}

@ -10,60 +10,60 @@ import { RegisterModel } from "../registers/RegisterModel";
import { DataRepositoryModel } from "../dataRepositories/DataRepositoryModel";
export class DatasetModel implements Serializable<DatasetModel> {
public id: String;
public label: String;
public profile: String;
public uri: String;
public status: String;
public description: String;
public services: ServiceModel[] = [];
public registries: RegisterModel[] = [];
public dataRepositories: DataRepositoryModel[] = [];
public id: String;
public label: String;
public profile: String;
public uri: String;
public status: String;
public description: String;
public services: ServiceModel[] = [];
public registries: RegisterModel[] = [];
public dataRepositories: DataRepositoryModel[] = [];
public errorModel: BaseErrorModel = new BaseErrorModel();
public errorModel: BaseErrorModel = new BaseErrorModel();
fromJSONObject(item: any): DatasetModel {
this.id = item.id;
this.label = item.label;
this.profile = item.profile;
this.uri = item.uri;
this.status = item.status;
this.description = item.description;
this.services = JsonSerializer.fromJSONArray(item.services, ServiceModel);
this.registries = JsonSerializer.fromJSONArray(item.registries, RegisterModel);
this.dataRepositories = JsonSerializer.fromJSONArray(item.dataRepositories, DataRepositoryModel);
fromJSONObject(item: any): DatasetModel {
this.id = item.id;
this.label = item.label;
this.profile = item.profile;
this.uri = item.uri;
this.status = item.status;
this.description = item.description;
this.services = JsonSerializer.fromJSONArray(item.services, ServiceModel);
this.registries = JsonSerializer.fromJSONArray(item.registries, RegisterModel);
this.dataRepositories = JsonSerializer.fromJSONArray(item.dataRepositories, DataRepositoryModel);
return this;
}
return this;
}
buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup {
if (context == null) { context = this.createValidationContext(); }
buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup {
if (context == null) { context = this.createValidationContext(); }
const formGroup = new FormBuilder().group({
label: [{ value: this.label, disabled: disabled }, context.getValidation('label').validators],
profile: [{ value: this.profile, disabled: disabled }, context.getValidation('profile').validators],
uri: [{ value: this.uri, disabled: disabled }, context.getValidation('uri').validators],
status: [{ value: this.status, disabled: disabled }, context.getValidation('status').validators],
description: [{ value: this.description, disabled: disabled }, context.getValidation('description').validators],
services: [{ value: this.services, disabled: disabled }, context.getValidation('services').validators],
registries: [{ value: this.registries, disabled: disabled }, context.getValidation('registries').validators],
dataRepositories: [{ value: this.dataRepositories, disabled: disabled }, context.getValidation('dataRepositories').validators]
});
const formGroup = new FormBuilder().group({
label: [{ value: this.label, disabled: disabled }, context.getValidation('label').validators],
profile: [{ value: this.profile, disabled: disabled }, context.getValidation('profile').validators],
uri: [{ value: this.uri, disabled: disabled }, context.getValidation('uri').validators],
status: [{ value: this.status, disabled: disabled }, context.getValidation('status').validators],
description: [{ value: this.description, disabled: disabled }, context.getValidation('description').validators],
services: [{ value: this.services, disabled: disabled }, context.getValidation('services').validators],
registries: [{ value: this.registries, disabled: disabled }, context.getValidation('registries').validators],
dataRepositories: [{ value: this.dataRepositories, disabled: disabled }, context.getValidation('dataRepositories').validators]
});
return formGroup;
}
return formGroup;
}
createValidationContext(): ValidationContext {
const baseContext: ValidationContext = new ValidationContext();
baseContext.validation.push({ key: 'label', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'label')] });
baseContext.validation.push({ key: 'profile', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'profile')] });
baseContext.validation.push({ key: 'uri', validators: [BackendErrorValidator(this.errorModel, 'uri')] });
baseContext.validation.push({ key: 'status', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'status')] });
baseContext.validation.push({ key: 'description', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'description')] });
baseContext.validation.push({ key: 'services', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'services')] });
baseContext.validation.push({ key: 'registries', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'registries')] });
baseContext.validation.push({ key: 'dataRepositories', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'dataRepositories')] });
createValidationContext(): ValidationContext {
const baseContext: ValidationContext = new ValidationContext();
baseContext.validation.push({ key: 'label', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'label')] });
baseContext.validation.push({ key: 'profile', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'profile')] });
baseContext.validation.push({ key: 'uri', validators: [BackendErrorValidator(this.errorModel, 'uri')] });
baseContext.validation.push({ key: 'status', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'status')] });
baseContext.validation.push({ key: 'description', validators: [BackendErrorValidator(this.errorModel, 'description')] });
baseContext.validation.push({ key: 'services', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'services')] });
baseContext.validation.push({ key: 'registries', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'registries')] });
baseContext.validation.push({ key: 'dataRepositories', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'dataRepositories')] });
return baseContext;
}
}
return baseContext;
}
}

@ -65,7 +65,7 @@ export class DatasetWizardModel implements Serializable<DatasetWizardModel> {
} else {
//externalDatasetsFormArray.push(new ExternalDatasetModel().buildForm(context.getValidation('externalDatasets').descendantValidations, disabled));
}
formGroup.addControl('externalDatasets', formBuilder.array(externalDatasetsFormArray, Validators.required));
formGroup.addControl('externalDatasets', formBuilder.array(externalDatasetsFormArray));
const registriesFormArray = new Array<FormGroup>();
if (this.registries && this.registries.length > 0) {
@ -75,7 +75,7 @@ export class DatasetWizardModel implements Serializable<DatasetWizardModel> {
} else {
//externalDatasetsFormArray.push(new ExternalDatasetModel().buildForm(context.getValidation('externalDatasets').descendantValidations, disabled));
}
formGroup.addControl('registries', formBuilder.array(registriesFormArray, Validators.required));
formGroup.addControl('registries', formBuilder.array(registriesFormArray));
const dataRepositoriesFormArray = new Array<FormGroup>();
if (this.dataRepositories && this.dataRepositories.length > 0) {
@ -85,7 +85,7 @@ export class DatasetWizardModel implements Serializable<DatasetWizardModel> {
} else {
//externalDatasetsFormArray.push(new ExternalDatasetModel().buildForm(context.getValidation('externalDatasets').descendantValidations, disabled));
}
formGroup.addControl('dataRepositories', formBuilder.array(dataRepositoriesFormArray, Validators.required));
formGroup.addControl('dataRepositories', formBuilder.array(dataRepositoriesFormArray));
const servicesFormArray = new Array<FormGroup>();
if (this.services && this.services.length > 0) {
@ -95,7 +95,7 @@ export class DatasetWizardModel implements Serializable<DatasetWizardModel> {
} else {
//externalDatasetsFormArray.push(new ExternalDatasetModel().buildForm(context.getValidation('externalDatasets').descendantValidations, disabled));
}
formGroup.addControl('services', formBuilder.array(servicesFormArray, Validators.required));
formGroup.addControl('services', formBuilder.array(servicesFormArray));
if (this.datasetProfileDefinition) formGroup.addControl("datasetProfileDefinition", this.datasetProfileDefinition.buildForm())
formGroup.addControl("profile", this.profile.buildForm())
@ -109,7 +109,7 @@ export class DatasetWizardModel implements Serializable<DatasetWizardModel> {
baseContext.validation.push({ key: 'profile', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'profile')] });
baseContext.validation.push({ key: 'uri', validators: [BackendErrorValidator(this.errorModel, 'uri')] });
baseContext.validation.push({ key: 'status', validators: [BackendErrorValidator(this.errorModel, 'status')] });
baseContext.validation.push({ key: 'description', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'description')] });
baseContext.validation.push({ key: 'description', validators: [BackendErrorValidator(this.errorModel, 'description')] });
baseContext.validation.push({ key: 'services', validators: [BackendErrorValidator(this.errorModel, 'services')] });
baseContext.validation.push({ key: 'registries', validators: [BackendErrorValidator(this.errorModel, 'registries')] });
baseContext.validation.push({ key: 'dataRepositories', validators: [BackendErrorValidator(this.errorModel, 'dataRepositories')] });

@ -17,7 +17,7 @@ export class ProjectModel implements Serializable<ProjectModel> {
public label: String;
public abbreviation: String;
public reference: String;
public type: ProjectType;
public type: ProjectType = ProjectType.Internal;
public uri: String;
public status: Status = Status.Active;
public startDate: Date;
@ -73,7 +73,7 @@ export class ProjectModel implements Serializable<ProjectModel> {
baseContext.validation.push({ key: 'description', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'description')] });
baseContext.validation.push({ key: 'startDate', validators: [BackendErrorValidator(this.errorModel, 'startDate')] });
baseContext.validation.push({ key: 'endDate', validators: [BackendErrorValidator(this.errorModel, 'endDate')] });
baseContext.validation.push({ key: 'files', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'files')] });
baseContext.validation.push({ key: 'files', validators: [BackendErrorValidator(this.errorModel, 'files')] });
return baseContext;
}

@ -5,17 +5,18 @@
<mat-card-title *ngIf="isNew">{{'PROJECT-EDITOR.TITLE.NEW' | translate}}</mat-card-title>
<mat-card-title *ngIf="!isNew">{{formGroup.get('label').value}}</mat-card-title>
<div class="fill-space"></div>
<button *ngIf="!editMode&& !isExternalProject()" mat-icon-button (click)="enableForm()">
<mat-icon class="mat-24">edit</mat-icon>
</button>
<button *ngIf="editMode && !isExternalProject()" mat-icon-button (click)="disableForm()">
<mat-icon class="mat-24">lock</mat-icon>
</button>
<button mat-button (click)="goToProjectDmps()">
<mat-icon class="mat-24">arrow_forward</mat-icon>
<span>{{'PROJECT-EDITOR.ACTIONS.GO-TO-DMPS' | translate}}</span>
</button>
<div *ngIf="!isNew">
<button *ngIf="!editMode && !isExternalProject()" mat-icon-button (click)="enableForm()">
<mat-icon class="mat-24">edit</mat-icon>
</button>
<button *ngIf="editMode && !isExternalProject()" mat-icon-button (click)="disableForm()">
<mat-icon class="mat-24">lock</mat-icon>
</button>
<button mat-button (click)="goToProjectDmps()">
<mat-icon class="mat-24">arrow_forward</mat-icon>
<span>{{'PROJECT-EDITOR.ACTIONS.GO-TO-DMPS' | translate}}</span>
</button>
</div>
</mat-card-header>
<mat-card-content>
@ -85,7 +86,7 @@
</table>
<div layout="row" class="full-width text-right" align="end">
<button mat-raised-button color="primary" (click)="cancel()" type="button">{{'PROJECT-EDITOR.ACTIONS.CANCEL' | translate}}</button>
<button *ngIf="editMode" mat-raised-button color="primary" type="submit">{{'PROJECT-EDITOR.ACTIONS.SAVE' | translate}}</button>
<button *ngIf="isNew || editMode" mat-raised-button color="primary" type="submit">{{'PROJECT-EDITOR.ACTIONS.SAVE' | translate}}</button>
<button *ngIf="!isNew && editMode" mat-raised-button color="primary" type="button" (click)="delete()">{{'PROJECT-EDITOR.ACTIONS.DELETE' | translate}}</button>
</div>

@ -171,7 +171,7 @@ export class ProjectEditorComponent implements AfterViewInit {
}
public goToProjectDmps() {
this.router.navigate(["dmps/project/" + this.project.id])
this.router.navigate(["dmps/project/" + this.project.id, { projectLabel: this.project.label }])
}
public isExternalProject() {

@ -1,69 +1,69 @@
<div class="container-fluid">
<h3>{{languageResolverService.getBy('listingTitle') | translate}}</h3>
<h3>{{languageResolverService.getBy('listingTitle') | translate}}</h3>
<app-projects-criteria-component></app-projects-criteria-component>
<mat-card class="mat-card">
<mat-card-header>
<mat-progress-bar *ngIf="dataSource?.isLoadingResults" mode="query"></mat-progress-bar>
</mat-card-header>
<app-projects-criteria-component></app-projects-criteria-component>
<mat-card class="mat-card">
<mat-card-header>
<mat-progress-bar *ngIf="dataSource?.isLoadingResults" mode="query"></mat-progress-bar>
</mat-card-header>
<mat-table [dataSource]="dataSource" matSort (matSortChange)="refresh()">
<mat-table [dataSource]="dataSource" matSort (matSortChange)="refresh()">
<ng-container cdkColumnDef="avatar">
<mat-header-cell *matHeaderCellDef mat-sort-header="avatar">{{'PROJECT-LISTING.COLUMNS.AVATAR' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row">
<img mat-card-avatar [src]="host+'files/'+row.files[0].id+'?location='+row.files[0].location+'&type='+row.files[0].type">
</mat-cell>
</ng-container>
<!-- Column Definition: Name -->
<ng-container cdkColumnDef="name">
<mat-header-cell *matHeaderCellDef mat-sort-header="label">{{'PROJECT-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.label}}</mat-cell>
</ng-container>
<ng-container cdkColumnDef="avatar">
<mat-header-cell *matHeaderCellDef mat-sort-header="avatar">{{'PROJECT-LISTING.COLUMNS.AVATAR' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row">
<img mat-card-avatar [src]="host+'files/'+row.files[0].id+'?location='+row.files[0].location+'&type='+row.files[0].type">
</mat-cell>
</ng-container>
<!-- Column Definition: Name -->
<ng-container cdkColumnDef="name">
<mat-header-cell *matHeaderCellDef mat-sort-header="label">{{'PROJECT-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.label}}</mat-cell>
</ng-container>
<!-- Column Definition: Αbbreviation -->
<ng-container cdkColumnDef="abbreviation">
<mat-header-cell *matHeaderCellDef mat-sort-header="abbreviation">{{'PROJECT-LISTING.COLUMNS.ABBREVIATION' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.abbreviation}} </mat-cell>
</ng-container>
<!-- Column Definition: Αbbreviation -->
<ng-container cdkColumnDef="abbreviation">
<mat-header-cell *matHeaderCellDef mat-sort-header="abbreviation">{{'PROJECT-LISTING.COLUMNS.ABBREVIATION' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.abbreviation}} </mat-cell>
</ng-container>
<!-- Column Definition: Start -->
<ng-container cdkColumnDef="start">
<mat-header-cell *matHeaderCellDef mat-sort-header="startdate">{{'PROJECT-LISTING.COLUMNS.START' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.startDate | date:'shortDate'}} </mat-cell>
</ng-container>
<!-- Column Definition: Start -->
<ng-container cdkColumnDef="start">
<mat-header-cell *matHeaderCellDef mat-sort-header="startdate">{{'PROJECT-LISTING.COLUMNS.START' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.startDate | date:'shortDate'}} </mat-cell>
</ng-container>
<!-- Column Definition: End -->
<ng-container cdkColumnDef="end">
<mat-header-cell *matHeaderCellDef mat-sort-header="enddate">{{'PROJECT-LISTING.COLUMNS.END' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.endDate | date:'shortDate'}} </mat-cell>
</ng-container>
<!-- Column Definition: End -->
<ng-container cdkColumnDef="end">
<mat-header-cell *matHeaderCellDef mat-sort-header="enddate">{{'PROJECT-LISTING.COLUMNS.END' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.endDate | date:'shortDate'}} </mat-cell>
</ng-container>
<!-- Column Definition: End -->
<ng-container cdkColumnDef="dmps">
<mat-header-cell *matHeaderCellDef mat-sort-header="dmps">{{'PROJECT-LISTING.COLUMNS.DMPS' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row" (click)="$event.stopPropagation()">
<app-url-listing [items]="row.dmps" [urlLimit]="5"></app-url-listing>
</mat-cell>
</ng-container>
<!-- Column Definition: End -->
<ng-container cdkColumnDef="dmps">
<mat-header-cell *matHeaderCellDef mat-sort-header="dmps">{{'PROJECT-LISTING.COLUMNS.DMPS' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row" (click)="$event.stopPropagation()">
<app-url-listing [items]="row.dmps" [urlLimit]="5" [parameters]="{ projectLabel: row.label }"></app-url-listing>
</mat-cell>
</ng-container>
<!-- Column Definition: Submission Time -->
<!-- <ng-container cdkColumnDef="actions">
<!-- Column Definition: Submission Time -->
<!-- <ng-container cdkColumnDef="actions">
<mat-header-cell *matHeaderCellDef>{{'PROJECT-LISTING.COLUMNS.ACTIONS' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"></mat-cell>
</ng-container> -->
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns" (click)="rowClick(row.id)"></mat-row>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns" (click)="rowClick(row.id)"></mat-row>
</mat-table>
<mat-paginator #paginator [length]="dataSource?.totalCount" [pageSizeOptions]="[10, 25, 100]">
</mat-paginator>
</mat-card>
</mat-table>
<mat-paginator #paginator [length]="dataSource?.totalCount" [pageSizeOptions]="[10, 25, 100]">
</mat-paginator>
</mat-card>
<button mat-fab class="mat-fab-bottom-right" color="primary" [routerLink]=" ['./new'] ">
<mat-icon class="mat-24">add</mat-icon>
</button>
</div>
<button mat-fab class="mat-fab-bottom-right" color="primary" [routerLink]=" ['./new'] ">
<mat-icon class="mat-24">add</mat-icon>
</button>
</div>

@ -9,48 +9,47 @@ import { CachedContentItem } from './CachedContentItem';
import { HostConfiguration } from '../../app.constants';
@Injectable()
export class HelpContentService {
private _helpServiceUrl = HostConfiguration.HelpServiceUrl;
cache = new Map<String, CachedContentItem>();
private _helpServiceUrl = HostConfiguration.HelpServiceUrl;
cache = new Map<String, CachedContentItem>();
constructor(private http: Http) {
}
constructor(private http: Http) {
}
getActivePageContent(route: string) {
if (!this.cache.get(route) || !this.isValidCachedItem(route)) {
return this.http.get(this._helpServiceUrl + "/page/route?q=" + route)
.map(res => {
this.cache.set(route, { timestamp: Date.now(), content: <PageHelpContent>res.json() })
return res.json();
})
.catch(this.handleError)
}
return Observable.create(observer => observer.next(this.cache.get(route).content));
}
private extractData(res: Response) {
let body = res.json();
return body.data || {};
getActivePageContent(route: string) {
if (!this.cache.get(route) || !this.isValidCachedItem(route)) {
return this.http.get(this._helpServiceUrl + "/page/route?q=" + route)
.map(res => {
this.cache.set(route, { timestamp: Date.now(), content: <PageHelpContent>res.json() })
return res.json();
})
.catch(this.handleError)
}
private handleError(error: Response | any) {
// In a real world app, we might use a remote logging infrastructure
// We'd also dig deeper into the error to get a better message
let errMsg = "";
console.log(error);
if (error instanceof Response) {
const body = error.text() || '';
//const err = body.error || JSON.stringify(body);
errMsg = `${error.status} - ${error.statusText || ''} ${body}`;
} else {
errMsg = (error.message) ? error.message :
error.status ? `${error.status} - ${error.statusText}` : 'Server error';
console.error(errMsg); // log to console instead
}
return Observable.throw(errMsg);
return Observable.create(observer => observer.next(this.cache.get(route).content));
}
private extractData(res: Response) {
let body = res.json();
return body.data || {};
}
private handleError(error: Response | any) {
// In a real world app, we might use a remote logging infrastructure
// We'd also dig deeper into the error to get a better message
let errMsg = "";
if (error instanceof Response) {
const body = error.text() || '';
//const err = body.error || JSON.stringify(body);
errMsg = `${error.status} - ${error.statusText || ''} ${body}`;
} else {
errMsg = (error.message) ? error.message :
error.status ? `${error.status} - ${error.statusText}` : 'Server error';
console.error(errMsg); // log to console instead
}
return Observable.throw(errMsg);
}
isValidCachedItem(route) {
let cachedTimestamp = this.cache.get(route).timestamp;
let currentTimestamp = Date.now();
if (currentTimestamp - cachedTimestamp > HostConfiguration.CacheLifeTimeMillis) return false;
else return true;
}
}
isValidCachedItem(route) {
let cachedTimestamp = this.cache.get(route).timestamp;
let currentTimestamp = Date.now();
if (currentTimestamp - cachedTimestamp > HostConfiguration.CacheLifeTimeMillis) return false;
else return true;
}
}

@ -36,7 +36,6 @@ export class AvailableProfilesComponent implements OnInit {
}
addProfiles(profiles) {
console.log(profiles)
// profiles.selectedOptions.forEach(element => {
// selectedProfiles.push(element.value)
// });

@ -7,7 +7,6 @@ import { BackendErrorValidator } from '../../../../utilities/validators/BackendE
import { DataManagementPlanCriteria } from '../../../../models/criteria/data-management-plan/DataManagementPlanCriteria';
import { DataManagementPlanCriteriaErrorModel } from '../../../../models/criteria/data-management-plan/DataManagementPlanCriteriaErrorModel';
import { ProjectModel } from '../../../../models/projects/ProjectModel';
import { ProjectService } from '../../../../services/project/project.service';
import { ProjectCriteria } from '../../../../models/criteria/project/ProjectCriteria';
import { RequestItem } from '../../../../models/criteria/RequestItem';
import { create } from 'domain';
@ -30,8 +29,7 @@ export class DataManagementPlanProfileCriteriaComponent extends BaseCriteriaComp
constructor(
public language: TranslateService,
public projectService: ProjectService,
public formBuilder: FormBuilder
public formBuilder: FormBuilder
) {
super(new DataManagementPlanProfileCriteriaErrorModel());
}

@ -9,75 +9,74 @@ import { Principal } from '../../../../models/login/Principal';
import { FormBuilder, FormGroup } from '@angular/forms';
@Component({
selector: 'users-criteria-component',
templateUrl: './users-criteria.component.html',
styleUrls: ['./users-criteria.component.scss'],
selector: 'users-criteria-component',
templateUrl: './users-criteria.component.html',
styleUrls: ['./users-criteria.component.scss'],
})
export class UsersCriteriaComponent extends BaseCriteriaComponent implements OnInit {
public role: Principal.AppRole;
public criteria: UserCriteria = new UserCriteria();
public role: Principal.AppRole;
public criteria: UserCriteria = new UserCriteria();
constructor(
public language: TranslateService,
public errorModel: UserCriteriaErrorModel,
public formBuilder: FormBuilder
) {
super(errorModel);
}
constructor(
public language: TranslateService,
public formBuilder: FormBuilder
) {
super(new UserCriteriaErrorModel());
}
ngOnInit() {
super.ngOnInit();
if (this.criteria == null) { this.criteria = new UserCriteria(); }
if (this.formGroup == null) { this.formGroup = this.buildForm(); }
}
ngOnInit() {
super.ngOnInit();
if (this.criteria == null) { this.criteria = new UserCriteria(); }
if (this.formGroup == null) { this.formGroup = this.buildForm(); }
}
setCriteria(criteria: UserCriteria): void {
this.criteria = criteria;
this.formGroup = this.buildForm();
}
setCriteria(criteria: UserCriteria): void {
this.criteria = criteria;
this.formGroup = this.buildForm();
}
public fromJSONObject(item: any): UserCriteria {
this.criteria = new UserCriteria();
this.criteria.label = item.Label;
this.criteria.appRoles = item.appRoles;
return this.criteria;
}
public fromJSONObject(item: any): UserCriteria {
this.criteria = new UserCriteria();
this.criteria.label = item.Label;
this.criteria.appRoles = item.appRoles;
return this.criteria;
}
buildForm(): FormGroup {
const context: ValidationContext = this.createValidationContext();
buildForm(): FormGroup {
const context: ValidationContext = this.createValidationContext();
return this.formBuilder.group({
like: [this.criteria.label, context.getValidation('label').validators],
appRoles: [this.criteria.appRoles, context.getValidation('appRoles').validators],
});
}
return this.formBuilder.group({
like: [this.criteria.label, context.getValidation('label').validators],
appRoles: [this.criteria.appRoles, context.getValidation('appRoles').validators],
});
}
createValidationContext(): ValidationContext {
const validationContext: ValidationContext = new ValidationContext();
const validationArray: Validation[] = new Array<Validation>();
createValidationContext(): ValidationContext {
const validationContext: ValidationContext = new ValidationContext();
const validationArray: Validation[] = new Array<Validation>();
validationArray.push({ key: 'label' });
validationArray.push({ key: 'appRoles' });
validationArray.push({ key: 'label' });
validationArray.push({ key: 'appRoles' });
validationContext.validation = validationArray;
return validationContext;
}
validationContext.validation = validationArray;
return validationContext;
}
getPrincipalAppRoleValues(): Number[] {
let keys: string[] = Object.keys(Principal.AppRole);
keys = keys.slice(0, keys.length / 2);
const values: Number[] = keys.map(Number);
return values;
}
getPrincipalAppRoleValues(): Number[] {
let keys: string[] = Object.keys(Principal.AppRole);
keys = keys.slice(0, keys.length / 2);
const values: Number[] = keys.map(Number);
return values;
}
getPrincipalAppRoleWithLanguage(role: Principal.AppRole): string {
let result = '';
this.language.get(new Utilities().convertFromPrincipalAppRole(role)).subscribe((value: string) => {
result = value;
});
return result;
}
getPrincipalAppRoleWithLanguage(role: Principal.AppRole): string {
let result = '';
this.language.get(new Utilities().convertFromPrincipalAppRole(role)).subscribe((value: string) => {
result = value;
});
return result;
}
}

@ -12,8 +12,8 @@
[placeholder]="placeholder" (onItemChange)="this.onItemChangeFunc($event)" [formCtrl]="formControl" [disabled]="disabled">
</app-external-item>
</div>
<div fxLayout="row" *ngFor="let suggestion of formGroup.controls">
<ng-container *ngTemplateOutlet="parentTemplate; context: { $implicit: suggestion }">
<div fxLayout="row" *ngFor="let suggestion of formGroup.controls; let i = index">
<ng-container *ngTemplateOutlet="parentTemplate; context: { $implicit: suggestion, index: i,function: this.deleteItem.bind(this) }">
</ng-container>
</div>
</div>

@ -1,6 +1,6 @@
import { Component, OnInit, Input, ContentChild, TemplateRef, ViewChild, Output, EventEmitter } from "@angular/core";
import { AutoCompleteConfiguration } from "../../autocomplete/AutoCompleteConfiguration";
import { FormGroup, FormControl } from "@angular/forms";
import { FormGroup, FormControl, FormArray, AbstractControl } from "@angular/forms";
import { ExternalSourcesUrlModel } from "../../../../models/external-sources/ExternalSourcesUrlModel";
@Component({
@ -13,7 +13,7 @@ export class ExternalItemListingComponent implements OnInit {
public placeholder: string;
@Input()
public formGroup: FormGroup;
public formGroup: AbstractControl;
@Input()
public autoCompleteConfiguration: AutoCompleteConfiguration;
@ -39,6 +39,7 @@ export class ExternalItemListingComponent implements OnInit {
public choice: string;
public formControl = new FormControl();
ngOnInit() {
if (this.disabled) this.formControl.disable();
}
@ -51,5 +52,9 @@ export class ExternalItemListingComponent implements OnInit {
if (this.formControl.disabled) this.formControl.enable();
this.autoCompleteConfiguration.requestItem.criteria["type"] = event.value;
}
deleteItem(name: number) {
(<FormArray>this.formGroup).removeAt(name)
}
}

@ -35,7 +35,6 @@ export class ExternalItemComponent implements OnInit {
public formCtrl: FormControl;
ngOnInit() {
//this.formCtrl.valueChanges.subscribe(x => console.log(x));
}
onItemChangeFunc(event) {

@ -3,55 +3,54 @@ import { FileUploader } from "../../../shared/components/file-uploader/FileUploa
import { FormControl } from "@angular/forms";
@Component({
selector: 'app-fileuploader-component',
templateUrl: './file-uploader.component.html'
selector: 'app-fileuploader-component',
templateUrl: './file-uploader.component.html'
})
export class FileUploaderComponent implements OnInit {
files: File | FileList;
disabled: boolean = false;
files: File | FileList;
disabled: boolean = false;
fileSelectMultipleMsg: string = 'No file(s) selected yet.';
fileSelectMultipleMsg: string = 'No file(s) selected yet.';
@Input()
public label: string = 'FILE-UPLOADER.DEFAULT';
@Input()
public label: string = 'FILE-UPLOADER.DEFAULT';
@Input()
public fileUploader: FileUploader;
@Input()
public fileUploader: FileUploader;
@Input()
form: FormControl;
@Input()
form: FormControl;
ngOnInit(): void {
console.log(this.form)
}
ngOnInit(): void {
}
selectEvent(files: FileList | File): void {
this.label = 'FILE-UPLOADER.UPLOAD'
if (files instanceof FileList) {
let names: string[] = [];
for (let i: number = 0; i < files.length; i++) {
names.push(files[i].name);
}
this.fileSelectMultipleMsg = names.join(',');
} else {
this.fileSelectMultipleMsg = files.name;
}
selectEvent(files: FileList | File): void {
this.label = 'FILE-UPLOADER.UPLOAD'
if (files instanceof FileList) {
let names: string[] = [];
for (let i: number = 0; i < files.length; i++) {
names.push(files[i].name);
}
this.fileSelectMultipleMsg = names.join(',');
} else {
this.fileSelectMultipleMsg = files.name;
}
}
uploadEvent(files: FileList | File): void {
let formdata: FormData = new FormData();
if (files instanceof FileList) {
for (let i: number = 0; i < files.length; i++) {
formdata.append('file', files[i]);
}
} else {
formdata.append('file', files);
}
this.fileUploader.uploadFile(formdata).subscribe(files => this.form.patchValue(files));
}
uploadEvent(files: FileList | File): void {
let formdata: FormData = new FormData();
cancelEvent(): void {
if (files instanceof FileList) {
for (let i: number = 0; i < files.length; i++) {
formdata.append('file', files[i]);
}
} else {
formdata.append('file', files);
}
}
this.fileUploader.uploadFile(formdata).subscribe(files => this.form.patchValue(files));
}
cancelEvent(): void {
}
}

@ -1,27 +1,30 @@
import { Component, Input } from "@angular/core";
import { UrlListingItem } from "../../../shared/components/url-listing/UrlListingItem";
import { Router } from "@angular/router";
import { UrlUtilities } from "../../../utilities/UrlUtilities";
@Component({
selector: 'app-url-listing',
templateUrl: './url-listing.component.html'
selector: 'app-url-listing',
templateUrl: './url-listing.component.html'
})
export class UrlListingComponent {
@Input()
items: UrlListingItem[];
@Input()
items: UrlListingItem[];
@Input()
urlLimit: number = 3;
@Input()
parameters: any
constructor(private router: Router) { }
@Input()
urlLimit: number = 3;
ngOnInit() {
constructor(private router: Router, private urlUtilities: UrlUtilities) { }
console.log(this.items.length > this.urlLimit)
}
ngOnInit() {
navigate(link: string) {
this.router.navigateByUrl(link);
}
}
}
navigate(link: string) {
this.router.navigate([link, this.parameters]);
}
}

@ -6,7 +6,6 @@ import { AuthService } from '../../services/auth/auth.service';
export class AuthGuard implements CanActivate {
constructor(private auth: AuthService, private router: Router) {
console.log(auth);
}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
let url: string = state.url;

@ -21,11 +21,10 @@ export class UserRoleEditorComponent implements OnInit {
@Input() public item: UserListingModel;
private formGroup: FormGroup = null;
private nowEditing = false;
private errorModel: UserErrorModel;
constructor(
private language: TranslateService,
private userService: UserReferenceService,
private errorModel: UserErrorModel,
private formBuilder: FormBuilder,
private snackBar: MatSnackBar
) {

@ -0,0 +1,17 @@
import { Injectable } from "@angular/core";
@Injectable()
export class UrlUtilities {
public applyUrlTemplate(url: string, params: any): string {
let paramsToString = "";
if (params) paramsToString = "?"
let keys = Object.keys(params);
keys.forEach(x => {
if (keys.indexOf(x) > 0) paramsToString += "&"
paramsToString += x + "=" + params[x];
})
return url + paramsToString;
}
}

@ -1,6 +1,6 @@
export const environment = {
production: true,
Server: 'http://dl043.madgik.di.uoa.gr:8080/api/',
App: 'http://dl043.madgik.di.uoa.gr:8080/',
Server: 'http://dl043.madgik.di.uoa.gr/api/',
App: 'http://dl043.madgik.di.uoa.gr/',
HelpServiceUrl: 'http://dl043.madgik.di.uoa.gr:5555/'
};

Loading…
Cancel
Save