External Dataset type (newly added field).
This commit is contained in:
parent
1a6df44eeb
commit
ef7de5efe3
|
@ -0,0 +1,5 @@
|
||||||
|
export enum ExternalDatasetTypeEnum{
|
||||||
|
ReusedDataset = "reused_dataset",
|
||||||
|
ProducedDataset = "produced_dataset",
|
||||||
|
Other = "other"
|
||||||
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { ExternalDatasetTypeEnum } from "@app/core/common/enum/external-dataset-type-enum";
|
||||||
import { DatasetProfileComboBoxType } from "../../../common/enum/dataset-profile-combo-box-type";
|
import { DatasetProfileComboBoxType } from "../../../common/enum/dataset-profile-combo-box-type";
|
||||||
import { DatasetProfileInternalDmpEntitiesType } from "../../../common/enum/dataset-profile-internal-dmp-entities-type";
|
import { DatasetProfileInternalDmpEntitiesType } from "../../../common/enum/dataset-profile-internal-dmp-entities-type";
|
||||||
|
|
||||||
|
@ -72,6 +73,7 @@ export interface DmpsAutoCompleteFieldData extends FieldData {
|
||||||
|
|
||||||
export interface ExternalDatasetsFieldData extends FieldData {
|
export interface ExternalDatasetsFieldData extends FieldData {
|
||||||
multiAutoComplete: boolean;
|
multiAutoComplete: boolean;
|
||||||
|
type?: ExternalDatasetTypeEnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DataRepositoriesFieldData extends FieldData {
|
export interface DataRepositoriesFieldData extends FieldData {
|
||||||
|
|
|
@ -1,15 +1,18 @@
|
||||||
import { FormGroup } from '@angular/forms';
|
import { FormGroup } from '@angular/forms';
|
||||||
import { FieldDataEditorModel } from './field-data-editor-model';
|
import { FieldDataEditorModel } from './field-data-editor-model';
|
||||||
import { ExternalDatasetsFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
|
import { ExternalDatasetsFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
|
||||||
|
import { ExternalDatasetTypeEnum } from '@app/core/common/enum/external-dataset-type-enum';
|
||||||
|
|
||||||
export class ExternalDatasetsDataEditorModel extends FieldDataEditorModel<ExternalDatasetsDataEditorModel> {
|
export class ExternalDatasetsDataEditorModel extends FieldDataEditorModel<ExternalDatasetsDataEditorModel> {
|
||||||
public label: string;
|
public label: string;
|
||||||
public multiAutoComplete: boolean;
|
public multiAutoComplete: boolean;
|
||||||
|
public type: ExternalDatasetTypeEnum;
|
||||||
|
|
||||||
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
||||||
const formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('ExternalDatasetsDataEditorModel.label')) }],
|
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('ExternalDatasetsDataEditorModel.label')) }],
|
||||||
multiAutoComplete: [{ value: this.multiAutoComplete, disabled: (disabled && !skipDisable.includes('ExternalDatasetsDataEditorModel.multiAutoComplete')) }]
|
multiAutoComplete: [{ value: this.multiAutoComplete, disabled: (disabled && !skipDisable.includes('ExternalDatasetsDataEditorModel.multiAutoComplete')) }],
|
||||||
|
type: [{ value: this.type, disabled: (disabled && !skipDisable.includes('ExternalDatasetsDataEditorModel.type')) }]
|
||||||
});
|
});
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
|
@ -17,6 +20,7 @@ export class ExternalDatasetsDataEditorModel extends FieldDataEditorModel<Extern
|
||||||
fromModel(item: ExternalDatasetsFieldData): ExternalDatasetsDataEditorModel {
|
fromModel(item: ExternalDatasetsFieldData): ExternalDatasetsDataEditorModel {
|
||||||
this.label = item.label;
|
this.label = item.label;
|
||||||
this.multiAutoComplete = item.multiAutoComplete;
|
this.multiAutoComplete = item.multiAutoComplete;
|
||||||
|
this.type = item.type;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,4 +10,13 @@
|
||||||
<input matInput type="string"
|
<input matInput type="string"
|
||||||
[formControl]="form.get('data').get('label')">
|
[formControl]="form.get('data').get('label')">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
<mat-form-field class="col-6">
|
||||||
|
<mat-label>
|
||||||
|
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.EXTERNAL-DATASET-TYPE-NAME' | translate}}
|
||||||
|
</mat-label>
|
||||||
|
<mat-select [formControl]="form.get('data').get('type')">
|
||||||
|
<mat-option *ngFor="let type of externalDatasetTypes" [value]="type.value">{{type.label | translate}}</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
|
||||||
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { Component, Input, OnInit } from '@angular/core';
|
||||||
import { FormGroup } from '@angular/forms';
|
import { FormGroup } from '@angular/forms';
|
||||||
import { DatePickerDataEditorModel } from '../../../../admin/field-data/date-picker-data-editor-models';
|
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 { ExternalDatasetsDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/external-datasets-data-editor-models';
|
||||||
|
import { ExternalDatasetTypeEnum } from '@app/core/common/enum/external-dataset-type-enum';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-dataset-profile-editor-external-datasets-field-component',
|
selector: 'app-dataset-profile-editor-external-datasets-field-component',
|
||||||
|
@ -13,7 +14,28 @@ export class DatasetProfileEditorExternalDatasetsFieldComponent implements OnIni
|
||||||
@Input() form: FormGroup;
|
@Input() form: FormGroup;
|
||||||
private data: ExternalDatasetsDataEditorModel = new ExternalDatasetsDataEditorModel();
|
private data: ExternalDatasetsDataEditorModel = new ExternalDatasetsDataEditorModel();
|
||||||
|
|
||||||
|
externalDatasetTypes = [
|
||||||
|
... Object.keys(ExternalDatasetTypeEnum).map(key=>{
|
||||||
|
return {
|
||||||
|
label: this.parseExtrernalDatasetTypeKey(key),
|
||||||
|
value: ExternalDatasetTypeEnum[key]
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (!this.form.get('data')) { this.form.addControl('data', this.data.buildForm()); }
|
if (!this.form.get('data')) { this.form.addControl('data', this.data.buildForm()); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parseExtrernalDatasetTypeKey(key: string): string{
|
||||||
|
if(ExternalDatasetTypeEnum[key] === ExternalDatasetTypeEnum.ProducedDataset){
|
||||||
|
return 'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.EXTERNAL-DATASET-TYPES.PRODUCED';
|
||||||
|
}
|
||||||
|
if(ExternalDatasetTypeEnum[key] === ExternalDatasetTypeEnum.ReusedDataset){
|
||||||
|
return 'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.EXTERNAL-DATASET-TYPES.REUSED';
|
||||||
|
}
|
||||||
|
if(ExternalDatasetTypeEnum[key] === ExternalDatasetTypeEnum.Other){
|
||||||
|
return 'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.EXTERNAL-DATASET-TYPES.OTHER';
|
||||||
|
}
|
||||||
|
return key;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -441,7 +441,13 @@
|
||||||
"FIELD-DATASET-IDENTIFIER-TITLE": "Dataset Identifier Data",
|
"FIELD-DATASET-IDENTIFIER-TITLE": "Dataset Identifier Data",
|
||||||
"FIELD-DATASET-IDENTIFIER-PLACEHOLDER": "Input placeholder",
|
"FIELD-DATASET-IDENTIFIER-PLACEHOLDER": "Input placeholder",
|
||||||
"FIELD-VALIDATOR-TITLE": "Validator Data",
|
"FIELD-VALIDATOR-TITLE": "Validator Data",
|
||||||
"FIELD-VALIDATOR-PLACEHOLDER": "Input placeholder Text"
|
"FIELD-VALIDATOR-PLACEHOLDER": "Input placeholder Text",
|
||||||
|
"EXTERNAL-DATASET-TYPE-NAME": "Type",
|
||||||
|
"EXTERNAL-DATASET-TYPES":{
|
||||||
|
"PRODUCED": "Produced dataset",
|
||||||
|
"REUSED": "Reused dataset",
|
||||||
|
"OTHER": "Other"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"ERROR-MESSAGES": {
|
"ERROR-MESSAGES": {
|
||||||
"FIELD-OTHER-SOURCES-REQUIRED": "At least one source must be provided.",
|
"FIELD-OTHER-SOURCES-REQUIRED": "At least one source must be provided.",
|
||||||
|
|
|
@ -441,7 +441,13 @@
|
||||||
"FIELD-DATASET-IDENTIFIER-TITLE": "Dataset Identifier Data",
|
"FIELD-DATASET-IDENTIFIER-TITLE": "Dataset Identifier Data",
|
||||||
"FIELD-DATASET-IDENTIFIER-PLACEHOLDER": "Input placeholder Text",
|
"FIELD-DATASET-IDENTIFIER-PLACEHOLDER": "Input placeholder Text",
|
||||||
"FIELD-VALIDATOR-TITLE": "Validator Data",
|
"FIELD-VALIDATOR-TITLE": "Validator Data",
|
||||||
"FIELD-VALIDATOR-PLACEHOLDER": "Input placeholder Text"
|
"FIELD-VALIDATOR-PLACEHOLDER": "Input placeholder Text",
|
||||||
|
"EXTERNAL-DATASET-TYPE-NAME": "Type",
|
||||||
|
"EXTERNAL-DATASET-TYPES":{
|
||||||
|
"PRODUCED": "Produced dataset",
|
||||||
|
"REUSED": "Reused dataset",
|
||||||
|
"OTHER": "Other"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"ERROR-MESSAGES": {
|
"ERROR-MESSAGES": {
|
||||||
"FIELD-OTHER-SOURCES-REQUIRED": "At least one source must be provided.",
|
"FIELD-OTHER-SOURCES-REQUIRED": "At least one source must be provided.",
|
||||||
|
|
|
@ -441,7 +441,13 @@
|
||||||
"FIELD-DATASET-IDENTIFIER-TITLE": "Dataset Identifier Data",
|
"FIELD-DATASET-IDENTIFIER-TITLE": "Dataset Identifier Data",
|
||||||
"FIELD-DATASET-IDENTIFIER-PLACEHOLDER": "Input placeholder Text",
|
"FIELD-DATASET-IDENTIFIER-PLACEHOLDER": "Input placeholder Text",
|
||||||
"FIELD-VALIDATOR-TITLE": "Validator Data",
|
"FIELD-VALIDATOR-TITLE": "Validator Data",
|
||||||
"FIELD-VALIDATOR-PLACEHOLDER": "Input placeholder Text"
|
"FIELD-VALIDATOR-PLACEHOLDER": "Input placeholder Text",
|
||||||
|
"EXTERNAL-DATASET-TYPE-NAME": "Type",
|
||||||
|
"EXTERNAL-DATASET-TYPES":{
|
||||||
|
"PRODUCED": "Produced dataset",
|
||||||
|
"REUSED": "Reused dataset",
|
||||||
|
"OTHER": "Other"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"ERROR-MESSAGES": {
|
"ERROR-MESSAGES": {
|
||||||
"FIELD-OTHER-SOURCES-REQUIRED": "At least one source must be provided.",
|
"FIELD-OTHER-SOURCES-REQUIRED": "At least one source must be provided.",
|
||||||
|
|
|
@ -441,7 +441,13 @@
|
||||||
"FIELD-DATASET-IDENTIFIER-TITLE": "Dataset Identifier Data",
|
"FIELD-DATASET-IDENTIFIER-TITLE": "Dataset Identifier Data",
|
||||||
"FIELD-DATASET-IDENTIFIER-PLACEHOLDER": "Input placeholder Text",
|
"FIELD-DATASET-IDENTIFIER-PLACEHOLDER": "Input placeholder Text",
|
||||||
"FIELD-VALIDATOR-TITLE": "Validator Data",
|
"FIELD-VALIDATOR-TITLE": "Validator Data",
|
||||||
"FIELD-VALIDATOR-PLACEHOLDER": "Input placeholder Text"
|
"FIELD-VALIDATOR-PLACEHOLDER": "Input placeholder Text",
|
||||||
|
"EXTERNAL-DATASET-TYPE-NAME": "Type",
|
||||||
|
"EXTERNAL-DATASET-TYPES":{
|
||||||
|
"PRODUCED": "Produced dataset",
|
||||||
|
"REUSED": "Reused dataset",
|
||||||
|
"OTHER": "Other"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"ERROR-MESSAGES": {
|
"ERROR-MESSAGES": {
|
||||||
"FIELD-OTHER-SOURCES-REQUIRED": "At least one source must be provided.",
|
"FIELD-OTHER-SOURCES-REQUIRED": "At least one source must be provided.",
|
||||||
|
|
|
@ -441,7 +441,13 @@
|
||||||
"FIELD-DATASET-IDENTIFIER-TITLE": "Dados de Identificador de Dataset",
|
"FIELD-DATASET-IDENTIFIER-TITLE": "Dados de Identificador de Dataset",
|
||||||
"FIELD-DATASET-IDENTIFIER-PLACEHOLDER": "Texto de Entrada",
|
"FIELD-DATASET-IDENTIFIER-PLACEHOLDER": "Texto de Entrada",
|
||||||
"FIELD-VALIDATOR-TITLE": "Dados de Validação",
|
"FIELD-VALIDATOR-TITLE": "Dados de Validação",
|
||||||
"FIELD-VALIDATOR-PLACEHOLDER": "Texto de Entrada"
|
"FIELD-VALIDATOR-PLACEHOLDER": "Texto de Entrada",
|
||||||
|
"EXTERNAL-DATASET-TYPE-NAME": "Type",
|
||||||
|
"EXTERNAL-DATASET-TYPES":{
|
||||||
|
"PRODUCED": "Produced dataset",
|
||||||
|
"REUSED": "Reused dataset",
|
||||||
|
"OTHER": "Other"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"ERROR-MESSAGES": {
|
"ERROR-MESSAGES": {
|
||||||
"FIELD-OTHER-SOURCES-REQUIRED": "Deve ser fornecida pelo menos uma fonte.",
|
"FIELD-OTHER-SOURCES-REQUIRED": "Deve ser fornecida pelo menos uma fonte.",
|
||||||
|
|
|
@ -441,7 +441,13 @@
|
||||||
"FIELD-DATASET-IDENTIFIER-TITLE": "Dataset Identifier Data",
|
"FIELD-DATASET-IDENTIFIER-TITLE": "Dataset Identifier Data",
|
||||||
"FIELD-DATASET-IDENTIFIER-PLACEHOLDER": "Input placeholder Text",
|
"FIELD-DATASET-IDENTIFIER-PLACEHOLDER": "Input placeholder Text",
|
||||||
"FIELD-VALIDATOR-TITLE": "Validator Data",
|
"FIELD-VALIDATOR-TITLE": "Validator Data",
|
||||||
"FIELD-VALIDATOR-PLACEHOLDER": "Input placeholder Text"
|
"FIELD-VALIDATOR-PLACEHOLDER": "Input placeholder Text",
|
||||||
|
"EXTERNAL-DATASET-TYPE-NAME": "Type",
|
||||||
|
"EXTERNAL-DATASET-TYPES":{
|
||||||
|
"PRODUCED": "Produced dataset",
|
||||||
|
"REUSED": "Reused dataset",
|
||||||
|
"OTHER": "Other"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"ERROR-MESSAGES": {
|
"ERROR-MESSAGES": {
|
||||||
"FIELD-OTHER-SOURCES-REQUIRED": "At least one source must be provided.",
|
"FIELD-OTHER-SOURCES-REQUIRED": "At least one source must be provided.",
|
||||||
|
|
|
@ -441,7 +441,13 @@
|
||||||
"FIELD-DATASET-IDENTIFIER-TITLE": "Dataset Identifier Data",
|
"FIELD-DATASET-IDENTIFIER-TITLE": "Dataset Identifier Data",
|
||||||
"FIELD-DATASET-IDENTIFIER-PLACEHOLDER": "Input placeholder Text",
|
"FIELD-DATASET-IDENTIFIER-PLACEHOLDER": "Input placeholder Text",
|
||||||
"FIELD-VALIDATOR-TITLE": "Validator Data",
|
"FIELD-VALIDATOR-TITLE": "Validator Data",
|
||||||
"FIELD-VALIDATOR-PLACEHOLDER": "Input placeholder Text"
|
"FIELD-VALIDATOR-PLACEHOLDER": "Input placeholder Text",
|
||||||
|
"EXTERNAL-DATASET-TYPE-NAME": "Type",
|
||||||
|
"EXTERNAL-DATASET-TYPES":{
|
||||||
|
"PRODUCED": "Produced dataset",
|
||||||
|
"REUSED": "Reused dataset",
|
||||||
|
"OTHER": "Other"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"ERROR-MESSAGES": {
|
"ERROR-MESSAGES": {
|
||||||
"FIELD-OTHER-SOURCES-REQUIRED": "At least one source must be provided.",
|
"FIELD-OTHER-SOURCES-REQUIRED": "At least one source must be provided.",
|
||||||
|
|
|
@ -441,7 +441,13 @@
|
||||||
"FIELD-DATASET-IDENTIFIER-TITLE": "Dataset Identifier Data",
|
"FIELD-DATASET-IDENTIFIER-TITLE": "Dataset Identifier Data",
|
||||||
"FIELD-DATASET-IDENTIFIER-PLACEHOLDER": "Input placeholder Text",
|
"FIELD-DATASET-IDENTIFIER-PLACEHOLDER": "Input placeholder Text",
|
||||||
"FIELD-VALIDATOR-TITLE": "Validator Data",
|
"FIELD-VALIDATOR-TITLE": "Validator Data",
|
||||||
"FIELD-VALIDATOR-PLACEHOLDER": "Input placeholder Text"
|
"FIELD-VALIDATOR-PLACEHOLDER": "Input placeholder Text",
|
||||||
|
"EXTERNAL-DATASET-TYPE-NAME": "Type",
|
||||||
|
"EXTERNAL-DATASET-TYPES":{
|
||||||
|
"PRODUCED": "Produced dataset",
|
||||||
|
"REUSED": "Reused dataset",
|
||||||
|
"OTHER": "Other"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"ERROR-MESSAGES": {
|
"ERROR-MESSAGES": {
|
||||||
"FIELD-OTHER-SOURCES-REQUIRED": "At least one source must be provided.",
|
"FIELD-OTHER-SOURCES-REQUIRED": "At least one source must be provided.",
|
||||||
|
|
Loading…
Reference in New Issue