diff --git a/backend/web/src/main/java/org/opencdmp/controllers/DescriptionController.java b/backend/web/src/main/java/org/opencdmp/controllers/DescriptionController.java index 6e73adec2..a42c2599e 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/DescriptionController.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/DescriptionController.java @@ -165,8 +165,8 @@ public class DescriptionController { @OperationWithTenantHeader(summary = "Query all descriptions", description = SwaggerHelpers.Description.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.Description.endpoint_query_request_body, content = @Content( examples = { @ExampleObject( - name = "Pagination and projection", - description = "Simple paginated request using a property projection list and pagination info", + name = SwaggerHelpers.Commons.pagination_example, + description = SwaggerHelpers.Commons.pagination_example_description, value = SwaggerHelpers.Description.endpoint_query_request_body_example ) } @@ -177,8 +177,8 @@ public class DescriptionController { ) ), examples = @ExampleObject( - name = "First page", - description = "Example with the first page of paginated results", + name = SwaggerHelpers.Commons.pagination_response_example, + description = SwaggerHelpers.Commons.pagination_response_example_description, value = SwaggerHelpers.Description.endpoint_query_response_example )))) public QueryResult query(@RequestBody DescriptionLookup lookup) throws MyApplicationException, MyForbiddenException { diff --git a/backend/web/src/main/java/org/opencdmp/controllers/DescriptionTemplateController.java b/backend/web/src/main/java/org/opencdmp/controllers/DescriptionTemplateController.java index dc82bdf75..77d2eee27 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/DescriptionTemplateController.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/DescriptionTemplateController.java @@ -101,8 +101,8 @@ public class DescriptionTemplateController { @OperationWithTenantHeader(summary = "Query all description templates", description = SwaggerHelpers.DescriptionTemplate.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.DescriptionTemplate.endpoint_query_request_body, content = @Content( examples = { @ExampleObject( - name = "Pagination and projection", - description = "Simple paginated request using a property projection list and pagination info", + name = SwaggerHelpers.Commons.pagination_example, + description = SwaggerHelpers.Commons.pagination_example_description, value = SwaggerHelpers.DescriptionTemplate.endpoint_query_request_body_example ) } @@ -113,8 +113,8 @@ public class DescriptionTemplateController { ) ), examples = @ExampleObject( - name = "First page", - description = "Example with the first page of paginated results", + name = SwaggerHelpers.Commons.pagination_response_example, + description = SwaggerHelpers.Commons.pagination_response_example_description, value = SwaggerHelpers.DescriptionTemplate.endpoint_query_response_example )))) public QueryResult query(@RequestBody DescriptionTemplateLookup lookup) throws MyApplicationException, MyForbiddenException { diff --git a/backend/web/src/main/java/org/opencdmp/controllers/DescriptionTemplateTypeController.java b/backend/web/src/main/java/org/opencdmp/controllers/DescriptionTemplateTypeController.java index dabe332c1..44944a3a2 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/DescriptionTemplateTypeController.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/DescriptionTemplateTypeController.java @@ -82,8 +82,8 @@ public class DescriptionTemplateTypeController { @OperationWithTenantHeader(summary = "Query all description template types", description = SwaggerHelpers.DescriptionTemplateType.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.DescriptionTemplateType.endpoint_query_request_body, content = @Content( examples = { @ExampleObject( - name = "Pagination and projection", - description = "Simple paginated request using a property projection list and pagination info", + name = SwaggerHelpers.Commons.pagination_example, + description = SwaggerHelpers.Commons.pagination_example_description, value = SwaggerHelpers.DescriptionTemplateType.endpoint_query_request_body_example ) } @@ -94,8 +94,8 @@ public class DescriptionTemplateTypeController { ) ), examples = @ExampleObject( - name = "First page", - description = "Example with the first page of paginated results", + name = SwaggerHelpers.Commons.pagination_response_example, + description = SwaggerHelpers.Commons.pagination_response_example_description, value = SwaggerHelpers.DescriptionTemplateType.endpoint_query_response_example )))) public QueryResult Query(@RequestBody DescriptionTemplateTypeLookup lookup) throws MyApplicationException, MyForbiddenException { diff --git a/backend/web/src/main/java/org/opencdmp/controllers/EntityDoiController.java b/backend/web/src/main/java/org/opencdmp/controllers/EntityDoiController.java index 742e091d5..ac5902d99 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/EntityDoiController.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/EntityDoiController.java @@ -82,8 +82,8 @@ public class EntityDoiController { @OperationWithTenantHeader(summary = "Query all entity dois", description = SwaggerHelpers.EntityDoi.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.EntityDoi.endpoint_query_request_body, content = @Content( examples = { @ExampleObject( - name = "Pagination and projection", - description = "Simple paginated request using a property projection list and pagination info", + name = SwaggerHelpers.Commons.pagination_example, + description = SwaggerHelpers.Commons.pagination_example_description, value = SwaggerHelpers.EntityDoi.endpoint_query_request_body_example ) } @@ -94,8 +94,8 @@ public class EntityDoiController { ) ), examples = @ExampleObject( - name = "First page", - description = "Example with the first page of paginated results", + name = SwaggerHelpers.Commons.pagination_response_example, + description = SwaggerHelpers.Commons.pagination_response_example_description, value = SwaggerHelpers.EntityDoi.endpoint_query_response_example )))) public QueryResult query(@RequestBody EntityDoiLookup lookup) throws MyApplicationException, MyForbiddenException { diff --git a/backend/web/src/main/java/org/opencdmp/controllers/LockController.java b/backend/web/src/main/java/org/opencdmp/controllers/LockController.java index ee78a1498..8966f6f92 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/LockController.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/LockController.java @@ -105,8 +105,8 @@ public class LockController { @OperationWithTenantHeader(summary = "Query all locked entities", description = SwaggerHelpers.Lock.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.Lock.endpoint_query_request_body, content = @Content( examples = { @ExampleObject( - name = "Pagination and projection", - description = "Simple paginated request using a property projection list and pagination info", + name = SwaggerHelpers.Commons.pagination_example, + description = SwaggerHelpers.Commons.pagination_example_description, value = SwaggerHelpers.Lock.endpoint_query_request_body_example ) } @@ -117,8 +117,8 @@ public class LockController { ) ), examples = @ExampleObject( - name = "First page", - description = "Example with the first page of paginated results", + name = SwaggerHelpers.Commons.pagination_response_example, + description = SwaggerHelpers.Commons.pagination_response_example_description, value = SwaggerHelpers.Lock.endpoint_query_response_example )))) public QueryResult query(@RequestBody LockLookup lookup) throws MyApplicationException, MyForbiddenException, InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException { diff --git a/backend/web/src/main/java/org/opencdmp/controllers/PlanBlueprintController.java b/backend/web/src/main/java/org/opencdmp/controllers/PlanBlueprintController.java index 8ec72dc52..44937bdbb 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/PlanBlueprintController.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/PlanBlueprintController.java @@ -94,8 +94,8 @@ public class PlanBlueprintController { @OperationWithTenantHeader(summary = "Query all plan blueprints", description = SwaggerHelpers.PlanBlueprint.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.PlanBlueprint.endpoint_query_request_body, content = @Content( examples = { @ExampleObject( - name = "Pagination and projection", - description = "Simple paginated request using a property projection list and pagination info", + name = SwaggerHelpers.Commons.pagination_example, + description = SwaggerHelpers.Commons.pagination_example_description, value = SwaggerHelpers.PlanBlueprint.endpoint_query_request_body_example ) } @@ -106,8 +106,8 @@ public class PlanBlueprintController { ) ), examples = @ExampleObject( - name = "First page", - description = "Example with the first page of paginated results", + name = SwaggerHelpers.Commons.pagination_response_example, + description = SwaggerHelpers.Commons.pagination_response_example_description, value = SwaggerHelpers.PlanBlueprint.endpoint_query_response_example )))) public QueryResult query(@RequestBody PlanBlueprintLookup lookup) throws MyApplicationException, MyForbiddenException { diff --git a/backend/web/src/main/java/org/opencdmp/controllers/PlanController.java b/backend/web/src/main/java/org/opencdmp/controllers/PlanController.java index 08404887f..3a8ce31aa 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/PlanController.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/PlanController.java @@ -147,8 +147,8 @@ public class PlanController { @PostMapping("query") @OperationWithTenantHeader(summary = "Query all plans", description = SwaggerHelpers.Plan.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.Plan.endpoint_query_request_body, content = @Content(examples = @ExampleObject( - name = "Pagination and projection", - description = "Simple paginated request using a property projection list and pagination info", + name = SwaggerHelpers.Commons.pagination_example, + description = SwaggerHelpers.Commons.pagination_example_description, value = SwaggerHelpers.Plan.endpoint_query_request_body_example ))), responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( array = @ArraySchema( @@ -157,8 +157,8 @@ public class PlanController { ) ), examples = @ExampleObject( - name = "First page", - description = "Example with the first page of paginated results", + name = SwaggerHelpers.Commons.pagination_response_example, + description = SwaggerHelpers.Commons.pagination_response_example_description, value = SwaggerHelpers.Plan.endpoint_query_response_example )))) public QueryResult Query(@RequestBody PlanLookup lookup) throws MyApplicationException, MyForbiddenException { diff --git a/backend/web/src/main/java/org/opencdmp/controllers/PrincipalController.java b/backend/web/src/main/java/org/opencdmp/controllers/PrincipalController.java index 641f5bcfd..295c60999 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/PrincipalController.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/PrincipalController.java @@ -14,7 +14,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import org.opencdmp.audit.AuditableAction; import org.opencdmp.controllers.swagger.SwaggerHelpers; import org.opencdmp.controllers.swagger.annotation.OperationWithTenantHeader; -import org.opencdmp.model.Lock; +import org.opencdmp.controllers.swagger.annotation.SwaggerCommonErrorResponses; import org.opencdmp.model.Tenant; import org.opencdmp.models.Account; import org.opencdmp.models.AccountBuilder; @@ -32,84 +32,89 @@ import java.util.List; @RestController @RequestMapping("/api/principal/") @Tag(name = "Principal", description = "Get user account information") +@SwaggerCommonErrorResponses public class PrincipalController { - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PrincipalController.class)); - private final AuditService auditService; - private final CurrentPrincipalResolver currentPrincipalResolver; - private final AccountBuilder accountBuilder; - private final TenantService tenantService; + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PrincipalController.class)); - @Autowired - public PrincipalController( - CurrentPrincipalResolver currentPrincipalResolver, - AccountBuilder accountBuilder, - AuditService auditService, TenantService tenantService) { - this.currentPrincipalResolver = currentPrincipalResolver; - this.accountBuilder = accountBuilder; - this.auditService = auditService; - this.tenantService = tenantService; - } + private final AuditService auditService; - @RequestMapping(path = "me", method = RequestMethod.GET ) - @OperationWithTenantHeader(summary = "Fetch auth information of the logged in user", description = "", - responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( - schema = @Schema( - implementation = Account.class - )) - )) - public Account me( - @Parameter(name = "fieldSet", description = SwaggerHelpers.Commons.fieldset_description, required = true) FieldSet fieldSet - ) throws InvalidApplicationException { - logger.debug("me"); + private final CurrentPrincipalResolver currentPrincipalResolver; - if (fieldSet == null || fieldSet.isEmpty()) { - fieldSet = new BaseFieldSet( - Account._isAuthenticated, - BaseFieldSet.asIndexer(Account._principal, Account.PrincipalInfo._subject), - BaseFieldSet.asIndexer(Account._principal, Account.PrincipalInfo._userId), - BaseFieldSet.asIndexer(Account._principal, Account.PrincipalInfo._name), - BaseFieldSet.asIndexer(Account._principal, Account.PrincipalInfo._scope), - BaseFieldSet.asIndexer(Account._principal, Account.PrincipalInfo._client), - BaseFieldSet.asIndexer(Account._principal, Account.PrincipalInfo._issuedAt), - BaseFieldSet.asIndexer(Account._principal, Account.PrincipalInfo._notBefore), - BaseFieldSet.asIndexer(Account._principal, Account.PrincipalInfo._authenticatedAt), - BaseFieldSet.asIndexer(Account._principal, Account.PrincipalInfo._expiresAt), - BaseFieldSet.asIndexer(Account._principal, Account.PrincipalInfo._more), - BaseFieldSet.asIndexer(Account._profile, Account.UserProfileInfo._avatarUrl), - BaseFieldSet.asIndexer(Account._profile, Account.UserProfileInfo._language), - BaseFieldSet.asIndexer(Account._profile, Account.UserProfileInfo._culture), - BaseFieldSet.asIndexer(Account._profile, Account.UserProfileInfo._timezone), - Account._permissions, - BaseFieldSet.asIndexer(Account._selectedTenant, Tenant._id), - BaseFieldSet.asIndexer(Account._selectedTenant, Tenant._name), - BaseFieldSet.asIndexer(Account._selectedTenant, Tenant._code)); - } + private final AccountBuilder accountBuilder; - MyPrincipal principal = this.currentPrincipalResolver.currentPrincipal(); + private final TenantService tenantService; - Account me = this.accountBuilder.build(fieldSet, principal); + @Autowired + public PrincipalController( + CurrentPrincipalResolver currentPrincipalResolver, + AccountBuilder accountBuilder, + AuditService auditService, TenantService tenantService) { + this.currentPrincipalResolver = currentPrincipalResolver; + this.accountBuilder = accountBuilder; + this.auditService = auditService; + this.tenantService = tenantService; + } - this.auditService.track(AuditableAction.Principal_Lookup); - //auditService.trackIdentity(AuditableAction.IdentityTracking_Action); + @RequestMapping(path = "me", method = RequestMethod.GET) + @OperationWithTenantHeader(summary = "Fetch auth information of the logged in user", description = "", + responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( + schema = @Schema( + implementation = Account.class + )) + )) + public Account me( + @Parameter(name = "fieldSet", description = SwaggerHelpers.Commons.fieldset_description, required = true) FieldSet fieldSet + ) throws InvalidApplicationException { + logger.debug("me"); - return me; - } + if (fieldSet == null || fieldSet.isEmpty()) { + fieldSet = new BaseFieldSet( + Account._isAuthenticated, + BaseFieldSet.asIndexer(Account._principal, Account.PrincipalInfo._subject), + BaseFieldSet.asIndexer(Account._principal, Account.PrincipalInfo._userId), + BaseFieldSet.asIndexer(Account._principal, Account.PrincipalInfo._name), + BaseFieldSet.asIndexer(Account._principal, Account.PrincipalInfo._scope), + BaseFieldSet.asIndexer(Account._principal, Account.PrincipalInfo._client), + BaseFieldSet.asIndexer(Account._principal, Account.PrincipalInfo._issuedAt), + BaseFieldSet.asIndexer(Account._principal, Account.PrincipalInfo._notBefore), + BaseFieldSet.asIndexer(Account._principal, Account.PrincipalInfo._authenticatedAt), + BaseFieldSet.asIndexer(Account._principal, Account.PrincipalInfo._expiresAt), + BaseFieldSet.asIndexer(Account._principal, Account.PrincipalInfo._more), + BaseFieldSet.asIndexer(Account._profile, Account.UserProfileInfo._avatarUrl), + BaseFieldSet.asIndexer(Account._profile, Account.UserProfileInfo._language), + BaseFieldSet.asIndexer(Account._profile, Account.UserProfileInfo._culture), + BaseFieldSet.asIndexer(Account._profile, Account.UserProfileInfo._timezone), + Account._permissions, + BaseFieldSet.asIndexer(Account._selectedTenant, Tenant._id), + BaseFieldSet.asIndexer(Account._selectedTenant, Tenant._name), + BaseFieldSet.asIndexer(Account._selectedTenant, Tenant._code)); + } - @GetMapping("my-tenants") - @OperationWithTenantHeader(summary = "Fetch a list with the tenants the user belongs to", description = "", - responses = @ApiResponse(description = "OK", responseCode = "200")) - public List myTenants( - @Parameter(name = "fieldSet", description = SwaggerHelpers.Commons.fieldset_description, required = true) FieldSet fieldSet - ) { - logger.debug("my-tenants"); + MyPrincipal principal = this.currentPrincipalResolver.currentPrincipal(); - List models = this.tenantService.myTenants(fieldSet); + Account me = this.accountBuilder.build(fieldSet, principal); - this.auditService.track(AuditableAction.Principal_MyTenants); - //auditService.trackIdentity(AuditableAction.IdentityTracking_Action); - - return models; - } + this.auditService.track(AuditableAction.Principal_Lookup); + //auditService.trackIdentity(AuditableAction.IdentityTracking_Action); + + return me; + } + + @GetMapping("my-tenants") + @OperationWithTenantHeader(summary = "Fetch a list with the tenants the user belongs to", description = "", + responses = @ApiResponse(description = "OK", responseCode = "200")) + public List myTenants( + @Parameter(name = "fieldSet", description = SwaggerHelpers.Commons.fieldset_description, required = true) FieldSet fieldSet + ) { + logger.debug("my-tenants"); + + List models = this.tenantService.myTenants(fieldSet); + + this.auditService.track(AuditableAction.Principal_MyTenants); + //auditService.trackIdentity(AuditableAction.IdentityTracking_Action); + + return models; + } } diff --git a/backend/web/src/main/java/org/opencdmp/controllers/ReferenceController.java b/backend/web/src/main/java/org/opencdmp/controllers/ReferenceController.java index 94707022a..50154041e 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/ReferenceController.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/ReferenceController.java @@ -12,7 +12,6 @@ import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.logging.LoggerService; import gr.cite.tools.logging.MapLogEntry; import gr.cite.tools.validation.ValidationFilterAnnotation; -import io.swagger.v3.oas.annotations.Hidden; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; @@ -33,7 +32,6 @@ import org.opencdmp.data.ReferenceEntity; import org.opencdmp.model.builder.reference.ReferenceBuilder; import org.opencdmp.model.censorship.reference.ReferenceCensor; import org.opencdmp.model.persist.ReferencePersist; -import org.opencdmp.model.planblueprint.PlanBlueprint; import org.opencdmp.model.reference.Reference; import org.opencdmp.model.result.QueryResult; import org.opencdmp.query.ReferenceQuery; @@ -74,7 +72,6 @@ public class ReferenceController { private final MessageSource messageSource; - @Autowired public ReferenceController( BuilderFactory builderFactory, @@ -95,8 +92,8 @@ public class ReferenceController { @OperationWithTenantHeader(summary = "Query all references", description = SwaggerHelpers.Reference.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.Reference.endpoint_query_request_body, content = @Content( examples = { @ExampleObject( - name = "Pagination and projection", - description = "Simple paginated request using a property projection list and pagination info", + name = SwaggerHelpers.Commons.pagination_example, + description = SwaggerHelpers.Commons.pagination_example_description, value = SwaggerHelpers.Reference.endpoint_query_request_body_example ) } @@ -107,8 +104,8 @@ public class ReferenceController { ) ), examples = @ExampleObject( - name = "First page", - description = "Example with the first page of paginated results", + name = SwaggerHelpers.Commons.pagination_response_example, + description = SwaggerHelpers.Commons.pagination_response_example_description, value = SwaggerHelpers.Reference.endpoint_query_response_example )))) public QueryResult query(@RequestBody ReferenceLookup lookup) throws MyApplicationException, MyForbiddenException { @@ -126,10 +123,27 @@ public class ReferenceController { return new QueryResult<>(models, count); } - @PostMapping("search") - @Hidden - //TODO thgiannos add swagger docs + @OperationWithTenantHeader(summary = "Query all references including results from external APIs", description = SwaggerHelpers.Reference.endpoint_search, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.Reference.endpoint_search_request_body, content = @Content( + examples = { + @ExampleObject( + name = SwaggerHelpers.Commons.pagination_example, + description = SwaggerHelpers.Commons.pagination_example_description, + value = SwaggerHelpers.Reference.endpoint_search_request_body_example + ) + } + )), responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( + array = @ArraySchema( + schema = @Schema( + implementation = Reference.class + ) + ), + examples = @ExampleObject( + name = SwaggerHelpers.Commons.pagination_response_example, + description = SwaggerHelpers.Commons.pagination_response_example_description, + value = SwaggerHelpers.Reference.endpoint_search_response_example + )))) + @Swagger404 public List searchReferenceWithDefinition(@RequestBody ReferenceSearchLookup lookup) throws MyNotFoundException, InvalidApplicationException { logger.debug("search with db definition {}", Reference.class.getSimpleName()); @@ -138,7 +152,7 @@ public class ReferenceController { List references = this.referenceService.searchReferenceData(lookup); this.auditService.track(AuditableAction.Reference_Search, "lookup", lookup); - + return references; } diff --git a/backend/web/src/main/java/org/opencdmp/controllers/ReferenceTypeController.java b/backend/web/src/main/java/org/opencdmp/controllers/ReferenceTypeController.java index 6c500aac8..f47d022aa 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/ReferenceTypeController.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/ReferenceTypeController.java @@ -94,8 +94,8 @@ public class ReferenceTypeController{ @OperationWithTenantHeader(summary = "Query all reference types", description = SwaggerHelpers.ReferenceType.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.ReferenceType.endpoint_query_request_body, content = @Content( examples = { @ExampleObject( - name = "Pagination and projection", - description = "Simple paginated request using a property projection list and pagination info", + name = SwaggerHelpers.Commons.pagination_example, + description = SwaggerHelpers.Commons.pagination_example_description, value = SwaggerHelpers.ReferenceType.endpoint_query_request_body_example ) } @@ -106,8 +106,8 @@ public class ReferenceTypeController{ ) ), examples = @ExampleObject( - name = "First page", - description = "Example with the first page of paginated results", + name = SwaggerHelpers.Commons.pagination_response_example, + description = SwaggerHelpers.Commons.pagination_response_example_description, value = SwaggerHelpers.ReferenceType.endpoint_query_response_example )))) public QueryResult query(@RequestBody ReferenceTypeLookup lookup) throws MyApplicationException, MyForbiddenException { diff --git a/backend/web/src/main/java/org/opencdmp/controllers/TagController.java b/backend/web/src/main/java/org/opencdmp/controllers/TagController.java index 5bde81889..c4069a02b 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/TagController.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/TagController.java @@ -81,8 +81,8 @@ public class TagController { @OperationWithTenantHeader(summary = "Query all tags", description = SwaggerHelpers.Tag.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.Tag.endpoint_query_request_body, content = @Content( examples = { @ExampleObject( - name = "Pagination and projection", - description = "Simple paginated request using a property projection list and pagination info", + name = SwaggerHelpers.Commons.pagination_example, + description = SwaggerHelpers.Commons.pagination_example_description, value = SwaggerHelpers.Tag.endpoint_query_request_body_example ) } @@ -93,8 +93,8 @@ public class TagController { ) ), examples = @ExampleObject( - name = "First page", - description = "Example with the first page of paginated results", + name = SwaggerHelpers.Commons.pagination_response_example, + description = SwaggerHelpers.Commons.pagination_response_example_description, value = SwaggerHelpers.Tag.endpoint_query_response_example )))) public QueryResult Query(@RequestBody TagLookup lookup) throws MyApplicationException, MyForbiddenException { diff --git a/backend/web/src/main/java/org/opencdmp/controllers/UserController.java b/backend/web/src/main/java/org/opencdmp/controllers/UserController.java index 0683fd296..23ad6e1d8 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/UserController.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/UserController.java @@ -12,7 +12,6 @@ import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.logging.LoggerService; import gr.cite.tools.logging.MapLogEntry; import gr.cite.tools.validation.ValidationFilterAnnotation; -import io.swagger.v3.oas.annotations.Hidden; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; @@ -37,9 +36,11 @@ import org.opencdmp.model.builder.PlanAssociatedUserBuilder; import org.opencdmp.model.builder.UserBuilder; import org.opencdmp.model.censorship.PlanAssociatedUserCensor; import org.opencdmp.model.censorship.UserCensor; -import org.opencdmp.model.persist.*; +import org.opencdmp.model.persist.UserMergeRequestPersist; +import org.opencdmp.model.persist.UserPersist; +import org.opencdmp.model.persist.UserRolePatchPersist; +import org.opencdmp.model.persist.UserTenantUsersInviteRequest; import org.opencdmp.model.persist.actionconfirmation.RemoveCredentialRequestPersist; -import org.opencdmp.model.plan.Plan; import org.opencdmp.model.result.QueryResult; import org.opencdmp.model.user.User; import org.opencdmp.query.UserQuery; @@ -110,8 +111,8 @@ public class UserController { @OperationWithTenantHeader(summary = "Query all users", description = SwaggerHelpers.User.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.User.endpoint_query_request_body, content = @Content( examples = { @ExampleObject( - name = "Pagination and projection", - description = "Simple paginated request using a property projection list and pagination info", + name = SwaggerHelpers.Commons.pagination_example, + description = SwaggerHelpers.Commons.pagination_example_description, value = SwaggerHelpers.User.endpoint_query_request_body_example ) } @@ -122,8 +123,8 @@ public class UserController { ) ), examples = @ExampleObject( - name = "First page", - description = "Example with the first page of paginated results", + name = SwaggerHelpers.Commons.pagination_response_example, + description = SwaggerHelpers.Commons.pagination_response_example_description, value = SwaggerHelpers.User.endpoint_query_response_example )))) public QueryResult query(@RequestBody UserLookup lookup) throws MyApplicationException, MyForbiddenException { @@ -143,7 +144,25 @@ public class UserController { } @PostMapping("plan-associated/query") - @Hidden + @OperationWithTenantHeader(summary = "Query all plan associated users", description = SwaggerHelpers.User.endpoint_query_plan_associated, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.User.endpoint_query_request_body, content = @Content( + examples = { + @ExampleObject( + name = SwaggerHelpers.Commons.pagination_example, + description = SwaggerHelpers.Commons.pagination_example_description, + value = SwaggerHelpers.User.endpoint_query_plan_associated_request_body_example + ) + } + )), responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( + array = @ArraySchema( + schema = @Schema( + implementation = PlanAssociatedUser.class + ) + ), + examples = @ExampleObject( + name = SwaggerHelpers.Commons.pagination_response_example, + description = SwaggerHelpers.Commons.pagination_response_example_description, + value = SwaggerHelpers.User.endpoint_query_plan_associated_response_example + )))) public QueryResult queryPlanAssociated(@RequestBody UserLookup lookup) throws MyApplicationException, MyForbiddenException { logger.debug("querying {}", User.class.getSimpleName()); @@ -219,8 +238,11 @@ public class UserController { } @GetMapping("/export/csv/{hasTenantAdminMode}") - @Hidden - public ResponseEntity exportCsv(@PathVariable("hasTenantAdminMode") Boolean hasTenantAdminMode) throws MyApplicationException, MyForbiddenException, MyNotFoundException, IOException, InvalidApplicationException { + @OperationWithTenantHeader(summary = "Export users in a .csv file", description = "", + responses = @ApiResponse(description = "OK", responseCode = "200")) + public ResponseEntity exportCsv( + @Parameter(name = "hasTenantAdminMode", description = "Controls whether to fetch users as a tenant admin or not", example = "false", required = true) @PathVariable("hasTenantAdminMode") Boolean hasTenantAdminMode + ) throws MyApplicationException, MyForbiddenException, MyNotFoundException, IOException, InvalidApplicationException { logger.debug(new MapLogEntry("export" + User.class.getSimpleName()).And("hasTenantAdminMode", hasTenantAdminMode)); // this.censorFactory.censor(UserCensor.class).censor(fieldSet, null); diff --git a/backend/web/src/main/java/org/opencdmp/controllers/swagger/SwaggerHelpers.java b/backend/web/src/main/java/org/opencdmp/controllers/swagger/SwaggerHelpers.java index e3ba6bc6b..a01110aaf 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/swagger/SwaggerHelpers.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/swagger/SwaggerHelpers.java @@ -8,6 +8,26 @@ public final class SwaggerHelpers { """ This is an object containing a list of the properties you wish to include in the response, similar to the 'project' attribute on queries. """; + + public static final String pagination_example = + """ + Pagination and projection + """; + + public static final String pagination_example_description = + """ + Simple paginated request using a property projection list and pagination info + """; + + public static final String pagination_response_example = + """ + Pagination and projection + """; + + public static final String pagination_response_example_description = + """ + Simple paginated request using a property projection list and pagination info + """; } public static final class Errors { @@ -3346,6 +3366,190 @@ public final class SwaggerHelpers { } """; + public static final String endpoint_search = + """ + This endpoint is used to fetch all the available references.
+ It also allows to restrict the results using a query object passed in the request body.
+ """; + + public static final String endpoint_search_request_body = + """ + Let's explore the options this object gives us. + + ### General query parameters: + +
    +
  • page: + This is an object controlling the pagination of the results. It contains two properties. +
  • +
      +
    • offset: + How many records to omit. +
    • +
    • size: + How many records to include in each page. +
    • +
    +
+ + For example, if we want the third page, and our pages to contain 15 elements, we would pass the following object: + + ```JSON + { + "offset": 30, + "size": 15 + } + ``` + +
    +
  • order: + This is an object controlling the ordering of the results. + It contains a list of strings called items with the names of the properties to use. +
    If the name of the property is prefixed with a '-', the ordering direction is DESC. Otherwise, it is ASC. +
  • +
+ + For example, if we wanted to order based on the field 'createdAt' in descending order, we would pass the following object: + + ```JSON + { + "items": [ + "-createdAt" + ], + } + ``` + +
    +
  • metadata: + This is an object containing metadata for the request. There is only one available option. +
      +
    • countAll: + If this is set to true, the count property included in the response will account for all the records regardless the pagination, + with all the rest of filtering options applied of course. + Otherwise, if it is set to false or not present, only the returned results will be counted. +
      The first option is useful for the UI clients to calculate how many result pages are available. +
    • +
    +
  • +
  • project: + This is an object controlling the data projection of the results. + It contains a list of strings called fields with the names of the properties to project. +
    You can also include properties that are deeper in the object tree by prefixing them with dots. +
  • +
+ + ### Reference specific query parameters: + +
    +
  • like: + If there is a like parameter present in the query, only the reference entities that include the contents of the parameter either in their labels, descriptions or the references will be in the response. +
  • +
  • typeId: + This is the type id of the references we want in the response.
    If empty, every record is included. +
  • +
  • key: + This is the id of the external source (API) we want results from. +
    If not present, no external reference is included. +
  • +
  • dependencyReferences: + This is a list and determines which records we want to include in the response, based on the references they depend on. +
    If not present, every record is included. +
  • +
+ """; + + public static final String endpoint_search_request_body_example = + """ + { + "project":{ + "fields":[ + "id", + "hash", + "label", + "type", + "type.id", + "description", + "definition.fields.code", + "definition.fields.dataType", + "definition.fields.value", + "reference", + "abbreviation", + "source", + "sourceType" + ] + }, + "page":{ + "size":100, + "offset":0 + }, + "typeId":"5b9c284f-f041-4995-96cc-fad7ad13289c", + "dependencyReferences":[ + \s + ], + "order":{ + "items":[ + "label" + ] + } + } + """; + + public static final String endpoint_search_response_example = + """ + [ + { + "label": "A Randomized, Double-Blind, Placebo-Controlled, Multi-Center Study to Evaluate the Efficacy of ManNAc in Subjects with GNE Myopathy (nih_________::5U01AR070498-04)", + "type": { + "id": "5b9c284f-f041-4995-96cc-fad7ad13289c" + }, + "description": "A Randomized, Double-Blind, Placebo-Controlled, Multi-Center Study to Evaluate the Efficacy of ManNAc in Subjects with GNE Myopathy", + "definition": { + "fields": [ + { + "code": "referenceType", + "dataType": 0, + "value": "Grants" + }, + { + "code": "key", + "dataType": 0, + "value": "openaire" + } + ] + }, + "reference": "nih_________::5U01AR070498-04", + "source": "openaire", + "sourceType": 1, + "hash": "" + }, + { + "label": "A genome scale census of virulence factors in the major mould pathogen of human lungs, Aspergillus fumigatus (ukri________::1640253)", + "type": { + "id": "5b9c284f-f041-4995-96cc-fad7ad13289c" + }, + "description": "A genome scale census of virulence factors in the major mould pathogen of human lungs, Aspergillus fumigatus", + "definition": { + "fields": [ + { + "code": "referenceType", + "dataType": 0, + "value": "Grants" + }, + { + "code": "key", + "dataType": 0, + "value": "openaire" + } + ] + }, + "reference": "ukri________::1640253", + "source": "openaire", + "sourceType": 1, + "hash": "" + } + ] + """; + } public static final class ReferenceType { @@ -3779,6 +3983,12 @@ public final class SwaggerHelpers { It also allows to restrict the results using a query object passed in the request body.
"""; + public static final String endpoint_query_plan_associated = + """ + This endpoint is used to fetch all the available users.
+ It also allows to restrict the results using a query object passed in the request body.
+ """; + public static final String endpoint_query_request_body = """ Let's explore the options this object gives us. @@ -3908,6 +4118,32 @@ public final class SwaggerHelpers { } """; + public static final String endpoint_query_plan_associated_request_body_example = + """ + { + "project":{ + "fields":[ + "id", + "name", + "email" + ] + }, + "page":{ + "size":100, + "offset":0 + }, + "isActive":[ + 1 + ], + "order":{ + "items":[ + "name" + ] + }, + "like":"user%" + } + """; + public static final String endpoint_query_response_example = """ { @@ -4241,6 +4477,25 @@ public final class SwaggerHelpers { } """; + public static final String endpoint_query_plan_associated_response_example = + """ + { + "items":[ + { + "id":"d26916c6-8763-450e-9048-b06e1114d0b4", + "name":"user3 user3", + "email":"user3@dmp.gr" + }, + { + "id":"02832fb6-0b12-469f-a886-7685406959d4", + "name":"user4", + "email":"user4@dmp.gr" + } + ], + "count":2 + } + """; + } public static final class Principal { diff --git a/dmp-frontend/src/app/app-routing.module.ts b/dmp-frontend/src/app/app-routing.module.ts index f3a7c4a16..3c3d55883 100644 --- a/dmp-frontend/src/app/app-routing.module.ts +++ b/dmp-frontend/src/app/app-routing.module.ts @@ -45,7 +45,7 @@ const appRoutes: Routes = [ }, { path: 'plans', - loadChildren: () => import('./ui/plan/plan.module').then(m => m.DmpModule), + loadChildren: () => import('./ui/plan/plan.module').then(m => m.PlanModule), data: { authContext: { permissions: [AppPermission.ViewMyPlanPage] @@ -59,7 +59,7 @@ const appRoutes: Routes = [ }, { path: 'explore-plans', - loadChildren: () => import('./ui/plan/plan.module').then(m => m.PublicDmpModule), + loadChildren: () => import('./ui/plan/plan.module').then(m => m.PublicPlanModule), data: { breadcrumb: true, ...BreadcrumbService.generateRouteDataConfiguration({ diff --git a/dmp-frontend/src/app/app.component.ts b/dmp-frontend/src/app/app.component.ts index d584f1716..16ce315cb 100644 --- a/dmp-frontend/src/app/app.component.ts +++ b/dmp-frontend/src/app/app.component.ts @@ -252,7 +252,7 @@ export class AppComponent implements OnInit, AfterViewInit { return this.authentication.currentAccountIsAuthenticated(); } - goToDMPs() { //not used + goToPlans() { //not used this.router.navigate(['/plans'], { queryParams: { /*refresh : Math.random() ,returnUrl: this.state.url*/ } }); } diff --git a/dmp-frontend/src/app/core/common/enum/annotation-entity-type.ts b/dmp-frontend/src/app/core/common/enum/annotation-entity-type.ts index ae1df923f..9c1d0bfdb 100644 --- a/dmp-frontend/src/app/core/common/enum/annotation-entity-type.ts +++ b/dmp-frontend/src/app/core/common/enum/annotation-entity-type.ts @@ -1,4 +1,4 @@ export enum AnnotationEntityType { Description = "description", - Dmp = "dmp" + Plan = "plan" } diff --git a/dmp-frontend/src/app/core/common/enum/file-transformer-entity-type.ts b/dmp-frontend/src/app/core/common/enum/file-transformer-entity-type.ts index 5330267b0..ac8d5f013 100644 --- a/dmp-frontend/src/app/core/common/enum/file-transformer-entity-type.ts +++ b/dmp-frontend/src/app/core/common/enum/file-transformer-entity-type.ts @@ -1,4 +1,4 @@ export enum FileTransformerEntityType { - Dmp = 0, + Plan = 0, Description = 1 } diff --git a/dmp-frontend/src/app/core/common/enum/respone-error-code.ts b/dmp-frontend/src/app/core/common/enum/respone-error-code.ts index 5d2364b6f..8391bdcd7 100644 --- a/dmp-frontend/src/app/core/common/enum/respone-error-code.ts +++ b/dmp-frontend/src/app/core/common/enum/respone-error-code.ts @@ -13,11 +13,11 @@ export enum ResponseErrorCode { DescriptionTemplateNewVersionConflict = 113, DescriptionTemplateIsNotFinalized = 114, MultipleDescriptionTemplateVersionsNotSupported = 115, - DmpNewVersionConflict = 116, - DmpIsNotFinalized = 117, - MultipleDmpVersionsNotSupported = 118, - DmpIsFinalized = 119, - DmpCanNotChange = 120, + PlanNewVersionConflict = 116, + PlanIsNotFinalized = 117, + MultiplePlanVersionsNotSupported = 118, + PlanIsFinalized = 119, + PlanCanNotChange = 120, PlanDescriptionTemplateCanNotChange = 121, InvalidDescriptionTemplate = 122, DescriptionIsFinalized = 123, @@ -28,11 +28,11 @@ export enum ResponseErrorCode { TenantConfigurationTypeCanNotChange = 128, MultipleTenantConfigurationTypeNotAllowed = 129, TenantCodeExists = 130, - DmpNewVersionAlreadyCreatedDraft = 131, + PlanNewVersionAlreadyCreatedDraft = 131, DescriptionTemplateInactiveUser = 132, DescriptionTemplateMissingUserContactInfo = 133, - DmpInactiveUser = 134, - DmpMissingUserContactInfo = 135, + PlanInactiveUser = 134, + PlanMissingUserContactInfo = 135, ImportDescriptionWithoutPlanDescriptionTemplate = 136, DuplicatePlanUser = 137, DescriptionTemplateNewVersionAlreadyCreatedDraft = 138, @@ -79,15 +79,15 @@ export class ResponseErrorCodeHelper { return language.instant("GENERAL.BACKEND-ERRORS.DESCRIPTION-TEMPLATE-IS-NOT-FINALIZED"); case ResponseErrorCode.MultipleDescriptionTemplateVersionsNotSupported: return language.instant("GENERAL.BACKEND-ERRORS.MULTIPLE-DESCRIPTION-TEMPLATE-VERSIONS-NOT-SUPPORTED"); - case ResponseErrorCode.DmpNewVersionConflict: + case ResponseErrorCode.PlanNewVersionConflict: return language.instant("GENERAL.BACKEND-ERRORS.PLAN-NEW-VERSION-CONFLICT"); - case ResponseErrorCode.DmpIsNotFinalized: + case ResponseErrorCode.PlanIsNotFinalized: return language.instant("GENERAL.BACKEND-ERRORS.PLAN-IS-NOT-FINALIZED"); - case ResponseErrorCode.MultipleDmpVersionsNotSupported: + case ResponseErrorCode.MultiplePlanVersionsNotSupported: return language.instant("GENERAL.BACKEND-ERRORS.MULTIPLE-PLAN-VERSIONS-NOT-SUPPORTED"); - case ResponseErrorCode.DmpIsFinalized: + case ResponseErrorCode.PlanIsFinalized: return language.instant("GENERAL.BACKEND-ERRORS.PLAN-IS-FINALIZED"); - case ResponseErrorCode.DmpCanNotChange: + case ResponseErrorCode.PlanCanNotChange: return language.instant("GENERAL.BACKEND-ERRORS.PLAN-CAN-NOT-CHANGE"); case ResponseErrorCode.PlanDescriptionTemplateCanNotChange: return language.instant("GENERAL.BACKEND-ERRORS.PLAN-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE"); @@ -109,15 +109,15 @@ export class ResponseErrorCodeHelper { return language.instant("GENERAL.BACKEND-ERRORS.MULTIPLE-TENANT-CONFIGURATION-TYPE-NOT-ALLOWED"); case ResponseErrorCode.TenantCodeExists: return language.instant("GENERAL.BACKEND-ERRORS.TENANT-CODE-EXISTS"); - case ResponseErrorCode.DmpNewVersionAlreadyCreatedDraft: + case ResponseErrorCode.PlanNewVersionAlreadyCreatedDraft: return language.instant("GENERAL.BACKEND-ERRORS.PLAN-NEW-VERSION-ALREADY-CREATED-DRAFT"); case ResponseErrorCode.DescriptionTemplateInactiveUser: return language.instant("GENERAL.BACKEND-ERRORS.DESCRIPTION-TEMPLATE-INACTIVE-USER"); case ResponseErrorCode.DescriptionTemplateMissingUserContactInfo: return language.instant("GENERAL.BACKEND-ERRORS.DESCRIPTION-TEMPLATE-MISSING-USER-CONTACT-INFO"); - case ResponseErrorCode.DmpInactiveUser: + case ResponseErrorCode.PlanInactiveUser: return language.instant("GENERAL.BACKEND-ERRORS.PLAN-INACTIVE-USER"); - case ResponseErrorCode.DmpMissingUserContactInfo: + case ResponseErrorCode.PlanMissingUserContactInfo: return language.instant("GENERAL.BACKEND-ERRORS.PLAN-MISSING-USER-CONTACT-INFO"); case ResponseErrorCode.ImportDescriptionWithoutPlanDescriptionTemplate: return language.instant("GENERAL.BACKEND-ERRORS.IMPORT-DESCRIPTION-WITHOUT-PLAN-DESCRIPTION-TEMPLATE"); diff --git a/dmp-frontend/src/app/core/model/user/user.ts b/dmp-frontend/src/app/core/model/user/user.ts index 4521dab8b..769f1eb54 100644 --- a/dmp-frontend/src/app/core/model/user/user.ts +++ b/dmp-frontend/src/app/core/model/user/user.ts @@ -72,7 +72,7 @@ export interface UserCredentialData { email: String; } -export interface DmpAssociatedUser { +export interface PlanAssociatedUser { id: Guid; name: string; email: string; diff --git a/dmp-frontend/src/app/core/services/file-transformer/file-transformer.service.ts b/dmp-frontend/src/app/core/services/file-transformer/file-transformer.service.ts index 7748bc475..894d5983f 100644 --- a/dmp-frontend/src/app/core/services/file-transformer/file-transformer.service.ts +++ b/dmp-frontend/src/app/core/services/file-transformer/file-transformer.service.ts @@ -30,7 +30,7 @@ export class FileTransformerService extends BaseService { private _loading: boolean = false; private xmlExportRepo: RepositoryFileFormat = { - entityTypes: [FileTransformerEntityType.Description, FileTransformerEntityType.Dmp], + entityTypes: [FileTransformerEntityType.Description, FileTransformerEntityType.Plan], format: "xml", hasLogo: true, icon: "fa-file-code-o", diff --git a/dmp-frontend/src/app/core/services/matomo/analytics-service.ts b/dmp-frontend/src/app/core/services/matomo/analytics-service.ts index db77d373d..fc1f0b250 100644 --- a/dmp-frontend/src/app/core/services/matomo/analytics-service.ts +++ b/dmp-frontend/src/app/core/services/matomo/analytics-service.ts @@ -34,7 +34,7 @@ export class AnalyticsService { public static PlanFilterDialog: string = 'DMP Criteria'; public static PlanListingItem: string = 'DMP Listing Item'; public static StartNewPlanDialog: string = 'Start New DMP Dialog'; - public static DmpUploadDialog: string = 'DMP Upload Dialog'; + public static PlanUploadDialog: string = 'DMP Upload Dialog'; public static PlanOverview: string = 'DMP Overview'; public static FAQ: string = 'FAQ'; public static Glossary: string = 'Glossary'; diff --git a/dmp-frontend/src/app/core/services/user/user.service.ts b/dmp-frontend/src/app/core/services/user/user.service.ts index 818d40ac0..9797c6f98 100644 --- a/dmp-frontend/src/app/core/services/user/user.service.ts +++ b/dmp-frontend/src/app/core/services/user/user.service.ts @@ -1,7 +1,7 @@ import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { IsActive } from '@app/core/common/enum/is-active.enum'; -import { DmpAssociatedUser, RemoveCredentialRequestPersist, User, UserMergeRequestPersist, UserPersist, UserRolePatchPersist, UserTenantUsersInviteRequest } from '@app/core/model/user/user'; +import { PlanAssociatedUser, RemoveCredentialRequestPersist, User, UserMergeRequestPersist, UserPersist, UserRolePatchPersist, UserTenantUsersInviteRequest } from '@app/core/model/user/user'; import { UserLookup } from '@app/core/query/user.lookup'; import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration'; import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration'; @@ -31,9 +31,9 @@ export class UserService { return this.http.post>(url, q).pipe(catchError((error: any) => throwError(error))); } - queryDmpAssociated(q: UserLookup): Observable> { + queryPlanAssociated(q: UserLookup): Observable> { const url = `${this.apiBase}/plan-associated/query`; - return this.http.post>(url, q).pipe(catchError((error: any) => throwError(error))); + return this.http.post>(url, q).pipe(catchError((error: any) => throwError(error))); } getSingle(id: Guid, reqFields: string[] = []): Observable { @@ -178,14 +178,14 @@ export class UserService { valueAssign: (item: User) => item.id, }; - singleAutoCompleteDmpAssociatedUserConfiguration: SingleAutoCompleteConfiguration = { - initialItems: (data?: any) => this.queryDmpAssociated(this.buildAutocompleteLookup()).pipe(map(x => x.items)), - filterFn: (searchQuery: string, data?: any) => this.queryDmpAssociated(this.buildAutocompleteLookup(searchQuery)).pipe(map(x => x.items)), - getSelectedItem: (selectedItem: any) => this.queryDmpAssociated(this.buildAutocompleteLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])), - displayFn: (item: DmpAssociatedUser) => item.name, - subtitleFn: (item: DmpAssociatedUser) => item.email, - titleFn: (item: DmpAssociatedUser) => item.name, - valueAssign: (item: DmpAssociatedUser) => item.id, + singleAutoCompletePlanAssociatedUserConfiguration: SingleAutoCompleteConfiguration = { + initialItems: (data?: any) => this.queryPlanAssociated(this.buildAutocompleteLookup()).pipe(map(x => x.items)), + filterFn: (searchQuery: string, data?: any) => this.queryPlanAssociated(this.buildAutocompleteLookup(searchQuery)).pipe(map(x => x.items)), + getSelectedItem: (selectedItem: any) => this.queryPlanAssociated(this.buildAutocompleteLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])), + displayFn: (item: PlanAssociatedUser) => item.name, + subtitleFn: (item: PlanAssociatedUser) => item.email, + titleFn: (item: PlanAssociatedUser) => item.name, + valueAssign: (item: PlanAssociatedUser) => item.id, }; public buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[]): UserLookup { diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-set/description-template-editor-field-set.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-set/description-template-editor-field-set.component.html index 056258b70..797c6119e 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-set/description-template-editor-field-set.component.html +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-set/description-template-editor-field-set.component.html @@ -225,11 +225,11 @@ -
+
@@ -55,26 +55,26 @@
-
+
{{'DASHBOARD.LATEST-ACTIVITY' | translate}}
- + - + > - - + + - +
-
+
@@ -101,7 +101,7 @@
-
+
{{'DASHBOARD.PERSONAL-USAGE' | translate}}
@@ -162,7 +162,7 @@
-
+
{{'DASHBOARD.PUBLIC-USAGE' | translate}}
@@ -184,7 +184,7 @@
-
+
{{'DASHBOARD.PUBLIC-USAGE' | translate}}
diff --git a/dmp-frontend/src/app/ui/dashboard/dashboard.component.scss b/dmp-frontend/src/app/ui/dashboard/dashboard.component.scss index b9f877ef7..3de8e3f3c 100644 --- a/dmp-frontend/src/app/ui/dashboard/dashboard.component.scss +++ b/dmp-frontend/src/app/ui/dashboard/dashboard.component.scss @@ -155,7 +155,7 @@ padding-left: 3rem; } -.dmp-card, +.plan-card, .description-card { min-width: 712px; /* min-height: 308px; */ @@ -182,7 +182,7 @@ input[type="text"] { padding-left: 15px; } -.dmp-label { +.plan-label { background: var(--primary-color) 0% 0% no-repeat padding-box; border-radius: 4px 0px; opacity: 1; @@ -213,7 +213,7 @@ input[type="text"] { // padding-bottom: 0.4rem; } -.dmp-subtitle, +.plan-subtitle, .description-subtitle { .icon-align { @@ -225,7 +225,7 @@ input[type="text"] { } .description-card-actions, -.dmp-card-actions { +.plan-card-actions { display: flex; flex-direction: row; border-top: 1px solid #dbdbdb; @@ -234,24 +234,24 @@ input[type="text"] { } .description-card-actions a, -.dmp-card-actions a { +.plan-card-actions a { color: #848484 !important; text-decoration: none !important; } .description-card-actions a:hover, -.dmp-card-actions a:hover { +.plan-card-actions a:hover { color: var(--primary-color) !important; } -.dmp-description-descriptions-title { +.plan-description-descriptions-title { color: #000000; opacity: 0.6; padding-top: 1.5rem; padding-bottom: 0.8rem; } -.dmp-description-descriptions-name { +.plan-description-descriptions-name { color: #000000; opacity: 0.6; font-weight: 700; diff --git a/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts b/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts index bd49dd73e..b779007bb 100644 --- a/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts @@ -57,7 +57,7 @@ export class DashboardComponent extends BaseComponent implements OnInit { ngOnInit() { this.route.queryParams.subscribe(params => { let type = params['type']; - if (type || type == "recent" || (type == "drafts" && this.isAuthenticated()) || type == "dmps" || type == "descriptions") { + if (type || type == "recent" || (type == "drafts" && this.isAuthenticated()) || type == "plans" || type == "descriptions") { this.currentType = type; } else { this.currentType = "recent"; @@ -98,7 +98,7 @@ export class DashboardComponent extends BaseComponent implements OnInit { if (this.currentType == "drafts") { return 1; } - if (this.currentType == "dmps") { + if (this.currentType == "plans") { return this.isAuthenticated() ? 2 : 1; } if (this.currentType == "descriptions") { @@ -126,7 +126,7 @@ export class DashboardComponent extends BaseComponent implements OnInit { } } - public hasDmps(): boolean { + public hasPlans(): boolean { if (this.dashboardStatistics) { return this.dashboardStatistics.planCount !== 0 || this.dashboardStatistics.descriptionCount !== 0 @@ -167,7 +167,7 @@ export class DashboardComponent extends BaseComponent implements OnInit { useOrb: true, steps: [ { - selector: '.new-dmp-dialog', + selector: '.new-plan-dialog', content: 'Step 1', orientation: Orientation.BottomRight, isStepUnique: false, @@ -199,10 +199,10 @@ export class DashboardComponent extends BaseComponent implements OnInit { ] }; - public setDashboardTourDmpText(): void { - const dmpText = this.language.instant('DASHBOARD.TOUR-GUIDE.PLAN') + '\n\n' + + public setDashboardTourPlanText(): void { + const planText = this.language.instant('DASHBOARD.TOUR-GUIDE.PLAN') + '\n\n' + this.language.instant('DASHBOARD.TOUR-GUIDE.START-NEW'); - this.dashboardTour.steps[0].title = dmpText; + this.dashboardTour.steps[0].title = planText; } public setDashboardImportFileText(): void { @@ -222,7 +222,7 @@ export class DashboardComponent extends BaseComponent implements OnInit { } openDashboardTour() { - this.setDashboardTourDmpText(); + this.setDashboardTourPlanText(); this.setDashboardImportFileText(); this.setDashboardStartWizardText(); this.setDescriptionText(); diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.html b/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.html index 3258dff80..56d77c783 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.html +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.html @@ -31,14 +31,14 @@
- +
{{'GENERAL.ACTIONS.NO-MORE-AVAILABLE' | translate}}
-
+
diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.scss b/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.scss index 62bf4a122..183b977f0 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.scss +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.scss @@ -13,7 +13,7 @@ input[type="text"] { padding-left: 15px; } -.dmp-label { +.plan-label { background: var(--primary-color) 0% 0% no-repeat padding-box; border-radius: 4px 0px; opacity: 1; @@ -31,7 +31,7 @@ input[type="text"] { } .description-card-actions, -.dmp-card-actions { +.plan-card-actions { display: flex; flex-direction: row; border-top: 1px solid #dbdbdb; @@ -40,7 +40,7 @@ input[type="text"] { } .description-card-actions, -.dmp-card-actions { +.plan-card-actions { display: flex; flex-direction: row; border-top: 1px solid #dbdbdb; @@ -49,24 +49,24 @@ input[type="text"] { } .description-card-actions a, -.dmp-card-actions a { +.plan-card-actions a { color: #848484 !important; text-decoration: none !important; } .description-card-actions a:hover, -.dmp-card-actions a:hover { +.plan-card-actions a:hover { color: var(--primary-color) !important; } -.dmp-description-descriptions-title { +.plan-description-descriptions-title { color: #000000; opacity: 0.6; padding-top: 1.5rem; padding-bottom: 0.8rem; } -.dmp-description-descriptions-name { +.plan-description-descriptions-name { color: #000000; opacity: 0.6; font-weight: 700; diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts b/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts index 143c5cc9c..0dbab076b 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts @@ -44,18 +44,18 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn @Input() type: string; @Input() selectedType: string; @Input() includeDescriptions: boolean = false; - @Input() includeDmps: boolean = false; + @Input() includePlans: boolean = false; @Input() onlyDrafts: boolean = false; - @Input() hasDmps: boolean = false; + @Input() hasPlans: boolean = false; @Output() addNewDescription: BehaviorSubject = new BehaviorSubject(false); get onlyPlans(): boolean { - return this.includeDmps && !this.includeDescriptions; + return this.includePlans && !this.includeDescriptions; } get onlyDescriptions(): boolean { - return !this.includeDmps && this.includeDescriptions; + return !this.includePlans && this.includeDescriptions; } pageLessSize= this.pageSize; @@ -166,7 +166,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn this.lookup.like = this.formGroup.get('like').value; this.lookup.project = { fields : [ - ...(this.includeDmps ? this._getPlanLookup() : []), + ...(this.includePlans ? this._getPlanLookup() : []), ...(this.includeDescriptions ? this._getDescriptionLookup() : []) ] }; diff --git a/dmp-frontend/src/app/ui/description/description-copy-dialog/description-copy-dialog.component.html b/dmp-frontend/src/app/ui/description/description-copy-dialog/description-copy-dialog.component.html index 2547e3f44..7fe92037c 100644 --- a/dmp-frontend/src/app/ui/description/description-copy-dialog/description-copy-dialog.component.html +++ b/dmp-frontend/src/app/ui/description/description-copy-dialog/description-copy-dialog.component.html @@ -7,7 +7,7 @@
- +
diff --git a/dmp-frontend/src/app/ui/description/description-copy-dialog/description-copy-dialog.component.ts b/dmp-frontend/src/app/ui/description/description-copy-dialog/description-copy-dialog.component.ts index 68d19441f..a38ad2220 100644 --- a/dmp-frontend/src/app/ui/description/description-copy-dialog/description-copy-dialog.component.ts +++ b/dmp-frontend/src/app/ui/description/description-copy-dialog/description-copy-dialog.component.ts @@ -26,10 +26,9 @@ import { DescriptionTemplatesInSection, PlanBlueprint, PlanBlueprintDefinition, }) export class DescriptionCopyDialogComponent { - dmpModel: Plan; sections: PlanBlueprintDefinitionSection[] = []; descriptionDescriptionTemplateLabel: String; - dmpAutoCompleteConfiguration: SingleAutoCompleteConfiguration = { //TODO: add filter to only get DMPs that have connection with the same Description Template group. + planAutoCompleteConfiguration: SingleAutoCompleteConfiguration = { //TODO: add filter to only get plans that have connection with the same Description Template group. initialItems: (data?: any) => this.planService.query(this.buildPlanLookup(null,null,null, this.planDescriptionTemplateLookup)).pipe(map(x => x.items)), filterFn: (searchQuery: string, data?: any) => this.planService.query(this.buildPlanLookup(searchQuery, null, null, this.planDescriptionTemplateLookup)).pipe(map(x => x.items)), getSelectedItem: (selectedItem: any) => this.planService.query(this.buildPlanLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])), @@ -83,16 +82,16 @@ export class DescriptionCopyDialogComponent { ngOnInit() { } - findSection(dmp: Plan){ - const availableSectionIds = dmp.planDescriptionTemplates?.filter(x => x.descriptionTemplateGroupId === this.data.descriptionTemplate.groupId && x.isActive == IsActive.Active).map(y => y.sectionId); - this.sections = dmp.blueprint.definition.sections.filter(x => x.hasTemplates == true && availableSectionIds?.includes(x.id)) || []; + findSection(plan: Plan){ + const availableSectionIds = plan.planDescriptionTemplates?.filter(x => x.descriptionTemplateGroupId === this.data.descriptionTemplate.groupId && x.isActive == IsActive.Active).map(y => y.sectionId); + this.sections = plan.blueprint.definition.sections.filter(x => x.hasTemplates == true && availableSectionIds?.includes(x.id)) || []; if(this.sections.length == 1){ this.data.formGroup.get('sectionId').setValue(this.sections[0].id); }else { this.data.formGroup.get('sectionId').setValue(null); } - return dmp.id + return plan.id } cancel() { diff --git a/dmp-frontend/src/app/ui/description/editor/description-base-fields-editor/description-base-fields-editor.component.scss b/dmp-frontend/src/app/ui/description/editor/description-base-fields-editor/description-base-fields-editor.component.scss index 099fc0049..61e967700 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-base-fields-editor/description-base-fields-editor.component.scss +++ b/dmp-frontend/src/app/ui/description/editor/description-base-fields-editor/description-base-fields-editor.component.scss @@ -57,14 +57,14 @@ color: var(--primary-color-3) !important; } - .dmp-link { + .plan-link { color: #3fafac; font-weight: 400; font-size: 16px; cursor: pointer; } - .dmp-link:hover { + .plan-link:hover { text-decoration: underline; } } diff --git a/dmp-frontend/src/app/ui/description/editor/description-editor.component.html b/dmp-frontend/src/app/ui/description/editor/description-editor.component.html index 6d9d1b337..057b03d8f 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-editor.component.html +++ b/dmp-frontend/src/app/ui/description/editor/description-editor.component.html @@ -15,9 +15,9 @@
{{'DESCRIPTION-EDITOR.TITLE-PREVIEW-DESCRIPTION' | translate}}
-
-
{{'DESCRIPTION-EDITOR.TO-PLAN' | translate}}
-
: {{ item?.plan?.label }}
+
+
{{'DESCRIPTION-EDITOR.TO-PLAN' | translate}}
+
: {{ item?.plan?.label }}
open_in_new @@ -86,11 +86,11 @@
-
+
chevron_left {{'DESCRIPTION-EDITOR.ACTIONS.BACK-TO' | translate}}
-
{{'DESCRIPTION-EDITOR.PLAN' | translate}}
+
{{'DESCRIPTION-EDITOR.PLAN' | translate}}
{{'DESCRIPTION-EDITOR.TOC.TITLE' | translate}}
@@ -178,7 +178,7 @@ [validationErrorModel]="editorModel.validationErrorModel" [isNew]="isNew || isCopy" [canReview]="canReview" - [dmpUsers]="item?.plan?.planUsers ?? []" + [planUsers]="item?.plan?.planUsers ?? []" >
diff --git a/dmp-frontend/src/app/ui/description/editor/description-editor.component.scss b/dmp-frontend/src/app/ui/description/editor/description-editor.component.scss index d3e4b63f0..8603d2aff 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-editor.component.scss +++ b/dmp-frontend/src/app/ui/description/editor/description-editor.component.scss @@ -202,7 +202,7 @@ align-items: center; } - .description-to-dmp { + .description-to-plan { display: flex; align-items: center; padding: 0; @@ -213,11 +213,11 @@ line-height: 25px; } - .dmp-info { + .plan-info { padding-top: 0.75rem; } - .dmp-label { + .plan-label { min-width: 67px; height: 37px; background: var(--primary-color) 0% 0% no-repeat padding-box; @@ -229,7 +229,7 @@ justify-content: center; } - .dmp-title { + .plan-title { text-align: left; font-weight: 700; font-size: 1rem; @@ -345,7 +345,7 @@ } } - .back-to-dmp:hover { + .back-to-plan:hover { background: #ececec; border-radius: 6px; } 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 cb2ddb7ae..bade72910 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 @@ -140,7 +140,7 @@ export class DescriptionEditorComponent extends BaseEditor { if (result) { - const dmpUserRemovePersist: DescriptionStatusPersist = { + const planUserRemovePersist: DescriptionStatusPersist = { id: this.formGroup.get('id').value, status: DescriptionStatus.Draft, hash: this.formGroup.get('hash').value }; - this.descriptionService.persistStatus(dmpUserRemovePersist, DescriptionEditorEntityResolver.lookupFields()).pipe(takeUntil(this._destroyed)) + this.descriptionService.persistStatus(planUserRemovePersist, DescriptionEditorEntityResolver.lookupFields()).pipe(takeUntil(this._destroyed)) .subscribe(data => { this.isFinalized = false; this.refreshData(); diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.ts b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.ts index 4489e66e3..bee62bdf2 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.ts @@ -35,7 +35,7 @@ export class DescriptionFormFieldSetComponent extends BaseComponent { @Input() hideAnnotations: boolean = false; @Input() canReview: boolean = false; @Input() numbering: string; - @Input() dmpUsers: PlanUser[] = []; + @Input() planUsers: PlanUser[] = []; get isMultiplicityEnabled() { return this.fieldSet.hasMultiplicity && this.fieldSet.multiplicity != null; @@ -186,7 +186,7 @@ export class DescriptionFormFieldSetComponent extends BaseComponent { entityId: this.descriptionId, anchor: fieldSetId, entityType: AnnotationEntityType.Description, - planUsers: this.dmpUsers + planUsers: this.planUsers } }); dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(changesMade => { diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.html b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.html index a22461f6c..88f405b18 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.html +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.html @@ -25,7 +25,7 @@ [isChild]="false" [hideAnnotations]="isNew" [canReview]="canReview" - [dmpUsers]="dmpUsers" + [planUsers]="planUsers" >
diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.ts b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.ts index 2e397ca2f..bbbe82951 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.ts @@ -26,7 +26,7 @@ export class DescriptionFormSectionComponent extends BaseComponent implements On @Input() visibilityRulesService: VisibilityRulesService; @Input() path: string; @Input() descriptionId: Guid; - @Input() dmpUsers: PlanUser[] = []; + @Input() planUsers: PlanUser[] = []; // @Input() descriptionTemplateId: String; diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/description-form.component.html b/dmp-frontend/src/app/ui/description/editor/description-form/description-form.component.html index f29f4c18e..b1119a46b 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/description-form.component.html +++ b/dmp-frontend/src/app/ui/description/editor/description-form/description-form.component.html @@ -15,7 +15,7 @@
- +
diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/description-form.component.ts b/dmp-frontend/src/app/ui/description/editor/description-form/description-form.component.ts index 7dcce55ff..4490a1ebe 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/description-form.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-form/description-form.component.ts @@ -27,7 +27,7 @@ export class DescriptionFormComponent extends BaseComponent implements OnInit, O @Input() datasetDescription: String; @Input() linkToScroll: LinkToScroll; @Input() validationErrorModel: ValidationErrorModel; - @Input() dmpUsers: PlanUser[] = []; + @Input() planUsers: PlanUser[] = []; @Output() formChanged: EventEmitter = new EventEmitter(); diff --git a/dmp-frontend/src/app/ui/description/editor/prefill-description/prefill-description.component.ts b/dmp-frontend/src/app/ui/description/editor/prefill-description/prefill-description.component.ts index 4564a4acf..2584edc63 100644 --- a/dmp-frontend/src/app/ui/description/editor/prefill-description/prefill-description.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/prefill-description/prefill-description.component.ts @@ -31,7 +31,7 @@ export class PrefillDescriptionDialogComponent extends BaseComponent implements prefillSelected: boolean = false; prefillForm: UntypedFormGroup; - dmp: Plan; + plan: Plan; planSectionId: Guid; availableDescriptionTemplates: DescriptionTemplate[] = []; @@ -43,13 +43,13 @@ export class PrefillDescriptionDialogComponent extends BaseComponent implements @Inject(MAT_DIALOG_DATA) public data: any) { super(); - this.dmp = data.plan; + this.plan = data.plan; this.planSectionId = data.planSectionId; - this.availableDescriptionTemplates = this.dmp.planDescriptionTemplates.filter(x => x.sectionId == this.planSectionId && x.isActive == IsActive.Active).map(x => x.currentDescriptionTemplate); + this.availableDescriptionTemplates = this.plan.planDescriptionTemplates.filter(x => x.sectionId == this.planSectionId && x.isActive == IsActive.Active).map(x => x.currentDescriptionTemplate); } ngOnInit() { - const availablePrefillingSourcesIds = this.dmp.blueprint.definition.sections.filter(x => x.id === this.planSectionId)[0].prefillingSources?.map(x => x.id) || null; + const availablePrefillingSourcesIds = this.plan.blueprint.definition.sections.filter(x => x.id === this.planSectionId)[0].prefillingSources?.map(x => x.id) || null; this.singlePrefillingSourceAutoCompleteConfiguration = this.prefillingSourceService.getSingleAutocompleteConfiguration(availablePrefillingSourcesIds); this.progressIndicationService.getProgressIndicationObservable().pipe(takeUntil(this._destroyed)).subscribe(x => { diff --git a/dmp-frontend/src/app/ui/description/editor/resolvers/description-editor-entity.resolver.ts b/dmp-frontend/src/app/ui/description/editor/resolvers/description-editor-entity.resolver.ts index ee9f5478e..bc97377fa 100644 --- a/dmp-frontend/src/app/ui/description/editor/resolvers/description-editor-entity.resolver.ts +++ b/dmp-frontend/src/app/ui/description/editor/resolvers/description-editor-entity.resolver.ts @@ -34,7 +34,7 @@ export class DescriptionEditorEntityResolver extends BaseEditorResolver { public static lookupFields(): string[] { return [ ...DescriptionEditorEntityResolver.descriptionLookupFields(), - ...DescriptionEditorEntityResolver.dmpLookupFields(nameof(x => x.plan)), + ...DescriptionEditorEntityResolver.planLookupFields(nameof(x => x.plan)), ...DescriptionEditorEntityResolver.descriptionTemplateLookupFieldsForDescrption(), ] } @@ -115,7 +115,7 @@ export class DescriptionEditorEntityResolver extends BaseEditorResolver { ] } - public static dmpLookupFields(prefix?: string): string[] { + public static planLookupFields(prefix?: string): string[] { return [ (prefix ? prefix + '.' : '') + [nameof(x => x.id)].join('.'), (prefix ? prefix + '.' : '') + [nameof(x => x.label)].join('.'), @@ -176,20 +176,20 @@ export class DescriptionEditorEntityResolver extends BaseEditorResolver { } return this.descriptionService.getSingle(Guid.parse(id), fields).pipe(tap(d => this.breadcrumbService.addIdResolvedValue(d.id.toString(), d.label))); } else if (planId != null && planSectionId != null && copyPlanId == null) { - return this.planService.getSingle(Guid.parse(planId), DescriptionEditorEntityResolver.dmpLookupFields()) + return this.planService.getSingle(Guid.parse(planId), DescriptionEditorEntityResolver.planLookupFields()) .pipe(tap(x => { this.breadcrumbService.addExcludedParam(planId, true); this.breadcrumbService.addIdResolvedValue(planSectionId, this.language.instant("DESCRIPTION-EDITOR.TITLE-NEW")); - }), takeUntil(this._destroyed), map(dmp => { + }), takeUntil(this._destroyed), map(plan => { const description: Description = {}; - description.plan = dmp; + description.plan = plan; description.planDescriptionTemplate = { sectionId: Guid.parse(planSectionId) } return description; })); } else if (copyPlanId != null && id != null && planSectionId != null) { - return this.planService.getSingle(Guid.parse(copyPlanId), DescriptionEditorEntityResolver.dmpLookupFields()).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed), concatMap(dmp => { + return this.planService.getSingle(Guid.parse(copyPlanId), DescriptionEditorEntityResolver.planLookupFields()).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed), concatMap(plan => { return this.descriptionService.getSingle(Guid.parse(id), DescriptionEditorEntityResolver.cloneLookupFields()) .pipe(tap(x => { this.breadcrumbService.addExcludedParam(copyPlanId, true) @@ -200,9 +200,9 @@ export class DescriptionEditorEntityResolver extends BaseEditorResolver { description.id = null; description.hash = null; description.status = DescriptionStatus.Draft; - description.plan = dmp; + description.plan = plan; description.planDescriptionTemplate = { - id: dmp.planDescriptionTemplates.filter(x => x.sectionId == Guid.parse(planSectionId) && x.descriptionTemplateGroupId == description.descriptionTemplate.groupId)[0].id, + id: plan.planDescriptionTemplates.filter(x => x.sectionId == Guid.parse(planSectionId) && x.descriptionTemplateGroupId == description.descriptionTemplate.groupId)[0].id, sectionId: Guid.parse(planSectionId) } return description; diff --git a/dmp-frontend/src/app/ui/description/editor/resolvers/description-editor-permissions.resolver.ts b/dmp-frontend/src/app/ui/description/editor/resolvers/description-editor-permissions.resolver.ts index 9ee56ca30..5aa34d07f 100644 --- a/dmp-frontend/src/app/ui/description/editor/resolvers/description-editor-permissions.resolver.ts +++ b/dmp-frontend/src/app/ui/description/editor/resolvers/description-editor-permissions.resolver.ts @@ -46,13 +46,13 @@ export class DescriptionEditorPermissionsResolver extends BaseEditorResolver { })); } else if (planId != null && planSectionId != null && copyPlanId == null) { - return this.planService.getSingle(Guid.parse(planId), DescriptionEditorEntityResolver.dmpLookupFields()) + return this.planService.getSingle(Guid.parse(planId), DescriptionEditorEntityResolver.planLookupFields()) .pipe(tap(x => { this.breadcrumbService.addExcludedParam(planId, true); this.breadcrumbService.addIdResolvedValue(planSectionId, this.language.instant("DESCRIPTION-EDITOR.TITLE-NEW")); - }), takeUntil(this._destroyed), map(dmp => { + }), takeUntil(this._destroyed), map(plan => { const description: Description = {}; - description.plan = dmp; + description.plan = plan; description.planDescriptionTemplate = { sectionId: Guid.parse(planSectionId) } @@ -67,7 +67,7 @@ export class DescriptionEditorPermissionsResolver extends BaseEditorResolver { return this.descriptionService.getDescriptionSectionPermissions(descriptionSectionPermissionResolverModel).pipe(takeUntil(this._destroyed)); })); } else if (copyPlanId != null && id != null && planSectionId != null) { - return this.planService.getSingle(Guid.parse(copyPlanId), DescriptionEditorEntityResolver.dmpLookupFields()).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed), concatMap(dmp => { + return this.planService.getSingle(Guid.parse(copyPlanId), DescriptionEditorEntityResolver.planLookupFields()).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed), concatMap(plan => { //TODO return this.descriptionService.getSingle(Guid.parse(id), DescriptionEditorEntityResolver.cloneLookupFields()) .pipe(tap(x => { @@ -79,9 +79,9 @@ export class DescriptionEditorPermissionsResolver extends BaseEditorResolver { description.id = null; description.hash = null; description.status = DescriptionStatus.Draft; - description.plan = dmp; + description.plan = plan; description.planDescriptionTemplate = { - id: dmp.planDescriptionTemplates.filter(x => x.sectionId == Guid.parse(planSectionId) && x.descriptionTemplateGroupId == description.descriptionTemplate.groupId)[0].id, + id: plan.planDescriptionTemplates.filter(x => x.sectionId == Guid.parse(planSectionId) && x.descriptionTemplateGroupId == description.descriptionTemplate.groupId)[0].id, sectionId: Guid.parse(planSectionId) } return description; diff --git a/dmp-frontend/src/app/ui/description/listing/description-listing.component.scss b/dmp-frontend/src/app/ui/description/listing/description-listing.component.scss index 0092defe6..053d11082 100644 --- a/dmp-frontend/src/app/ui/description/listing/description-listing.component.scss +++ b/dmp-frontend/src/app/ui/description/listing/description-listing.component.scss @@ -16,7 +16,7 @@ padding-bottom: 2em; } -.explore-dmp-content { +.explore-plan-content { padding: 30px 15px; } diff --git a/dmp-frontend/src/app/ui/description/listing/description-listing.component.ts b/dmp-frontend/src/app/ui/description/listing/description-listing.component.ts index 53d134a41..fee1ac61d 100644 --- a/dmp-frontend/src/app/ui/description/listing/description-listing.component.ts +++ b/dmp-frontend/src/app/ui/description/listing/description-listing.component.ts @@ -54,7 +54,7 @@ export class DescriptionListingComponent extends BaseListingComponent 0; + // Plans + let plans = formGroup.get("associatedPlanIds")?.value ?? null; let addPlans = plans && plans?.length > 0; let roles = formGroup.get("role")?.value !== null ? [formGroup.get("role")?.value] : null; let addRoles = roles && roles?.length > 0; - if (addDmps || addRoles) { + if (addPlans || addRoles) { lookup.planSubQuery = DescriptionFilterService.initializePlanLookup(); - if (addDmps) lookup.planSubQuery.ids = dmps?.length > 0 ? dmps : null; + if (addPlans) lookup.planSubQuery.ids = plans?.length > 0 ? plans : null; if (addRoles) { lookup.planSubQuery.planUserSubQuery = DescriptionFilterService.initializePlanUserLookup(); @@ -434,7 +434,7 @@ export class DescriptionListingComponent extends BaseListingComponent 0 ? lookup.statuses[0] : null], role: lookup.planSubQuery?.planUserSubQuery?.userRoles ? lookup.planSubQuery?.planUserSubQuery?.userRoles[0] : [], descriptionTemplates: lookup.descriptionTemplateSubQuery?.ids ? [lookup.descriptionTemplateSubQuery?.ids] : [], - associatedDmpIds: lookup.planSubQuery?.ids ? [lookup.planSubQuery?.ids] : [], + associatedPlanIds: lookup.planSubQuery?.ids ? [lookup.planSubQuery?.ids] : [], tags: lookup.descriptionTagSubQuery?.tagIds ? [lookup.descriptionTagSubQuery?.tagIds] : [], }); } diff --git a/dmp-frontend/src/app/ui/description/listing/description-listing.routing.ts b/dmp-frontend/src/app/ui/description/listing/description-listing.routing.ts index a4c49e5e9..5df456f55 100644 --- a/dmp-frontend/src/app/ui/description/listing/description-listing.routing.ts +++ b/dmp-frontend/src/app/ui/description/listing/description-listing.routing.ts @@ -13,7 +13,7 @@ const routes: Routes = [ }, }, { - path: 'dmp/:planId', + path: 'plan/:planId', component: DescriptionListingComponent, canActivate: [AuthGuard], data: { diff --git a/dmp-frontend/src/app/ui/description/listing/filtering/description-filter.component.html b/dmp-frontend/src/app/ui/description/listing/filtering/description-filter.component.html index 42f34d4b8..8ec8a0feb 100644 --- a/dmp-frontend/src/app/ui/description/listing/filtering/description-filter.component.html +++ b/dmp-frontend/src/app/ui/description/listing/filtering/description-filter.component.html @@ -1,5 +1,5 @@ -
+
@@ -32,16 +32,16 @@
- +
{{'DESCRIPTION-LISTING.FILTERS.ASSOCIATED-PLANS.NAME' | translate}}
{{'DESCRIPTION-LISTING.FILTERS.ASSOCIATED-PLANS.PLACEHOLDER' | translate }} - +
- + @@ -57,10 +57,10 @@
{{'DESCRIPTION-LISTING.FILTERS.ROLE.NAME' | translate }}
{{ 'DESCRIPTION-LISTING.FILTERS.ROLE.TYPES.ANY' | translate }} - {{ 'DESCRIPTION-LISTING.FILTERS.ROLE.TYPES.OWNER' | translate }} - {{ 'DESCRIPTION-LISTING.FILTERS.ROLE.TYPES.VIEWER' | translate }} - {{ 'DESCRIPTION-LISTING.FILTERS.ROLE.TYPES.DESCRIPTION-CONTRIBUTOR' | translate }} - {{ 'DESCRIPTION-LISTING.FILTERS.ROLE.TYPES.REVIEWER' | translate }} + {{ 'DESCRIPTION-LISTING.FILTERS.ROLE.TYPES.OWNER' | translate }} + {{ 'DESCRIPTION-LISTING.FILTERS.ROLE.TYPES.VIEWER' | translate }} + {{ 'DESCRIPTION-LISTING.FILTERS.ROLE.TYPES.DESCRIPTION-CONTRIBUTOR' | translate }} + {{ 'DESCRIPTION-LISTING.FILTERS.ROLE.TYPES.REVIEWER' | translate }}
diff --git a/dmp-frontend/src/app/ui/description/listing/filtering/description-filter.component.ts b/dmp-frontend/src/app/ui/description/listing/filtering/description-filter.component.ts index aef670e8b..3cb6fb33a 100644 --- a/dmp-frontend/src/app/ui/description/listing/filtering/description-filter.component.ts +++ b/dmp-frontend/src/app/ui/description/listing/filtering/description-filter.component.ts @@ -41,11 +41,11 @@ export class DescriptionFilterComponent extends BaseCriteriaComponent implements public filteringTagsAsync = false; statuses = DescriptionStatus; - dmpRole = PlanUserRole; + planRole = PlanUserRole; options: UntypedFormGroup; descriptionTemplateAutoCompleteConfiguration: MultipleAutoCompleteConfiguration; - dmpAutoCompleteConfiguration: MultipleAutoCompleteConfiguration; + planAutoCompleteConfiguration: MultipleAutoCompleteConfiguration; tagAutoCompleteConfiguration: MultipleAutoCompleteConfiguration; referenceTypeAutocompleteConfiguration: SingleAutoCompleteConfiguration; referenceAutocompleteConfiguration: Map; @@ -71,7 +71,7 @@ export class DescriptionFilterComponent extends BaseCriteriaComponent implements if (changes['filterFormGroup']) { this.descriptionTemplateAutoCompleteConfiguration = this.descriptionTemplateService.buildMultipleAutocompleteConfiguration(); - this.dmpAutoCompleteConfiguration = this.planService.multipleAutocompleteConfiguration; + this.planAutoCompleteConfiguration = this.planService.multipleAutocompleteConfiguration; this.tagAutoCompleteConfiguration = this.tagService.multipleAutocompleteConfiguration; this.referenceTypeAutocompleteConfiguration = this.getReferenceTypeAutocompleteConfiguration(); this.referenceAutocompleteConfiguration = new Map(); diff --git a/dmp-frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.html b/dmp-frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.html index 21d083e01..454d28922 100644 --- a/dmp-frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.html +++ b/dmp-frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.html @@ -8,8 +8,8 @@
{{description.label}}
{{description.label}}
- {{ enumUtils.toPlanUserRolesString(planService.getCurrentUserRolesInPlan(description?.plan?.planUsers)) }} - . + {{ enumUtils.toPlanUserRolesString(planService.getCurrentUserRolesInPlan(description?.plan?.planUsers)) }} + . public{{'DESCRIPTION-LISTING.STATES.PUBLIC' | translate}} done{{ enumUtils.toDescriptionStatusString(description.status) }} create{{ enumUtils.toDescriptionStatusString(description.status) }} @@ -18,19 +18,19 @@
{{'DESCRIPTION-LISTING.PART-OF' | translate}} -
{{'DESCRIPTION-LISTING.PLAN' | translate}}
+
{{'DESCRIPTION-LISTING.PLAN' | translate}}
-
{{description.plan?.label}}
+
{{description.plan?.label}}
-
-
@@ -72,8 +72,8 @@
-
diff --git a/dmp-frontend/src/app/ui/description/overview/description-overview.component.scss b/dmp-frontend/src/app/ui/description/overview/description-overview.component.scss index 9a3414172..3ed5c9160 100644 --- a/dmp-frontend/src/app/ui/description/overview/description-overview.component.scss +++ b/dmp-frontend/src/app/ui/description/overview/description-overview.component.scss @@ -59,7 +59,7 @@ align-self: center; } -.dmp-btn { +.plan-btn { width: 35em; min-height: 2.3em; background-color: var(--primary-color); @@ -69,8 +69,8 @@ border: none; } -.dmp-btn, -.dmp-btn > mat-icon { +.plan-btn, +.plan-btn > mat-icon { color: #ffffff; // opacity: 0.8; } @@ -185,7 +185,7 @@ margin-bottom: 1.875em; } -.dmp-btn-label { +.plan-btn-label { margin-right: 1em; color: #ffffff; opacity: 0.8; @@ -294,7 +294,7 @@ } .description-label, -.dmp-btn, +.plan-btn, .doi-panel, .researcher { display: flex; diff --git a/dmp-frontend/src/app/ui/description/overview/description-overview.component.ts b/dmp-frontend/src/app/ui/description/overview/description-overview.component.ts index e7cb105ad..34b8fb480 100644 --- a/dmp-frontend/src/app/ui/description/overview/description-overview.component.ts +++ b/dmp-frontend/src/app/ui/description/overview/description-overview.component.ts @@ -248,16 +248,16 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni } else return false; } - focusOnAuthor(dmpUserId: Guid, order: number): void { - this.authorFocus = `${dmpUserId}-${order}`; + focusOnAuthor(planUserId: Guid, order: number): void { + this.authorFocus = `${planUserId}-${order}`; } resetAuthorFocus(): void { this.authorFocus = null; } - isFocusedOnUser(dmpUserId: Guid, order: number): boolean { - return `${dmpUserId}-${order}` == this.authorFocus; + isFocusedOnUser(planUserId: Guid, order: number): boolean { + return `${planUserId}-${order}` == this.authorFocus; } openShareDialog() { @@ -266,7 +266,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni restoreFocus: false, data: { planId: this.description.plan.id, - dmpName: this.description.plan.label, + planName: this.description.plan.label, blueprint: this.description.plan.blueprint } }); @@ -308,11 +308,11 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni }); } - dmpClicked(dmp: Plan) { + planClicked(plan: Plan) { if (this.isPublicView) { - this.router.navigate([this.routerUtils.generateUrl(['/explore-plans/overview/public/', dmp.id.toString()])]); + this.router.navigate([this.routerUtils.generateUrl(['/explore-plans/overview/public/', plan.id.toString()])]); } else { - this.router.navigate([this.routerUtils.generateUrl(['/plans/overview/', dmp.id.toString()])]); + this.router.navigate([this.routerUtils.generateUrl(['/plans/overview/', plan.id.toString()])]); } } @@ -360,7 +360,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni return sections == null ? '' : sections[0].label; } - openCopyToDmpDialog() { + openCopyToPlanDialog() { const formGroup = this.fb.group({ planId: this.fb.control(null, Validators.required), sectionId: this.fb.control(null, Validators.required), @@ -387,7 +387,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni }); } - removeUserFromDmp(dmpUser: PlanUser) { + removeUserFromPlan(planUser: PlanUser) { const dialogRef = this.dialog.open(ConfirmationDialogComponent, { data: { message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-USER'), @@ -398,12 +398,12 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni }); dialogRef.afterClosed().subscribe(result => { if (result) { - const dmpUserRemovePersist: PlanUserRemovePersist = { - id: dmpUser.id, + const planUserRemovePersist: PlanUserRemovePersist = { + id: planUser.id, planId: this.description.plan.id, - role: dmpUser.role + role: planUser.role }; - this.planService.removeUser(dmpUserRemovePersist).pipe(takeUntil(this._destroyed)) + this.planService.removeUser(planUserRemovePersist).pipe(takeUntil(this._destroyed)) .subscribe(data => { this.reloadPage(); }, (error: any) => this.httpErrorHandlingService.handleBackedRequestError(error)); @@ -465,12 +465,12 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni }); dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { if (result) { - const dmpUserRemovePersist: DescriptionStatusPersist = { + const planUserRemovePersist: DescriptionStatusPersist = { id: description.id, status: DescriptionStatus.Draft, hash: description.hash }; - this.descriptionService.persistStatus(dmpUserRemovePersist).pipe(takeUntil(this._destroyed)) + this.descriptionService.persistStatus(planUserRemovePersist).pipe(takeUntil(this._destroyed)) .subscribe(data => { this.reloadPage(); this.onUpdateCallbackSuccess() diff --git a/dmp-frontend/src/app/ui/description/start-new-description-dialog/start-new-description-dialog.component.html b/dmp-frontend/src/app/ui/description/start-new-description-dialog/start-new-description-dialog.component.html index a5303d95f..ec8435336 100644 --- a/dmp-frontend/src/app/ui/description/start-new-description-dialog/start-new-description-dialog.component.html +++ b/dmp-frontend/src/app/ui/description/start-new-description-dialog/start-new-description-dialog.component.html @@ -16,7 +16,7 @@
- {{'DASHBOARD.ADD-NEW-DESCRIPTION.OPTIONS-NOT-ENOUGH' | translate}} {{'DASHBOARD.ADD-NEW-DESCRIPTION.START-NEW-PLAN' | translate}} + {{'DASHBOARD.ADD-NEW-DESCRIPTION.OPTIONS-NOT-ENOUGH' | translate}} {{'DASHBOARD.ADD-NEW-DESCRIPTION.START-NEW-PLAN' | translate}}
diff --git a/dmp-frontend/src/app/ui/description/start-new-description-dialog/start-new-description-dialog.component.scss b/dmp-frontend/src/app/ui/description/start-new-description-dialog/start-new-description-dialog.component.scss index 5f51075b8..30c49c679 100644 --- a/dmp-frontend/src/app/ui/description/start-new-description-dialog/start-new-description-dialog.component.scss +++ b/dmp-frontend/src/app/ui/description/start-new-description-dialog/start-new-description-dialog.component.scss @@ -92,7 +92,7 @@ min-width: 101px; flex-direction: row; } -.new-dmp { +.new-plan { text-align: left; text-decoration: underline; letter-spacing: 0px; @@ -100,11 +100,11 @@ min-width: 101px; cursor: pointer; } -::ng-deep .dmp-form .mat-form-field-appearance-outline .mat-form-field-outline { +::ng-deep .plan-form .mat-form-field-appearance-outline .mat-form-field-outline { // background: #fafafa !important; } -::ng-deep .dmp-form .mat-form-field-appearance-outline .mat-form-field-infix { +::ng-deep .plan-form .mat-form-field-appearance-outline .mat-form-field-infix { // font-size: 1rem; // padding: 0.6em 0 1em 0 !important; } diff --git a/dmp-frontend/src/app/ui/navbar/navbar.component.html b/dmp-frontend/src/app/ui/navbar/navbar.component.html index f1b4100c3..46547f920 100644 --- a/dmp-frontend/src/app/ui/navbar/navbar.component.html +++ b/dmp-frontend/src/app/ui/navbar/navbar.component.html @@ -20,7 +20,7 @@