This commit is contained in:
amentis 2024-03-11 15:20:09 +02:00
parent 097d2832be
commit 06e6ee406b
24 changed files with 68 additions and 41 deletions

View File

@ -15,7 +15,7 @@ public final class Permission {
//Public
public static String PublicBrowseDescription = "PublicBrowseDescription";
public static String PublicBrowseDescriptionTemplate = "BrowseDescriptionTemplate";
public static String PublicBrowseDescriptionTemplate = "PublicBrowseDescriptionTemplate";
public static String PublicBrowseDmp = "PublicBrowseDmp";
public static String PublicBrowseDmpReference = "PublicBrowseDmpReference";
public static String PublicBrowseDmpUser = "PublicBrowseDmpUser";

View File

@ -37,7 +37,7 @@ public class PublicDmp {
public static final String _publishedAt = "publishedAt";
private List<PublicDmpUser> users;
private List<PublicDmpUser> dmpUsers;
public static final String _dmpUsers = "dmpUsers";
@ -104,12 +104,12 @@ public class PublicDmp {
this.publishedAt = publishedAt;
}
public List<PublicDmpUser> getUsers() {
return users;
public List<PublicDmpUser> getDmpUsers() {
return dmpUsers;
}
public void setUsers(List<PublicDmpUser> users) {
this.users = users;
public void setDmpUsers(List<PublicDmpUser> dmpUsers) {
this.dmpUsers = dmpUsers;
}
public List<PublicDmpReference> getDmpReferences() {

View File

@ -76,7 +76,7 @@ public class PublicDmpBuilder extends BaseBuilder<PublicDmp, DmpEntity> {
if (fields.hasField(this.asIndexer(PublicDmp._updatedAt))) m.setUpdatedAt(d.getUpdatedAt());
if (dmpReferenceMap != null && !dmpReferenceMap.isEmpty() && dmpReferenceMap.containsKey(d.getId())) m.setDmpReferences(dmpReferenceMap.get(d.getId()));
if (dmpUsersMap != null && !dmpUsersMap.isEmpty() && dmpUsersMap.containsKey(d.getId())) m.setUsers(dmpUsersMap.get(d.getId()));
if (dmpUsersMap != null && !dmpUsersMap.isEmpty() && dmpUsersMap.containsKey(d.getId())) m.setDmpUsers(dmpUsersMap.get(d.getId()));
if (descriptionsMap != null && !descriptionsMap.isEmpty() && descriptionsMap.containsKey(d.getId())) m.setDescriptions(descriptionsMap.get(d.getId()));
models.add(m);

View File

@ -154,7 +154,10 @@ public class UserQuery extends QueryBase<UserEntity> {
else userId = null;
List<Predicate> predicates = new ArrayList<>();
if (userId != null) {
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public);
if (usePublic){
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(UserEntity._isActive)).value(IsActive.Active));
}else if (userId != null) {
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(UserEntity._id)).value(userId));
}
if (!predicates.isEmpty()) {

View File

@ -202,7 +202,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
this.entityManager.persist(data);
this.persistUsers(data.getId(), model.getUsers());
if (!isUpdate)
if (this.conventionService.isListNullOrEmpty(model.getUsers()))
this.addOwner(data);
this.entityManager.flush();
@ -260,9 +260,9 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
this.sendDescriptionTemplateInvitationEvent(data, NotificationContactType.EMAIL);
this.sendDescriptionTemplateInvitationEvent(data, NotificationContactType.IN_APP);
}
updatedCreatedIds.add(data.getId());
updatedCreatedIds.add(data.getUserId());
}
List<UserDescriptionTemplateEntity> toDelete = items.stream().filter(x -> updatedCreatedIds.stream().noneMatch(y -> y.equals(x.getId()))).collect(Collectors.toList());
List<UserDescriptionTemplateEntity> toDelete = items.stream().filter(x -> updatedCreatedIds.stream().noneMatch(y -> y.equals(x.getUserId()))).collect(Collectors.toList());
this.deleterFactory.deleter(UserDescriptionTemplateDeleter.class).delete(toDelete);
}

View File

@ -2,7 +2,7 @@ web:
security:
enabled: true
authorized-endpoints: [ api ]
allowed-endpoints: [ api/public, api/description/public, /api/supportive-material/public, api/language/public, api/contact-support/public, api/dashboard/public ]
allowed-endpoints: [ api/public, api/dmp/public, api/description/public, /api/supportive-material/public, api/language/public, api/contact-support/public, api/dashboard/public ]
idp:
api-key:
enabled: false

View File

@ -158,7 +158,7 @@ export interface PublicDmp extends BaseEntity {
finalizedAt?: Date;
publishedAt?: Date;
dmpReferences: PublicDmpReference[];
users: PublicDmpUser[];
dmpUsers: PublicDmpUser[];
descriptions: PublicDescription[];
}

View File

@ -34,7 +34,11 @@ export class DescriptionService {
publicQuery(q: DescriptionLookup): Observable<QueryResult<PublicDescription>> {
const url = `${this.apiBase}/public/query`;
return this.http.post<QueryResult<PublicDescription>>(url, q).pipe(catchError((error: any) => throwError(error)));
const params = new BaseHttpParams();
params.interceptorContext = {
excludedInterceptors: [InterceptorType.AuthToken]
};
return this.http.post<QueryResult<PublicDescription>>(url, q, {params: params}).pipe(catchError((error: any) => throwError(error)));
}
getSingle(id: Guid, reqFields: string[] = []): Observable<Description> {
@ -50,10 +54,15 @@ export class DescriptionService {
getPublicSingle(id: Guid, reqFields: string[] = []): Observable<PublicDescription> {
const url = `${this.apiBase}/public/${id}`;
const options = { params: { f: reqFields } };
const options: HttpParamsOptions = { fromObject: { f: reqFields } };
let params: BaseHttpParams = new BaseHttpParams(options);
params.interceptorContext = {
excludedInterceptors: [InterceptorType.AuthToken]
};
return this.http
.get<PublicDescription>(url, options).pipe(
.get<PublicDescription>(url, { params: params }).pipe(
catchError((error: any) => throwError(error)));
}

View File

@ -43,7 +43,11 @@ export class DmpService {
publicQuery(q: DmpLookup): Observable<QueryResult<PublicDmp>> {
const url = `${this.apiBase}/public/query`;
return this.http.post<QueryResult<PublicDmp>>(url, q).pipe(catchError((error: any) => throwError(error)));
const params = new BaseHttpParams();
params.interceptorContext = {
excludedInterceptors: [InterceptorType.AuthToken]
};
return this.http.post<QueryResult<PublicDmp>>(url, q, {params: params}).pipe(catchError((error: any) => throwError(error)));
}
getSingle(id: Guid, reqFields: string[] = []): Observable<Dmp> {
@ -57,10 +61,16 @@ export class DmpService {
getPublicSingle(id: Guid, reqFields: string[] = []): Observable<PublicDmp> {
const url = `${this.apiBase}/public/${id}`;
const options = { params: { f: reqFields } };
const options: HttpParamsOptions = { fromObject: { f: reqFields } };
let params: BaseHttpParams = new BaseHttpParams(options);
params.interceptorContext = {
excludedInterceptors: [InterceptorType.AuthToken]
};
return this.http
.get<PublicDmp>(url, options).pipe(
.get<PublicDmp>(url, { params: params }).pipe(
catchError((error: any) => throwError(error)));
}

View File

@ -206,7 +206,7 @@ export class ReferenceService {
}
getReferencesForTypes(dmpReferences: DmpReference[], referenceTypeIds?: Guid[]): DmpReference[] {
return dmpReferences?.filter(x => referenceTypeIds?.includes(x?.reference?.type?.id));
return dmpReferences?.filter(x => referenceTypeIds?.includes(x?.reference?.type?.id)).filter(x=> x.isActive === IsActive.Active);;
}
getReferencesForTypesFirstSafe(dmpReferences: DmpReference[], referenceTypeIds?: Guid[]): DmpReference {

View File

@ -205,18 +205,14 @@
Argos Entities
</button>
<mat-action-list class="ml-4">
<button mat-list-item (click)="addNewInput(descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_DMPS)">
<button mat-list-item (click)="addNewInput(descriptionTemplateFieldTypeEnum.INTERNAL_ENTRIES_DMPS)">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Internal Dmp icon">
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_DMPS)}}
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.INTERNAL_ENTRIES_DMPS)}}
</button>
<button mat-list-item (click)="addNewInput(descriptionTemplateFieldTypeEnum.INTERNAL_ENTRIES_DESCRIPTIONS)">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Internal Dmp icon">
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.INTERNAL_ENTRIES_DESCRIPTIONS)}}
</button>
<button mat-list-item (click)="addNewInput(descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_RESEARCHERS)">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Internal Dmp icon">
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_RESEARCHERS)}}
</button>
<button mat-list-item (click)="addNewInput(descriptionTemplateFieldTypeEnum.TAGS)">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Tags icon">
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.TAGS)}}

