Merge branch 'dmp-refactoring' of code-repo.d4science.org:MaDgiK-CITE/argos into dmp-refactoring
This commit is contained in:
commit
e073fc718c
|
@ -94,10 +94,7 @@ public class CloneDmpPersist {
|
||||||
.failOn(CloneDmpPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{CloneDmpPersist._label}, LocaleContextHolder.getLocale())),
|
.failOn(CloneDmpPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{CloneDmpPersist._label}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.must(() -> !this.isEmpty(item.getDescription()))
|
.must(() -> !this.isEmpty(item.getDescription()))
|
||||||
.failOn(CloneDmpPersist._description).failWith(messageSource.getMessage("Validation_Required", new Object[]{CloneDmpPersist._description}, LocaleContextHolder.getLocale())),
|
.failOn(CloneDmpPersist._description).failWith(messageSource.getMessage("Validation_Required", new Object[]{CloneDmpPersist._description}, LocaleContextHolder.getLocale()))
|
||||||
this.spec()
|
|
||||||
.must(() -> !this.isNull(item.getDescriptions()))
|
|
||||||
.failOn(CloneDmpPersist._descriptions).failWith(messageSource.getMessage("Validation_Required", new Object[]{CloneDmpPersist._descriptions}, LocaleContextHolder.getLocale()))
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -580,6 +580,11 @@ public class DmpServiceImpl implements DmpService {
|
||||||
this.annotationEntityTouchedIntegrationEventHandler.handleDmp(newDmp.getId());
|
this.annotationEntityTouchedIntegrationEventHandler.handleDmp(newDmp.getId());
|
||||||
|
|
||||||
DmpEntity resultingDmpEntity = this.queryFactory.query(DmpQuery.class).ids(newDmp.getId()).firstAs(fields);
|
DmpEntity resultingDmpEntity = this.queryFactory.query(DmpQuery.class).ids(newDmp.getId()).firstAs(fields);
|
||||||
|
if (!this.conventionService.isListNullOrEmpty(model.getDescriptions())){
|
||||||
|
for (UUID description: model.getDescriptions()) {
|
||||||
|
descriptionService.clone(newDmp.getId(), description);
|
||||||
|
}
|
||||||
|
}
|
||||||
return this.builderFactory.builder(DmpBuilder.class).build(fields, resultingDmpEntity);
|
return this.builderFactory.builder(DmpBuilder.class).build(fields, resultingDmpEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -628,7 +628,6 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
||||||
|
|
||||||
refreshData(): void {
|
refreshData(): void {
|
||||||
this.getItem(this.editorModel.id, (data: Description) => this.prepareForm(data));
|
this.getItem(this.editorModel.id, (data: Description) => this.prepareForm(data));
|
||||||
this.tocValidationService.validateForm();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshOnNavigateToData(id?: Guid): void {
|
refreshOnNavigateToData(id?: Guid): void {
|
||||||
|
@ -649,7 +648,8 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
||||||
this.descriptionService.persist(formData)
|
this.descriptionService.persist(formData)
|
||||||
.pipe(takeUntil(this._destroyed)).subscribe(
|
.pipe(takeUntil(this._destroyed)).subscribe(
|
||||||
complete => {
|
complete => {
|
||||||
onSuccess ? onSuccess(complete) : this.onCallbackSuccess(complete);
|
onSuccess ? onSuccess(complete) : this.onCallbackSuccess(complete, this.isNew);
|
||||||
|
this.tocValidationService.validateForm();
|
||||||
this.descriptionIsOnceSaved = true;
|
this.descriptionIsOnceSaved = true;
|
||||||
if (this.formGroup.get('status').value == DescriptionStatus.Finalized) this.isFinalized = true;
|
if (this.formGroup.get('status').value == DescriptionStatus.Finalized) this.isFinalized = true;
|
||||||
},
|
},
|
||||||
|
@ -1099,10 +1099,11 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
||||||
|
|
||||||
page.sections?.forEach((section: DescriptionTemplateSection) => {
|
page.sections?.forEach((section: DescriptionTemplateSection) => {
|
||||||
let fieldsets = this.getNestedSectionFieldsets(section);
|
let fieldsets = this.getNestedSectionFieldsets(section);
|
||||||
let sectionIds = this.getNestedSectionIds(section);
|
|
||||||
let fieldsBySection: DescriptionFieldIndicator[] = fieldsets?.flatMap((fieldset: DescriptionTemplateFieldSet) =>
|
let fieldsBySection: DescriptionFieldIndicator[] = fieldsets?.flatMap((fieldset: DescriptionTemplateFieldSet) =>
|
||||||
fieldset.fields?.flatMap((field: DescriptionTemplateField) =>
|
fieldset.fields?.flatMap((field: DescriptionTemplateField) => {
|
||||||
new DescriptionFieldIndicator(page.id, sectionIds, fieldset.id, field.id, field.data.fieldType, field.data.multipleSelect)
|
let sectionIds = this.getNestedSectionIdsByField(section, fieldset.id);
|
||||||
|
return new DescriptionFieldIndicator(page.id, sectionIds, fieldset.id, field.id, field.data.fieldType, field.data.multipleSelect)
|
||||||
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
fieldsByPage.push(...fieldsBySection);
|
fieldsByPage.push(...fieldsBySection);
|
||||||
|
@ -1119,12 +1120,14 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
||||||
else return section.fieldSets;
|
else return section.fieldSets;
|
||||||
}
|
}
|
||||||
|
|
||||||
getNestedSectionIds(section: DescriptionTemplateSection): string[] {
|
getNestedSectionIdsByField(section: DescriptionTemplateSection, fieldSetId: string): string[] {
|
||||||
if (section.sections) {
|
if (section.sections) {
|
||||||
return [section.id, ...section.sections.flatMap((subsection: DescriptionTemplateSection) => this.getNestedSectionIds(subsection))];
|
return [section.id, ...section.sections.flatMap((subsection: DescriptionTemplateSection) => this.getNestedSectionIdsByField(subsection, fieldSetId))];
|
||||||
}
|
}
|
||||||
|
|
||||||
else return [section.id];
|
else if (section.fieldSets.find(fieldSet => fieldSet.id == fieldSetId)) return [section.id];
|
||||||
|
|
||||||
|
else return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// // this._listenersSubscription.add(dmpSubscription);
|
// // this._listenersSubscription.add(dmpSubscription);
|
||||||
|
|
|
@ -36,7 +36,7 @@ export class DescriptionEditorModel extends BaseEditorModel implements Descripti
|
||||||
this.descriptionTemplateId = item.descriptionTemplate?.id;
|
this.descriptionTemplateId = item.descriptionTemplate?.id;
|
||||||
this.status = item.status ?? DescriptionStatus.Draft;
|
this.status = item.status ?? DescriptionStatus.Draft;
|
||||||
this.description = item.description;
|
this.description = item.description;
|
||||||
this.tags = item.descriptionTags?.map(x => x.tag?.label);
|
this.tags = item.descriptionTags?.filter(x => x.isActive === IsActive.Active).map(x => x.tag?.label);
|
||||||
this.properties = new DescriptionPropertyDefinitionEditorModel(this.validationErrorModel).fromModel(item.properties, descriptionTemplate, item.descriptionReferences);
|
this.properties = new DescriptionPropertyDefinitionEditorModel(this.validationErrorModel).fromModel(item.properties, descriptionTemplate, item.descriptionReferences);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -75,6 +75,7 @@ export class DescriptionEditorResolver extends BaseEditorResolver {
|
||||||
|
|
||||||
[nameof<Description>(x => x.descriptionTags), nameof<DescriptionTag>(x => x.id),].join('.'),
|
[nameof<Description>(x => x.descriptionTags), nameof<DescriptionTag>(x => x.id),].join('.'),
|
||||||
[nameof<Description>(x => x.descriptionTags), nameof<DescriptionTag>(x => x.tag), nameof<Tag>(x => x.label)].join('.'),
|
[nameof<Description>(x => x.descriptionTags), nameof<DescriptionTag>(x => x.tag), nameof<Tag>(x => x.label)].join('.'),
|
||||||
|
[nameof<Description>(x => x.descriptionTags), nameof<DescriptionTag>(x => x.tag), nameof<Tag>(x => x.isActive)].join('.'),
|
||||||
|
|
||||||
[nameof<Description>(x => x.descriptionReferences), nameof<DescriptionReference>(x => x.data), nameof<DescriptionReferenceData>(x => x.fieldId)].join('.'),
|
[nameof<Description>(x => x.descriptionReferences), nameof<DescriptionReference>(x => x.data), nameof<DescriptionReferenceData>(x => x.fieldId)].join('.'),
|
||||||
[nameof<Description>(x => x.descriptionReferences), nameof<DescriptionReference>(x => x.reference), nameof<Reference>(x => x.id)].join('.'),
|
[nameof<Description>(x => x.descriptionReferences), nameof<DescriptionReference>(x => x.reference), nameof<Reference>(x => x.id)].join('.'),
|
||||||
|
|
|
@ -1,16 +1,39 @@
|
||||||
.percentage {
|
// .percentage {
|
||||||
color: #212121;
|
// color: #212121;
|
||||||
opacity: 0.7;
|
// opacity: 0.7;
|
||||||
font-weight: 400;
|
// font-weight: 400;
|
||||||
font-size: 0.875rem;
|
// font-size: 0.875rem;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
// .progress-bar {
|
||||||
|
// border-radius: 20px;
|
||||||
|
// height: 11px;
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
// ::ng-deep .mat-progress-bar .mat-progress-bar-fill::after {
|
||||||
|
// border-radius: 20px !important;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// Bar container
|
||||||
.progress-bar {
|
.progress-bar {
|
||||||
|
--mdc-linear-progress-active-indicator-height: 11px !important;
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
height: 11px;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
::ng-deep .mat-progress-bar .mat-progress-bar-fill::after {
|
//Progress bar
|
||||||
|
::ng-deep .mdc-linear-progress__bar-inner {
|
||||||
|
--mdc-linear-progress-active-indicator-color: var(--primary-color) !important;
|
||||||
border-radius: 20px !important;
|
border-radius: 20px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Buffer bar
|
||||||
|
::ng-deep .mdc-linear-progress__buffer {
|
||||||
|
--mdc-linear-progress-track-height: 11px !important;
|
||||||
|
--mdc-linear-progress-active-indicator-color: var(--secondary-color) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .mdc-linear-progress__buffer-bar {
|
||||||
|
--mdc-linear-progress-track-color: var(--secondary-color) !important;
|
||||||
|
}
|
||||||
|
|
|
@ -63,6 +63,7 @@ export class TagsComponent extends BaseComponent implements OnInit {
|
||||||
|
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
this.tags.splice(index, 1);
|
this.tags.splice(index, 1);
|
||||||
|
this.form.setValue(this.tags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,12 +109,12 @@ export abstract class BaseEditor<EditorModelType extends BaseEditorModel, Entity
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
onCallbackSuccess(data?: any): void {
|
onCallbackSuccess(data?: any, refresh: boolean = true): void {
|
||||||
|
|
||||||
console.log("Success:", data);
|
console.log("Success:", data);
|
||||||
|
|
||||||
this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
|
this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
|
||||||
this.refreshOnNavigateToData(data ? data.id : null);
|
if (refresh) this.refreshOnNavigateToData(data ? data.id : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
onCallbackDeleteSuccess(data?: any): void {
|
onCallbackDeleteSuccess(data?: any): void {
|
||||||
|
|
Loading…
Reference in New Issue