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) {
QueryableList<DMP> query = getDatabaseService().getQueryable(DMP.getHints(), DMP.class);
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)
query.where((builder, root) -> builder.lessThan(root.get("created"), criteria.getPeriodEnd()));
if (criteria.getPeriodStart() != null)

View File

@ -19,9 +19,9 @@ public abstract class AbstractBatchLogger {
private Map<String, Object> concurrentHashMap = new ConcurrentHashMap<String, Object>();
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();

View File

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

View File

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

View File

@ -102,21 +102,21 @@ public class DashBoardManager {
List<SearchBarItem> searchBarItems = new LinkedList<>();
CompletableFuture<List<SearchBarItem>> dmps = dataManagementPlanRepository.getAuthenticated(dataManagementPlanRepository.asQueryable(), user)
.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")))
.selectAsync(item -> new SearchBarItem(item.getId().toString(), item.getLabel(), SearchBarItemType.DMP.getValue()))
.whenComplete((dmpItems, throwable) -> searchBarItems.addAll(dmpItems));
CompletableFuture<List<SearchBarItem>> datasets = datasetRepository.getAuthenticated(datasetRepository.asQueryable(), user)
.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")))
.selectAsync(item -> new SearchBarItem(item.getId().toString(), item.getLabel(), SearchBarItemType.DATASET.getValue()))
.whenComplete((dataSetItems, throwable) -> searchBarItems.addAll(dataSetItems));
CompletableFuture<List<SearchBarItem>> projects = projectRepository.getAuthenticated(projectRepository.asQueryable(), user)
.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")))
.selectAsync(item -> new SearchBarItem(item.getId().toString(), item.getLabel(), SearchBarItemType.PROJECT.getValue()))
.whenComplete((projectItems, throwable) -> searchBarItems.addAll(projectItems));

View File

@ -254,7 +254,7 @@ public class DatasetManager {
datasetDataRepository.setDataset(dataset);
dataset.getDatasetDataRepositories().add(datasetDataRepository);
} else {
datasetDataRepository.getDataRepository().setId(UUID.randomUUID());
//datasetDataRepository.getDataRepository().setId(UUID.randomUUID());
DataRepository dataRepository = dataRepositoryDao.createOrUpdate(datasetDataRepository.getDataRepository());
datasetDataRepository.setDataRepository(dataRepository);
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)
.withName("type").withMessage("project.external.edit");
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

View File

@ -41,11 +41,11 @@ google.login.clientId=524432312250-sc9qsmtmbvlv05r44onl6l93ia3k9deo.apps.googleu
########################LINKEDIN LOGIN Properties#############################HiR4hQH9HNubKC5iKQy0l4mAZ
linkedin.login.clientId=86bl8vfk77clh9
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#############################
twitter.login.clientId=HiR4hQH9HNubKC5iKQy0l4mAZ
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##############################
spring.profiles.active=devel
########################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.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.clientSecret=A3b*1*92
#################################################################################

View File

@ -90,7 +90,7 @@ import { CultureService } from './utilities/culture/culture-service';
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/api/oauth/authorized/b2access',
redirectUri: 'http://opendmp.eu/api/oauth/authorized/b2access',
accessTokenUri: 'https://b2access-integration.fz-juelich.de:443/oauth2/token'
}
}),

View File

@ -1,5 +1,5 @@
<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>

View File