View File

@ -100,18 +100,14 @@
<!-- TODO -->
<mat-divider></mat-divider>
<mat-optgroup label="Argos Entities">
<mat-option [value]="descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_DMPS">
<mat-option [value]="descriptionTemplateFieldTypeEnum.INTERNAL_ENTRIES_DMPS">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="InternalDmpEntities icon">
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_DMPS)}}
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.INTERNAL_ENTRIES_DMPS)}}
</mat-option>
<mat-option [value]="descriptionTemplateFieldTypeEnum.INTERNAL_ENTRIES_DESCRIPTIONS">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="InternalDmpEntities icon">
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.INTERNAL_ENTRIES_DESCRIPTIONS)}}
</mat-option>
<mat-option [value]="descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_RESEARCHERS">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="InternalDmpEntities icon">
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_RESEARCHERS)}}
</mat-option>
<mat-option [value]="descriptionTemplateFieldTypeEnum.TAGS">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Tags icon">
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.TAGS)}}
@ -187,7 +183,7 @@
<app-description-template-editor-external-datasets-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.EXTERNAL_DATASETS" class="col-12" [form]="form"></app-description-template-editor-external-datasets-field-component>
<app-description-template-editor-multiplicity-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_DMPS" class="col-12" [form]="form"></app-description-template-editor-multiplicity-field-component>
<app-description-template-editor-multiplicity-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.INTERNAL_ENTRIES_DMPS" class="col-12" [form]="form"></app-description-template-editor-multiplicity-field-component>
<app-description-template-editor-multiplicity-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.INTERNAL_ENTRIES_DESCRIPTIONS" class="col-12" [form]="form"></app-description-template-editor-multiplicity-field-component>
</div>

