Fixed Bugs With Some Search Fields and Dataset Locking

This commit is contained in:
Ioannis Kalyvas 2018-10-11 14:22:49 +03:00
parent 2ca29e303b
commit c33d5ea50a
12 changed files with 106 additions and 77 deletions

View File

@ -80,7 +80,7 @@ public class Dataset implements DataEntity<Dataset, UUID> {
@ManyToOne(fetch = FetchType.LAZY)
// @Cascade(value=org.hibernate.annotations.CascadeType.ALL)
@JoinColumn(name = "\"DMP\"", nullable = true)
@JoinColumn(name = "\"DMP\"", nullable = false)
private DMP dmp;

View File

@ -28,7 +28,7 @@ public class ResearcherManager {
QueryableList<eu.eudat.data.entities.Researcher> items = apiContext.getOperationsContext().getDatabaseRepository().getResearcherDao().getWithCriteria(researcherCriteriaRequest.getCriteria());
List<eu.eudat.models.data.dmp.Researcher> researchers = items.select(item -> new eu.eudat.models.data.dmp.Researcher().fromDataModel(item));
List<Map<String, String>> remoteRepos = remoteFetcher.getResearchers(researcherCriteriaRequest.getCriteria().getLike(),null);
List<Map<String, String>> remoteRepos = remoteFetcher.getResearchers(researcherCriteriaRequest.getCriteria().getName(),null);
ResearchersExternalSourcesModel researchersExternalSourcesModel = new ResearchersExternalSourcesModel().fromExternalItem(remoteRepos);
for (ExternalSourcesItemModel externalListingItem : researchersExternalSourcesModel) {
eu.eudat.models.data.dmp.Researcher researcher = apiContext.getOperationsContext().getBuilderFactory().getBuilder(ResearcherBuilder.class)

View File

@ -44,7 +44,15 @@
<urlConfig>
<ordinal>1</ordinal>
<url>https://eestore.paas2.uninett.no/api/projectrepo/</url>
<datapath>$['data'][*]['attributes']['pid','name','uri','description']</datapath>
<data>
<path>$['data'][*]['attributes']</path>
<fields>
<id>'pid'</id>
<name>'name'</name>
<uri>'uri'</uri>
<description>'description'</description>
</fields>
</data>
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
</urlConfig>
<externalFieldId>pid</externalFieldId>

View File

@ -1,10 +1,10 @@
<div class="dataset-wizard">
<h3 *ngIf="isNew">{{ 'DATASET-WIZARD.TITLE.NEW' | translate }}</h3>
<div class="flex-container">
<div fxLayout="row">
<div fxLayout="row" fxLayoutAlign="space-between center">
<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>
<button *ngIf="!editMode" mat-icon-button (click)="enableForm()">
<mat-icon class="mat-24">edit</mat-icon>
</button>
@ -12,8 +12,7 @@
<mat-icon class="mat-24">lock</mat-icon>
</button>
</div>
</div>
<div class="flex-container" *ngIf="this.datasetProfileDefinitionModel">
<div *ngIf="this.datasetProfileDefinitionModel">
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status != 1" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;"
(click)="save();" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE' | translate }}</button>
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status != 1" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;"
@ -84,7 +83,7 @@
[formControl]="suggestion.get('info')">
</mat-form-field>
</div>
<div class="col-md-2">
<div class="col-md-2" *ngIf='!viewOnly'>
<button mat-button (click)="callback(i)">
<mat-icon>close</mat-icon>
</button>
@ -129,7 +128,7 @@
</mat-form-field>
</div>
<div class="col-md-2">
<button mat-button (click)="callback(i)">
<button mat-button (click)="callback(i)" *ngIf='!viewOnly'>
<mat-icon>close</mat-icon>
</button>
</div>
@ -159,7 +158,7 @@
</p>
</div>
<div class="col-md-10">
<button mat-button (click)="callback(i)">
<button mat-button (click)="callback(i)" *ngIf='!viewOnly'>
<mat-icon>close</mat-icon>
</button>
</div>
@ -180,7 +179,6 @@
[parentTemplate]='servicesTemplate' [displayFunction]='servicesDisplayFunc' [formGroup]="formGroup.get('services')"
[viewOnly]='viewOnly' [subtitleFunction]='dataRepositoryDisplaySubtitleFunc' [autoCompleteConfiguration]="servicesAutoCompleteConfiguration"
(onItemChange)="servicesOnItemChange($event)">
</app-external-item-listing>
<ng-template #servicesTemplate let-suggestion let-i="index" let-callback="function">
@ -190,7 +188,7 @@
</p>
</div>
<div class="col-md-10">
<button mat-button (click)="callback(i)">
<button mat-button (click)="callback(i)" *ngIf='!viewOnly'>
<mat-icon>close</mat-icon>
</button>
</div>
@ -207,7 +205,6 @@
placeholder="{{'DATASET-EDITOR.FIELDS.TAGS' | translate}}" [parentTemplate]='tagsTemplate' [displayFunction]='tagsDisplayFunc'
[formGroup]="formGroup.get('tags')" [viewOnly]='viewOnly' [subtitleFunction]='tagsDisplaySubtitleFunc'
[autoCompleteConfiguration]="tagsAutoCompleteConfiguration" (onItemChange)="tagsOnItemChange($event)">
</app-external-item-listing>
<ng-template #tagsTemplate let-suggestion let-i="index" let-callback="function">
@ -217,7 +214,7 @@
</p>
</div>
<div class="col-md-10">
<button mat-button (click)="callback(i)">
<button mat-button (click)="callback(i)" *ngIf='!viewOnly'>
<mat-icon>close</mat-icon>
</button>
</div>

View File

@ -41,6 +41,7 @@ import { DataRepositoryReferencedModelHelperComponent } from '../dataset-referen
import { RegistryReferencedModelHelperComponent } from '../dataset-referenced-models-helper/registry/registry-referenced-model-helper.component';
import { ExternalDatasetReferencedModelHelperComponent } from '../dataset-referenced-models-helper/externalDataset/externaldataset-referenced-model-helper.component';
import { ServicesReferencedModelHelperComponent } from '../dataset-referenced-models-helper/services/services-referenced-model-helper.component';
import { BehaviorSubject } from 'rxjs';
@Component({
selector: 'app-dataset-wizard-component',
@ -114,23 +115,28 @@ export class DatasetWizardComponent implements OnInit, AfterViewInit, IBreadCrum
const externalDatasetRequestItem: RequestItem<ExternalDatasetCriteria> = new RequestItem();
externalDatasetRequestItem.criteria = new ExternalDatasetCriteria();
this.externalDatasetAutoCompleteConfiguration = new AutoCompleteConfiguration(this.externalSourcesService.searchDatasetSExternalDatasetservice.bind(this.externalSourcesService), externalDatasetRequestItem);
this.externalDatasetAutoCompleteConfiguration = new AutoCompleteConfiguration(this.externalSourcesService.searchDatasetSExternalDatasetservice.bind(this.externalSourcesService),
externalDatasetRequestItem, new BehaviorSubject(false));
const registriesRequestItem: RequestItem<RegistryCriteria> = new RequestItem();
registriesRequestItem.criteria = new RegistryCriteria();
this.registriesAutoCompleteConfiguration = new AutoCompleteConfiguration(this.externalSourcesService.searchDatasetRegistry.bind(this.externalSourcesService), registriesRequestItem);
this.registriesAutoCompleteConfiguration = new AutoCompleteConfiguration(this.externalSourcesService.searchDatasetRegistry.bind(this.externalSourcesService),
registriesRequestItem, new BehaviorSubject(false));
const dataRepositoriesRequestItem: RequestItem<DataRepositoryCriteria> = new RequestItem();
dataRepositoriesRequestItem.criteria = new DataRepositoryCriteria();
this.dataRepositoriesAutoCompleteConfiguration = new AutoCompleteConfiguration(this.externalSourcesService.searchDatasetRepository.bind(this.externalSourcesService), dataRepositoriesRequestItem);
this.dataRepositoriesAutoCompleteConfiguration = new AutoCompleteConfiguration(this.externalSourcesService.searchDatasetRepository.bind(this.externalSourcesService),
dataRepositoriesRequestItem, new BehaviorSubject(false));
const servicesRequestItem: RequestItem<ServicesCriteria> = new RequestItem();
servicesRequestItem.criteria = new ServicesCriteria();
this.servicesAutoCompleteConfiguration = new AutoCompleteConfiguration(this.externalSourcesService.searchDatasetService.bind(this.externalSourcesService), servicesRequestItem);
this.servicesAutoCompleteConfiguration = new AutoCompleteConfiguration(this.externalSourcesService.searchDatasetService.bind(this.externalSourcesService),
servicesRequestItem, new BehaviorSubject(false));
const tagsRequestItem: RequestItem<TagsCriteria> = new RequestItem();
tagsRequestItem.criteria = new TagsCriteria();
this.tagsAutoCompleteConfiguration = new AutoCompleteConfiguration(this.externalSourcesService.searchDatasetTags.bind(this.externalSourcesService), tagsRequestItem);
this.tagsAutoCompleteConfiguration = new AutoCompleteConfiguration(this.externalSourcesService.searchDatasetTags.bind(this.externalSourcesService),
tagsRequestItem, new BehaviorSubject(false));
this.externalSourcesConfigurationService.getExternalSourcesConfiguration().subscribe(result => {
this.externalSourcesConfiguration = result;
@ -465,12 +471,14 @@ export class DatasetWizardComponent implements OnInit, AfterViewInit, IBreadCrum
public enableForm() {
this.editMode = true;
this.viewOnly = false;
this.formGroup.enable();
}
public disableForm() {
this.editMode = false;
this.viewOnly = true;
this.formGroup.disable();
}
}

View File

@ -166,7 +166,6 @@ export class ProjectEditorComponent implements OnInit, IBreadCrumbComponent {
this.editMode = true;
this.formGroup.enable();
}
}
public disableForm() {

View File

@ -1,11 +1,14 @@
import { BaseCriteria } from '../../../models/criteria/BaseCriteria';
import { RequestItem } from '../../../models/criteria/RequestItem';
import { BehaviorSubject } from 'rxjs';
export class AutoCompleteConfiguration {
public callback: Function;
public refreshEvent: BehaviorSubject<boolean>;
public requestItem: RequestItem<any>;
constructor(callback: Function, requestItem: RequestItem<any>) {
constructor(callback: Function, requestItem: RequestItem<any>, refreshEvent = null) {
this.callback = callback;
this.requestItem = requestItem;
this.refreshEvent = refreshEvent;
}
}

View File

@ -1,4 +1,4 @@
import { Input, OnInit, Component, AfterViewInit, Output, EventEmitter, OnChanges } from '@angular/core';
import { Input, OnInit, Component, AfterViewInit, Output, EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
import { FormGroup, FormControl, FormGroupDirective, NgForm } from '@angular/forms';
import { ErrorStateMatcher } from '@angular/material';
import { AutoCompleteConfiguration } from './AutoCompleteConfiguration';
@ -39,7 +39,13 @@ export class AutoCompleteComponent implements OnInit, ErrorStateMatcher {
}
ngOnInit() {
this.inputData.refreshEvent.subscribe(x => {
if (x) {
this.formCtrl.patchValue(null);
this.textFormCtrl.patchValue(null);
this.options = [];
}
});
this.textFormCtrl = new FormControl();
if (this.disabled) { this.textFormCtrl.disable(); }
this.formCtrl.registerOnDisabledChange(isDisabled => {

View File

@ -11,8 +11,8 @@
</mat-form-field>
</div>
<div>
<app-external-item class="col-md-9" [autoCompleteConfiguration]="autoCompleteConfiguration" [formGroup]="formGroup"
[displayFunction]="displayFunction" [placeholder]="placeholder" [subtitleFunction]="subtitleFunction"
<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>

View File

@ -44,7 +44,7 @@ export class ExternalItemListingComponent implements OnInit {
public choice: string;
public formControl = new FormControl();
enabled = true;
ngOnInit() {
if (this.disabled) { this.formControl.disable(); }
@ -57,6 +57,7 @@ export class ExternalItemListingComponent implements OnInit {
selectionChange(event) {
if (this.formControl.disabled) { this.formControl.enable(); }
this.autoCompleteConfiguration.requestItem.criteria['type'] = event.value;
this.autoCompleteConfiguration.refreshEvent.next(true);
}
deleteItem(name: number) {

View File

@ -190,7 +190,8 @@
"GO-TO-DATASETS": "Go To Datasets",
"SAVE": "Save",
"CANCEL": "Cancel",
"DELETE": "Remove"
"DELETE": "Remove",
"FINALISE": "Finalise"
}
},
"CRITERIA": {
@ -408,5 +409,11 @@
"TITLE": "DMP Organisations",
"FILTER": "Filter Organisations"
}
},
"DMP-FINALISE-DIALOG": {
"SUBMIT": "Submit",
"FINALISE-TITLE": "Do you want to finalise any of the following Datasets?",
"ALREADY-FINALISED-DATASETS": "Already Finalised Datasets",
"NONE": "None"
}
}

View File

@ -5,7 +5,7 @@
export const environment = {
production: false,
Server: 'http://devel-21.local.cite.gr:5000/api/',
Server: 'http://devel-21.local.cite.gr:8080/api/',
App: 'http://localhost:4200/',
HelpService: {
Enabled: false,