diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/DescriptionTemplateController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/DescriptionTemplateController.java index c01f89863..cc1237e6d 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/DescriptionTemplateController.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/DescriptionTemplateController.java @@ -3,6 +3,7 @@ package eu.eudat.controllers.v2; import com.fasterxml.jackson.core.JsonProcessingException; import eu.eudat.audit.AuditableAction; import eu.eudat.authorization.AuthorizationFlags; +import gr.cite.tools.fieldset.BaseFieldSet; import gr.cite.tools.validation.ValidationFilterAnnotation; import eu.eudat.data.DescriptionTemplateEntity; import eu.eudat.model.DescriptionTemplate; @@ -119,6 +120,7 @@ public class DescriptionTemplateController { @ValidationFilterAnnotation(validator = DescriptionTemplatePersist.DescriptionTemplatePersistValidator.ValidatorName, argumentName = "model") public DescriptionTemplate persist(@RequestBody DescriptionTemplatePersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, JsonProcessingException, TransformerException { logger.debug(new MapLogEntry("persisting" + DescriptionTemplate.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet)); + new BaseFieldSet(fieldSet.getFields()).ensure(DescriptionTemplate._id); DescriptionTemplate persisted = this.descriptionTemplateTypeService.persist(model, fieldSet); this.auditService.track(AuditableAction.DescriptionTemplate_Persist, Map.ofEntries( diff --git a/dmp-frontend/src/app/core/services/description-template/description-template.service.ts b/dmp-frontend/src/app/core/services/description-template/description-template.service.ts index cf23e4648..796a6b99f 100644 --- a/dmp-frontend/src/app/core/services/description-template/description-template.service.ts +++ b/dmp-frontend/src/app/core/services/description-template/description-template.service.ts @@ -99,6 +99,7 @@ export class DescriptionTemplateService { getSelectedItem: (selectedItem: any) => this.query(this.buildAutocompleteLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])), displayFn: (item: DescriptionTemplate) => item.label, titleFn: (item: DescriptionTemplate) => item.label, + subtitleFn: (item: DescriptionTemplate) => item.description, valueAssign: (item: DescriptionTemplate) => item.id, }; @@ -109,7 +110,9 @@ export class DescriptionTemplateService { getSelectedItems: (selectedItems: any[]) => this.query(this.buildAutocompleteLookup(null, null, selectedItems)).pipe(map(x => x.items)), displayFn: (item: DescriptionTemplate) => item.label, titleFn: (item: DescriptionTemplate) => item.label, + subtitleFn: (item: DescriptionTemplate) => item.description, valueAssign: (item: DescriptionTemplate) => item.id, + popupItemActionIcon: 'visibility' }; public buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[]): DescriptionTemplateLookup { @@ -121,7 +124,8 @@ export class DescriptionTemplateService { lookup.project = { fields: [ nameof(x => x.id), - nameof(x => x.label) + nameof(x => x.label), + nameof(x => x.description), ] }; lookup.order = { items: [nameof(x => x.label)] }; @@ -139,6 +143,7 @@ export class DescriptionTemplateService { getSelectedItem: (selectedItem: any) => this.query(this.buildDescriptionTempalteGroupAutocompleteLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])), displayFn: (item: DescriptionTemplate) => item.label, titleFn: (item: DescriptionTemplate) => item.label, + subtitleFn: (item: DescriptionTemplate) => item.description, valueAssign: (item: DescriptionTemplate) => item.groupId, }; @@ -149,7 +154,9 @@ export class DescriptionTemplateService { getSelectedItems: (selectedItems: any[]) => this.query(this.buildDescriptionTempalteGroupAutocompleteLookup(null, null, selectedItems)).pipe(map(x => x.items)), displayFn: (item: DescriptionTemplate) => item.label, titleFn: (item: DescriptionTemplate) => item.label, + subtitleFn: (item: DescriptionTemplate) => item.description, valueAssign: (item: DescriptionTemplate) => item.groupId, + popupItemActionIcon: 'visibility' }; public buildDescriptionTempalteGroupAutocompleteLookup(like?: string, excludedIds?: Guid[], groupIds?: Guid[]): DescriptionTemplateLookup { @@ -165,6 +172,7 @@ export class DescriptionTemplateService { nameof(x => x.id), nameof(x => x.label), nameof(x => x.groupId), + nameof(x => x.description), ] }; lookup.order = { items: [nameof(x => x.label)] }; diff --git a/dmp-frontend/src/app/core/services/reference/reference.service.ts b/dmp-frontend/src/app/core/services/reference/reference.service.ts index e485ccc12..c0075c023 100644 --- a/dmp-frontend/src/app/core/services/reference/reference.service.ts +++ b/dmp-frontend/src/app/core/services/reference/reference.service.ts @@ -16,6 +16,7 @@ import { catchError, map } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; import { ConfigurationService } from '../configuration/configuration.service'; import { BaseHttpV2Service } from '../http/base-http-v2.service'; +import { TranslateService } from '@ngx-translate/core'; @Injectable() export class ReferenceService { @@ -23,7 +24,8 @@ export class ReferenceService { constructor( private http: BaseHttpV2Service, private configurationService: ConfigurationService, - private filterService: FilterService + private filterService: FilterService, + private language: TranslateService, ) { } @@ -134,6 +136,7 @@ export class ReferenceService { getSelectedItems: (selectedItems: any[]) => this.query(this.buildAutocompleteSearchSelectedItemsLookup([type], null, null, null, selectedItems?.map(x => x.id))).pipe(map(x => x.items)), displayFn: (item: Reference) => item.label, titleFn: (item: Reference) => item.label, + subtitleFn: (item: Reference) => item?.sourceType === ReferenceSourceType.External ? this.language.instant('REFERENCE-FIELD-COMPONENT.EXTERNAL-SOURCE') + ': ' + item.source : this.language.instant('REFERENCE-FIELD-COMPONENT.INTERNAL-SOURCE'), valueAssign: (item: Reference) => item, }; } diff --git a/dmp-frontend/src/app/library/auto-complete/multiple/multiple-auto-complete-configuration.ts b/dmp-frontend/src/app/library/auto-complete/multiple/multiple-auto-complete-configuration.ts index 6c88bba4a..fc4f529a8 100644 --- a/dmp-frontend/src/app/library/auto-complete/multiple/multiple-auto-complete-configuration.ts +++ b/dmp-frontend/src/app/library/auto-complete/multiple/multiple-auto-complete-configuration.ts @@ -1,6 +1,7 @@ -import { TemplateRef } from '@angular/core'; +import { TemplateRef, Type } from '@angular/core'; import { Observable } from 'rxjs'; import { AutoCompleteGroup } from '../auto-complete-group'; +import { OptionComponent } from './option-component.model'; export interface MultipleAutoCompleteConfiguration { // Delay for performing the request. Default: 200ms. @@ -29,6 +30,8 @@ export interface MultipleAutoCompleteConfiguration { valueAssign?: (selectedItem: any) => any; // Property formating template optionTemplate?: TemplateRef; + // Property formatting component + optionComponent?: Type; // Selected value formating template selectedValueTemplate?: TemplateRef; // Display icon that opens popup diff --git a/dmp-frontend/src/app/library/auto-complete/multiple/multiple-auto-complete.component.html b/dmp-frontend/src/app/library/auto-complete/multiple/multiple-auto-complete.component.html index 90e891d45..04b2ae965 100644 --- a/dmp-frontend/src/app/library/auto-complete/multiple/multiple-auto-complete.component.html +++ b/dmp-frontend/src/app/library/auto-complete/multiple/multiple-auto-complete.component.html @@ -1,29 +1,42 @@
- + - - + arrow_drop_down
+
--> + + + + + + + + + {{_displayFn(selectedItem)}} + + + + + + arrow_drop_down +
+ @@ -52,10 +65,36 @@ - +
+ + + + + + + +
+ {{_titleFn(item)}} +
+ {{_subtitleFn(item)}} + {{popupItemActionIcon}} +
+
+
+ + No results found! + +
+ + loading... + + + + @@ -82,7 +121,7 @@
loading... - + -->
-
+ \ No newline at end of file diff --git a/dmp-frontend/src/app/library/auto-complete/multiple/multiple-auto-complete.component.scss b/dmp-frontend/src/app/library/auto-complete/multiple/multiple-auto-complete.component.scss index e616373c0..4022ddd6d 100644 --- a/dmp-frontend/src/app/library/auto-complete/multiple/multiple-auto-complete.component.scss +++ b/dmp-frontend/src/app/library/auto-complete/multiple/multiple-auto-complete.component.scss @@ -19,6 +19,19 @@ } +.chip-text { + // text-overflow: ellipsis; + // white-space: nowrap; + // overflow: hidden; + white-space: normal; + word-break: break-word; + } + + + .chip-list { + max-width: calc(100% - 30px); + } + .title-subtitle-fn { height: auto; width: calc(100% - 46px); @@ -60,6 +73,11 @@ line-clamp: 1; } +.option { + line-height: 1rem; + // height: 3em; + } + .option-icon { mat-icon { margin: 0px 5px 0px 10px; diff --git a/dmp-frontend/src/app/library/auto-complete/multiple/multiple-auto-complete.component.ts b/dmp-frontend/src/app/library/auto-complete/multiple/multiple-auto-complete.component.ts index 7e7ea3d1a..666a42a41 100644 --- a/dmp-frontend/src/app/library/auto-complete/multiple/multiple-auto-complete.component.ts +++ b/dmp-frontend/src/app/library/auto-complete/multiple/multiple-auto-complete.component.ts @@ -14,6 +14,7 @@ import { Self, SimpleChanges, TemplateRef, + Type, ViewChild } from '@angular/core'; import { ControlValueAccessor, FormGroupDirective, NgControl, NgForm } from '@angular/forms'; @@ -409,10 +410,13 @@ export class MultipleAutoCompleteComponent extends _CustomComponentMixinBase imp return item; } + _optionComponent(item: any): Type { + if (this.configuration.optionComponent && item) { return this.configuration.optionComponent; } + return null; + } + _optionTemplate(item: any): TemplateRef { - if (this.configuration.optionTemplate && item) { - return this.configuration.optionTemplate; - } + if (this.configuration.optionTemplate && item) { return this.configuration.optionTemplate; } return null; } diff --git a/dmp-frontend/src/app/library/auto-complete/multiple/option-component.model.ts b/dmp-frontend/src/app/library/auto-complete/multiple/option-component.model.ts new file mode 100644 index 000000000..8fc4985ec --- /dev/null +++ b/dmp-frontend/src/app/library/auto-complete/multiple/option-component.model.ts @@ -0,0 +1,3 @@ +export interface OptionComponent{ + item: any; +} diff --git a/dmp-frontend/src/app/ui/description/description-preview/dataset-preview-dialog.component.html b/dmp-frontend/src/app/ui/admin/description-template/description-template-preview/description-template-preview-dialog.component.html similarity index 54% rename from dmp-frontend/src/app/ui/description/description-preview/dataset-preview-dialog.component.html rename to dmp-frontend/src/app/ui/admin/description-template/description-template-preview/description-template-preview-dialog.component.html index 3d1182cde..f8b1e0f82 100644 --- a/dmp-frontend/src/app/ui/description/description-preview/dataset-preview-dialog.component.html +++ b/dmp-frontend/src/app/ui/admin/description-template/description-template-preview/description-template-preview-dialog.component.html @@ -1,18 +1,17 @@ -
+
- {{'DMP-LISTING.COLUMNS.PROFILE' | translate}} - {{data.template.label}} + {{'DMP-LISTING.COLUMNS.PROFILE' | translate}} - {{descriptionTemplate.label}} close
- +
-
+
-
+
\ No newline at end of file diff --git a/dmp-frontend/src/app/ui/description/description-preview/dataset-preview-dialog.component.scss b/dmp-frontend/src/app/ui/admin/description-template/description-template-preview/description-template-preview-dialog.component.scss similarity index 100% rename from dmp-frontend/src/app/ui/description/description-preview/dataset-preview-dialog.component.scss rename to dmp-frontend/src/app/ui/admin/description-template/description-template-preview/description-template-preview-dialog.component.scss diff --git a/dmp-frontend/src/app/ui/admin/description-template/description-template-preview/description-template-preview-dialog.component.ts b/dmp-frontend/src/app/ui/admin/description-template/description-template-preview/description-template-preview-dialog.component.ts new file mode 100644 index 000000000..af579e989 --- /dev/null +++ b/dmp-frontend/src/app/ui/admin/description-template/description-template-preview/description-template-preview-dialog.component.ts @@ -0,0 +1,81 @@ +import { Component, Inject, OnInit } from '@angular/core'; +import { UntypedFormGroup } from '@angular/forms'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; +import { DescriptionTemplate } from '@app/core/model/description-template/description-template'; +import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service'; +import { LoggingService } from '@app/core/services/logging/logging-service'; +import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service'; +import { ProgressIndicationService } from '@app/core/services/progress-indication/progress-indication-service'; +import { DescriptionEditorModel } from '@app/ui/description/editor/description-editor.model'; +import { DescriptionEditorResolver } from '@app/ui/description/editor/description-editor.resolver'; +import { VisibilityRulesService } from '@app/ui/description/editor/description-form/visibility-rules/visibility-rules.service'; +import { BaseComponent } from '@common/base/base.component'; +import { TranslateService } from '@ngx-translate/core'; +import { takeUntil } from 'rxjs/operators'; + +@Component({ + selector: 'app-description-template-preview-dialog-component', + templateUrl: 'description-template-preview-dialog.component.html', + styleUrls: ['./description-template-preview-dialog.component.scss'], +}) +export class DescriptionTemplatePreviewDialogComponent extends BaseComponent implements OnInit { + + datasetProfileDefinitionFormGroup: UntypedFormGroup; + progressIndication = false; + editorModel: DescriptionEditorModel; + formGroup: UntypedFormGroup; + descriptionTemplate: DescriptionTemplate; + + constructor( + public dialogRef: MatDialogRef, + private progressIndicationService: ProgressIndicationService, + private descriptionTemplateService: DescriptionTemplateService, + private uiNotificationService: UiNotificationService, + private logger: LoggingService, + private language: TranslateService, + public visibilityRulesService: VisibilityRulesService, + @Inject(MAT_DIALOG_DATA) public data: any + ) { + super(); + } + + ngOnInit(): void { + this.progressIndicationService.getProgressIndicationObservable().pipe(takeUntil(this._destroyed)).subscribe(x => { + setTimeout(() => { this.progressIndication = x; }); + }); + + if (this.data && this.data.descriptionTemplateId) { + + this.descriptionTemplateService.getSingle(this.data.descriptionTemplateId, DescriptionEditorResolver.descriptionTemplateLookupFields()) + .pipe(takeUntil(this._destroyed)) + .subscribe(item => { + this.descriptionTemplate = item; + this.prepareForm(this.descriptionTemplate); + }); + } + } + + prepareForm(data: DescriptionTemplate) { + try { + this.editorModel = new DescriptionEditorModel(); + this.buildForm(); + } catch (error) { + this.logger.error('Could not parse Description item: ' + data + error); + this.uiNotificationService.snackBarNotification(this.language.instant('COMMONS.ERRORS.DEFAULT'), SnackBarNotificationLevel.Error); + } + } + + buildForm() { + this.formGroup = this.editorModel.buildForm(null, true); + this.visibilityRulesService.buildVisibilityRules(this.visibilityRulesService.getVisibilityRulesFromDescriptionTempalte(this.descriptionTemplate), this.formGroup); + } + + select(): void { + this.dialogRef.close(true); + } + + closeDialog(): void { + this.dialogRef.close(); + } + +} diff --git a/dmp-frontend/src/app/ui/admin/description-template/description-template-preview/description-template-preview-dialog.module.ts b/dmp-frontend/src/app/ui/admin/description-template/description-template-preview/description-template-preview-dialog.module.ts new file mode 100644 index 000000000..e75a4862e --- /dev/null +++ b/dmp-frontend/src/app/ui/admin/description-template/description-template-preview/description-template-preview-dialog.module.ts @@ -0,0 +1,26 @@ +import { NgModule } from '@angular/core'; +import { FormattingModule } from '@app/core/formatting.module'; +import { DescriptionFormModule } from '@app/ui/description/editor/description-form/description-form.module'; +import { VisibilityRulesService } from '@app/ui/description/editor/description-form/visibility-rules/visibility-rules.service'; +import { CommonFormsModule } from '@common/forms/common-forms.module'; +import { CommonUiModule } from '@common/ui/common-ui.module'; +import { DescriptionTemplatePreviewDialogComponent } from './description-template-preview-dialog.component'; + +@NgModule({ + imports: [ + CommonUiModule, + CommonFormsModule, + FormattingModule, + DescriptionFormModule + ], + declarations: [ + DescriptionTemplatePreviewDialogComponent, + ], + exports: [ + DescriptionTemplatePreviewDialogComponent, + ], + providers: [ + VisibilityRulesService + ] +}) +export class DescriptionTemplatePreviewDialogModule { } diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.ts index 4ba0e88e1..27869204a 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.ts +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.ts @@ -175,7 +175,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor { this.uiNotificationService.snackBarNotification(this.language.instant('DESCRIPTION-TEMPLATE-LISTING.MESSAGES.TEMPLATE-UPLOAD-SUCCESS'), SnackBarNotificationLevel.Success); - this.ngOnInit(); + this.refresh(); }, error => { this.uiNotificationService.snackBarNotification(error.message, SnackBarNotificationLevel.Error); diff --git a/dmp-frontend/src/app/ui/admin/description-types/listing/description-template-type-listing.component.ts b/dmp-frontend/src/app/ui/admin/description-types/listing/description-template-type-listing.component.ts index 535365233..fc891de59 100644 --- a/dmp-frontend/src/app/ui/admin/description-types/listing/description-template-type-listing.component.ts +++ b/dmp-frontend/src/app/ui/admin/description-types/listing/description-template-type-listing.component.ts @@ -174,6 +174,6 @@ export class DescriptionTemplateTypeListingComponent extends BaseListingComponen onCallbackSuccess(): void { this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DELETE'), SnackBarNotificationLevel.Success); - this.ngOnInit(); + this.refresh(); } } diff --git a/dmp-frontend/src/app/ui/admin/dmp-blueprint/dmp-blueprint.module.ts b/dmp-frontend/src/app/ui/admin/dmp-blueprint/dmp-blueprint.module.ts index fa3871907..7cd06eb4f 100644 --- a/dmp-frontend/src/app/ui/admin/dmp-blueprint/dmp-blueprint.module.ts +++ b/dmp-frontend/src/app/ui/admin/dmp-blueprint/dmp-blueprint.module.ts @@ -14,6 +14,7 @@ import { DmpBlueprintEditorComponent } from './editor/dmp-blueprint-editor.compo import { DmpBlueprintListingComponent } from './listing/dmp-blueprint-listing.component'; import { DmpBlueprintListingFiltersComponent } from "./listing/filters/dmp-blueprint-listing-filters.component"; import { ImportDmpBlueprintDialogComponent } from './listing/import-dmp-blueprint/import-dmp-blueprint.dialog.component'; +import { DescriptionTemplatePreviewDialogModule } from '../description-template/description-template-preview/description-template-preview-dialog.module'; @NgModule({ imports: [ @@ -27,7 +28,8 @@ import { ImportDmpBlueprintDialogComponent } from './listing/import-dmp-blueprin HybridListingModule, TextFilterModule, UserSettingsModule, - CommonFormattingModule + CommonFormattingModule, + DescriptionTemplatePreviewDialogModule ], declarations: [ DmpBlueprintEditorComponent, diff --git a/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.component.html b/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.component.html index be178cfb1..8b468647a 100644 --- a/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.component.html +++ b/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.component.html @@ -182,7 +182,7 @@
{{'DMP-BLUEPRINT-EDITOR.FIELDS.DESCRIPTION-TEMPLATES' | translate}} - +
diff --git a/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.component.ts b/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.component.ts index b2e31c062..39b2b47d5 100644 --- a/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.component.ts +++ b/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.component.ts @@ -43,6 +43,7 @@ import { nameof } from 'ts-simple-nameof'; import { DescriptionTemplateStatus } from '@app/core/common/enum/description-template-status'; import { DescriptionTemplateVersionStatus } from '@app/core/common/enum/description-template-version-status'; import { MatSelectChange } from '@angular/material/select'; +import { DescriptionTemplatePreviewDialogComponent } from '../../description-template/description-template-preview/description-template-preview-dialog.component'; @Component({ @@ -63,14 +64,6 @@ export class DmpBlueprintEditorComponent extends BaseEditor(DmpBlueprintSystemFieldType); dmpBlueprintExtraFieldDataType = DmpBlueprintExtraFieldDataType; public dmpBlueprintExtraFieldDataTypeEnum = this.enumUtils.getEnumValues(DmpBlueprintExtraFieldDataType); - templatesAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = { - initialItems: (excludedItems: any[], data?: any) => this.descriptionTemplateService.query(this.buildAutocompleteLookup(null, excludedItems ? excludedItems : null)).pipe(map(x => x.items)), - filterFn: (searchQuery: string, excludedItems: any[]) => this.descriptionTemplateService.query(this.buildAutocompleteLookup(searchQuery, excludedItems)).pipe(map(x => x.items)), - getSelectedItems: (selectedItems: any[]) => this.descriptionTemplateService.query(this.buildAutocompleteLookup(null, null, selectedItems)).pipe(map(x => x.items)), - displayFn: (item: DescriptionTemplate) => item.label, - titleFn: (item: DescriptionTemplate) => item.label, - valueAssign: (item: DescriptionTemplate) => item.id, - }; protected get canDelete(): boolean { return !this.isDeleted && !this.isNew && this.hasPermission(this.authService.permissionEnum.DeleteDmpBlueprint); @@ -109,7 +102,7 @@ export class DmpBlueprintEditorComponent extends BaseEditor this.prepareForm(data)); + refreshData(id?: Guid): void { + this.getItem(id ?? this.editorModel.id, (data: DmpBlueprint) => this.prepareForm(data)); } refreshOnNavigateToData(id?: Guid): void { this.formGroup.markAsPristine(); - let route = []; - - if (id === null) { - route.push('../..'); - } else if (this.isNew) { - route.push('../' + id); + if (this.isNew) { + let route = []; + route.push('/dmp-blueprints/' + id); + this.router.navigate(route, { queryParams: { 'lookup': this.queryParamsService.serializeLookup(this.lookupParams), 'lv': ++this.lv }, replaceUrl: true, relativeTo: this.route }); } else { - route.push('..'); + this.refreshData(id); } - - this.router.navigate(route, { queryParams: { 'lookup': this.queryParamsService.serializeLookup(this.lookupParams), 'lv': ++this.lv }, replaceUrl: true, relativeTo: this.route }); } persistEntity(onSuccess?: (response) => void): void { @@ -201,7 +190,7 @@ export class DmpBlueprintEditorComponent extends BaseEditor this.onCallbackSuccess(), + complete => this.cancel(), error => this.onCallbackError(error) ); } @@ -220,7 +209,7 @@ export class DmpBlueprintEditorComponent extends BaseEditor (y as UntypedFormGroup).get('systemFieldType')?.value === systemFieldType)){ + } else { + if (!((this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('fields') as FormArray).controls.some(y => (y as UntypedFormGroup).get('systemFieldType')?.value === systemFieldType)) { ((this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('fields') as FormArray).push(this.editorModel.createChildSystemField(sectionIndex, fieldSize, systemFieldType)); return; } @@ -611,36 +600,36 @@ export class DmpBlueprintEditorComponent extends BaseEditor { - // // if (result) { - // // let blueprints = this.sectionsArray().at(sectionIndex).get('descriptionTemplates').value;//this.formGroup.get('blueprints').value; - // // const blueprint: DescriptionTemplatesInSectionEditor = new DescriptionTemplatesInSectionEditor(); - // // blueprint.id = Guid.create().toString(); - // // blueprint.descriptionTemplateId = event.id; - // // blueprint.label = event.label; - // // blueprints.push(blueprint.buildForm()); - // // this.sectionsArray().at(sectionIndex).get('descriptionTemplates').setValue(blueprints);//this.formGroup.get('blueprints').setValue(blueprints); - // // this.blueprintsAutoCompleteConfiguration = { - // // filterFn: this.filterProfiles.bind(this), - // // initialItems: (excludedItems: any[]) => this.filterProfiles('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))), - // // displayFn: (item) => item['label'], - // // titleFn: (item) => item['label'], - // // subtitleFn: (item) => item['description'], - // // popupItemActionIcon: 'visibility' - // // }; - // // } - // // }); - // // } + onPreviewDescriptionTemplate(event: DescriptionTemplate, sectionId: Guid) { + const dialogRef = this.dialog.open(DescriptionTemplatePreviewDialogComponent, { + width: '590px', + minHeight: '200px', + restoreFocus: false, + data: { + descriptionTemplateId: event.id + }, + panelClass: 'custom-modalbox' + }); + dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { + // if (result) { + // let blueprints = this.sectionsArray().at(sectionIndex).get('descriptionTemplates').value;//this.formGroup.get('blueprints').value; + // const blueprint: DescriptionTemplatesInSectionEditor = new DescriptionTemplatesInSectionEditor(); + // blueprint.id = Guid.create().toString(); + // blueprint.descriptionTemplateId = event.id; + // blueprint.label = event.label; + // blueprints.push(blueprint.buildForm()); + // this.sectionsArray().at(sectionIndex).get('descriptionTemplates').setValue(blueprints);//this.formGroup.get('blueprints').setValue(blueprints); + // this.blueprintsAutoCompleteConfiguration = { + // filterFn: this.filterProfiles.bind(this), + // initialItems: (excludedItems: any[]) => this.filterProfiles('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))), + // displayFn: (item) => item['label'], + // titleFn: (item) => item['label'], + // subtitleFn: (item) => item['description'], + // popupItemActionIcon: 'visibility' + // }; + // } + }); + } diff --git a/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.model.ts b/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.model.ts index 1c5987b20..7a8cf0fe1 100644 --- a/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.model.ts +++ b/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.model.ts @@ -41,7 +41,8 @@ export class DmpBlueprintEditorModel extends BaseEditorModel implements DmpBluep label: [{ value: this.label, disabled: disabled }, context.getValidation('label').validators], status: [{ value: this.status, disabled: disabled }, context.getValidation('status').validators], definition: this.definition.buildForm({ - rootPath: `definition.` + rootPath: `definition.`, + disabled: disabled }), hash: [{ value: this.hash, disabled: disabled }, context.getValidation('hash').validators] }); @@ -142,7 +143,8 @@ export class DmpBlueprintDefinitionEditorModel implements DmpBlueprintDefinition (item, index) => new DmpBlueprintDefinitionSectionEditorModel( this.validationErrorModel ).fromModel(item).buildForm({ - rootPath: `${rootPath}sections[${index}].` + rootPath: `${rootPath}sections[${index}].`, + disabled: disabled }) ), context.getValidation('sections').validators ), @@ -232,7 +234,8 @@ export class DmpBlueprintDefinitionSectionEditorModel implements DmpBlueprintDef (item, index) => new FieldInSectionEditorModel( this.validationErrorModel ).fromModel(item).buildForm({ - rootPath: `${rootPath}fields[${index}].` + rootPath: `${rootPath}fields[${index}].`, + disabled: disabled }) ), context.getValidation('fields') ), @@ -241,7 +244,8 @@ export class DmpBlueprintDefinitionSectionEditorModel implements DmpBlueprintDef (item, index) => new DescriptionTemplatesInSectionEditorModel( this.validationErrorModel ).fromModel(item).buildForm({ - rootPath: `${rootPath}descriptionTemplates[${index}].` + rootPath: `${rootPath}descriptionTemplates[${index}].`, + disabled: disabled }) ), context.getValidation('descriptionTemplates') ) diff --git a/dmp-frontend/src/app/ui/admin/dmp-blueprint/listing/dmp-blueprint-listing.component.ts b/dmp-frontend/src/app/ui/admin/dmp-blueprint/listing/dmp-blueprint-listing.component.ts index ba2839557..0611744f8 100644 --- a/dmp-frontend/src/app/ui/admin/dmp-blueprint/listing/dmp-blueprint-listing.component.ts +++ b/dmp-frontend/src/app/ui/admin/dmp-blueprint/listing/dmp-blueprint-listing.component.ts @@ -185,7 +185,7 @@ export class DmpBlueprintListingComponent extends BaseListingComponent { this.uiNotificationService.snackBarNotification(this.language.instant('DMP-BLUEPRINT-LISTING.MESSAGES.TEMPLATE-UPLOAD-SUCCESS'), SnackBarNotificationLevel.Success); - this.ngOnInit(); + this.refresh(); }, error => { this.uiNotificationService.snackBarNotification(error.message, SnackBarNotificationLevel.Error); @@ -227,177 +227,177 @@ export class DmpBlueprintListingComponent extends BaseListingComponent { - // const blob = new Blob([response.body], { type: 'application/xml' }); - // const filename = this.fileUtils.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition')); - // FileSaver.saveAs(blob, filename); - // }); - // } +// downloadXML(dmpBlueprintId: string): void { +// this.dmpBlueprintService.downloadXML(dmpBlueprintId) +// .pipe(takeUntil(this._destroyed)) +// .subscribe(response => { +// const blob = new Blob([response.body], { type: 'application/xml' }); +// const filename = this.fileUtils.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition')); +// FileSaver.saveAs(blob, filename); +// }); +// } - // deleteTemplate(id: string) { - // if (id) { - // this.dialog.open(ConfirmationDialogComponent, { - // data: { - // isDeleteConfirmation: true, - // confirmButton: this.languageService.instant('DMP-BLUEPRINT-EDITOR.CONFIRM-DELETE-DIALOG.CONFIRM-BUTTON'), - // cancelButton: this.languageService.instant("DMP-BLUEPRINT-EDITOR.CONFIRM-DELETE-DIALOG.CANCEL-BUTTON"), - // message: this.languageService.instant("DMP-BLUEPRINT-EDITOR.CONFIRM-DELETE-DIALOG.MESSAGE") - // } - // }) - // .afterClosed() - // .subscribe( - // confirmed => { - // if (confirmed) { - // this.dmpBlueprintService.delete(id) - // .pipe(takeUntil(this._destroyed)) - // .subscribe( - // complete => { - // this.uiNotificationService.snackBarNotification(this.languageService.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DMP-BLUEPRINT-DELETE'), SnackBarNotificationLevel.Success); - // this.refresh(); - // }, - // error => { - // this.onCallbackError(error); - // if (error.error.statusCode == 674) { - // this.uiNotificationService.snackBarNotification(this.languageService.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DMP-BLUEPRINT-DELETE'), SnackBarNotificationLevel.Error); - // } else { - // this.uiNotificationService.snackBarNotification(this.languageService.instant(error.message), SnackBarNotificationLevel.Error); - // } - // } - // ); - // } - // } - // ) - // } - // } +// deleteTemplate(id: string) { +// if (id) { +// this.dialog.open(ConfirmationDialogComponent, { +// data: { +// isDeleteConfirmation: true, +// confirmButton: this.languageService.instant('DMP-BLUEPRINT-EDITOR.CONFIRM-DELETE-DIALOG.CONFIRM-BUTTON'), +// cancelButton: this.languageService.instant("DMP-BLUEPRINT-EDITOR.CONFIRM-DELETE-DIALOG.CANCEL-BUTTON"), +// message: this.languageService.instant("DMP-BLUEPRINT-EDITOR.CONFIRM-DELETE-DIALOG.MESSAGE") +// } +// }) +// .afterClosed() +// .subscribe( +// confirmed => { +// if (confirmed) { +// this.dmpBlueprintService.delete(id) +// .pipe(takeUntil(this._destroyed)) +// .subscribe( +// complete => { +// this.uiNotificationService.snackBarNotification(this.languageService.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DMP-BLUEPRINT-DELETE'), SnackBarNotificationLevel.Success); +// this.refresh(); +// }, +// error => { +// this.onCallbackError(error); +// if (error.error.statusCode == 674) { +// this.uiNotificationService.snackBarNotification(this.languageService.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DMP-BLUEPRINT-DELETE'), SnackBarNotificationLevel.Error); +// } else { +// this.uiNotificationService.snackBarNotification(this.languageService.instant(error.message), SnackBarNotificationLevel.Error); +// } +// } +// ); +// } +// } +// ) +// } +// } - // onCallbackError(errorResponse: HttpErrorResponse) { - // this.uiNotificationService.snackBarNotification(errorResponse.message, SnackBarNotificationLevel.Warning); - // } +// onCallbackError(errorResponse: HttpErrorResponse) { +// this.uiNotificationService.snackBarNotification(errorResponse.message, SnackBarNotificationLevel.Warning); +// } - // getDefaultCriteria(): DmpBlueprintCriteria { - // const defaultCriteria = new DmpBlueprintCriteria(); - // return defaultCriteria; - // } +// getDefaultCriteria(): DmpBlueprintCriteria { +// const defaultCriteria = new DmpBlueprintCriteria(); +// return defaultCriteria; +// } - // // makeItPublic(id: String) { - // // debugger; - // // this.datasetService.makeDatasetPublic(id).pipe(takeUntil(this._destroyed)).subscribe(); - // // } +// // makeItPublic(id: String) { +// // debugger; +// // this.datasetService.makeDatasetPublic(id).pipe(takeUntil(this._destroyed)).subscribe(); +// // } - // parseStatus(value: number): string { - // const stringVal = value.toString() - // try { - // return this.statuses.find(status => status.value === stringVal).viewValue; - // } catch { - // return stringVal; - // } - // } +// parseStatus(value: number): string { +// const stringVal = value.toString() +// try { +// return this.statuses.find(status => status.value === stringVal).viewValue; +// } catch { +// return stringVal; +// } +// } - // openDialog(): void { - // const dialogRef = this.dialog.open(DialodConfirmationUploadDmpBlueprints, { - // restoreFocus: false, - // data: { - // message: this.languageService.instant('DMP-BLUEPRINT-LISTING.IMPORT.UPLOAD-XML-FILE-TITLE'), - // confirmButton: this.languageService.instant('DMP-BLUEPRINT-LISTING.IMPORT.UPLOAD-XML'), - // cancelButton: this.languageService.instant('DMP-BLUEPRINT-LISTING.IMPORT.UPLOAD-XML-FILE-CANCEL'), - // name: '', - // file: FileList, - // sucsess: false - // } - // }); - // dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(data => { - // if (data && data.sucsess && data.name != null && data.file != null) { - // this.dmpBlueprintService.uploadFile(data.file, data.name) - // .pipe(takeUntil(this._destroyed)) - // .subscribe(_ => { - // this.uiNotificationService.snackBarNotification(this.languageService.instant('DMP-BLUEPRINT-LISTING.MESSAGES.TEMPLATE-UPLOAD-SUCCESS'), SnackBarNotificationLevel.Success); - // this.refresh(); - // }, - // error => { - // this.uiNotificationService.snackBarNotification(error.message, SnackBarNotificationLevel.Error); - // }); - // } - // }); - // } - // getStatusClass(status: number): string { +// openDialog(): void { +// const dialogRef = this.dialog.open(DialodConfirmationUploadDmpBlueprints, { +// restoreFocus: false, +// data: { +// message: this.languageService.instant('DMP-BLUEPRINT-LISTING.IMPORT.UPLOAD-XML-FILE-TITLE'), +// confirmButton: this.languageService.instant('DMP-BLUEPRINT-LISTING.IMPORT.UPLOAD-XML'), +// cancelButton: this.languageService.instant('DMP-BLUEPRINT-LISTING.IMPORT.UPLOAD-XML-FILE-CANCEL'), +// name: '', +// file: FileList, +// sucsess: false +// } +// }); +// dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(data => { +// if (data && data.sucsess && data.name != null && data.file != null) { +// this.dmpBlueprintService.uploadFile(data.file, data.name) +// .pipe(takeUntil(this._destroyed)) +// .subscribe(_ => { +// this.uiNotificationService.snackBarNotification(this.languageService.instant('DMP-BLUEPRINT-LISTING.MESSAGES.TEMPLATE-UPLOAD-SUCCESS'), SnackBarNotificationLevel.Success); +// this.refresh(); +// }, +// error => { +// this.uiNotificationService.snackBarNotification(error.message, SnackBarNotificationLevel.Error); +// }); +// } +// }); +// } +// getStatusClass(status: number): string { - // if (status === 1) {//finalized - // return 'status-chip-finalized' - // } - // if (status === 0) { - // return 'status-chip-draft'; - // } - // return ''; - // } - // } +// if (status === 1) {//finalized +// return 'status-chip-finalized' +// } +// if (status === 0) { +// return 'status-chip-draft'; +// } +// return ''; +// } +// } - // export class DatasetDataSource extends DataSource { +// export class DatasetDataSource extends DataSource { - // totalCount = 0; +// totalCount = 0; - // constructor( - // private _service: dmpBlueprintService, - // private _paginator: MatPaginator, - // private _sort: MatSort, - // private _criteria: DmpBlueprintCriteriaComponent - // ) { - // super(); +// constructor( +// private _service: dmpBlueprintService, +// private _paginator: MatPaginator, +// private _sort: MatSort, +// private _criteria: DmpBlueprintCriteriaComponent +// ) { +// super(); - // } +// } - // connect(): Observable { - // const displayDataChanges = [ - // this._paginator.page - // //this._sort.matSortChange - // ]; +// connect(): Observable { +// const displayDataChanges = [ +// this._paginator.page +// //this._sort.matSortChange +// ]; - // return observableMerge(...displayDataChanges).pipe( - // startWith(null), - // switchMap(() => { - // const startIndex = this._paginator.pageIndex * this._paginator.pageSize; - // let fields: Array = new Array(); - // if (this._sort.active) { fields = this._sort.direction === 'asc' ? ['+' + this._sort.active] : ['-' + this._sort.active]; } - // const request = new DataTableRequest(startIndex, this._paginator.pageSize, { fields: fields }); - // request.criteria = this._criteria.criteria; - // return this._service.getPagedBlueprint(request); - // }), - // /*.catch((error: any) => { - // this._snackBar.openFromComponent(SnackBarNotificationComponent, { - // data: { message: 'GENERAL.SNACK-BAR.FORMS-BAD-REQUEST', language: this._languageService }, - // duration: 3000, - // extraClasses: ['snackbar-warning'] - // }); - // //this._criteria.criteria.onCallbackError(error); - // return Observable.of(null); - // })*/ - // map(result => { - // return result; - // }), - // map(result => { - // if (!result) { return []; } - // if (this._paginator.pageIndex === 0) { this.totalCount = result.totalCount; } - // return result.data; - // })); - // } +// return observableMerge(...displayDataChanges).pipe( +// startWith(null), +// switchMap(() => { +// const startIndex = this._paginator.pageIndex * this._paginator.pageSize; +// let fields: Array = new Array(); +// if (this._sort.active) { fields = this._sort.direction === 'asc' ? ['+' + this._sort.active] : ['-' + this._sort.active]; } +// const request = new DataTableRequest(startIndex, this._paginator.pageSize, { fields: fields }); +// request.criteria = this._criteria.criteria; +// return this._service.getPagedBlueprint(request); +// }), +// /*.catch((error: any) => { +// this._snackBar.openFromComponent(SnackBarNotificationComponent, { +// data: { message: 'GENERAL.SNACK-BAR.FORMS-BAD-REQUEST', language: this._languageService }, +// duration: 3000, +// extraClasses: ['snackbar-warning'] +// }); +// //this._criteria.criteria.onCallbackError(error); +// return Observable.of(null); +// })*/ +// map(result => { +// return result; +// }), +// map(result => { +// if (!result) { return []; } +// if (this._paginator.pageIndex === 0) { this.totalCount = result.totalCount; } +// return result.data; +// })); +// } - // disconnect() { - // // No-op - // } +// disconnect() { +// // No-op +// } diff --git a/dmp-frontend/src/app/ui/admin/language/listing/language-listing.component.ts b/dmp-frontend/src/app/ui/admin/language/listing/language-listing.component.ts index 1409ddcb9..9534c8dde 100644 --- a/dmp-frontend/src/app/ui/admin/language/listing/language-listing.component.ts +++ b/dmp-frontend/src/app/ui/admin/language/listing/language-listing.component.ts @@ -166,6 +166,6 @@ export class LanguageListingComponent extends BaseListingComponent onCallbackSuccess(): void { this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DELETE'), SnackBarNotificationLevel.Success); - this.ngOnInit(); + this.refresh(); } onUserRowActivated(event: RowActivateEvent, baseRoute: string = null) { diff --git a/dmp-frontend/src/app/ui/description/description-preview/dataset-preview-dialog.component.ts b/dmp-frontend/src/app/ui/description/description-preview/dataset-preview-dialog.component.ts deleted file mode 100644 index 9cacc9367..000000000 --- a/dmp-frontend/src/app/ui/description/description-preview/dataset-preview-dialog.component.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { Component, Inject, OnInit } from '@angular/core'; -import { UntypedFormGroup } from '@angular/forms'; -import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; -import { DatasetWizardService } from '@app/core/services/dataset-wizard/dataset-wizard.service'; -import { ProgressIndicationService } from '@app/core/services/progress-indication/progress-indication-service'; -import { DatasetDescriptionFormEditorModel } from '@app/ui/misc/dataset-description-form/dataset-description-form.model'; -import { BaseComponent } from '@common/base/base.component'; -import { takeUntil } from 'rxjs/operators'; - -@Component({ - selector: 'app-dataset-preview-dialog-component', - templateUrl: 'dataset-preview-dialog.component.html', - styleUrls: ['./dataset-preview-dialog.component.scss'], -}) -export class DatasetPreviewDialogComponent extends BaseComponent implements OnInit { - - datasetProfileDefinitionModel: DatasetDescriptionFormEditorModel; - datasetProfileDefinitionFormGroup: UntypedFormGroup; - progressIndication = false; - - constructor( - public dialogRef: MatDialogRef, - private datasetWizardService: DatasetWizardService, - private progressIndicationService: ProgressIndicationService, - @Inject(MAT_DIALOG_DATA) public data: any - ) { - super(); - } - - ngOnInit(): void { - this.progressIndicationService.getProgressIndicationObservable().pipe(takeUntil(this._destroyed)).subscribe(x => { - setTimeout(() => { this.progressIndication = x; }); - }); - - if (this.data && this.data.template) { - this.datasetWizardService.getDefinition(this.data.template.id) - .pipe(takeUntil(this._destroyed)) - .subscribe(item => { - this.datasetProfileDefinitionModel = new DatasetDescriptionFormEditorModel().fromModel(item); - this.datasetProfileDefinitionFormGroup = this.datasetProfileDefinitionModel.buildForm(); - this.datasetProfileDefinitionFormGroup.disable(); - }); - } - } - - select(): void { - this.dialogRef.close(true); - } - - closeDialog(): void { - this.dialogRef.close(); - } - -} diff --git a/dmp-frontend/src/app/ui/description/description-preview/dataset-preview-dialog.module.ts b/dmp-frontend/src/app/ui/description/description-preview/dataset-preview-dialog.module.ts deleted file mode 100644 index 30c165387..000000000 --- a/dmp-frontend/src/app/ui/description/description-preview/dataset-preview-dialog.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { NgModule } from '@angular/core'; -import { FormattingModule } from '@app/core/formatting.module'; -import { CommonFormsModule } from '@common/forms/common-forms.module'; -import { CommonUiModule } from '@common/ui/common-ui.module'; -import { DatasetPreviewDialogComponent } from './dataset-preview-dialog.component'; - -@NgModule({ - imports: [ - CommonUiModule, - CommonFormsModule, - FormattingModule, - ], - declarations: [ - DatasetPreviewDialogComponent, - ], - exports: [ - DatasetPreviewDialogComponent, - ] -}) -export class DatasetPreviewDialogModule { } diff --git a/dmp-frontend/src/app/ui/description/editor/description-editor.component.ts b/dmp-frontend/src/app/ui/description/editor/description-editor.component.ts index fca886fcc..fdbb79efd 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-editor.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-editor.component.ts @@ -565,7 +565,7 @@ export class DescriptionEditorComponent extends BaseEditor(x => x.dmpDescriptionTemplate), nameof(x => x.id)].join('.'), [nameof(x => x.dmpDescriptionTemplate), nameof(x => x.sectionId)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.id)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.label)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.version)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.pages), nameof(x => x.id)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.pages), nameof(x => x.ordinal)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.pages), nameof(x => x.title)].join('.'), - - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.ordinal)].join('.'), - // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.defaultVisibility)].join('.'), - // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.multiplicity)].join('.'), - // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.numbering)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.page)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.title)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.description)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.extendedDescription)].join('.'), - // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.ordinal)].join('.'), // TODO: need to sort based on that - // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.sections)].join('.'), // TODO: it is recursive here - - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.id)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.ordinal)].join('.'), - // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.numbering)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.title)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.description)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.extendedDescription)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.additionalInformation)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.hasCommentField)].join('.'), - // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.multiplicity), nameof(x => x.min)].join('.'), - // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.multiplicity), nameof(x => x.max)].join('.'), - // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.multiplicity), nameof(x => x.placeholder)].join('.'), - // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.multiplicity), nameof(x => x.tableView)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.id)].join('.'), - // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.ordinal)].join('.'), - // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.numbering)].join('.'), - // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.schematics)].join('.'), - // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.defaultValue)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.defaultValue)].join('.'), - // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.fieldType)].join('.'), - // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.includeInExport)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.validations)].join('.'), - - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.visibilityRules), nameof(x => x.target)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.visibilityRules), nameof(x => x.value)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.label)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.fieldType)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.options)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.options), nameof(x => x.label)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.options), nameof(x => x.value)].join('.'), - [nameof(x => x.descriptionTemplate), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.multiList)].join('.'), - + ...DescriptionEditorResolver.descriptionTemplateLookupFields(nameof(x => x.descriptionTemplate)), [nameof(x => x.properties), nameof(x => x.fields), nameof(x => x.key)].join('.'), [nameof(x => x.properties), nameof(x => x.fields), nameof(x => x.value)].join('.'), @@ -121,6 +72,41 @@ export class DescriptionEditorResolver extends BaseEditorResolver { ] } + public static descriptionTemplateLookupFields(prefix?: string): string[] { + return [ + (prefix ? prefix + '.' : '') + [nameof(x => x.id)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.label)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.version)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.pages), nameof(x => x.id)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.pages), nameof(x => x.ordinal)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.pages), nameof(x => x.title)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.ordinal)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.page)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.title)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.description)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.extendedDescription)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.id)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.ordinal)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.title)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.description)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.extendedDescription)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.additionalInformation)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.hasCommentField)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.id)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.defaultValue)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.validations)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.visibilityRules), nameof(x => x.target)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.visibilityRules), nameof(x => x.value)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.label)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.fieldType)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.options)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.options), nameof(x => x.label)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.options), nameof(x => x.value)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.multiList)].join('.'), + ] + } + resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { const fields = [ diff --git a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.ts b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.ts index 66b89cf51..ec110fffe 100644 --- a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.ts +++ b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.ts @@ -181,7 +181,7 @@ export class DmpEditorComponent extends BaseEditor implemen buildForm() { this.formGroup = this.editorModel.buildForm(null, this.isDeleted || !this.authService.hasPermission(AppPermission.EditDescription)); - if (this.editorModel.status == DmpStatus.Finalized) { + if (this.editorModel.status == DmpStatus.Finalized || this.isDeleted) { this.formGroup.disable(); } diff --git a/dmp-frontend/src/app/ui/inapp-notification/listing/mine-inapp-notification-listing.component.ts b/dmp-frontend/src/app/ui/inapp-notification/listing/mine-inapp-notification-listing.component.ts index 2029435db..72efce277 100644 --- a/dmp-frontend/src/app/ui/inapp-notification/listing/mine-inapp-notification-listing.component.ts +++ b/dmp-frontend/src/app/ui/inapp-notification/listing/mine-inapp-notification-listing.component.ts @@ -170,6 +170,6 @@ export class MineInAppNotificationListingComponent extends BaseListingComponent< onCallbackSuccess(): void { this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DELETE'), SnackBarNotificationLevel.Success); - this.ngOnInit(); + this.refresh(); } } diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index 1c0d8e1d4..dc2c33fba 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -2121,6 +2121,10 @@ "EXPORT": "Export users" } }, + "REFERENCE-FIELD-COMPONENT": { + "EXTERNAL-SOURCE": "Source", + "INTERNAL-SOURCE": "Not bind with source" + }, "TYPES": { "APP-ROLE": { "ADMIN": "Admin", diff --git a/dmp-frontend/src/common/base/base-listing-component.ts b/dmp-frontend/src/common/base/base-listing-component.ts index 6589419e5..9c8cfb20c 100644 --- a/dmp-frontend/src/common/base/base-listing-component.ts +++ b/dmp-frontend/src/common/base/base-listing-component.ts @@ -148,6 +148,9 @@ export abstract class BaseListingComponent