View File

@ -220,8 +220,8 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
}
formSubmit(): void {
this.formService.removeAllBackEndErrors(this.formGroup);
this.formService.touchAllFormFields(this.formGroup);
console.log(this.formGroup);
if (!this.isFormValid()) {
return;
}

View File

@ -3,6 +3,7 @@ import { DescriptionTemplateFieldDataExternalDatasetType } from "@app/core/commo
import { DescriptionTemplateFieldType } from "@app/core/common/enum/description-template-field-type";
import { DescriptionTemplateFieldValidationType } from "@app/core/common/enum/description-template-field-validation-type";
import { DescriptionTemplateStatus } from "@app/core/common/enum/description-template-status";
import { IsActive } from "@app/core/common/enum/is-active.enum";
import { UserDescriptionTemplateRole } from "@app/core/common/enum/user-description-template-role";
import { DescriptionTemplate, DescriptionTemplateDefinition, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateLabelData, DescriptionTemplateMultiplicity, DescriptionTemplatePage, DescriptionTemplateReferenceTypeData, DescriptionTemplateRule, DescriptionTemplateSection, UserDescriptionTemplate } from "@app/core/model/description-template/description-template";
import { DescriptionTemplateDefinitionPersist, DescriptionTemplateExternalDatasetDataPersist, DescriptionTemplateFieldPersist, DescriptionTemplateFieldSetPersist, DescriptionTemplateLabelAndMultiplicityDataPersist, DescriptionTemplateLabelDataPersist, DescriptionTemplateMultiplicityPersist, DescriptionTemplatePagePersist, DescriptionTemplatePersist, DescriptionTemplateRadioBoxDataPersist, DescriptionTemplateRadioBoxOptionPersist, DescriptionTemplateReferenceTypeFieldPersist, DescriptionTemplateRulePersist, DescriptionTemplateSectionPersist, DescriptionTemplateSelectDataPersist, DescriptionTemplateSelectOptionPersist, DescriptionTemplateUploadDataPersist, DescriptionTemplateUploadOptionPersist, UserDescriptionTemplatePersist } from "@app/core/model/description-template/description-template-persist";
@ -36,7 +37,7 @@ export class DescriptionTemplateEditorModel extends BaseEditorModel implements D
this.type = item.type?.id;
this.status = item.status;
this.definition = new DescriptionTemplateDefinitionEditorModel(this.validationErrorModel).fromModel(item.definition);
if (item.users) { item.users.map(x => this.users.push(new UserDescriptionTemplateEditorModel(this.validationErrorModel).fromModel(x))); }
if (item.users) { item.users.filter(x => x.isActive === IsActive.Active).map(x => this.users.push(new UserDescriptionTemplateEditorModel(this.validationErrorModel).fromModel(x))); }
}
return this;
}