@ -1,6 +1,12 @@
<div class="dataset-wizard">
<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">
<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' |
translate}}
</button>
</div>
</form>
</mat-step>
@ -49,7 +54,7 @@
<mat-card>
<mat-card-header>
<mat-card-title class="thick">
<mat-card-title class="thick" *ngIf='!viewOnly'>
{{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES' | translate}}
<button mat-raised-button color="primary" (click)="addDataRepository()">
{{'DATASET-EDITOR.FIELDS.CREATE'|translate}}
@ -64,17 +69,17 @@
</app-external-item-listing>
<ng-template #dataRepositoriesTemplate let-suggestion let-i="index" let-callback="function">
<div>
<div class="col-md-2">
<p>
{{i+1}}) {{suggestion.get('label').value}}
</p>
</div>
<div>
<div class="col-md-8">
<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>
<div class="col-md-2">
<button mat-button (click)="callback(i)">
<mat-icon>close</mat-icon>
</button>
@ -83,7 +88,7 @@
</mat-card>
<mat-card>
<mat-card-header>
<mat-card-title class="thick">
<mat-card-title class="thick" *ngIf='!viewOnly'>
{{'DATASET-EDITOR.FIELDS.EXTERNAL-DATASETS' | translate}}
<button mat-raised-button color="primary" (click)="addExternalDataset()">
{{'DATASET-EDITOR.FIELDS.CREATE'|translate}}
@ -98,18 +103,18 @@
</app-external-item-listing>
<ng-template #externalDatasetsTemplate let-suggestion let-i="index" let-callback="function">
<div>
<div class="col-md-2">
<p>
{{i+1}}) {{suggestion.get('label').value}}
</p>
</div>
<div>
<div class="col-md-4">
<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>
<div class="col-md-4">
<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>
@ -117,7 +122,7 @@
</mat-select>
</mat-form-field>
</div>
<div>
<div class="col-md-2">
<button mat-button (click)="callback(i)">
<mat-icon>close</mat-icon>
</button>
@ -127,7 +132,7 @@
<mat-card>
<mat-card-header>
<mat-card-title class="thick">
<mat-card-title class="thick" *ngIf='!viewOnly'>
{{'DATASET-EDITOR.FIELDS.REGISTRIES' | translate}}
<button mat-raised-button color="primary" (click)="addRegistry()">
{{'DATASET-EDITOR.FIELDS.CREATE'|translate}}
@ -138,16 +143,15 @@
placeholder="{{'DATASET-EDITOR.FIELDS.REGISTRIES' | translate}}" [parentTemplate]='registriesTemplate' [displayFunction]='registriesDisplayFunc'
[formGroup]="formGroup.get('registries')" [viewOnly]='viewOnly' [subtitleFunction]='dataRepositoryDisplaySubtitleFunc'
[autoCompleteConfiguration]="registriesAutoCompleteConfiguration" (onItemChange)="registriesOnItemChange($event)">
</app-external-item-listing>
<ng-template #registriesTemplate let-suggestion let-i="index" let-callback="function">
<div>
<div class="col-md-2">
<p>
{{i+1}}) {{suggestion.get('label').value}}
</p>
</div>
<div>
<div class="col-md-10">
<button mat-button (click)="callback(i)">
<mat-icon>close</mat-icon>
</button>
@ -157,7 +161,7 @@
<mat-card>
<mat-card-header>
<mat-card-title class="thick">
<mat-card-title class="thick" *ngIf='!viewOnly'>
{{'DATASET-EDITOR.FIELDS.SERVICES' | translate}}
<button mat-raised-button color="primary" (click)="addService()">
{{'DATASET-EDITOR.FIELDS.CREATE'|translate}}
@ -172,12 +176,12 @@
</app-external-item-listing>
<ng-template #servicesTemplate let-suggestion let-i="index" let-callback="function">
<div>
<div class="col-md-2">
<p>
{{i+1}}) {{suggestion.get('label').value}}
</p>
</div>
<div>
<div class="col-md-10">
<button mat-button (click)="callback(i)">
<mat-icon>close</mat-icon>
</button>
@ -199,12 +203,12 @@
</app-external-item-listing>
<ng-template #tagsTemplate let-suggestion let-i="index" let-callback="function">
<div>
<div class="col-md-2">
<p>
{{i+1}}) {{suggestion.get('name').value}}
</p>
</div>
<div>
<div class="col-md-10">
<button mat-button (click)="callback(i)">
<mat-icon>close</mat-icon>
</button>

View File

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

View File

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

View File

