no message

This commit is contained in:
Ioannis Kalyvas 2018-09-18 15:41:24 +03:00
parent 8c7d505178
commit a5160738eb
36 changed files with 256 additions and 177 deletions

View File

@ -29,7 +29,7 @@ public class DMPDaoImpl extends DatabaseAccess<DMP> implements DMPDao {
public QueryableList<DMP> getWithCriteria(DataManagementPlanCriteria criteria) { public QueryableList<DMP> getWithCriteria(DataManagementPlanCriteria criteria) {
QueryableList<DMP> query = getDatabaseService().getQueryable(DMP.getHints(), DMP.class); QueryableList<DMP> query = getDatabaseService().getQueryable(DMP.getHints(), DMP.class);
if (criteria.getLike() != null && !criteria.getLike().isEmpty()) if (criteria.getLike() != null && !criteria.getLike().isEmpty())
query.where((builder, root) -> builder.like(root.get("label"), "%" + criteria.getLike() + "%")); query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"));
if (criteria.getPeriodEnd() != null) if (criteria.getPeriodEnd() != null)
query.where((builder, root) -> builder.lessThan(root.get("created"), criteria.getPeriodEnd())); query.where((builder, root) -> builder.lessThan(root.get("created"), criteria.getPeriodEnd()));
if (criteria.getPeriodStart() != null) if (criteria.getPeriodStart() != null)

View File

@ -19,9 +19,9 @@ public abstract class AbstractBatchLogger {
private Map<String, Object> concurrentHashMap = new ConcurrentHashMap<String, Object>(); private Map<String, Object> concurrentHashMap = new ConcurrentHashMap<String, Object>();
public AbstractBatchLogger(Environment environment) { public AbstractBatchLogger(Environment environment) {
ScheduledExecutorService executor = Executors.newScheduledThreadPool(1); //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); //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 abstract LoggingOutputType logOutputType();

View File

@ -6,6 +6,7 @@ import eu.eudat.models.data.helpers.responses.ResponseItem;
import eu.eudat.models.data.security.Principal; import eu.eudat.models.data.security.Principal;
import eu.eudat.types.ApiMessageCode; import eu.eudat.types.ApiMessageCode;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.ResponseStatus;
import types.LoggingType; import types.LoggingType;
import javax.annotation.Priority;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -20,6 +22,7 @@ import java.util.Map;
* Created by ikalyvas on 6/12/2018. * Created by ikalyvas on 6/12/2018.
*/ */
@ControllerAdvice @ControllerAdvice
@Priority(5)
public class ControllerErrorHandler { public class ControllerErrorHandler {
private Logger logger; private Logger logger;
@ -29,7 +32,7 @@ public class ControllerErrorHandler {
this.logger = logger; this.logger = logger;
} }
@ExceptionHandler(NullPointerException.class) @ExceptionHandler(Exception.class)
@ResponseStatus(HttpStatus.BAD_REQUEST) @ResponseStatus(HttpStatus.BAD_REQUEST)
@ResponseBody @ResponseBody
public ResponseItem<Exception> processValidationError(Principal principal, Exception ex) throws Exception { public ResponseItem<Exception> processValidationError(Principal principal, Exception ex) throws Exception {
@ -41,6 +44,7 @@ public class ControllerErrorHandler {
apiExceptionLoggingModel.setData(exceptionMap); apiExceptionLoggingModel.setData(exceptionMap);
apiExceptionLoggingModel.setMessage(ex.getMessage()); apiExceptionLoggingModel.setMessage(ex.getMessage());
apiExceptionLoggingModel.setType(LoggingType.ERROR); apiExceptionLoggingModel.setType(LoggingType.ERROR);
ex.printStackTrace();
this.logger.error(apiExceptionLoggingModel); this.logger.error(apiExceptionLoggingModel);
return new ResponseItem<Exception>().message(ex.getMessage()).status(ApiMessageCode.DEFAULT_ERROR_MESSAGE); return new ResponseItem<Exception>().message(ex.getMessage()).status(ApiMessageCode.DEFAULT_ERROR_MESSAGE);
} }

View File

@ -3,16 +3,20 @@ package eu.eudat.controllers.controllerhandler;
import eu.eudat.core.logger.Logger; import eu.eudat.core.logger.Logger;
import eu.eudat.exceptions.security.UnauthorisedException; import eu.eudat.exceptions.security.UnauthorisedException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.ResponseStatus;
import javax.annotation.Priority;
/** /**
* Created by ikalyvas on 6/12/2018. * Created by ikalyvas on 6/12/2018.
*/ */
@ControllerAdvice @ControllerAdvice
@Priority(4)
public class ControllerUnauthorisedHandler { public class ControllerUnauthorisedHandler {
private Logger logger; private Logger logger;

View File

@ -6,6 +6,7 @@ import eu.eudat.types.ApiMessageCode;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource; import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError; import org.springframework.validation.FieldError;
@ -20,6 +21,7 @@ import java.util.Locale;
@ControllerAdvice @ControllerAdvice
@Order(3)
public class ControllerValidatorErrorHandler { public class ControllerValidatorErrorHandler {
private MessageSource messageSource; private MessageSource messageSource;

View File

@ -102,21 +102,21 @@ public class DashBoardManager {
List<SearchBarItem> searchBarItems = new LinkedList<>(); List<SearchBarItem> searchBarItems = new LinkedList<>();
CompletableFuture<List<SearchBarItem>> dmps = dataManagementPlanRepository.getAuthenticated(dataManagementPlanRepository.asQueryable(), user) CompletableFuture<List<SearchBarItem>> dmps = dataManagementPlanRepository.getAuthenticated(dataManagementPlanRepository.asQueryable(), user)
.withHint("dmpRecentActivity") .withHint("dmpRecentActivity")
.where((builder, root) -> builder.like(root.get("label"), "%" + like + "%")) .where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + like.toUpperCase() + "%"))
.orderBy((builder, root) -> builder.desc(root.get("modified"))) .orderBy((builder, root) -> builder.desc(root.get("modified")))
.selectAsync(item -> new SearchBarItem(item.getId().toString(), item.getLabel(), SearchBarItemType.DMP.getValue())) .selectAsync(item -> new SearchBarItem(item.getId().toString(), item.getLabel(), SearchBarItemType.DMP.getValue()))
.whenComplete((dmpItems, throwable) -> searchBarItems.addAll(dmpItems)); .whenComplete((dmpItems, throwable) -> searchBarItems.addAll(dmpItems));
CompletableFuture<List<SearchBarItem>> datasets = datasetRepository.getAuthenticated(datasetRepository.asQueryable(), user) CompletableFuture<List<SearchBarItem>> datasets = datasetRepository.getAuthenticated(datasetRepository.asQueryable(), user)
.withHint("datasetRecentActivity") .withHint("datasetRecentActivity")
.where((builder, root) -> builder.like(root.get("label"), "%" + like + "%")) .where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + like.toUpperCase() + "%"))
.orderBy((builder, root) -> builder.desc(root.get("modified"))) .orderBy((builder, root) -> builder.desc(root.get("modified")))
.selectAsync(item -> new SearchBarItem(item.getId().toString(), item.getLabel(), SearchBarItemType.DATASET.getValue())) .selectAsync(item -> new SearchBarItem(item.getId().toString(), item.getLabel(), SearchBarItemType.DATASET.getValue()))
.whenComplete((dataSetItems, throwable) -> searchBarItems.addAll(dataSetItems)); .whenComplete((dataSetItems, throwable) -> searchBarItems.addAll(dataSetItems));
CompletableFuture<List<SearchBarItem>> projects = projectRepository.getAuthenticated(projectRepository.asQueryable(), user) CompletableFuture<List<SearchBarItem>> projects = projectRepository.getAuthenticated(projectRepository.asQueryable(), user)
.withHint("projectRecentActivity") .withHint("projectRecentActivity")
.where((builder, root) -> builder.like(root.get("label"), "%" + like + "%")) .where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + like.toUpperCase() + "%"))
.orderBy((builder, root) -> builder.desc(root.get("modified"))) .orderBy((builder, root) -> builder.desc(root.get("modified")))
.selectAsync(item -> new SearchBarItem(item.getId().toString(), item.getLabel(), SearchBarItemType.PROJECT.getValue())) .selectAsync(item -> new SearchBarItem(item.getId().toString(), item.getLabel(), SearchBarItemType.PROJECT.getValue()))
.whenComplete((projectItems, throwable) -> searchBarItems.addAll(projectItems)); .whenComplete((projectItems, throwable) -> searchBarItems.addAll(projectItems));

View File

@ -254,7 +254,7 @@ public class DatasetManager {
datasetDataRepository.setDataset(dataset); datasetDataRepository.setDataset(dataset);
dataset.getDatasetDataRepositories().add(datasetDataRepository); dataset.getDatasetDataRepositories().add(datasetDataRepository);
} else { } else {
datasetDataRepository.getDataRepository().setId(UUID.randomUUID()); //datasetDataRepository.getDataRepository().setId(UUID.randomUUID());
DataRepository dataRepository = dataRepositoryDao.createOrUpdate(datasetDataRepository.getDataRepository()); DataRepository dataRepository = dataRepositoryDao.createOrUpdate(datasetDataRepository.getDataRepository());
datasetDataRepository.setDataRepository(dataRepository); datasetDataRepository.setDataRepository(dataRepository);
dataset.getDatasetDataRepositories().add(datasetDataRepository); dataset.getDatasetDataRepositories().add(datasetDataRepository);

View File

@ -15,7 +15,9 @@ public class ProjectModelValidator extends FluentValidator<Project> {
ruleFor(x -> x.getType()).compareAs((x -> eu.eudat.data.entities.Project.ProjectType.EXTERNAL.getValue()), (leftItem, rightItem) -> leftItem == rightItem) ruleFor(x -> x.getType()).compareAs((x -> eu.eudat.data.entities.Project.ProjectType.EXTERNAL.getValue()), (leftItem, rightItem) -> leftItem == rightItem)
.withName("type").withMessage("project.external.edit"); .withName("type").withMessage("project.external.edit");
ruleFor(x -> x.getStartDate()).compareAs((x -> x.getEndDate()), (leftItem, rightItem) -> leftItem.after(rightItem)) ruleFor(x -> x.getStartDate()).compareAs((x -> x.getEndDate()), (leftItem, rightItem) -> leftItem.after(rightItem))
.withName("startDate").withMessage("project.startDate.overlapping"); .withName("startDate").withMessage("project.startDate.overlapping")
.ruleIf(x -> x.getStartDate() != null && x.getEndDate() != null);
} }
@Override @Override

View File

@ -41,11 +41,11 @@ google.login.clientId=524432312250-sc9qsmtmbvlv05r44onl6l93ia3k9deo.apps.googleu
########################LINKEDIN LOGIN Properties#############################HiR4hQH9HNubKC5iKQy0l4mAZ ########################LINKEDIN LOGIN Properties#############################HiR4hQH9HNubKC5iKQy0l4mAZ
linkedin.login.clientId=86bl8vfk77clh9 linkedin.login.clientId=86bl8vfk77clh9
linkedin.login.clientSecret=2OCO9e3wKylW05Tt linkedin.login.clientSecret=2OCO9e3wKylW05Tt
linkedin.login.redirect_uri=http://localhost:4200/login/linkedin linkedin.login.redirect_uri=http://opendmp.eu/login/linkedin
########################LINKEDIN LOGIN Properties############################# ########################LINKEDIN LOGIN Properties#############################
twitter.login.clientId=HiR4hQH9HNubKC5iKQy0l4mAZ twitter.login.clientId=HiR4hQH9HNubKC5iKQy0l4mAZ
twitter.login.clientSecret=9KZHgkqUO2QFnELSL14jeUvfUacWX23rqD8OW8X0xoRDXOSfKH twitter.login.clientSecret=9KZHgkqUO2QFnELSL14jeUvfUacWX23rqD8OW8X0xoRDXOSfKH
twitter.login.redirect_uri=http://dl043.madgik.di.uoa.gr/login/twitter twitter.login.redirect_uri=http://opendmp.eu/login/twitter
########################Persistence/Hibernate/Batch############################## ########################Persistence/Hibernate/Batch##############################
spring.profiles.active=devel spring.profiles.active=devel
########################Persistence/Hibernate/Connection pool#################### ########################Persistence/Hibernate/Connection pool####################
@ -55,7 +55,7 @@ autouser.root.username=root
################################################################################# #################################################################################
b2access.externallogin.user_info_url=https://b2access-integration.fz-juelich.de:443/oauth2/userinfo b2access.externallogin.user_info_url=https://b2access-integration.fz-juelich.de:443/oauth2/userinfo
b2access.externallogin.access_token_url=https://b2access-integration.fz-juelich.de:443/oauth2/token b2access.externallogin.access_token_url=https://b2access-integration.fz-juelich.de:443/oauth2/token
b2access.externallogin.redirect_uri=http://dl043.madgik.di.uoa.gr/api/oauth/authorized/b2access b2access.externallogin.redirect_uri=http://opendmp.eu/api/oauth/authorized/b2access
b2access.externallogin.clientid=eudatdmptool b2access.externallogin.clientid=eudatdmptool
b2access.externallogin.clientSecret=A3b*1*92 b2access.externallogin.clientSecret=A3b*1*92
################################################################################# #################################################################################

View File

@ -90,7 +90,7 @@ import { CultureService } from './utilities/culture/culture-service';
clientId: 'eudatdmptool', clientId: 'eudatdmptool',
clientSecret: 'A3b*1*92', clientSecret: 'A3b*1*92',
oauthUrl: 'https://b2access-integration.fz-juelich.de:443/oauth2-as/oauth2-authz', oauthUrl: 'https://b2access-integration.fz-juelich.de:443/oauth2-as/oauth2-authz',
redirectUri: 'http://dl043.madgik.di.uoa.gr/api/oauth/authorized/b2access', redirectUri: 'http://opendmp.eu/api/oauth/authorized/b2access',
accessTokenUri: 'https://b2access-integration.fz-juelich.de:443/oauth2/token' accessTokenUri: 'https://b2access-integration.fz-juelich.de:443/oauth2/token'
} }
}), }),

View File

@ -1,5 +1,5 @@
<div> <div>
<h3>{{'DATASET-LISTING.TITLE' | translate}} {{titlePrefix}}</h3> <h3>{{'DATASET-PUBLIC-LISTING.TITLE' | translate}} {{titlePrefix}}</h3>
<app-datasets-criteria-component [isPublic]='true'></app-datasets-criteria-component> <app-datasets-criteria-component [isPublic]='true'></app-datasets-criteria-component>

View File

@ -1,6 +1,12 @@
<div class="dataset-wizard"> <div class="dataset-wizard">
<h3 *ngIf="isNew">New Dataset</h3> <h3 *ngIf="isNew">New Dataset</h3>
<h3 *ngIf="!isNew">{{datasetWizardModel?.label}} Dataset</h3> <div class="flex-container">
<div fxLayout="row">
<h3 *ngIf="!isNew">{{datasetWizardModel?.label}} {{ 'GENERAL.NAMES.DATASET' | translate }}</h3>
<h3 *ngIf="this.formGroup && this.formGroup.dirty"> - {{ 'GENERAL.STATUSES.EDIT' | translate }}</h3>
<h3 *ngIf="this.formGroup && viewOnly"> - {{ 'GENERAL.STATUSES.FINALISED' | translate }}</h3>
</div>
</div>
<div class="flex-container"> <div class="flex-container">
<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;"
@ -39,7 +45,6 @@
<button matStepperNext mat-raised-button style="float:right;" color="primary">{{'DATASET-WIZARD.ACTIONS.NEXT' | <button matStepperNext mat-raised-button style="float:right;" color="primary">{{'DATASET-WIZARD.ACTIONS.NEXT' |
translate}} translate}}
</button> </button>
</div> </div>
</form> </form>
</mat-step> </mat-step>
@ -49,7 +54,7 @@
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>
<mat-card-title class="thick"> <mat-card-title class="thick" *ngIf='!viewOnly'>
{{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES' | translate}} {{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES' | translate}}
<button mat-raised-button color="primary" (click)="addDataRepository()"> <button mat-raised-button color="primary" (click)="addDataRepository()">
{{'DATASET-EDITOR.FIELDS.CREATE'|translate}} {{'DATASET-EDITOR.FIELDS.CREATE'|translate}}
@ -64,17 +69,17 @@
</app-external-item-listing> </app-external-item-listing>
<ng-template #dataRepositoriesTemplate let-suggestion let-i="index" let-callback="function"> <ng-template #dataRepositoriesTemplate let-suggestion let-i="index" let-callback="function">
<div> <div class="col-md-2">
<p> <p>
{{i+1}}) {{suggestion.get('label').value}} {{i+1}}) {{suggestion.get('label').value}}
</p> </p>
</div> </div>
<div> <div class="col-md-8">
<mat-form-field> <mat-form-field>
<input matInput placeholder="{{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES-INFO' | translate}}" type="text" name="info" [formControl]="suggestion.get('info')"> <input matInput placeholder="{{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES-INFO' | translate}}" type="text" name="info" [formControl]="suggestion.get('info')">
</mat-form-field> </mat-form-field>
</div> </div>
<div> <div class="col-md-2">
<button mat-button (click)="callback(i)"> <button mat-button (click)="callback(i)">
<mat-icon>close</mat-icon> <mat-icon>close</mat-icon>
</button> </button>
@ -83,7 +88,7 @@
</mat-card> </mat-card>
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>
<mat-card-title class="thick"> <mat-card-title class="thick" *ngIf='!viewOnly'>
{{'DATASET-EDITOR.FIELDS.EXTERNAL-DATASETS' | translate}} {{'DATASET-EDITOR.FIELDS.EXTERNAL-DATASETS' | translate}}
<button mat-raised-button color="primary" (click)="addExternalDataset()"> <button mat-raised-button color="primary" (click)="addExternalDataset()">
{{'DATASET-EDITOR.FIELDS.CREATE'|translate}} {{'DATASET-EDITOR.FIELDS.CREATE'|translate}}
@ -98,18 +103,18 @@
</app-external-item-listing> </app-external-item-listing>
<ng-template #externalDatasetsTemplate let-suggestion let-i="index" let-callback="function"> <ng-template #externalDatasetsTemplate let-suggestion let-i="index" let-callback="function">
<div> <div class="col-md-2">
<p> <p>
{{i+1}}) {{suggestion.get('label').value}} {{i+1}}) {{suggestion.get('label').value}}
</p> </p>
</div> </div>
<div> <div class="col-md-4">
<mat-form-field> <mat-form-field>
<input matInput placeholder="{{'DATASET-EDITOR.FIELDS.EXTERNAL-DATASET-INFO' | translate}}" type="text" name="info" [formControl]="suggestion.get('info')"> <input matInput placeholder="{{'DATASET-EDITOR.FIELDS.EXTERNAL-DATASET-INFO' | translate}}" type="text" name="info" [formControl]="suggestion.get('info')">
</mat-form-field> </mat-form-field>
</div> </div>
<div> <div class="col-md-4">
<mat-form-field> <mat-form-field>
<mat-select placeholder="{{'DATASET-WIZARD.EDITOR.FIELDS.EXTERNAL-DATASET-TYPE' | translate}}" [formControl]="suggestion.get('type')"> <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]="0">{{'TYPES.EXTERNAL-DATASET-TYPE.SOURCE' | translate}}</mat-option>
@ -117,7 +122,7 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</div> </div>
<div> <div class="col-md-2">
<button mat-button (click)="callback(i)"> <button mat-button (click)="callback(i)">
<mat-icon>close</mat-icon> <mat-icon>close</mat-icon>
</button> </button>
@ -127,7 +132,7 @@
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>
<mat-card-title class="thick"> <mat-card-title class="thick" *ngIf='!viewOnly'>
{{'DATASET-EDITOR.FIELDS.REGISTRIES' | translate}} {{'DATASET-EDITOR.FIELDS.REGISTRIES' | translate}}
<button mat-raised-button color="primary" (click)="addRegistry()"> <button mat-raised-button color="primary" (click)="addRegistry()">
{{'DATASET-EDITOR.FIELDS.CREATE'|translate}} {{'DATASET-EDITOR.FIELDS.CREATE'|translate}}
@ -138,16 +143,15 @@
placeholder="{{'DATASET-EDITOR.FIELDS.REGISTRIES' | translate}}" [parentTemplate]='registriesTemplate' [displayFunction]='registriesDisplayFunc' placeholder="{{'DATASET-EDITOR.FIELDS.REGISTRIES' | translate}}" [parentTemplate]='registriesTemplate' [displayFunction]='registriesDisplayFunc'
[formGroup]="formGroup.get('registries')" [viewOnly]='viewOnly' [subtitleFunction]='dataRepositoryDisplaySubtitleFunc' [formGroup]="formGroup.get('registries')" [viewOnly]='viewOnly' [subtitleFunction]='dataRepositoryDisplaySubtitleFunc'
[autoCompleteConfiguration]="registriesAutoCompleteConfiguration" (onItemChange)="registriesOnItemChange($event)"> [autoCompleteConfiguration]="registriesAutoCompleteConfiguration" (onItemChange)="registriesOnItemChange($event)">
</app-external-item-listing> </app-external-item-listing>
<ng-template #registriesTemplate let-suggestion let-i="index" let-callback="function"> <ng-template #registriesTemplate let-suggestion let-i="index" let-callback="function">
<div> <div class="col-md-2">
<p> <p>
{{i+1}}) {{suggestion.get('label').value}} {{i+1}}) {{suggestion.get('label').value}}
</p> </p>
</div> </div>
<div> <div class="col-md-10">
<button mat-button (click)="callback(i)"> <button mat-button (click)="callback(i)">
<mat-icon>close</mat-icon> <mat-icon>close</mat-icon>
</button> </button>
@ -157,7 +161,7 @@
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>
<mat-card-title class="thick"> <mat-card-title class="thick" *ngIf='!viewOnly'>
{{'DATASET-EDITOR.FIELDS.SERVICES' | translate}} {{'DATASET-EDITOR.FIELDS.SERVICES' | translate}}
<button mat-raised-button color="primary" (click)="addService()"> <button mat-raised-button color="primary" (click)="addService()">
{{'DATASET-EDITOR.FIELDS.CREATE'|translate}} {{'DATASET-EDITOR.FIELDS.CREATE'|translate}}
@ -172,12 +176,12 @@
</app-external-item-listing> </app-external-item-listing>
<ng-template #servicesTemplate let-suggestion let-i="index" let-callback="function"> <ng-template #servicesTemplate let-suggestion let-i="index" let-callback="function">
<div> <div class="col-md-2">
<p> <p>
{{i+1}}) {{suggestion.get('label').value}} {{i+1}}) {{suggestion.get('label').value}}
</p> </p>
</div> </div>
<div> <div class="col-md-10">
<button mat-button (click)="callback(i)"> <button mat-button (click)="callback(i)">
<mat-icon>close</mat-icon> <mat-icon>close</mat-icon>
</button> </button>
@ -199,12 +203,12 @@
</app-external-item-listing> </app-external-item-listing>
<ng-template #tagsTemplate let-suggestion let-i="index" let-callback="function"> <ng-template #tagsTemplate let-suggestion let-i="index" let-callback="function">
<div> <div class="col-md-2">
<p> <p>
{{i+1}}) {{suggestion.get('name').value}} {{i+1}}) {{suggestion.get('name').value}}
</p> </p>
</div> </div>
<div> <div class="col-md-10">
<button mat-button (click)="callback(i)"> <button mat-button (click)="callback(i)">
<mat-icon>close</mat-icon> <mat-icon>close</mat-icon>
</button> </button>

