DmpBlueprint refactor
This commit is contained in:
parent
dc380cdc01
commit
a68668f07e
|
@ -1,6 +1,7 @@
|
||||||
package eu.eudat.commons.types.dmpblueprint;
|
package eu.eudat.commons.types.dmpblueprint;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.DmpBlueprintExtraFieldDataType;
|
import eu.eudat.commons.enums.DmpBlueprintExtraFieldDataType;
|
||||||
|
import eu.eudat.commons.enums.DmpBlueprintFieldCategory;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
public class ExtraFieldEntity extends FieldEntity {
|
public class ExtraFieldEntity extends FieldEntity {
|
||||||
|
@ -23,6 +24,7 @@ public class ExtraFieldEntity extends FieldEntity {
|
||||||
@Override
|
@Override
|
||||||
public ExtraFieldEntity fromXmlChild(Element item) {
|
public ExtraFieldEntity fromXmlChild(Element item) {
|
||||||
this.type = DmpBlueprintExtraFieldDataType.of(Short.parseShort(item.getAttribute("type")));
|
this.type = DmpBlueprintExtraFieldDataType.of(Short.parseShort(item.getAttribute("type")));
|
||||||
|
this.setCategory(DmpBlueprintFieldCategory.Extra);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package eu.eudat.commons.types.dmpblueprint;
|
package eu.eudat.commons.types.dmpblueprint;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.DmpBlueprintExtraFieldDataType;
|
||||||
import eu.eudat.commons.enums.DmpBlueprintFieldCategory;
|
import eu.eudat.commons.enums.DmpBlueprintFieldCategory;
|
||||||
import eu.eudat.commons.types.xml.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package eu.eudat.commons.types.dmpblueprint;
|
package eu.eudat.commons.types.dmpblueprint;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.DmpBlueprintFieldCategory;
|
||||||
import eu.eudat.commons.enums.DmpBlueprintSystemFieldType;
|
import eu.eudat.commons.enums.DmpBlueprintSystemFieldType;
|
||||||
import eu.eudat.commons.types.xml.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
|
@ -27,6 +28,7 @@ public class SystemFieldEntity extends FieldEntity {
|
||||||
@Override
|
@Override
|
||||||
public SystemFieldEntity fromXmlChild(Element item) {
|
public SystemFieldEntity fromXmlChild(Element item) {
|
||||||
this.type = DmpBlueprintSystemFieldType.of(Short.parseShort(item.getAttribute("type")));
|
this.type = DmpBlueprintSystemFieldType.of(Short.parseShort(item.getAttribute("type")));
|
||||||
|
this.setCategory(DmpBlueprintFieldCategory.System);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,12 +10,17 @@ import { BaseHttpParams } from '@common/http/base-http-params';
|
||||||
import { InterceptorType } from '@common/http/interceptors/interceptor-type';
|
import { InterceptorType } from '@common/http/interceptors/interceptor-type';
|
||||||
import { QueryResult } from '@common/model/query-result';
|
import { QueryResult } from '@common/model/query-result';
|
||||||
import { Guid } from '@common/types/guid';
|
import { Guid } from '@common/types/guid';
|
||||||
import { Observable, throwError } from 'rxjs';
|
import { catchError, map } from 'rxjs/operators';
|
||||||
import { catchError } from 'rxjs/operators';
|
|
||||||
import { ConfigurationService } from '../configuration/configuration.service';
|
import { ConfigurationService } from '../configuration/configuration.service';
|
||||||
import { BaseHttpV2Service } from '../http/base-http-v2.service';
|
import { BaseHttpV2Service } from '../http/base-http-v2.service';
|
||||||
import { DmpBlueprintCriteria } from '@app/core/query/dmp/dmp-blueprint-criteria';
|
import { DmpBlueprintCriteria } from '@app/core/query/dmp/dmp-blueprint-criteria';
|
||||||
import { DataTableRequest } from '@app/core/model/data-table/data-table-request';
|
import { DataTableRequest } from '@app/core/model/data-table/data-table-request';
|
||||||
|
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
|
||||||
|
import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration';
|
||||||
|
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
||||||
|
import { nameof } from 'ts-simple-nameof';
|
||||||
|
import { FilterService } from '@common/modules/text-filter/filter-service';
|
||||||
|
import { Observable, throwError } from 'rxjs';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class DmpBlueprintService {
|
export class DmpBlueprintService {
|
||||||
|
@ -23,7 +28,7 @@ export class DmpBlueprintService {
|
||||||
private actionUrl: string;
|
private actionUrl: string;
|
||||||
private headers = new HttpHeaders();
|
private headers = new HttpHeaders();
|
||||||
|
|
||||||
constructor(private http: BaseHttpV2Service, private httpClient: HttpClient, private configurationService: ConfigurationService) {
|
constructor(private http: BaseHttpV2Service, private httpClient: HttpClient, private configurationService: ConfigurationService, private filterService: FilterService) {
|
||||||
this.actionUrl = configurationService.server + 'dmpprofile/';
|
this.actionUrl = configurationService.server + 'dmpprofile/';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,10 +70,6 @@ export class DmpBlueprintService {
|
||||||
return this.http.post<DataTableData<DmpBlueprint>>(this.actionUrl + 'getPaged', dataTableRequest, { headers: this.headers });
|
return this.http.post<DataTableData<DmpBlueprint>>(this.actionUrl + 'getPaged', dataTableRequest, { headers: this.headers });
|
||||||
}
|
}
|
||||||
|
|
||||||
getPagedBlueprint(dataTableRequest: DataTableRequest<DmpBlueprintCriteria>): Observable<DataTableData<DmpBlueprint>> {
|
|
||||||
return this.http.post<DataTableData<DmpBlueprint>>(this.actionUrl + 'getPagedBlueprint', dataTableRequest, { headers: this.headers });
|
|
||||||
}
|
|
||||||
|
|
||||||
getSingleBlueprint(id: String): Observable<DmpBlueprint> {
|
getSingleBlueprint(id: String): Observable<DmpBlueprint> {
|
||||||
return this.http.get<DmpBlueprint>(this.actionUrl + 'getSingleBlueprint/' + id, { headers: this.headers });
|
return this.http.get<DmpBlueprint>(this.actionUrl + 'getSingleBlueprint/' + id, { headers: this.headers });
|
||||||
}
|
}
|
||||||
|
@ -103,4 +104,44 @@ export class DmpBlueprintService {
|
||||||
externalAutocomplete(lookUpItem: RequestItem<DmpBlueprintExternalAutocompleteCriteria>): Observable<any> {
|
externalAutocomplete(lookUpItem: RequestItem<DmpBlueprintExternalAutocompleteCriteria>): Observable<any> {
|
||||||
return this.httpClient.post(this.actionUrl + 'search/autocomplete', lookUpItem);
|
return this.httpClient.post(this.actionUrl + 'search/autocomplete', lookUpItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Autocomplete Commons
|
||||||
|
//
|
||||||
|
// tslint:disable-next-line: member-ordering
|
||||||
|
singleAutocompleteConfiguration: SingleAutoCompleteConfiguration = {
|
||||||
|
initialItems: (data?: any) => this.query(this.buildAutocompleteLookup()).pipe(map(x => x.items)),
|
||||||
|
filterFn: (searchQuery: string, data?: any) => this.query(this.buildAutocompleteLookup(searchQuery)).pipe(map(x => x.items)),
|
||||||
|
getSelectedItem: (selectedItem: any) => this.query(this.buildAutocompleteLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])),
|
||||||
|
displayFn: (item: DmpBlueprint) => item.label,
|
||||||
|
titleFn: (item: DmpBlueprint) => item.label,
|
||||||
|
valueAssign: (item: DmpBlueprint) => item.id,
|
||||||
|
};
|
||||||
|
|
||||||
|
// tslint:disable-next-line: member-ordering
|
||||||
|
multipleAutocompleteConfiguration: MultipleAutoCompleteConfiguration = {
|
||||||
|
initialItems: (excludedItems: any[], data?: any) => this.query(this.buildAutocompleteLookup(null, excludedItems ? excludedItems : null)).pipe(map(x => x.items)),
|
||||||
|
filterFn: (searchQuery: string, excludedItems: any[]) => this.query(this.buildAutocompleteLookup(searchQuery, excludedItems)).pipe(map(x => x.items)),
|
||||||
|
getSelectedItems: (selectedItems: any[]) => this.query(this.buildAutocompleteLookup(null, null, selectedItems)).pipe(map(x => x.items)),
|
||||||
|
displayFn: (item: DmpBlueprint) => item.label,
|
||||||
|
titleFn: (item: DmpBlueprint) => item.label,
|
||||||
|
valueAssign: (item: DmpBlueprint) => item.id,
|
||||||
|
};
|
||||||
|
|
||||||
|
private buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[]): DmpBlueprintLookup {
|
||||||
|
const lookup: DmpBlueprintLookup = new DmpBlueprintLookup();
|
||||||
|
lookup.page = { size: 100, offset: 0 };
|
||||||
|
if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; }
|
||||||
|
if (ids && ids.length > 0) { lookup.ids = ids; }
|
||||||
|
lookup.isActive = [IsActive.Active];
|
||||||
|
lookup.project = {
|
||||||
|
fields: [
|
||||||
|
nameof<DmpBlueprint>(x => x.id),
|
||||||
|
nameof<DmpBlueprint>(x => x.label)
|
||||||
|
]
|
||||||
|
};
|
||||||
|
lookup.order = { items: [nameof<DmpBlueprint>(x => x.label)] };
|
||||||
|
if (like) { lookup.like = this.filterService.transformLike(like); }
|
||||||
|
return lookup;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@
|
||||||
<div class="heading2">0.3 Blueprint of DMP *</div>
|
<div class="heading2">0.3 Blueprint of DMP *</div>
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-label>Select blueprint</mat-label>
|
<mat-label>Select blueprint</mat-label>
|
||||||
<app-single-auto-complete [required]="false" [formControl]="formGroup.get('profile')" placeholder="Select blueprint" [configuration]="dmpBlueprintAutoCompleteConfiguration">
|
<app-single-auto-complete [required]="false" [formControl]="formGroup.get('profile')" placeholder="Select blueprint" [configuration]="dmpBlueprintService.singleAutocompleteConfiguration">
|
||||||
</app-single-auto-complete>
|
</app-single-auto-complete>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -54,9 +54,10 @@ import { ExtraPropertiesFormModel } from '../editor/general-tab/extra-properties
|
||||||
import { FunderFormModel } from '../editor/grant-tab/funder-form-model';
|
import { FunderFormModel } from '../editor/grant-tab/funder-form-model';
|
||||||
import { GrantTabModel } from '../editor/grant-tab/grant-tab-model';
|
import { GrantTabModel } from '../editor/grant-tab/grant-tab-model';
|
||||||
import { ProjectFormModel } from '../editor/grant-tab/project-form-model';
|
import { ProjectFormModel } from '../editor/grant-tab/project-form-model';
|
||||||
import { DmpBlueprintDefinition } from '@app/core/model/dmp-blueprint/dmp-blueprint';
|
import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection, FieldInSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
|
||||||
import { DmpBlueprintExtraFieldDataType } from '@app/core/common/enum/dmp-blueprint-extra-field-data-type';
|
import { DmpBlueprintExtraFieldDataType } from '@app/core/common/enum/dmp-blueprint-extra-field-data-type';
|
||||||
import { DmpBlueprintSystemFieldType } from '@app/core/common/enum/dmp-blueprint-system-field-type';
|
import { DmpBlueprintSystemFieldType } from '@app/core/common/enum/dmp-blueprint-system-field-type';
|
||||||
|
import { nameof } from 'ts-simple-nameof';
|
||||||
|
|
||||||
interface Visible {
|
interface Visible {
|
||||||
value: boolean;
|
value: boolean;
|
||||||
|
@ -129,7 +130,7 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
|
||||||
|
|
||||||
profilesAutoCompleteConfiguration: MultipleAutoCompleteConfiguration;
|
profilesAutoCompleteConfiguration: MultipleAutoCompleteConfiguration;
|
||||||
|
|
||||||
readonly defaultBlueprintId = '86635178-36a6-484f-9057-a934e4eeecd5';
|
readonly defaultBlueprintId: Guid = Guid.parse('86635178-36a6-484f-9057-a934e4eeecd5');
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private dmpBlueprintService: DmpBlueprintService,
|
private dmpBlueprintService: DmpBlueprintService,
|
||||||
|
@ -179,19 +180,17 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
|
||||||
|
|
||||||
this.formGroupRawValue = JSON.parse(JSON.stringify(this.formGroup.getRawValue()));
|
this.formGroupRawValue = JSON.parse(JSON.stringify(this.formGroup.getRawValue()));
|
||||||
if (!isNullOrUndefined(this.formGroup.get('profile').value)) {
|
if (!isNullOrUndefined(this.formGroup.get('profile').value)) {
|
||||||
this.dmpBlueprintService.getSingleBlueprint(this.formGroup.get('profile').value)
|
this.getSingle(Guid.parse(this.formGroup.get('profile').value), data => {
|
||||||
.pipe(takeUntil(this._destroyed))
|
this.selectedDmpBlueprintDefinition = data.definition;
|
||||||
.subscribe(result => {
|
this.checkForGrant();
|
||||||
this.selectedDmpBlueprintDefinition = result.definition;
|
this.checkForFunder();
|
||||||
this.checkForGrant();
|
this.checkForProject();
|
||||||
this.checkForFunder();
|
this.buildExtraFields();
|
||||||
this.checkForProject();
|
this.formGroup.get('profile').setValue(data);
|
||||||
this.buildExtraFields();
|
this.maxStep = this.selectedDmpBlueprintDefinition.sections.length;
|
||||||
this.formGroup.get('profile').setValue(result);
|
this.step = 1;
|
||||||
this.maxStep = this.selectedDmpBlueprintDefinition.sections.length;
|
this.addProfiles(this.dmp.profiles);
|
||||||
this.step = 1;
|
});
|
||||||
this.addProfiles(this.dmp.profiles);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
this.maxStep = this.formGroup.get('datasets') ? this.maxStep + this.formGroup.get('datasets').value.length - 1 : this.maxStep;
|
this.maxStep = this.formGroup.get('datasets') ? this.maxStep + this.formGroup.get('datasets').value.length - 1 : this.maxStep;
|
||||||
|
|
||||||
|
@ -252,19 +251,17 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
|
||||||
this.formGroupRawValue = JSON.parse(JSON.stringify(this.formGroup.getRawValue()));
|
this.formGroupRawValue = JSON.parse(JSON.stringify(this.formGroup.getRawValue()));
|
||||||
|
|
||||||
if (!isNullOrUndefined(this.formGroup.get('profile').value)) {
|
if (!isNullOrUndefined(this.formGroup.get('profile').value)) {
|
||||||
this.dmpBlueprintService.getSingleBlueprint(this.formGroup.get('profile').value)
|
this.getSingle(Guid.parse(this.formGroup.get('profile').value), data => {
|
||||||
.pipe(takeUntil(this._destroyed))
|
this.selectedDmpBlueprintDefinition = data.definition;
|
||||||
.subscribe(result => {
|
this.checkForGrant();
|
||||||
this.selectedDmpBlueprintDefinition = result.definition;
|
this.checkForFunder();
|
||||||
this.checkForGrant();
|
this.checkForProject();
|
||||||
this.checkForFunder();
|
this.buildExtraFields();
|
||||||
this.checkForProject();
|
this.formGroup.get('profile').setValue(data);
|
||||||
this.buildExtraFields();
|
this.maxStep = this.selectedDmpBlueprintDefinition.sections.length;
|
||||||
this.formGroup.get('profile').setValue(result);
|
this.step = 1;
|
||||||
this.maxStep = this.selectedDmpBlueprintDefinition.sections.length;
|
this.addProfiles();
|
||||||
this.step = 1;
|
});
|
||||||
this.addProfiles();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
this.registerFormEventsForDmpBlueprint();
|
this.registerFormEventsForDmpBlueprint();
|
||||||
|
|
||||||
|
@ -434,14 +431,12 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
|
||||||
}
|
}
|
||||||
|
|
||||||
selectDefaultBlueprint() {
|
selectDefaultBlueprint() {
|
||||||
this.dmpBlueprintService.getSingleBlueprint(this.defaultBlueprintId)
|
this.getSingle(this.defaultBlueprintId, data => {
|
||||||
.pipe(takeUntil(this._destroyed))
|
this.selectedDmpBlueprintDefinition = data.definition;
|
||||||
.subscribe(result => {
|
this.formGroup.get('profile').setValue(data.id);
|
||||||
this.selectedDmpBlueprintDefinition = result.definition;
|
|
||||||
this.formGroup.get('profile').setValue(result);
|
|
||||||
this.maxStep = this.selectedDmpBlueprintDefinition.sections.length;
|
this.maxStep = this.selectedDmpBlueprintDefinition.sections.length;
|
||||||
this.nextStep();
|
this.nextStep();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
selectBlueprint() {
|
selectBlueprint() {
|
||||||
|
@ -834,18 +829,61 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
|
||||||
return this.dmpService.searchDmpBlueprints(request);
|
return this.dmpService.searchDmpBlueprints(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getSingle(blueprintId: Guid, successFunction) {
|
||||||
|
this.dmpBlueprintService.getSingle(blueprintId, [
|
||||||
|
nameof<DmpBlueprint>(x => x.id),
|
||||||
|
nameof<DmpBlueprint>(x => x.label),
|
||||||
|
nameof<DmpBlueprint>(x => x.status),
|
||||||
|
nameof<DmpBlueprint>(x => x.description),
|
||||||
|
nameof<DmpBlueprint>(x => x.status),
|
||||||
|
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.id)].join('.'),
|
||||||
|
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.label)].join('.'),
|
||||||
|
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.description)].join('.'),
|
||||||
|
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.ordinal)].join('.'),
|
||||||
|
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.hasTemplates)].join('.'),
|
||||||
|
|
||||||
|
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.id)].join('.'),
|
||||||
|
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.category)].join('.'),
|
||||||
|
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.dataType)].join('.'),
|
||||||
|
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.systemFieldType)].join('.'),
|
||||||
|
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.label)].join('.'),
|
||||||
|
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.placeholder)].join('.'),
|
||||||
|
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.description)].join('.'),
|
||||||
|
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.required)].join('.'),
|
||||||
|
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.ordinal)].join('.'),
|
||||||
|
|
||||||
|
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.id)].join('.'),
|
||||||
|
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.descriptionTemplateId)].join('.'),
|
||||||
|
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.label)].join('.'),
|
||||||
|
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.minMultiplicity)].join('.'),
|
||||||
|
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.maxMultiplicity)].join('.'),
|
||||||
|
nameof<DmpBlueprint>(x => x.createdAt),
|
||||||
|
nameof<DmpBlueprint>(x => x.hash),
|
||||||
|
nameof<DmpBlueprint>(x => x.isActive)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
.pipe(map(data => data as DmpBlueprint), takeUntil(this._destroyed))
|
||||||
|
.subscribe(
|
||||||
|
data => successFunction(data),
|
||||||
|
error => this.onCallbackError(error)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
registerFormEventsForDmpBlueprint(): void {
|
registerFormEventsForDmpBlueprint(): void {
|
||||||
this.formGroup.get('profile').valueChanges
|
this.formGroup.get('profile').valueChanges
|
||||||
.pipe(
|
.pipe(
|
||||||
takeUntil(this._destroyed))
|
takeUntil(this._destroyed))
|
||||||
.subscribe(Option => {
|
.subscribe(blueprintIdString => {
|
||||||
if (Option instanceof Object) {
|
const blueprintId = Guid.parse(blueprintIdString);
|
||||||
this.selectedDmpBlueprintDefinition = Option.definition;
|
if (blueprintId) {
|
||||||
this.checkForGrant();
|
this.getSingle(blueprintId, data => {
|
||||||
this.checkForFunder();
|
this.selectedDmpBlueprintDefinition = data.definition;
|
||||||
this.checkForProject();
|
this.checkForGrant();
|
||||||
this.buildExtraFields();
|
this.checkForFunder();
|
||||||
this.addProfiles();
|
this.checkForProject();
|
||||||
|
this.buildExtraFields();
|
||||||
|
this.addProfiles();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.selectedDmpBlueprintDefinition = null;
|
this.selectedDmpBlueprintDefinition = null;
|
||||||
|
@ -964,21 +1002,21 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dmpBlueprintAutoCompleteConfiguration: SingleAutoCompleteConfiguration = {
|
// dmpBlueprintAutoCompleteConfiguration: SingleAutoCompleteConfiguration = {
|
||||||
filterFn: this.dmpBlueprintSearch.bind(this),
|
// filterFn: this.dmpBlueprintSearch.bind(this),
|
||||||
initialItems: (extraData) => this.dmpBlueprintSearch(''),
|
// initialItems: (extraData) => this.dmpBlueprintSearch(''),
|
||||||
displayFn: (item) => item['label'],
|
// displayFn: (item) => item['label'],
|
||||||
titleFn: (item) => item['label']
|
// titleFn: (item) => item['label']
|
||||||
};
|
// };
|
||||||
|
|
||||||
dmpBlueprintSearch(query: string) {
|
// dmpBlueprintSearch(query: string) {
|
||||||
let fields: Array<string> = new Array();
|
// let fields: Array<string> = new Array();
|
||||||
var request = new DataTableRequest<DmpBlueprintCriteria>(0, 20, { fields: fields });
|
// var request = new DataTableRequest<DmpBlueprintCriteria>(0, 20, { fields: fields });
|
||||||
request.criteria = new DmpBlueprintCriteria();
|
// request.criteria = new DmpBlueprintCriteria();
|
||||||
request.criteria.like = query;
|
// request.criteria.like = query;
|
||||||
request.criteria.status = DmpBlueprintStatus.Finalized;
|
// request.criteria.status = DmpBlueprintStatus.Finalized;
|
||||||
return this.dmpBlueprintService.getPagedBlueprint(request).pipe(map(x => x.data));
|
// return this.dmpBlueprintService.getPagedBlueprint(request).pipe(map(x => x.data));
|
||||||
}
|
// }
|
||||||
|
|
||||||
getLanguageInfos(): LanguageInfo[] {
|
getLanguageInfos(): LanguageInfo[] {
|
||||||
return this.languageInfoService.getLanguageInfoValues();
|
return this.languageInfoService.getLanguageInfoValues();
|
||||||
|
|
Loading…
Reference in New Issue