Add new fields for the Dataset Template (incomplete but functional)

This commit is contained in:
George Kalampokis 2020-06-04 18:37:30 +03:00
parent 81c3e220e8
commit 46cfc3dae6
52 changed files with 1113 additions and 4 deletions

View File

@ -85,6 +85,14 @@ public class ModelBuilder {
if (type.equals("freetext")) return (FieldData<U>) new FreeTextData().fromData(data);
if (type.equals("textarea")) return (FieldData<U>) new TextAreaData().fromData(data);
if (type.equals("datePicker")) return (FieldData<U>) new DatePickerData().fromData(data);
if (type.equals("externalDatasets")) return (FieldData<U>) new ExternalDatasetsData().fromData(data);
if (type.equals("dataRepositories")) return (FieldData<U>) new DataRepositoriesData().fromData(data);
if (type.equals("registries")) return (FieldData<U>) new RegistriesData().fromData(data);
if (type.equals("services")) return (FieldData<U>) new ServicesData().fromData(data);
if (type.equals("tags")) return (FieldData<U>) new TagsData().fromData(data);
if (type.equals("researchers")) return (FieldData<U>) new ResearcherData().fromData(data);
if (type.equals("organizations")) return (FieldData<U>) new OrganizationsData().fromData(data);
if (type.equals("datasetIdentifier")) return (FieldData<U>) new DatasetIdentifierData().fromData(data);
return null;
}
@ -114,6 +122,14 @@ public class ModelBuilder {
if (type.equals("freetext")) return (FieldData<U>) new FreeTextData().fromData(data);
if (type.equals("textarea")) return (FieldData<U>) new TextAreaData().fromData(data);
if (type.equals("datePicker")) return (FieldData<U>) new DatePickerData().fromData(data);
if (type.equals("externalDatasets")) return (FieldData<U>) new ExternalDatasetsData().fromData(data);
if (type.equals("dataRepositories")) return (FieldData<U>) new DataRepositoriesData().fromData(data);
if (type.equals("registries")) return (FieldData<U>) new RegistriesData().fromData(data);
if (type.equals("services")) return (FieldData<U>) new ServicesData().fromData(data);
if (type.equals("tags")) return (FieldData<U>) new TagsData().fromData(data);
if (type.equals("researchers")) return (FieldData<U>) new ResearcherData().fromData(data);
if (type.equals("organizations")) return (FieldData<U>) new OrganizationsData().fromData(data);
if (type.equals("datasetIdentifier")) return (FieldData<U>) new DatasetIdentifierData().fromData(data);
return null;
}
}

View File

@ -0,0 +1,42 @@
package eu.eudat.models.data.components.commons.datafield;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import java.util.HashMap;
import java.util.Map;
public class DataRepositoriesData extends FieldData<DataRepositoriesData> {
@Override
public DataRepositoriesData fromData(Object data) {
if (data != null) {
this.setLabel((String) ((Map<String, Object>) data).get("label"));
}
return this;
}
@Override
public Object toData() {
return null;
}
@Override
public Element toXml(Document doc) {
Element root = doc.createElement("data");
root.setAttribute("label", this.getLabel());
return root;
}
@Override
public DataRepositoriesData fromXml(Element item) {
this.setLabel(item != null ? item.getAttribute("label") : "");
return this;
}
@Override
public Map<String, Object> toMap(Element item) {
HashMap dataMap = new HashMap();
dataMap.put("label", item != null ? item.getAttribute("label") : "");
return dataMap;
}
}

View File

@ -0,0 +1,42 @@
package eu.eudat.models.data.components.commons.datafield;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import java.util.HashMap;
import java.util.Map;
public class DatasetIdentifierData extends FieldData<DatasetIdentifierData> {
@Override
public DatasetIdentifierData fromData(Object data) {
if (data != null) {
this.setLabel((String) ((Map<String, Object>) data).get("label"));
}
return this;
}
@Override
public Object toData() {
return null;
}
@Override
public Element toXml(Document doc) {
Element root = doc.createElement("data");
root.setAttribute("label", this.getLabel());
return root;
}
@Override
public DatasetIdentifierData fromXml(Element item) {
this.setLabel(item != null ? item.getAttribute("label") : "");
return this;
}
@Override
public Map<String, Object> toMap(Element item) {
HashMap dataMap = new HashMap();
dataMap.put("label", item != null ? item.getAttribute("label") : "");
return dataMap;
}
}

View File

@ -0,0 +1,42 @@
package eu.eudat.models.data.components.commons.datafield;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import java.util.HashMap;
import java.util.Map;
public class ExternalDatasetsData extends FieldData<ExternalDatasetsData> {
@Override
public ExternalDatasetsData fromData(Object data) {
if (data != null) {
this.setLabel((String) ((Map<String, Object>) data).get("label"));
}
return this;
}
@Override
public Object toData() {
return null;
}
@Override
public Element toXml(Document doc) {
Element root = doc.createElement("data");
root.setAttribute("label", this.getLabel());
return root;
}
@Override
public ExternalDatasetsData fromXml(Element item) {
this.setLabel(item != null ? item.getAttribute("label") : "");
return this;
}
@Override
public Map<String, Object> toMap(Element item) {
HashMap dataMap = new HashMap();
dataMap.put("label", item != null ? item.getAttribute("label") : "");
return dataMap;
}
}

View File

@ -0,0 +1,42 @@
package eu.eudat.models.data.components.commons.datafield;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import java.util.HashMap;
import java.util.Map;
public class OrganizationsData extends FieldData<OrganizationsData> {
@Override
public OrganizationsData fromData(Object data) {
if (data != null) {
this.setLabel((String) ((Map<String, Object>) data).get("label"));
}
return this;
}
@Override
public Object toData() {
return null;
}
@Override
public Element toXml(Document doc) {
Element root = doc.createElement("data");
root.setAttribute("label", this.getLabel());
return root;
}
@Override
public OrganizationsData fromXml(Element item) {
this.setLabel(item != null ? item.getAttribute("label") : "");
return this;
}
@Override
public Map<String, Object> toMap(Element item) {
HashMap dataMap = new HashMap();
dataMap.put("label", item != null ? item.getAttribute("label") : "");
return dataMap;
}
}

View File