@ -7,8 +7,7 @@
<h5 *ngIf="compositeField.extendedDescription" class="fieldset-extended-desc">
<i>{{compositeField.extendedDescription}}</i>
</h5>
<df-field *ngIf="compositeField.fields.length == 1" [field]="compositeField.fields[0]"
[pathName]="pathName+'.fields.'+0"></df-field>
<df-field *ngIf="compositeField.fields.length == 1" [field]="compositeField.fields[0]" [pathName]="pathName+'.fields.'+0"></df-field>
</div>
</div>
@ -30,10 +29,12 @@
</div>
<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">
<df-field [field]="multipleField" [pathName]="pathName+'.fields.'+i+'.multiplicityItems.'+j"></df-field>
</div>
</div>
</div>
</div>
</div>
</div>

View File

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

View File

@ -10,9 +10,10 @@
</div>
</div>
<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">
<df-composite-field [compositeField]="multipleCompositeField"
[pathName]="pathName+'.compositeFields.'+i+'.multiplicityItems.'+j"></df-composite-field>
<df-composite-field [compositeField]="multipleCompositeField" [pathName]="pathName+'.compositeFields.'+i+'.multiplicityItems.'+j"></df-composite-field>
</div>
</div>
</div>
</div>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -30,7 +30,7 @@ export class BreadcrumbComponent implements OnInit {
}
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) {

View File

@ -1,7 +1,7 @@
<div>
<div class="container">
<div class="row">
<div class="col-md-5">
<div class="col-md-3">
<mat-form-field >
<mat-select placeholder="Sources" [(ngModel)]="choice" (selectionChange)="selectionChange($event)" [disabled]="viewOnly">
<mat-option *ngFor="let option of options" [value]="option.key">
@ -11,13 +11,13 @@
</mat-form-field>
</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"
[disabled]="disabled">
</app-external-item>
</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>
</div>

View File

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

View File

@ -37,3 +37,8 @@
.full-width {
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 { DashboardService } from '../../../services/dashboard/dashboard.service';
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 { Router } from '@angular/router';
@ -52,7 +52,7 @@ export class NavigationComponent {
loadDataOnStart: true
};
this.filteredOptions = this.searchControl.valueChanges.flatMap(x => {
this.filteredOptions = this.searchControl.valueChanges.debounceTime(500).distinctUntilChanged().flatMap(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])
}
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) {
this.initialModel = JsonSerializer.fromJSONObject(model, DatasetProfileDefinitionModel);
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 {
@ -53,7 +56,7 @@ export class VisibilityRulesService {
private evaluateVisibility(visibilityRule: VisibilityRule) {
for (let i = 0; i < visibilityRule.sourceVisibilityRules.length; i++) {
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.checkElementVisibility(this.formGroup.get(pathKey).parent.get("id").value)) {
let targetPathKey = this.fieldsPathMemory[visibilityRule.targetControlId]
@ -78,10 +81,6 @@ export class VisibilityRulesService {
this.elementVisibilityMap.set(visibilityRule.targetControlId, true)
}
private getParentPath(parentId: string): string {
return '';
}
private clearValues(pathKey) {
if (pathKey && this.formGroup.get(pathKey + '.value')) this.formGroup.get(pathKey + '.value').patchValue(null)
if (pathKey && this.formGroup.get(pathKey)["controls"].fields) {
@ -107,15 +106,16 @@ export class VisibilityRulesService {
updateValue(obj, value, path) {
var i;
if (value['id'].targetControlId === "other216a") debugger;
path = path.split('.');
for (i = 0; i < path.length - 1; i++)
for (i = 0; i < path.length - 1; i++) {
obj = obj[path[i]];
}
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) {
@ -140,7 +140,7 @@ export class VisibilityRulesService {
if (returnObj) return returnObj
} else if (i == key && obj[key] == val) {
//console.log(obj[key])
if (deleteObj) parent.splice(parent.indexOf(obj), 1);
if (deleteObj) parent[parent.indexOf(obj)] = null
return obj
}
}

View File

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

View File

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

View File

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