View File

@ -84,6 +84,7 @@ export class DescriptionTemplateEditorResolver extends BaseEditorResolver {
[nameof<DescriptionTemplate>(x => x.users), nameof<UserDescriptionTemplate>(x => x.user), nameof<User>(x => x.id),].join('.'),
[nameof<DescriptionTemplate>(x => x.users), nameof<UserDescriptionTemplate>(x => x.user), nameof<User>(x => x.name),].join('.'),
[nameof<DescriptionTemplate>(x => x.users), nameof<UserDescriptionTemplate>(x => x.role),].join('.'),
[nameof<DescriptionTemplate>(x => x.users), nameof<UserDescriptionTemplate>(x => x.isActive),].join('.'),
nameof<DescriptionTemplate>(x => x.createdAt),

View File

@ -227,8 +227,8 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
}
formSubmit(): void {
this.formService.removeAllBackEndErrors(this.formGroup);
this.formService.touchAllFormFields(this.formGroup);
console.log(this.formGroup)
if (!this.isFormValid()) {
return;
}

View File

@ -121,8 +121,10 @@ export class DescriptionEditorResolver extends BaseEditorResolver {
return [
(prefix ? prefix + '.' : '') + [nameof<Dmp>(x => x.id)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<Dmp>(x => x.label)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<Dmp>(x => x.isActive)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.id)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.isActive)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.id)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.label)].join('.'),

View File

@ -63,7 +63,7 @@
</mat-form-field>
</div>
</div>
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_DMPS" class="col-12">
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.INTERNAL_ENTRIES_DMPS" class="col-12">
<div class="row">
<mat-form-field class="col-md-12">
<ng-container *ngIf="field.data.multipleSelect">

View File

@ -210,6 +210,7 @@ export class DescriptionListingComponent extends BaseComponent implements OnInit
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.label)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.type), nameof<ReferenceType>(x => x.id)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.reference)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.isActive)].join('.'),
[nameof<Description>(x => x.dmpDescriptionTemplate), nameof<DmpDescriptionTemplate>(x => x.id)].join('.'),
[nameof<Description>(x => x.dmpDescriptionTemplate), nameof<DmpDescriptionTemplate>(x => x.dmp), nameof<Dmp>(x => x.id)].join('.'),
[nameof<Description>(x => x.dmpDescriptionTemplate), nameof<DmpDescriptionTemplate>(x => x.descriptionTemplateGroupId)].join('.'),

View File

@ -457,6 +457,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.type), nameof<ReferenceType>(x => x.id)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.source)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.reference)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.isActive)].join('.'),
]
}

View File

@ -243,10 +243,11 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
}
formSubmit(): void {
this.formService.removeAllBackEndErrors(this.formGroup);
this.formService.touchAllFormFields(this.formGroup);
// if (!this.isFormValid()) {
// return;
// }
if (!this.isFormValid()) {
return;
}
this.persistEntity();
}

View File

@ -209,6 +209,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit { //IBr
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.id)].join('.'),
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.label)].join('.'),
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.type), nameof<ReferenceType>(x => x.id)].join('.'),
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.isActive)].join('.'),
// [nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.reference)].join('.'),
]
};

View File

@ -785,6 +785,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.type), nameof<ReferenceType>(x => x.id)].join('.'),
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.source)].join('.'),
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.reference)].join('.'),
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.isActive)].join('.'),
[nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.id)].join('.'),
[nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition)].join('.'),

View File

@ -1077,6 +1077,10 @@
"DISCARD": "Discard"
}
},
"DESCRIPTION-COPY-DIALOG": {
"TITLE": "Copy Description to DMP",
"PLACEHOLDER": "Search DMP"
},
"PREFILL-DESCRIPTION-DIALOG": {
"TITLE": "Initialize your Dataset",
"OR": "OR",