@ -0,0 +1,42 @@
package eu.eudat.models.data.components.commons.datafield;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import java.util.HashMap;
import java.util.Map;
public class RegistriesData extends FieldData<RegistriesData> {
@Override
public RegistriesData fromData(Object data) {
if (data != null) {
this.setLabel((String) ((Map<String, Object>) data).get("label"));
}
return this;
}
@Override
public Object toData() {
return null;
}
@Override
public Element toXml(Document doc) {
Element root = doc.createElement("data");
root.setAttribute("label", this.getLabel());
return root;
}
@Override
public RegistriesData fromXml(Element item) {
this.setLabel(item != null ? item.getAttribute("label") : "");
return this;
}
@Override
public Map<String, Object> toMap(Element item) {
HashMap dataMap = new HashMap();
dataMap.put("label", item != null ? item.getAttribute("label") : "");
return dataMap;
}
}

View File

@ -0,0 +1,42 @@
package eu.eudat.models.data.components.commons.datafield;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import java.util.HashMap;
import java.util.Map;
public class ResearcherData extends FieldData<ResearcherData> {
@Override
public ResearcherData fromData(Object data) {
if (data != null) {
this.setLabel((String) ((Map<String, Object>) data).get("label"));
}
return this;
}
@Override
public Object toData() {
return null;
}
@Override
public Element toXml(Document doc) {
Element root = doc.createElement("data");
root.setAttribute("label", this.getLabel());
return root;
}
@Override
public ResearcherData fromXml(Element item) {
this.setLabel(item != null ? item.getAttribute("label") : "");
return this;
}
@Override
public Map<String, Object> toMap(Element item) {
HashMap dataMap = new HashMap();
dataMap.put("label", item != null ? item.getAttribute("label") : "");
return dataMap;
}
}

View File

@ -0,0 +1,42 @@
package eu.eudat.models.data.components.commons.datafield;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import java.util.HashMap;
import java.util.Map;
public class ServicesData extends FieldData<ServicesData> {
@Override
public ServicesData fromData(Object data) {
if (data != null) {
this.setLabel((String) ((Map<String, Object>) data).get("label"));
}
return this;
}
@Override
public Object toData() {
return null;
}
@Override
public Element toXml(Document doc) {
Element root = doc.createElement("data");
root.setAttribute("label", this.getLabel());
return root;
}
@Override
public ServicesData fromXml(Element item) {
this.setLabel(item != null ? item.getAttribute("label") : "");
return this;
}
@Override
public Map<String, Object> toMap(Element item) {
HashMap dataMap = new HashMap();
dataMap.put("label", item != null ? item.getAttribute("label") : "");
return dataMap;
}
}

View File

@ -0,0 +1,42 @@
package eu.eudat.models.data.components.commons.datafield;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import java.util.HashMap;
import java.util.Map;
public class TagsData extends FieldData<TagsData> {
@Override
public TagsData fromData(Object data) {
if (data != null) {
this.setLabel((String) ((Map<String, Object>) data).get("label"));
}
return this;
}
@Override
public Object toData() {
return null;
}
@Override
public Element toXml(Document doc) {
Element root = doc.createElement("data");
root.setAttribute("label", this.getLabel());
return root;
}
@Override
public TagsData fromXml(Element item) {
this.setLabel(item != null ? item.getAttribute("label") : "");
return this;
}
@Override
public Map<String, Object> toMap(Element item) {
HashMap dataMap = new HashMap();
dataMap.put("label", item != null ? item.getAttribute("label") : "");
return dataMap;
}
}

View File

@ -6,5 +6,13 @@ export enum DatasetProfileFieldViewStyle {
FreeText = "freetext",
RadioBox = "radiobox",
DatePicker = "datePicker",
InternalDmpEntities = "internalDmpEntities"
InternalDmpEntities = "internalDmpEntities",
ExternalDatasets = "externalDatasets",
DataRepositories = "dataRepositories",
Registries = "registries",
Services = "services",
Tags = "tags",
Researchers = "researchers",
Organizations = "organizations",
DatasetIdentifier = "datasetIdentifier"
}

View File

@ -68,3 +68,35 @@ export interface DmpsAutoCompleteFieldData extends FieldData {
type: DatasetProfileInternalDmpEntitiesType;
multiAutoComplete: boolean;
}
export interface ExternalDatasetsFieldData extends FieldData {
}
export interface DataRepositoriesFieldData extends FieldData {
}
export interface RegistriesFieldData extends FieldData {
}
export interface ServicesFieldData extends FieldData {
}
export interface TagsFieldData extends FieldData {
}
export interface ResearchersFieldData extends FieldData {
}
export interface OrganizationsFieldData extends FieldData {
}
export interface DatasetIdentifierFieldData extends FieldData {
}

View File

@ -75,6 +75,14 @@ export class EnumUtils {
case DatasetProfileFieldViewStyle.RadioBox: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.RADIO-BOX');
case DatasetProfileFieldViewStyle.TextArea: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.TEXT-AREA');
case DatasetProfileFieldViewStyle.DatePicker: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.DATE-PICKER');
case DatasetProfileFieldViewStyle.ExternalDatasets: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.EXTERNAL-DATASETS');
case DatasetProfileFieldViewStyle.DataRepositories: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.DATA-REPOSITORIES');
case DatasetProfileFieldViewStyle.Registries: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.REGISTRIES');
case DatasetProfileFieldViewStyle.Services: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.SERVICES');
case DatasetProfileFieldViewStyle.Tags: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.TAGS');
case DatasetProfileFieldViewStyle.Researchers: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.RESEARCHERS');
case DatasetProfileFieldViewStyle.Organizations: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.ORGANIZATIONS');
case DatasetProfileFieldViewStyle.DatasetIdentifier: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.DATASET-IDENTIFIER');
}
}

View File

@ -0,0 +1,19 @@
import { FormGroup } from '@angular/forms';
import { FieldDataEditorModel } from './field-data-editor-model';
import { DatePickerFieldData, ExternalDatasetsFieldData, DataRepositoriesFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
export class DataRepositoriesDataEditorModel extends FieldDataEditorModel<DataRepositoriesDataEditorModel> {
public label: string;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('DataRepositoriesDataEditorModel.label')) }]
});
return formGroup;
}
fromModel(item: DataRepositoriesFieldData): DataRepositoriesDataEditorModel {
this.label = item.label;
return this;
}
}

View File