View File

@ -179,6 +179,10 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
] ]
}]) }])
this.formGroup = this.datasetWizardModel.buildForm(); this.formGroup = this.datasetWizardModel.buildForm();
if (this.datasetWizardModel.status == 1) {
this.formGroup.disable()
this.viewOnly = true;
}
if (this.viewOnly) this.formGroup.disable(); if (this.viewOnly) this.formGroup.disable();
this.loadDatasetProfiles(); this.loadDatasetProfiles();
}); });
@ -190,6 +194,10 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
setTimeout(() => { setTimeout(() => {
this.datasetWizardModel.dmp = data; this.datasetWizardModel.dmp = data;
this.formGroup = this.datasetWizardModel.buildForm(); this.formGroup = this.datasetWizardModel.buildForm();
if (this.datasetWizardModel.status == 1) {
this.formGroup.disable()
this.viewOnly = true;
}
this.loadDatasetProfiles(); this.loadDatasetProfiles();
this.breadCrumbs = Observable.of([ this.breadCrumbs = Observable.of([
@ -214,6 +222,11 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
} else { } else {
this.datasetWizardModel = new DatasetWizardModel(); this.datasetWizardModel = new DatasetWizardModel();
this.formGroup = this.datasetWizardModel.buildForm() this.formGroup = this.datasetWizardModel.buildForm()
if (this.datasetWizardModel.status == 1) {
this.formGroup.disable()
this.viewOnly = true;
}
if (this.viewOnly) this.formGroup.disable(); if (this.viewOnly) this.formGroup.disable();
this.formGroup.get('dmp').valueChanges.subscribe(x => { this.formGroup.get('dmp').valueChanges.subscribe(x => {

View File

@ -1,4 +1,4 @@
<div *ngIf="form" [id]="field.id" [formGroup]="form" [ngSwitch]="field.viewStyle.renderStyle"> <div *ngIf="form && field" [id]="field.id" [formGroup]="form" [ngSwitch]="field.viewStyle.renderStyle">
<!-- <h5 *ngIf="field.title">{{field.title}}</h5> --> <!-- <h5 *ngIf="field.title">{{field.title}}</h5> -->

View File

@ -22,12 +22,13 @@ export class DynamicFormFieldComponent implements OnInit {
@Input() pathName: string; @Input() pathName: string;
@Input() path: string; @Input() path: string;
change: Subscription; change: Subscription;
trackByFn = (index,item) => item["id"] trackByFn = (index, item) => item ? item["id"] : null
constructor(private route: ActivatedRoute, public visibilityRulesService: VisibilityRulesService) { constructor(private route: ActivatedRoute, public visibilityRulesService: VisibilityRulesService) {
} }
ngOnInit() { ngOnInit() {
if (this.field) {
this.form = this.visibilityRulesService.getFormGroup(this.field.id) this.form = this.visibilityRulesService.getFormGroup(this.field.id)
if (!this.form) debugger; if (!this.form) debugger;
if (!this.form.get('value')) debugger; if (!this.form.get('value')) debugger;
@ -35,6 +36,7 @@ export class DynamicFormFieldComponent implements OnInit {
this.visibilityRulesService.updateValueAndVisibility(this.field.id) this.visibilityRulesService.updateValueAndVisibility(this.field.id)
}) })
} }
}
ngOnChanges(changeRecord) { ngOnChanges(changeRecord) {
@ -43,7 +45,7 @@ export class DynamicFormFieldComponent implements OnInit {
ngOnDestroy(): void { ngOnDestroy(): void {
//Called once, before the instance is destroyed. //Called once, before the instance is destroyed.
//Add 'implements OnDestroy' to the class. //Add 'implements OnDestroy' to the class.
this.change.unsubscribe() if(this.change) this.change.unsubscribe()
} }
clearInput() { clearInput() {

View File

@ -7,8 +7,7 @@
<h5 *ngIf="compositeField.extendedDescription" class="fieldset-extended-desc"> <h5 *ngIf="compositeField.extendedDescription" class="fieldset-extended-desc">
<i>{{compositeField.extendedDescription}}</i> <i>{{compositeField.extendedDescription}}</i>
</h5> </h5>
<df-field *ngIf="compositeField.fields.length == 1" [field]="compositeField.fields[0]" <df-field *ngIf="compositeField.fields.length == 1" [field]="compositeField.fields[0]" [pathName]="pathName+'.fields.'+0"></df-field>
[pathName]="pathName+'.fields.'+0"></df-field>
</div> </div>
</div> </div>
@ -30,6 +29,7 @@
</div> </div>
<df-field [field]="field" [pathName]="pathName+'.fields.'+i"></df-field> <df-field [field]="field" [pathName]="pathName+'.fields.'+i"></df-field>
<div *ngIf="field">
<div *ngFor="let multipleField of field.multiplicityItems; let j = index; trackBy: trackByFn"> <div *ngFor="let multipleField of field.multiplicityItems; let j = index; trackBy: trackByFn">
<df-field [field]="multipleField" [pathName]="pathName+'.fields.'+i+'.multiplicityItems.'+j"></df-field> <df-field [field]="multipleField" [pathName]="pathName+'.fields.'+i+'.multiplicityItems.'+j"></df-field>
</div> </div>
@ -37,3 +37,4 @@
</div> </div>
</div> </div>
</div> </div>
</div>

View File

@ -17,14 +17,16 @@ export class DynamicFormCompositeFieldComponent implements OnInit {
form: FormGroup; form: FormGroup;
@Input() pathName: string; @Input() pathName: string;
@Input() path: string; @Input() path: string;
trackByFn = (index, item) => item["id"] trackByFn = (index, item) => item ? item["id"] : null
constructor(private visibilityRulesService: VisibilityRulesService) { constructor(private visibilityRulesService: VisibilityRulesService) {
} }
ngOnInit() { ngOnInit() {
if (this.compositeField) {
this.form = this.visibilityRulesService.getFormGroup(this.compositeField.id) this.form = this.visibilityRulesService.getFormGroup(this.compositeField.id)
} }
}
addMultipleField(fieldIndex: number) { addMultipleField(fieldIndex: number) {
@ -32,6 +34,4 @@ export class DynamicFormCompositeFieldComponent implements OnInit {
this.compositeField.fields[fieldIndex].multiplicityItems.push(field); this.compositeField.fields[fieldIndex].multiplicityItems.push(field);
(<FormArray>(this.form.get("fields").get('' + fieldIndex).get('multiplicityItems'))).push(field.buildForm()); (<FormArray>(this.form.get("fields").get('' + fieldIndex).get('multiplicityItems'))).push(field.buildForm());
} }
} }

View File

@ -10,9 +10,10 @@
</div> </div>
</div> </div>
<df-composite-field [compositeField]="compositeField" [path]="path" [pathName]="pathName+'.compositeFields.'+i"></df-composite-field> <df-composite-field [compositeField]="compositeField" [path]="path" [pathName]="pathName+'.compositeFields.'+i"></df-composite-field>
<div *ngIf="compositeField">
<div *ngFor="let multipleCompositeField of compositeField.multiplicityItems; let j = index; trackBy: trackByFn"> <div *ngFor="let multipleCompositeField of compositeField.multiplicityItems; let j = index; trackBy: trackByFn">
<df-composite-field [compositeField]="multipleCompositeField" <df-composite-field [compositeField]="multipleCompositeField" [pathName]="pathName+'.compositeFields.'+i+'.multiplicityItems.'+j"></df-composite-field>
[pathName]="pathName+'.compositeFields.'+i+'.multiplicityItems.'+j"></df-composite-field> </div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -19,13 +19,15 @@ export class DynamicFormGroupComponent implements OnInit {
@Input() pathName: string; @Input() pathName: string;
@Input() path: string; @Input() path: string;
trackByFn = (index,item) => item["id"] trackByFn = (index, item) => item ? item["id"] : null
constructor(public visibilityRulesService: VisibilityRulesService) { constructor(public visibilityRulesService: VisibilityRulesService) {
} }
ngOnInit() { ngOnInit() {
if (this.group) {
this.form = this.visibilityRulesService.getFormGroup(this.group.id) this.form = this.visibilityRulesService.getFormGroup(this.group.id)
} }
}
addMultipleField(fieldsetIndex: number) { addMultipleField(fieldsetIndex: number) {

View File

@ -12,16 +12,16 @@
</mat-expansion-panel-header> </mat-expansion-panel-header>
<div *ngFor="let compositeField of section.compositeFields; let i = index; trackBy: trackByFn"> <div *ngFor="let compositeField of section.compositeFields; let i = index; trackBy: trackByFn">
<div> <div *ngIf="isElementVisible(compositeField)">
<div *ngIf="(compositeField?.multiplicity?.max - 1) > (compositeField?.multiplicityItems?.length)"> <div *ngIf="(compositeField?.multiplicity?.max - 1) > (compositeField?.multiplicityItems?.length)">
<a (click)="addMultipleField(i)" style="cursor: pointer"> <a (click)="addMultipleField(i)" style="cursor: pointer">
Add one more fieldset + Add one more fieldset +
</a> </a>
</div> </div>
<df-composite-field [compositeField]="compositeField" [path]="path" [pathName]="pathName+'.compositeFields.'+i"></df-composite-field> <df-composite-field [compositeField]="compositeField" [path]="path" [pathName]="pathName+'.compositeFields.'+i"></df-composite-field>
<div *ngIf="compositeField">
<div *ngFor="let multipleCompositeField of compositeField.multiplicityItems; let j = index; trackBy: trackByFn"> <div *ngFor="let multipleCompositeField of compositeField.multiplicityItems; let j = index; trackBy: trackByFn">
<df-composite-field [compositeField]="multipleCompositeField" <df-composite-field [compositeField]="multipleCompositeField" [pathName]="pathName+'.compositeFields.'+i+'.multiplicityItems.'+j"></df-composite-field>
[pathName]="pathName+'.compositeFields.'+i+'.multiplicityItems.'+j"></df-composite-field>
</div> </div>
<div *ngIf="compositeField.hasCommentField" [formGroup]="form.get('compositeFields').get(''+i)"> <div *ngIf="compositeField.hasCommentField" [formGroup]="form.get('compositeFields').get(''+i)">
<mat-form-field> <mat-form-field>
@ -29,10 +29,11 @@
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
</div>
</div> </div>
<div *ngIf="section.sections"> <div *ngIf="section?.sections">
<div *ngFor="let itemsection of section.sections; let j = index;"> <div *ngFor="let itemsection of section.sections; let j = index;">
<df-section [section]="itemsection" [path]="path+'.'+(j+1)" [pathName]="pathName+'.sections.'+j"></df-section> <df-section [section]="itemsection" [path]="path+'.'+(j+1)" [pathName]="pathName+'.sections.'+j"></df-section>
</div> </div>

View File

@ -19,12 +19,18 @@ export class DynamicFormSectionComponent implements OnInit {
form: FormGroup; form: FormGroup;
@Input() pathName: string; @Input() pathName: string;
@Input() path: string; @Input() path: string;
trackByFn = (item) => item["id"] trackByFn = (index, item) => item ? item["id"] : null
constructor(public visibilityRulesService: VisibilityRulesService) { } constructor(public visibilityRulesService: VisibilityRulesService) { }
ngOnInit() { ngOnInit() {
if (this.section) {
this.form = this.visibilityRulesService.getFormGroup(this.section.id) this.form = this.visibilityRulesService.getFormGroup(this.section.id)
} }
}
ngAfterViewInit() {
this.visibilityRulesService.triggerVisibilityEvaluation()
}
addMultipleField(fieldsetIndex: number) { addMultipleField(fieldsetIndex: number) {
let compositeField: CompositeField = this.section.compositeFields[fieldsetIndex].cloneForMultiplicity(fieldsetIndex); let compositeField: CompositeField = this.section.compositeFields[fieldsetIndex].cloneForMultiplicity(fieldsetIndex);
@ -32,10 +38,10 @@ export class DynamicFormSectionComponent implements OnInit {
(<FormArray>(this.form.get("compositeFields").get('' + fieldsetIndex).get('multiplicityItems'))).push(compositeField.buildForm()); (<FormArray>(this.form.get("compositeFields").get('' + fieldsetIndex).get('multiplicityItems'))).push(compositeField.buildForm());
} }
isVisible(pathname: string, fieldSet: CompositeField): boolean { isElementVisible(fieldSet: CompositeField): boolean {
if (!fieldSet || !this.visibilityRulesService.getFormGroup(fieldSet.id)) return false; if (!fieldSet) return false;
for (var i = 0; i < fieldSet.fields.length; i++) { for (var i = 0; i < fieldSet.fields.length; i++) {
if (this.visibilityRulesService.getFormGroup(fieldSet.fields[i].id)) if (fieldSet.fields[i])
return true; return true;
} }
return false; return false;

View File

@ -26,14 +26,14 @@ declare function simple_notifier(type: string, title: string, message: string):
], ],
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
}) })
export class DynamicFormComponent implements OnInit { export class DynamicFormComponent implements OnInit, AfterViewInit {
@Input() dataModel: DatasetWizardModel = new DatasetWizardModel(); @Input() dataModel: DatasetWizardModel = new DatasetWizardModel();
@Input() path: string; @Input() path: string;
@Input() form: FormGroup; @Input() form: FormGroup;
id: string; id: string;
trackByFn = (index,item) => item["id"] trackByFn = (index, item) => item ? item["id"] : null
pageTrackByFn = (index, item) => item["id"] pageTrackByFn = (index, item) => item["id"]
// @Input() datasetId: string; // @Input() datasetId: string;
@ -82,6 +82,10 @@ export class DynamicFormComponent implements OnInit {
}); });
} }
ngAfterViewInit() {
this.visibilityRulesService.triggerVisibilityEvaluation()
}
toggleSidebar() { toggleSidebar() {
this.visibleSidebar = !this.visibleSidebar; this.visibleSidebar = !this.visibleSidebar;

View File

@ -11,6 +11,7 @@ export class Section extends BaseModel implements Serializable<Section>, FormGen
//public fieldGroups: Array<FieldGroup>; //public fieldGroups: Array<FieldGroup>;
public defaultVisibility: boolean; public defaultVisibility: boolean;
public page: number; public page: number;
public ordinal: number;
public id: string public id: string
public title: string public title: string
public description: string; public description: string;
@ -23,6 +24,7 @@ export class Section extends BaseModel implements Serializable<Section>, FormGen
this.defaultVisibility = item.defaultVisibility; this.defaultVisibility = item.defaultVisibility;
this.id = item.id; this.id = item.id;
this.title = item.title; this.title = item.title;
this.ordinal = item.ordinal;
this.description = item.description; this.description = item.description;
this.compositeFields = JsonSerializer.fromJSONArray(item.compositeFields, CompositeField); this.compositeFields = JsonSerializer.fromJSONArray(item.compositeFields, CompositeField);
return this; return this;

View File

@ -1,4 +1,11 @@
export enum SearchBarItemType {
DATASET = 0,
DMP = 1,
PROJECT = 2
}
export class SearchBarItem { export class SearchBarItem {
public id: string; public id: string;
public label: string; public label: string;
public type: string;
} }

View File

@ -19,7 +19,7 @@ export class DatasetWizardModel implements Serializable<DatasetWizardModel> {
public label: string; public label: string;
public profile: DatasetProfileModel = new DatasetProfileModel(); public profile: DatasetProfileModel = new DatasetProfileModel();
public uri: String; public uri: String;
public status: String; public status: number;
public description: String; public description: String;
public services: ServiceModel[] = []; public services: ServiceModel[] = [];
public registries: RegisterModel[] = []; public registries: RegisterModel[] = [];

View File

@ -101,7 +101,7 @@ export class ProjectEditorComponent implements OnInit, IBreadCrumbComponent {
} }
onCallbackError(errorResponse: any) { onCallbackError(errorResponse: any) {
this.setErrorModel(errorResponse.error); this.setErrorModel(errorResponse.error.payload);
this.validateAllFormFields(this.formGroup); this.validateAllFormFields(this.formGroup);
} }

View File

@ -3,5 +3,4 @@
width: 100%; width: 100%;
padding: 3px; padding: 3px;
} }
} }

View File

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

View File

@ -1,7 +1,7 @@
<div> <div>
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-md-5"> <div class="col-md-3">
<mat-form-field > <mat-form-field >
<mat-select placeholder="Sources" [(ngModel)]="choice" (selectionChange)="selectionChange($event)" [disabled]="viewOnly"> <mat-select placeholder="Sources" [(ngModel)]="choice" (selectionChange)="selectionChange($event)" [disabled]="viewOnly">
<mat-option *ngFor="let option of options" [value]="option.key"> <mat-option *ngFor="let option of options" [value]="option.key">
@ -11,13 +11,13 @@
</mat-form-field> </mat-form-field>
</div> </div>
<div> <div>
<app-external-item class="col-md-7" [autoCompleteConfiguration]="autoCompleteConfiguration" [formGroup]="formGroup" [displayFunction]="displayFunction" <app-external-item class="col-md-9" [autoCompleteConfiguration]="autoCompleteConfiguration" [formGroup]="formGroup" [displayFunction]="displayFunction"
[placeholder]="placeholder" [subtitleFunction]="subtitleFunction" (onItemChange)="this.onItemChangeFunc($event)" [formCtrl]="formControl" [placeholder]="placeholder" [subtitleFunction]="subtitleFunction" (onItemChange)="this.onItemChangeFunc($event)" [formCtrl]="formControl"
[disabled]="disabled"> [disabled]="disabled">
</app-external-item> </app-external-item>
</div> </div>
</div> </div>
<div fxLayout="row" *ngFor="let suggestion of formGroup['controls']; let i = index"> <div class="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 *ngTemplateOutlet="parentTemplate; context: { $implicit: suggestion, index: i,function: this.deleteItem.bind(this) }">
</ng-container> </ng-container>
</div> </div>

View File

@ -21,8 +21,10 @@
<mat-form-field class="full-width" floatLabel="never"> <mat-form-field class="full-width" floatLabel="never">
<input type="text" placeholder="{{'DASHBOARD.SEARCH' | translate}}" matInput [formControl]="searchControl" [matAutocomplete]="auto"> <input type="text" placeholder="{{'DASHBOARD.SEARCH' | translate}}" matInput [formControl]="searchControl" [matAutocomplete]="auto">
<mat-autocomplete autoActiveFirstOption #auto="matAutocomplete" (optionSelected)="onOptionSelected($event)"> <mat-autocomplete autoActiveFirstOption #auto="matAutocomplete" (optionSelected)="onOptionSelected($event)">
<mat-option *ngFor="let option of filteredOptions | async" [value]="option"> <mat-option *ngFor="let option of filteredOptions | async" [value]="option" class="transformation-value-mat-option">
{{option.label}} <span>{{option.label}}</span>
<br>
<small>{{transformType(option.type)}}</small>
</mat-option> </mat-option>
</mat-autocomplete> </mat-autocomplete>
</mat-form-field> </mat-form-field>

View File

@ -37,3 +37,8 @@
.full-width { .full-width {
width: 100%; width: 100%;
} }
.transformation-value-mat-option {
height: 3.5em;
line-height: 1.2em;
}

View File

@ -12,7 +12,7 @@ import { ProjectService } from '../../../services/project/project.service';
import { FormControl } from '@angular/forms'; import { FormControl } from '@angular/forms';
import { DashboardService } from '../../../services/dashboard/dashboard.service'; import { DashboardService } from '../../../services/dashboard/dashboard.service';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
import { SearchBarItem } from '../../../models/dashboard/SearchBarItem'; import { SearchBarItem, SearchBarItemType } from '../../../models/dashboard/SearchBarItem';
import { SearchBarType } from '../search-bar/types/search-bar-type'; import { SearchBarType } from '../search-bar/types/search-bar-type';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
@ -52,7 +52,7 @@ export class NavigationComponent {
loadDataOnStart: true loadDataOnStart: true
}; };
this.filteredOptions = this.searchControl.valueChanges.flatMap(x => { this.filteredOptions = this.searchControl.valueChanges.debounceTime(500).distinctUntilChanged().flatMap(x => {
return this.dashBoardService.searchUserItems(x); return this.dashBoardService.searchUserItems(x);
}) })
} }
@ -122,4 +122,11 @@ export class NavigationComponent {
if (selectedSearchBarItem.type == SearchBarType.DATAMANAGEMENTPLAN) this.router.navigate(["dmps/edit/" + selectedSearchBarItem.id]) if (selectedSearchBarItem.type == SearchBarType.DATAMANAGEMENTPLAN) this.router.navigate(["dmps/edit/" + selectedSearchBarItem.id])
} }
transformType(type) {
switch(type){
case SearchBarItemType.DATASET: return "Dataset"
case SearchBarItemType.DMP: return "DMP"
case SearchBarItemType.PROJECT: return "Project"
}
}
} }

View File

@ -22,8 +22,11 @@ export class VisibilityRulesService {
public setModel(model: DatasetProfileDefinitionModel) { public setModel(model: DatasetProfileDefinitionModel) {
this.initialModel = JsonSerializer.fromJSONObject(model, DatasetProfileDefinitionModel); this.initialModel = JsonSerializer.fromJSONObject(model, DatasetProfileDefinitionModel);
this.currentModel = model this.currentModel = model
this.visibilityRuleContext.rules.forEach(item => this.evaluateVisibility(item)) //this.visibilityRuleContext.rules.forEach(item => this.evaluateVisibility(item))
}
public triggerVisibilityEvaluation() {
this.visibilityRuleContext.rules.forEach(item => this.evaluateVisibility(item))
} }
public getFormGroup(id: string): FormGroup { public getFormGroup(id: string): FormGroup {
@ -53,7 +56,7 @@ export class VisibilityRulesService {
private evaluateVisibility(visibilityRule: VisibilityRule) { private evaluateVisibility(visibilityRule: VisibilityRule) {
for (let i = 0; i < visibilityRule.sourceVisibilityRules.length; i++) { for (let i = 0; i < visibilityRule.sourceVisibilityRules.length; i++) {
let pathKey = this.fieldsPathMemory[visibilityRule.sourceVisibilityRules[i].sourceControlId]; let pathKey = this.fieldsPathMemory[visibilityRule.sourceVisibilityRules[i].sourceControlId];
if (this.formGroup.get(pathKey + '.value') && ((this.formGroup.get(pathKey + '.value').value == null || this.formGroup.get(pathKey + '.value').value == undefined) || "" + this.formGroup.get(pathKey + '.value').value != "" + visibilityRule.sourceVisibilityRules[i].sourceControlValue)) { if (this.formGroup.get(pathKey + '.value') && ((this.formGroup.get(pathKey + '.value').value == null || this.formGroup.get(pathKey + '.value').value == null) || "" + this.formGroup.get(pathKey + '.value').value != "" + visibilityRule.sourceVisibilityRules[i].sourceControlValue)) {
if (this.formGroup.get(pathKey).parent.get("id")) { if (this.formGroup.get(pathKey).parent.get("id")) {
if (!this.checkElementVisibility(this.formGroup.get(pathKey).parent.get("id").value)) { if (!this.checkElementVisibility(this.formGroup.get(pathKey).parent.get("id").value)) {
let targetPathKey = this.fieldsPathMemory[visibilityRule.targetControlId] let targetPathKey = this.fieldsPathMemory[visibilityRule.targetControlId]
@ -78,10 +81,6 @@ export class VisibilityRulesService {
this.elementVisibilityMap.set(visibilityRule.targetControlId, true) this.elementVisibilityMap.set(visibilityRule.targetControlId, true)
} }
private getParentPath(parentId: string): string {
return '';
}
private clearValues(pathKey) { private clearValues(pathKey) {
if (pathKey && this.formGroup.get(pathKey + '.value')) this.formGroup.get(pathKey + '.value').patchValue(null) if (pathKey && this.formGroup.get(pathKey + '.value')) this.formGroup.get(pathKey + '.value').patchValue(null)
if (pathKey && this.formGroup.get(pathKey)["controls"].fields) { if (pathKey && this.formGroup.get(pathKey)["controls"].fields) {
@ -107,15 +106,16 @@ export class VisibilityRulesService {
updateValue(obj, value, path) { updateValue(obj, value, path) {
var i; var i;
if (value['id'].targetControlId === "other216a") debugger;
path = path.split('.'); path = path.split('.');
for (i = 0; i < path.length - 1; i++)
for (i = 0; i < path.length - 1; i++) {
obj = obj[path[i]]; obj = obj[path[i]];
}
for (let propIndex = 0; propIndex < obj.length; propIndex++) { for (let propIndex = 0; propIndex < obj.length; propIndex++) {
if (obj[propIndex]["id"] === value["id"]) return if (obj[propIndex] && obj[propIndex]["id"] === value["id"]) return
} }
obj.splice(path[i], 0, value); obj[path[i]] = value;
} }
search(path, obj, target) { search(path, obj, target) {
@ -140,7 +140,7 @@ export class VisibilityRulesService {
if (returnObj) return returnObj if (returnObj) return returnObj
} else if (i == key && obj[key] == val) { } else if (i == key && obj[key] == val) {
//console.log(obj[key]) //console.log(obj[key])
if (deleteObj) parent.splice(parent.indexOf(obj), 1); if (deleteObj) parent[parent.indexOf(obj)] = null
return obj return obj
} }
} }

View File

@ -19,6 +19,13 @@
}, },
"ERRORS": { "ERRORS": {
"HTTP-REQUEST-ERROR": "An Unexpected Error Has Occured" "HTTP-REQUEST-ERROR": "An Unexpected Error Has Occured"
},
"NAMES": {
"DATASET": "Dataset"
},
"STATUSES": {
"EDIT": "Edited",
"FINALISED": "Finalized"
} }
}, },
"NAV-BAR": { "NAV-BAR": {
@ -26,7 +33,7 @@
"PROJECTS": "Projects", "PROJECTS": "Projects",
"DMPS": "DMPs", "DMPS": "DMPs",
"DATASETS": "Datasets", "DATASETS": "Datasets",
"PUBLIC-DATASETS": "Public Datasets", "PUBLIC-DATASETS": "Explore OpenDMP",
"USERS": "Users", "USERS": "Users",
"DATASETS-ADMIN": "Dataset Profiles", "DATASETS-ADMIN": "Dataset Profiles",
"DMP-PROFILES": "DMP Profiles", "DMP-PROFILES": "DMP Profiles",
@ -78,10 +85,10 @@
"PROFILE": "Dataset Profile" "PROFILE": "Dataset Profile"
}, },
"SECOND-STEP": { "SECOND-STEP": {
"TITLE": "External Sources" "TITLE": "External References"
}, },
"THIRD-STEP": { "THIRD-STEP": {
"TITLE": "Definition" "TITLE": "Description"
}, },
"ACTIONS": { "ACTIONS": {
"NEXT": "Next", "NEXT": "Next",
@ -112,6 +119,9 @@
"VIEW": "View" "VIEW": "View"
} }
}, },
"DATASET-PUBLIC-LISTING": {
"TITLE": "Published dataset descriptions"
},
"DMP-PROFILE-EDITOR": { "DMP-PROFILE-EDITOR": {
"TITLE": { "TITLE": {
"NEW": "New DMP Profile", "NEW": "New DMP Profile",
@ -212,6 +222,7 @@
"DESCRIPTION": "Description", "DESCRIPTION": "Description",
"PROFILE": "Profile", "PROFILE": "Profile",
"URI": "Uri", "URI": "Uri",
"DMP": "DMP",
"DATAREPOSITORIES": "Data Repositories", "DATAREPOSITORIES": "Data Repositories",
"REGISTRIES": "Registries", "REGISTRIES": "Registries",
"SERVICES": "Services", "SERVICES": "Services",

View File

@ -1,7 +1,7 @@
export const environment = { export const environment = {
production: true, production: true,
Server: 'http://dl043.madgik.di.uoa.gr:8080/api/', Server: 'http://opendmp.eu:8080/api/',
App: 'http://dl043.madgik.di.uoa.gr/', App: 'http://opendmp.eu/',
HelpServiceUrl: 'http://dl043.madgik.di.uoa.gr:5555/', HelpServiceUrl: 'http://opendmp.eu:5555/',
defaultCulture: "en-GB" defaultCulture: "en-GB"
}; };

View File

@ -1,3 +1,3 @@
transport.host: 0.0.0.0 transport.host: 0.0.0.0
network.host: 0.0.0.0 network.host: 0.0.0.0
xpack.security.enabled: false xpack.security.enabled: true