@ -0,0 +1,19 @@
import { FormGroup } from '@angular/forms';
import { FieldDataEditorModel } from './field-data-editor-model';
import { DatePickerFieldData, ExternalDatasetsFieldData, DataRepositoriesFieldData, RegistriesFieldData, ServicesFieldData, TagsFieldData, ResearchersFieldData, OrganizationsFieldData, DatasetIdentifierFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
export class DatasetIdentifierDataEditorModel extends FieldDataEditorModel<DatasetIdentifierDataEditorModel> {
public label: string;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('DatasetIdentifierDataEditorModel.label')) }]
});
return formGroup;
}
fromModel(item: DatasetIdentifierFieldData): DatasetIdentifierDataEditorModel {
this.label = item.label;
return this;
}
}

View File

@ -0,0 +1,19 @@
import { FormGroup } from '@angular/forms';
import { FieldDataEditorModel } from './field-data-editor-model';
import { DatePickerFieldData, ExternalDatasetsFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
export class ExternalDatasetsDataEditorModel extends FieldDataEditorModel<ExternalDatasetsDataEditorModel> {
public label: string;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('ExternalDatasetsDataEditorModel.label')) }]
});
return formGroup;
}
fromModel(item: ExternalDatasetsFieldData): ExternalDatasetsDataEditorModel {
this.label = item.label;
return this;
}
}

View File

@ -0,0 +1,19 @@
import { FormGroup } from '@angular/forms';
import { FieldDataEditorModel } from './field-data-editor-model';
import { DatePickerFieldData, ExternalDatasetsFieldData, DataRepositoriesFieldData, RegistriesFieldData, ServicesFieldData, TagsFieldData, ResearchersFieldData, OrganizationsFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
export class OrganizationsDataEditorModel extends FieldDataEditorModel<OrganizationsDataEditorModel> {
public label: string;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('OrganizationsDataEditorModel.label')) }]
});
return formGroup;
}
fromModel(item: OrganizationsFieldData): OrganizationsDataEditorModel {
this.label = item.label;
return this;
}
}

View File

@ -0,0 +1,19 @@
import { FormGroup } from '@angular/forms';
import { FieldDataEditorModel } from './field-data-editor-model';
import { DatePickerFieldData, ExternalDatasetsFieldData, DataRepositoriesFieldData, RegistriesFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
export class RegistriesDataEditorModel extends FieldDataEditorModel<RegistriesDataEditorModel> {
public label: string;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('RegistriesDataEditorModel.label')) }]
});
return formGroup;
}
fromModel(item: RegistriesFieldData): RegistriesDataEditorModel {
this.label = item.label;
return this;
}
}

View File

@ -0,0 +1,19 @@
import { FormGroup } from '@angular/forms';
import { FieldDataEditorModel } from './field-data-editor-model';
import { DatePickerFieldData, ExternalDatasetsFieldData, DataRepositoriesFieldData, RegistriesFieldData, ServicesFieldData, TagsFieldData, ResearchersFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
export class ResearchersDataEditorModel extends FieldDataEditorModel<ResearchersDataEditorModel> {
public label: string;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('ResearchersDataEditorModel.label')) }]
});
return formGroup;
}
fromModel(item: ResearchersFieldData): ResearchersDataEditorModel {
this.label = item.label;
return this;
}
}

View File

@ -0,0 +1,19 @@
import { FormGroup } from '@angular/forms';
import { FieldDataEditorModel } from './field-data-editor-model';
import { DatePickerFieldData, ExternalDatasetsFieldData, DataRepositoriesFieldData, RegistriesFieldData, ServicesFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
export class ServicesDataEditorModel extends FieldDataEditorModel<ServicesDataEditorModel> {
public label: string;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('ServicesDataEditorModel.label')) }]
});
return formGroup;
}
fromModel(item: ServicesFieldData): ServicesDataEditorModel {
this.label = item.label;
return this;
}
}

View File

@ -0,0 +1,19 @@
import { FormGroup } from '@angular/forms';
import { FieldDataEditorModel } from './field-data-editor-model';
import { DatePickerFieldData, ExternalDatasetsFieldData, DataRepositoriesFieldData, RegistriesFieldData, ServicesFieldData, TagsFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
export class TagsDataEditorModel extends FieldDataEditorModel<TagsDataEditorModel> {
public label: string;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('TagsDataEditorModel.label')) }]
});
return formGroup;
}
fromModel(item: TagsFieldData): TagsDataEditorModel {
this.label = item.label;
return this;
}
}

View File

@ -18,6 +18,14 @@ import { DatePickerDataEditorModel } from './field-data/date-picker-data-editor-
import { ResearchersAutoCompleteFieldDataEditorModel } from './field-data/researchers-auto-complete-field-data-editor-model';
import { DatasetsAutoCompleteFieldDataEditorModel } from './field-data/datasets-autocomplete-field-data-editor-mode';
import { DmpsAutoCompleteFieldDataEditorModel } from './field-data/dmps-autocomplete-field-data-editor-model';
import { ExternalDatasetsDataEditorModel } from './field-data/external-datasets-data-editor-models';
import { DataRepositoriesDataEditorModel } from './field-data/data-repositories-data-editor-models';
import { RegistriesDataEditorModel } from './field-data/registries-data-editor-models';
import { ServicesDataEditorModel } from './field-data/services-data-editor-models';
import { TagsDataEditorModel } from './field-data/tags-data-editor-models';
import { ResearchersDataEditorModel } from './field-data/researchers-data-editor-models';
import { OrganizationsDataEditorModel } from './field-data/organizations-data-editor-models';
import { DatasetIdentifierDataEditorModel } from './field-data/dataset-identifier-data-editor-models';
export class FieldEditorModel extends BaseFormModel {
@ -57,6 +65,14 @@ export class FieldEditorModel extends BaseFormModel {
if (this.viewStyle.renderStyle === 'freetext') { this.data = new FreeTextFieldDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'booleanDecision') { this.data = new BooleanDecisionFieldDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'datePicker') { this.data = new DatePickerDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'externalDatasets') { this.data = new ExternalDatasetsDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'dataRepositories') { this.data = new DataRepositoriesDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'registeries') { this.data = new RegistriesDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'services') { this.data = new ServicesDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'tags') { this.data = new TagsDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'researchers') { this.data = new ResearchersDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'organizations') { this.data = new OrganizationsDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'datasetIdentifier') { this.data = new DatasetIdentifierDataEditorModel().fromModel(item.data); }
}
}
return this;

View File

@ -28,6 +28,14 @@ import { DatasetProfileListingComponent } from '@app/ui/admin/dataset-profile/li
import { CommonFormsModule } from '@common/forms/common-forms.module';
import { CommonUiModule } from '@common/ui/common-ui.module';
import { ParseStatus } from './listing/pipe/parse-status.pipe';
import { DatasetProfileEditorExternalDatasetsFieldComponent } from './editor/components/field-type/external-datasets/dataset-profile-editor-external-datasets-field.component';
import { DatasetProfileEditorDataRepositoriesFieldComponent } from './editor/components/field-type/data-repositories/dataset-profile-editor-data-repositories-field.component';
import { DatasetProfileEditorRegistriesFieldComponent } from './editor/components/field-type/registries/dataset-profile-editor-registries-field.component';
import { DatasetProfileEditorServicesFieldComponent } from './editor/components/field-type/services/dataset-profile-editor-services-field.component';
import { DatasetProfileEditorTagsFieldComponent } from './editor/components/field-type/tags/dataset-profile-editor-tags-field.component';
import { DatasetProfileEditorResearchersFieldComponent } from './editor/components/field-type/researchers/dataset-profile-editor-researchers-field.component';
import { DatasetProfileEditorOrganizationsFieldComponent } from './editor/components/field-type/organizations/dataset-profile-editor-organizations-field.component';
import { DatasetProfileEditorDatasetIdentifierFieldComponent } from './editor/components/field-type/dataset-identifier/dataset-profile-editor-dataset-identifier-field.component';
@NgModule({
imports: [
@ -61,7 +69,15 @@ import { ParseStatus } from './listing/pipe/parse-status.pipe';
DatasetProfileEditorResearchersAutoCompleteFieldComponent,
DatasetProfileEditorDatasetsAutoCompleteFieldComponent,
DatasetProfileEditorDmpsAutoCompleteFieldComponent,
ParseStatus
ParseStatus,
DatasetProfileEditorExternalDatasetsFieldComponent,
DatasetProfileEditorDataRepositoriesFieldComponent,
DatasetProfileEditorRegistriesFieldComponent,
DatasetProfileEditorServicesFieldComponent,
DatasetProfileEditorTagsFieldComponent,
DatasetProfileEditorResearchersFieldComponent,
DatasetProfileEditorOrganizationsFieldComponent,
DatasetProfileEditorDatasetIdentifierFieldComponent
],
entryComponents: [
DialodConfirmationUploadDatasetProfiles

View File

@ -0,0 +1,9 @@
<div class="row" *ngIf="form.get('data')">
<h5 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-DATE-PICKER-TITLE'
| translate}}</h5>
<mat-form-field class="col-12">
<input matInput type="string"
placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-CHECKBOX-PLACEHOLDER' | translate}}"
[formControl]="form.get('data').get('label')">
</mat-form-field>
</div>

View File

@ -0,0 +1,20 @@
import { Component, Input, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { DatePickerDataEditorModel } from '../../../../admin/field-data/date-picker-data-editor-models';
import { ExternalDatasetsDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/external-datasets-data-editor-models';
import { DataRepositoriesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/data-repositories-data-editor-models';
@Component({
selector: 'app-dataset-profile-editor-data-repositories-field-component',
styleUrls: ['./dataset-profile-editor-data-repositories-field.component.scss'],
templateUrl: './dataset-profile-editor-data-repositories-field.component.html'
})
export class DatasetProfileEditorDataRepositoriesFieldComponent implements OnInit {
@Input() form: FormGroup;
private data: DataRepositoriesDataEditorModel = new DataRepositoriesDataEditorModel();
ngOnInit() {
if (!this.form.get('data')) { this.form.addControl('data', this.data.buildForm()); }
}
}

View File

@ -0,0 +1,9 @@
<div class="row" *ngIf="form.get('data')">
<h5 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-DATE-PICKER-TITLE'
| translate}}</h5>
<mat-form-field class="col-12">
<input matInput type="string"
placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-CHECKBOX-PLACEHOLDER' | translate}}"
[formControl]="form.get('data').get('label')">
</mat-form-field>
</div>

View File

@ -0,0 +1,18 @@
import { Component, Input, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { DatasetIdentifierDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/dataset-identifier-data-editor-models';
@Component({
selector: 'app-dataset-profile-editor-dataset-identifier-field-component',
styleUrls: ['./dataset-profile-editor-dataset-identifier-field.component.scss'],
templateUrl: './dataset-profile-editor-dataset-identifier-field.component.html'
})
export class DatasetProfileEditorDatasetIdentifierFieldComponent implements OnInit {
@Input() form: FormGroup;
private data: DatasetIdentifierDataEditorModel = new DatasetIdentifierDataEditorModel();
ngOnInit() {
if (!this.form.get('data')) { this.form.addControl('data', this.data.buildForm()); }
}
}

View File

@ -0,0 +1,9 @@
<div class="row" *ngIf="form.get('data')">
<h5 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-DATE-PICKER-TITLE'
| translate}}</h5>
<mat-form-field class="col-12">
<input matInput type="string"
placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-CHECKBOX-PLACEHOLDER' | translate}}"
[formControl]="form.get('data').get('label')">
</mat-form-field>
</div>

View File

@ -0,0 +1,19 @@
import { Component, Input, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { DatePickerDataEditorModel } from '../../../../admin/field-data/date-picker-data-editor-models';
import { ExternalDatasetsDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/external-datasets-data-editor-models';
@Component({
selector: 'app-dataset-profile-editor-external-datasets-field-component',
styleUrls: ['./dataset-profile-editor-external-datasets-field.component.scss'],
templateUrl: './dataset-profile-editor-external-datasets-field.component.html'
})
export class DatasetProfileEditorExternalDatasetsFieldComponent implements OnInit {
@Input() form: FormGroup;
private data: ExternalDatasetsDataEditorModel = new ExternalDatasetsDataEditorModel();
ngOnInit() {
if (!this.form.get('data')) { this.form.addControl('data', this.data.buildForm()); }
}
}

View File

@ -0,0 +1,9 @@
<div class="row" *ngIf="form.get('data')">
<h5 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-DATE-PICKER-TITLE'
| translate}}</h5>
<mat-form-field class="col-12">
<input matInput type="string"
placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-CHECKBOX-PLACEHOLDER' | translate}}"
[formControl]="form.get('data').get('label')">
</mat-form-field>
</div>

View File

@ -0,0 +1,25 @@
import { Component, Input, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { DatePickerDataEditorModel } from '../../../../admin/field-data/date-picker-data-editor-models';
import { ExternalDatasetsDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/external-datasets-data-editor-models';
import { DataRepositoriesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/data-repositories-data-editor-models';
import { RegistriesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/registries-data-editor-models';
import { ServicesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/services-data-editor-models';
import { TagsDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/tags-data-editor-models';
import { ResearchersDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/researchers-data-editor-models';
import { OrganizationsDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/organizations-data-editor-models';
@Component({
selector: 'app-dataset-profile-editor-organizations-field-component',
styleUrls: ['./dataset-profile-editor-organizations-field.component.scss'],
templateUrl: './dataset-profile-editor-organizations-field.component.html'
})
export class DatasetProfileEditorOrganizationsFieldComponent implements OnInit {
@Input() form: FormGroup;
private data: OrganizationsDataEditorModel = new OrganizationsDataEditorModel();
ngOnInit() {
if (!this.form.get('data')) { this.form.addControl('data', this.data.buildForm()); }
}
}

View File

@ -0,0 +1,9 @@
<div class="row" *ngIf="form.get('data')">
<h5 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-DATE-PICKER-TITLE'
| translate}}</h5>
<mat-form-field class="col-12">
<input matInput type="string"
placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-CHECKBOX-PLACEHOLDER' | translate}}"
[formControl]="form.get('data').get('label')">
</mat-form-field>
</div>

View File

@ -0,0 +1,21 @@
import { Component, Input, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { DatePickerDataEditorModel } from '../../../../admin/field-data/date-picker-data-editor-models';
import { ExternalDatasetsDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/external-datasets-data-editor-models';
import { DataRepositoriesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/data-repositories-data-editor-models';
import { RegistriesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/registries-data-editor-models';
@Component({
selector: 'app-dataset-profile-editor-registries-field-component',
styleUrls: ['./dataset-profile-editor-registries-field.component.scss'],
templateUrl: './dataset-profile-editor-registries-field.component.html'
})
export class DatasetProfileEditorRegistriesFieldComponent implements OnInit {
@Input() form: FormGroup;
private data: RegistriesDataEditorModel = new RegistriesDataEditorModel();
ngOnInit() {
if (!this.form.get('data')) { this.form.addControl('data', this.data.buildForm()); }
}
}

View File

@ -0,0 +1,9 @@
<div class="row" *ngIf="form.get('data')">
<h5 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-DATE-PICKER-TITLE'
| translate}}</h5>
<mat-form-field class="col-12">
<input matInput type="string"
placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-CHECKBOX-PLACEHOLDER' | translate}}"
[formControl]="form.get('data').get('label')">
</mat-form-field>
</div>

View File

@ -0,0 +1,24 @@
import { Component, Input, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { DatePickerDataEditorModel } from '../../../../admin/field-data/date-picker-data-editor-models';
import { ExternalDatasetsDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/external-datasets-data-editor-models';
import { DataRepositoriesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/data-repositories-data-editor-models';
import { RegistriesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/registries-data-editor-models';
import { ServicesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/services-data-editor-models';
import { TagsDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/tags-data-editor-models';
import { ResearchersDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/researchers-data-editor-models';
@Component({
selector: 'app-dataset-profile-editor-researchers-field-component',
styleUrls: ['./dataset-profile-editor-researchers-field.component.scss'],
templateUrl: './dataset-profile-editor-researchers-field.component.html'
})
export class DatasetProfileEditorResearchersFieldComponent implements OnInit {
@Input() form: FormGroup;
private data: ResearchersDataEditorModel = new ResearchersDataEditorModel();
ngOnInit() {
if (!this.form.get('data')) { this.form.addControl('data', this.data.buildForm()); }
}
}

View File

@ -0,0 +1,9 @@
<div class="row" *ngIf="form.get('data')">
<h5 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-DATE-PICKER-TITLE'
| translate}}</h5>
<mat-form-field class="col-12">
<input matInput type="string"
placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-CHECKBOX-PLACEHOLDER' | translate}}"
[formControl]="form.get('data').get('label')">
</mat-form-field>
</div>

View File

@ -0,0 +1,22 @@
import { Component, Input, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { DatePickerDataEditorModel } from '../../../../admin/field-data/date-picker-data-editor-models';
import { ExternalDatasetsDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/external-datasets-data-editor-models';
import { DataRepositoriesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/data-repositories-data-editor-models';
import { RegistriesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/registries-data-editor-models';
import { ServicesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/services-data-editor-models';
@Component({
selector: 'app-dataset-profile-editor-services-field-component',
styleUrls: ['./dataset-profile-editor-services-field.component.scss'],
templateUrl: './dataset-profile-editor-services-field.component.html'
})
export class DatasetProfileEditorServicesFieldComponent implements OnInit {
@Input() form: FormGroup;
private data: ServicesDataEditorModel = new ServicesDataEditorModel();
ngOnInit() {
if (!this.form.get('data')) { this.form.addControl('data', this.data.buildForm()); }
}
}

View File

@ -0,0 +1,9 @@
<div class="row" *ngIf="form.get('data')">
<h5 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-DATE-PICKER-TITLE'
| translate}}</h5>
<mat-form-field class="col-12">
<input matInput type="string"
placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-CHECKBOX-PLACEHOLDER' | translate}}"
[formControl]="form.get('data').get('label')">
</mat-form-field>
</div>

View File

@ -0,0 +1,23 @@
import { Component, Input, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { DatePickerDataEditorModel } from '../../../../admin/field-data/date-picker-data-editor-models';
import { ExternalDatasetsDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/external-datasets-data-editor-models';
import { DataRepositoriesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/data-repositories-data-editor-models';
import { RegistriesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/registries-data-editor-models';
import { ServicesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/services-data-editor-models';
import { TagsDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/tags-data-editor-models';
@Component({
selector: 'app-dataset-profile-editor-tags-field-component',
styleUrls: ['./dataset-profile-editor-tags-field.component.scss'],
templateUrl: './dataset-profile-editor-tags-field.component.html'
})
export class DatasetProfileEditorTagsFieldComponent implements OnInit {
@Input() form: FormGroup;
private data: TagsDataEditorModel = new TagsDataEditorModel();
ngOnInit() {
if (!this.form.get('data')) { this.form.addControl('data', this.data.buildForm()); }
}
}

View File

@ -17,6 +17,14 @@
<mat-option [value]="viewStyleEnum.InternalDmpEntities">{{enumUtils.toDatasetProfileFieldViewStyleString(viewStyleEnum.InternalDmpEntities)}}</mat-option>
<mat-option [value]="viewStyleEnum.RadioBox">{{enumUtils.toDatasetProfileFieldViewStyleString(viewStyleEnum.RadioBox)}}</mat-option>
<mat-option [value]="viewStyleEnum.DatePicker">{{enumUtils.toDatasetProfileFieldViewStyleString(viewStyleEnum.DatePicker)}}</mat-option>
<mat-option [value]="viewStyleEnum.ExternalDatasets">{{enumUtils.toDatasetProfileFieldViewStyleString(viewStyleEnum.ExternalDatasets)}}</mat-option>
<mat-option [value]="viewStyleEnum.DataRepositories">{{enumUtils.toDatasetProfileFieldViewStyleString(viewStyleEnum.DataRepositories)}}</mat-option>
<mat-option [value]="viewStyleEnum.Registries">{{enumUtils.toDatasetProfileFieldViewStyleString(viewStyleEnum.Registries)}}</mat-option>
<mat-option [value]="viewStyleEnum.Services">{{enumUtils.toDatasetProfileFieldViewStyleString(viewStyleEnum.Services)}}</mat-option>
<mat-option [value]="viewStyleEnum.Tags">{{enumUtils.toDatasetProfileFieldViewStyleString(viewStyleEnum.Tags)}}</mat-option>
<mat-option [value]="viewStyleEnum.Researchers">{{enumUtils.toDatasetProfileFieldViewStyleString(viewStyleEnum.Researchers)}}</mat-option>
<mat-option [value]="viewStyleEnum.Organizations">{{enumUtils.toDatasetProfileFieldViewStyleString(viewStyleEnum.Organizations)}}</mat-option>
<mat-option [value]="viewStyleEnum.DatasetIdentifier">{{enumUtils.toDatasetProfileFieldViewStyleString(viewStyleEnum.DatasetIdentifier)}}</mat-option>
</mat-select>
<mat-error *ngIf="this.form.get('viewStyle').get('renderStyle').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
@ -63,6 +71,15 @@
<app-dataset-profile-editor-boolean-decision-field-component *ngSwitchCase="viewStyleEnum.BooleanDecision" class="col-12"
[form]="form"></app-dataset-profile-editor-boolean-decision-field-component>
<app-dataset-profile-editor-checkbox-field-component *ngSwitchCase="viewStyleEnum.CheckBox" class="col-12" [form]="form"></app-dataset-profile-editor-checkbox-field-component>
<app-dataset-profile-editor-external-datasets-field-component *ngSwitchCase="viewStyleEnum.ExternalDatasets" class="col-12" [form]="form"></app-dataset-profile-editor-external-datasets-field-component>
<app-dataset-profile-editor-data-repositories-field-component *ngSwitchCase="viewStyleEnum.DataRepositories" class="col-12" [form]="form"></app-dataset-profile-editor-data-repositories-field-component>
<app-dataset-profile-editor-registries-field-component *ngSwitchCase="viewStyleEnum.Registries" class="col-12" [form]="form"></app-dataset-profile-editor-registries-field-component>
<app-dataset-profile-editor-services-field-component *ngSwitchCase="viewStyleEnum.Services" class="col-12" [form]="form"></app-dataset-profile-editor-services-field-component>
<app-dataset-profile-editor-tags-field-component *ngSwitchCase="viewStyleEnum.Tags" class="col-12" [form]="form"></app-dataset-profile-editor-tags-field-component>
<app-dataset-profile-editor-researchers-field-component *ngSwitchCase="viewStyleEnum.Researchers" class="col-12" [form]="form"></app-dataset-profile-editor-researchers-field-component>
<app-dataset-profile-editor-organizations-field-component *ngSwitchCase="viewStyleEnum.Organizations" class="col-12" [form]="form"></app-dataset-profile-editor-organizations-field-component>
<app-dataset-profile-editor-dataset-identifier-field-component *ngSwitchCase="viewStyleEnum.DatasetIdentifier" class="col-12" [form]="form"></app-dataset-profile-editor-dataset-identifier-field-component>
</div>
<div class="row">
<h4 class="col-12" style="font-weight: bold">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.RULES-TITLE' | translate}}

View File

@ -16,6 +16,15 @@ import { WordListFieldDataEditorModel } from '@app/ui/admin/dataset-profile/admi
import { RuleEditorModel } from '@app/ui/admin/dataset-profile/admin/rule-editor-model';
import { BaseComponent } from '@common/base/base.component';
import { takeUntil } from 'rxjs/operators';
import { ExternalDatasetEditorModel } from '@app/ui/dataset/dataset-wizard/dataset-wizard-editor.model';
import { DataRepositoriesDataEditorModel } from '../../../admin/field-data/data-repositories-data-editor-models';
import { RegistriesDataEditorModel } from '../../../admin/field-data/registries-data-editor-models';
import { ServicesDataEditorModel } from '../../../admin/field-data/services-data-editor-models';
import { TagsDataEditorModel } from '../../../admin/field-data/tags-data-editor-models';
import { ResearchersDataEditorModel } from '../../../admin/field-data/researchers-data-editor-models';
import { OrganizationsDataEditorModel } from '../../../admin/field-data/organizations-data-editor-models';
import { DatasetIdentifierDataEditorModel } from '../../../admin/field-data/dataset-identifier-data-editor-models';
import { ExternalDatasetsDataEditorModel } from '../../../admin/field-data/external-datasets-data-editor-models';
@Component({
selector: 'app-dataset-profile-editor-field-component',
@ -76,6 +85,30 @@ export class DatasetProfileEditorFieldComponent extends BaseComponent implements
case DatasetProfileFieldViewStyle.DatePicker:
this.form.addControl('data', new DatePickerDataEditorModel().buildForm());
break;
case DatasetProfileFieldViewStyle.ExternalDatasets:
this.form.addControl('data', new ExternalDatasetsDataEditorModel().buildForm());
break;
case DatasetProfileFieldViewStyle.DataRepositories:
this.form.addControl('data', new DataRepositoriesDataEditorModel().buildForm());
break;
case DatasetProfileFieldViewStyle.Registries:
this.form.addControl('data', new RegistriesDataEditorModel().buildForm());
break;
case DatasetProfileFieldViewStyle.Services:
this.form.addControl('data', new ServicesDataEditorModel().buildForm());
break;
case DatasetProfileFieldViewStyle.Tags:
this.form.addControl('data', new TagsDataEditorModel().buildForm());
break;
case DatasetProfileFieldViewStyle.Researchers:
this.form.addControl('data', new ResearchersDataEditorModel().buildForm());
break;
case DatasetProfileFieldViewStyle.Organizations:
this.form.addControl('data', new OrganizationsDataEditorModel().buildForm());
break;
case DatasetProfileFieldViewStyle.DatasetIdentifier:
this.form.addControl('data', new DatasetIdentifierDataEditorModel().buildForm());
break;
}
}
});
@ -92,6 +125,14 @@ export class DatasetProfileEditorFieldComponent extends BaseComponent implements
case DatasetProfileFieldViewStyle.InternalDmpEntities:
case DatasetProfileFieldViewStyle.BooleanDecision:
case DatasetProfileFieldViewStyle.DatePicker:
case DatasetProfileFieldViewStyle.ExternalDatasets:
case DatasetProfileFieldViewStyle.DataRepositories:
case DatasetProfileFieldViewStyle.Registries:
case DatasetProfileFieldViewStyle.Services:
case DatasetProfileFieldViewStyle.Tags:
case DatasetProfileFieldViewStyle.Registries:
case DatasetProfileFieldViewStyle.Organizations:
case DatasetProfileFieldViewStyle.DatasetIdentifier:
return false;
default:
return false;

View File

@ -47,7 +47,7 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl
initialItems: (type) => this.searchDatasetExternalDatasets('', type),//.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1),
displayFn: (item) => item ? item.name : null,
titleFn: (item) => item ? item.name : null,
subtitleFn: (item) => item.source ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.source : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE')
subtitleFn: (item) => item.source ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.source : item.tag ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.tag : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE')
};
registriesAutoCompleteConfiguration: SingleAutoCompleteConfiguration = {

View File

@ -132,4 +132,108 @@
{{'GENERAL.VALIDATION.REQUIRED' | translate}}
</mat-error>
</mat-form-field>
<div *ngSwitchCase="datasetProfileFieldViewStyleEnum.ExternalDatasets" class="col-12">
<div class="row">
<mat-form-field class="col-md-12">
<app-single-auto-complete placeholder="{{ form.get('data').value.label | translate }}" [formControl]="form.get('value')"
[configuration]="externalDatasetAutoCompleteConfiguration" [required]="form.get('validationRequired').value">
</app-single-auto-complete>
<mat-error *ngIf="form.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
</mat-error>
<mat-hint>{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}</mat-hint>
</mat-form-field>
</div>
</div>
<div *ngSwitchCase="datasetProfileFieldViewStyleEnum.DataRepositories" class="col-12">
<div class="row">
<mat-form-field class="col-md-12">
<app-single-auto-complete placeholder="{{ form.get('data').value.label | translate }}" [formControl]="form.get('value')"
[configuration]="dataRepositoriesAutoCompleteConfiguration" [required]="form.get('validationRequired').value">
</app-single-auto-complete>
<mat-error *ngIf="form.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
</mat-error>
<mat-hint>{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}</mat-hint>
</mat-form-field>
</div>
</div>
<div *ngSwitchCase="datasetProfileFieldViewStyleEnum.Registries" class="col-12">
<div class="row">
<mat-form-field class="col-md-12">
<app-single-auto-complete placeholder="{{ form.get('data').value.label | translate }}" [formControl]="form.get('value')"
[configuration]="registriesAutoCompleteConfiguration" [required]="form.get('validationRequired').value">
</app-single-auto-complete>
<mat-error *ngIf="form.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
</mat-error>
<mat-hint>{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}</mat-hint>
</mat-form-field>
</div>
</div>
<div *ngSwitchCase="datasetProfileFieldViewStyleEnum.Services" class="col-12">
<div class="row">
<mat-form-field class="col-md-12">
<app-single-auto-complete placeholder="{{ form.get('data').value.label | translate }}" [formControl]="form.get('value')"
[configuration]="servicesAutoCompleteConfiguration" [required]="form.get('validationRequired').value">
</app-single-auto-complete>
<mat-error *ngIf="form.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
</mat-error>
<mat-hint>{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}</mat-hint>
</mat-form-field>
</div>
</div>
<div *ngSwitchCase="datasetProfileFieldViewStyleEnum.Tags" class="col-12">
<div class="row">
<mat-form-field class="col-md-12">
<app-single-auto-complete placeholder="{{ form.get('data').value.label | translate }}" [formControl]="form.get('value')"
[configuration]="servicesAutoCompleteConfiguration" [required]="form.get('validationRequired').value">
</app-single-auto-complete>
<mat-error *ngIf="form.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
</mat-error>
<mat-hint>{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}</mat-hint>
</mat-form-field>
</div>
</div>
<div *ngSwitchCase="datasetProfileFieldViewStyleEnum.Researchers" class="col-12">
<div class="row">
<mat-form-field class="col-md-12">
<app-single-auto-complete placeholder="{{ form.get('data').value.label | translate }}" [formControl]="form.get('value')"
[configuration]="servicesAutoCompleteConfiguration" [required]="form.get('validationRequired').value">
</app-single-auto-complete>
<mat-error *ngIf="form.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
</mat-error>
<mat-hint>{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}</mat-hint>
</mat-form-field>
</div>
</div>
<div *ngSwitchCase="datasetProfileFieldViewStyleEnum.Organizations" class="col-12">
<div class="row">
<mat-form-field class="col-md-12">
<app-single-auto-complete placeholder="{{ form.get('data').value.label | translate }}" [formControl]="form.get('value')"
[configuration]="servicesAutoCompleteConfiguration" [required]="form.get('validationRequired').value">
</app-single-auto-complete>
<mat-error *ngIf="form.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
</mat-error>
<mat-hint>{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}</mat-hint>
</mat-form-field>
</div>
</div>
<div *ngSwitchCase="datasetProfileFieldViewStyleEnum.DatasetIdentifier" class="col-12">
<div class="row">
<mat-form-field class="col-md-12">
<app-single-auto-complete placeholder="{{ form.get('data').value.label | translate }}" [formControl]="form.get('value')"
[configuration]="servicesAutoCompleteConfiguration" [required]="form.get('validationRequired').value">
</app-single-auto-complete>
<mat-error *ngIf="form.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
</mat-error>
<mat-hint>{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}</mat-hint>
</mat-form-field>
</div>
</div>
</div>

View File

@ -20,6 +20,13 @@ import { VisibilityRulesService } from '@app/ui/misc/dataset-description-form/vi
import { BaseComponent } from '@common/base/base.component';
import { TranslateService } from '@ngx-translate/core';
import { map, takeUntil } from 'rxjs/operators';
import { Observable } from 'rxjs';
import { ExternalSourceItemModel } from '@app/core/model/external-sources/external-source-item';
import { ExternalDatasetCriteria } from '@app/core/query/external-dataset/external-dataset-criteria';
import { DataRepositoryCriteria } from '@app/core/query/data-repository/data-repository-criteria';
import { RegistryCriteria } from '@app/core/query/registry/registry-criteria';
import { ServiceCriteria } from '@app/core/query/service/service-criteria';
import { TagCriteria } from '@app/core/query/tag/tag-criteria';
@Component({
selector: 'app-form-field',
@ -51,6 +58,46 @@ export class FormFieldComponent extends BaseComponent implements OnInit {
private dmpService: DmpService
) { super(); }
externalDatasetAutoCompleteConfiguration: SingleAutoCompleteConfiguration = {
filterFn: this.searchDatasetExternalDatasets.bind(this),
initialItems: (type) => this.searchDatasetExternalDatasets('', type),//.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1),
displayFn: (item) => item ? item.name : null,
titleFn: (item) => item ? item.name : null,
subtitleFn: (item) => item.source ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.source : item.tag ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.tag : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE')
};
registriesAutoCompleteConfiguration: SingleAutoCompleteConfiguration = {
filterFn: this.searchDatasetExternalRegistries.bind(this),
initialItems: (type) => this.searchDatasetExternalRegistries('', type),
displayFn: (item) => item ? item.name : null,
titleFn: (item) => item ? item.name : null,
subtitleFn: (item) => item.source ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.source : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE')
};
dataRepositoriesAutoCompleteConfiguration: SingleAutoCompleteConfiguration = {
filterFn: this.searchDatasetExternalDataRepositories.bind(this),
initialItems: (type) => this.searchDatasetExternalDataRepositories('', type),
displayFn: (item) => item ? item.name : null,
titleFn: (item) => item ? item.name : null,
subtitleFn: (item) => item.source ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.source : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE')
};
servicesAutoCompleteConfiguration: SingleAutoCompleteConfiguration = {
filterFn: this.searchDatasetExternalServices.bind(this),
initialItems: (type) => this.searchDatasetExternalServices('', type),
displayFn: (item) => item ? item.label : null,
titleFn: (item) => item ? item.label : null,
subtitleFn: (item) => item.source ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.source : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE')
};
tagsAutoCompleteConfiguration: SingleAutoCompleteConfiguration = {
filterFn: this.searchDatasetTags.bind(this),
initialItems: (type) => this.searchDatasetTags('', type),
displayFn: (item) => item ? item.name : null,
titleFn: (item) => item ? item.name : null,
subtitleFn: (item) => item.tag ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.tag : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE')
};
ngOnInit() {
if (this.form.get('value').value) {
this.visibilityRulesService.updateValueAndVisibility(this.form.get('id').value, this.form.get('value').value);
@ -166,4 +213,44 @@ export class FormFieldComponent extends BaseComponent implements OnInit {
}
}
}
searchDatasetExternalDatasets(query: string, type: string): Observable<ExternalSourceItemModel[]> {
const requestItem: RequestItem<ExternalDatasetCriteria> = new RequestItem();
requestItem.criteria = new ExternalDatasetCriteria();
requestItem.criteria.like = query;
requestItem.criteria.type = type;
return this.externalSourcesService.searchDatasetSExternalDatasetservice(requestItem);
}
searchDatasetExternalDataRepositories(query: string, type: string): Observable<ExternalSourceItemModel[]> {
const requestItem: RequestItem<DataRepositoryCriteria> = new RequestItem();
requestItem.criteria = new DataRepositoryCriteria();
requestItem.criteria.like = query;
requestItem.criteria.type = type;
return this.externalSourcesService.searchDatasetRepository(requestItem);
}
searchDatasetExternalRegistries(query: string, type: string): Observable<ExternalSourceItemModel[]> {
const requestItem: RequestItem<RegistryCriteria> = new RequestItem();
requestItem.criteria = new RegistryCriteria();
requestItem.criteria.like = query;
requestItem.criteria.type = type;
return this.externalSourcesService.searchDatasetRegistry(requestItem);
}
searchDatasetExternalServices(query: string, type: string): Observable<ExternalSourceItemModel[]> {
const requestItem: RequestItem<ServiceCriteria> = new RequestItem();
requestItem.criteria = new ServiceCriteria();
requestItem.criteria.like = query;
requestItem.criteria.type = type;
return this.externalSourcesService.searchDatasetService(requestItem);
}
searchDatasetTags(query: string, type: string): Observable<ExternalSourceItemModel[]> {
const requestItem: RequestItem<TagCriteria> = new RequestItem();
requestItem.criteria = new TagCriteria();
requestItem.criteria.like = query;
requestItem.criteria.type = type;
return this.externalSourcesService.searchDatasetTags(requestItem);
}
}

View File

@ -933,7 +933,15 @@
"FREE-TEXT": "Free Text",
"RADIO-BOX": "Radio Box",
"TEXT-AREA": "Text Area",
"DATE-PICKER": "Date Picker"
"DATE-PICKER": "Date Picker",
"EXTERNAL-DATASETS": "External Datasets",
"DATA-REPOSITORIES": "Data Repositories",
"REGISTRIES": "Registries",
"SERVICES": "Services",
"TAGS": "Tags",
"RESEARCHERS": "Researchers",
"ORGANIZATIONS": "Organizations",
"DATASET-IDENTIFIER": "Dataset Identifier"
},
"DATASET-PROFILE-COMBO-BOX-TYPE": {
"WORD-LIST": "Word List",