Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

adapt specification to the scope implemented

ulfertsfbe56b9e9811
diff --git a/config/constants/views.rb b/config/constants/views.rb
index bb439828190..b8b3e31ee81 100644
--- a/config/constants/views.rb
+++ b/config/constants/views.rb
@@ -47,7 +47,7 @@ module Constants
def type(type)
searched_type = canonical_type(type)
- registered_types.find { |type| type == searched_type }
+ registered_types.find { |registered_type| registered_type == searched_type }
end
def contract_strategy(type)
diff --git a/docs/api/apiv3/components/examples/project_query_projection_schemas.yml b/docs/api/apiv3/components/examples/project_query_projection_schemas.yml
deleted file mode 100644
index fade615b5bb..00000000000
--- a/docs/api/apiv3/components/examples/project_query_projection_schemas.yml
+++ /dev/null
@@ -1,23 +0,0 @@
-# Example: ProjectQueryProjectionSchemas
----
-value:
- _links:
- self:
- href: "/api/v3/projects/45/queries/projection_schemas"
- total: 1
- count: 1
- _type: Collection
- _embedded:
- elements:
- _links:
- self:
- href: "/api/v3/queries/projection_schemas/table"
- _type: Schema
- columns:
- _links: {}
- hasDefault: true
- location: _links
- name: Columns
- required: false
- type: "[]QueryColumn"
- writable: true
diff --git a/docs/api/apiv3/components/examples/query_projection_schemas.yml b/docs/api/apiv3/components/examples/query_projection_schemas.yml
deleted file mode 100644
index c88617ae584..00000000000
--- a/docs/api/apiv3/components/examples/query_projection_schemas.yml
+++ /dev/null
@@ -1,23 +0,0 @@
-# Example: QueryProjectionSchemas
----
-value:
- _links:
- self:
- href: "/api/v3/queries/projection_schemas"
- total: 1
- count: 1
- _type: Collection
- _embedded:
- elements:
- _links:
- self:
- href: "/api/v3/queries/projection_schemas/table"
- _type: Schema
- columns:
- _links: {}
- hasDefault: true
- location: _links
- name: Columns
- required: false
- type: "[]QueryColumn"
- writable: true
diff --git a/docs/api/apiv3/components/examples/view_team_planner.yml b/docs/api/apiv3/components/examples/view_team_planner.yml
new file mode 100644
index 00000000000..c4a67105b23
--- /dev/null
+++ b/docs/api/apiv3/components/examples/view_team_planner.yml
@@ -0,0 +1,15 @@
+# Example: ViewWorkPackagesTable
+---
+value:
+ _type: Views::TeamPlanner
+ name: Product team
+ id: 9
+ _links:
+ self:
+ href: "/api/v3/views/9"
+ query:
+ href: "/api/v3/queries/18"
+ title: Product team
+ project:
+ href: "/api/v3/project/89"
+ title: The project
diff --git a/docs/api/apiv3/components/examples/view_work_packages_table.yml b/docs/api/apiv3/components/examples/view_work_packages_table.yml
index e2eac5d71f5..d92b7358f12 100644
--- a/docs/api/apiv3/components/examples/view_work_packages_table.yml
+++ b/docs/api/apiv3/components/examples/view_work_packages_table.yml
@@ -3,29 +3,13 @@
value:
_type: Views::WorkPackagesTable
name: Current work packages
- timelineVisible: true
id: 9
_links:
self:
href: "/api/v3/views/9"
query:
href: "/api/v3/queries/18"
- title: A query
- columns:
- - href: "/api/v3/users/id"
- title: ID
- - href: "/api/v3/users/subject"
- title: Subject
- - href: "/api/v3/users/type"
- title: Type
- - href: "/api/v3/users/status"
- title: Status
- - href: "/api/v3/users/priority"
- title: Priority
- - href: "/api/v3/users/assignee"
- title: Assignee
- - href: "/api/v3/users/updated_at"
- title: Updated on
+ title: Current work packages
project:
href: "/api/v3/project/89"
title: The project
diff --git a/docs/api/apiv3/components/examples/view_work_packages_table_schema.yml b/docs/api/apiv3/components/examples/view_work_packages_table_schema.yml
deleted file mode 100644
index 00b1326b340..00000000000
--- a/docs/api/apiv3/components/examples/view_work_packages_table_schema.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-# Example: Views::WorkPackagesTableSchema
----
-value:
- _type: Schema
- columns:
- _links: {}
- hasDefault: true
- location: _links
- name: Columns
- required: false
- type: "[]QueryColumn"
- writable: true
- _links:
- self:
- href: "/api/v3/views/schemas/table"
diff --git a/docs/api/apiv3/components/schemas/query_projection_schemas.yml b/docs/api/apiv3/components/schemas/query_projection_schemas.yml
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/docs/api/apiv3/openapi-spec.yml b/docs/api/apiv3/openapi-spec.yml
index 4707ea1b833..52b50506c2a 100644
--- a/docs/api/apiv3/openapi-spec.yml
+++ b/docs/api/apiv3/openapi-spec.yml
@@ -353,14 +353,10 @@ paths:
"$ref": "./paths/version_projects.yml"
"/api/v3/views":
"$ref": "./paths/views.yml"
- "/api/v3/views/{identifier}":
- "$ref": "./paths/views_{identifier}.yml"
- "/api/v3/views/schemas":
- "$ref": "./paths/views_schemas.yml"
- "/api/v3/views/schemas/{identifier}":
- "$ref": "./paths/views_schemas_{identifier}.yml"
"/api/v3/views/{id}":
"$ref": "./paths/view.yml"
+ "/api/v3/views/{identifier}":
+ "$ref": "./paths/views_{identifier}.yml"
"/api/v3/wiki_pages/{id}":
"$ref": "./paths/wiki_page.yml"
"/api/v3/wiki_pages/{id}/attachments":
@@ -397,24 +393,18 @@ paths:
"$ref": "./paths/work_package_watcher.yml"
components:
examples:
- ProjectQueryProjectionSchemas:
- "$ref": "./components/examples/project_query_projection_schemas.yml"
QueriesModel:
"$ref": "./components/examples/queries.yml"
QueryModel:
"$ref": "./components/examples/query.yml"
- QueryProjectionSchemas:
- "$ref": "./components/examples/query_projection_schemas.yml"
QuerySchemaModel:
"$ref": "./components/examples/query_schema.yml"
Views:
"$ref": "./components/examples/views.yml"
- ViewBCF:
- "$ref": "./components/examples/view_bcf.yml"
ViewWorkPackagesTable:
"$ref": "./components/examples/view_work_packages_table.yml"
- ViewWorkPackagesTableSchema:
- "$ref": "./components/examples/view_work_packages_table_schema.yml"
+ ViewTeamPlanner:
+ "$ref": "./components/examples/view_team_planner.yml"
schemas:
ActivityModel:
"$ref": "./components/schemas/activity_model.yml"
@@ -612,8 +602,6 @@ components:
"$ref": "./components/schemas/query_filter_instance_schemas_model.yml"
Query_Filter_Instance_Schemas_For_ProjectModel:
"$ref": "./components/schemas/query_filter_instance_schemas_for_project_model.yml"
- QueryProjectionSchemas:
- "$ref": "./components/schemas/query_projection_schemas.yml"
Query_OperatorModel:
"$ref": "./components/schemas/query_operator_model.yml"
Query_Sort_ByModel:
@@ -786,7 +774,6 @@ tags:
- "$ref": "./tags/query_operators.yml"
- "$ref": "./tags/query_sort_bys.yml"
- "$ref": "./tags/query_filter_instance_schema.yml"
-- "$ref": "./tags/query_projection_schema.yml"
- "$ref": "./tags/relations.yml"
- "$ref": "./tags/previewing.yml"
- "$ref": "./tags/revisions.yml"
diff --git a/docs/api/apiv3/paths/project_queries_projection_schemas.yml b/docs/api/apiv3/paths/project_queries_projection_schemas.yml
deleted file mode 100644
index 02afeaba93e..00000000000
--- a/docs/api/apiv3/paths/project_queries_projection_schemas.yml
+++ /dev/null
@@ -1,33 +0,0 @@
-# /api/v3/projects/{id}/queries/projection_schemas
----
-get:
- responses:
- '200':
- content:
- application/hal+json:
- examples:
- QueryProjectionSchemas:
- "$ref": "../components/examples/query_projection_schemas.yml"
- description: OK
- headers: {}
- '403':
- content:
- application/hal+json:
- examples:
- response:
- value:
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:Unauthenticated
- message: You are not authorized to access this resource.
- description: |-
- Returned if the client does not have sufficient permissions to see it.
-
- **Required permission:** view work package in any project
- headers: {}
- tags:
- - Query Projection Schema
- description: Returns the list of QueryProjection schemas defined for the project the
- query is in. Depending on the modules active in the project and the permissions the calling user
- has, this list might differn betweeen projects and users.
- operationId: List_Project_Query_Projection_Schemas
- summary: List Project Query Projection Schemas
diff --git a/docs/api/apiv3/paths/view.yml b/docs/api/apiv3/paths/view.yml
index a2de5f67e83..e645e20fcac 100644
--- a/docs/api/apiv3/paths/view.yml
+++ b/docs/api/apiv3/paths/view.yml
@@ -16,8 +16,8 @@ get:
examples:
ViewWorkPackagesTable:
"$ref": "../components/examples/view_work_packages_table.yml"
- ViewBcf:
- "$ref": "../components/examples/view_bcf.yml"
+ ViewTeamPlanner:
+ "$ref": "../components/examples/view_team_planner.yml"
'400':
content:
application/hal+json:
@@ -63,139 +63,4 @@ get:
- Views
description: ''
operationId: View_view
- summary: View view
-delete:
- parameters:
- - description: View id
- example: '1'
- in: path
- name: id
- required: true
- schema:
- type: integer
- responses:
- '204':
- description: Returned if the view was successfully deleted.
- headers: {}
- '403':
- content:
- application/hal+json:
- examples:
- response:
- value:
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission
- message: You are not authorized to access this resource.
- description: |-
- Returned if the client does not have sufficient permissions.
-
- **Required permission:** The permissions depend on the view.
- headers: {}
- '404':
- content:
- application/hal+json:
- examples:
- response:
- value:
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
- message: The requested resource could not be found.
- description: |-
- Returned if the view does not exist or the client does not have sufficient permissions
- to see it.
-
- **Required permission:** The permissions depend on the view.
-
- *Note: A client without sufficient permissions shall not be able to test for the existence of
- a version. That's why a 404 is returned here, even if a 403 might be more appropriate.*
- headers: {}
- tags:
- - Views
- description: Deletes the view.
- operationId: Delete_view
- summary: Delete view
-patch:
- parameters:
- - description: View id
- example: '1'
- in: path
- name: id
- required: true
- schema:
- type: integer
- responses:
- '200':
- content:
- application/hal+json:
- examples:
- ViewWorkPackagesTable:
- "$ref": "../components/examples/view_work_packages_table.yml"
- description: OK
- headers: {}
- '400':
- content:
- application/hal+json:
- examples:
- response:
- value:
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:InvalidRequestBody
- message: The request body was not a single JSON object.
- description: Occurs when the client did not send a valid JSON object in the
- request body.
- headers: {}
- '403':
- content:
- application/hal+json:
- examples:
- response:
- value:
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission
- message: You are not authorized to access this resource.
- description: |-
- Returned if the client does not have sufficient permissions.
-
- **Required permission:** The permissions depend on the view.
- headers: {}
- '404':
- content:
- application/hal+json:
- examples:
- response:
- value:
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
- message: The requested resource could not be found.
- description: |-
- Returned if the view does not exist or the client does not have sufficient permissions
- to see it.
-
- **Required permission:** The permissions depend on the view.
-
- *Note: A client without sufficient permissions shall not be able to test for the existence of
- a version. That's why a 404 is returned here, even if a 403 might be more appropriate.*
- headers: {}
- '422':
- content:
- application/hal+json:
- examples:
- response:
- value:
- _embedded:
- details:
- attribute: query
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:PropertyConstraintViolation
- message: The query does not exist.
- description: |-
- Returned if:
-
- * a constraint for a property was violated (`PropertyConstraintViolation`)
- headers: {}
- tags:
- - Views
- description: |-
- Updates the given View by applying the attributes provided in the body.
- operationId: Update_view
- summary: Update view
+ summary: View view
\ No newline at end of file
diff --git a/docs/api/apiv3/paths/views_schemas.yml b/docs/api/apiv3/paths/views_schemas.yml
deleted file mode 100644
index 90a5ce6f3d5..00000000000
--- a/docs/api/apiv3/paths/views_schemas.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-# /api/v3/views/schemas
----
-get:
- parameters:
- - description: |-
- JSON specifying filter conditions.
- Currently supported filters are:
-
- + project: filters schemas by the project a view is specifyable in which depends on the users's permissions
- and on the modules active within a project.
- If the project filter is passed with the `!*` (not any) operator, global view schemas are returned.
- example: '[{ "project_id": { "operator": "!*", "values": null }" }]'
- in: query
- name: filters
- required: false
- schema:
- type: string
- responses:
- '200':
- description: OK
- headers: {}
- tags:
- - Views
- description: |-
- List views schemas. The response will contain all views that can be created by the user given the permissions granted and the modules active within projects visible to the user.
- operationId: List_Views_Schemas
- summary: List views schemas
diff --git a/docs/api/apiv3/paths/views_schemas_{identifier}.yml b/docs/api/apiv3/paths/views_schemas_{identifier}.yml
deleted file mode 100644
index 7db31e90136..00000000000
--- a/docs/api/apiv3/paths/views_schemas_{identifier}.yml
+++ /dev/null
@@ -1,43 +0,0 @@
-# /api/v3/views/schemas/{identifier}
----
-get:
- parameters:
- - description: Identifier of the schema
- example: list
- in: path
- name: identifier
- required: true
- schema:
- type: string
- responses:
- '200':
- description: OK
- headers: {}
- content:
- application/hal+json:
- examples:
- ViewWorkPackagesTableSchema:
- "$ref": '../components/examples/view_work_packages_table_schema.yml'
- '404':
- content:
- application/hal+json:
- examples:
- response:
- value:
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
- message: The specified schema does not exist.
- description: |-
- Returned if the schema does not exist or the client does not have sufficient permissions
- to see it.
-
- **Required permission:** depending on the identifier.
-
- *Note: A client without sufficient permissions shall not be able to test for the existence of a project.
- That's why a 404 is returned here, even if a 403 might be more appropriate.*
- headers: {}
- tags:
- - Views
- description: ''
- operationId: View_View_Schema
- summary: View view schema
diff --git a/docs/api/apiv3/paths/views_{identifier}.yml b/docs/api/apiv3/paths/views_{identifier}.yml
index d59e20693fa..520f5e836d9 100644
--- a/docs/api/apiv3/paths/views_{identifier}.yml
+++ b/docs/api/apiv3/paths/views_{identifier}.yml
@@ -1,14 +1,41 @@
-# /api/v3/views
+# /api/v3/views/{identifier}
---
post:
+ requestBody:
+ content:
+ application/json:
+ examples:
+ 'Views::WorkPackagesTable':
+ value:
+ _links:
+ query:
+ href: /api/v3/queries/5
+ 'Views::TeamPlanner':
+ value:
+ _links:
+ query:
+ href: /api/v3/queries/5
+ schema:
+ type: object
+ properties:
+ _links:
+ type: object
+ properties:
+ query:
+ type: object
+ properties:
+ href:
+ type: href
responses:
'201':
content:
application/hal+json:
examples:
- Views:
+ 'Views::WorkPackagesTable':
"$ref": "../components/examples/view_work_packages_table.yml"
+ 'Views::TeamPlanner':
+ "$ref": "../components/examples/view_team_planner.yml"
description: Created
headers: {}
'400':
@@ -52,14 +79,10 @@ post:
The required fields of a View can be found in its schema, which is embedded in the respective form.
Note that it is only allowed to provide properties or links supporting the write operation.
- There are different subtypes of Views (e.g. `Views::WorkPackagesTable`) with each having its own
- endpoint for creating that subtype e.g.
- ```
- /api/v3/views/work_packages_table
- ```
- for `Views::WorkPackagesTable`.
+ There are different subtypes of `Views` (e.g. `Views::WorkPackagesTable`) with each having its own
+ endpoint for creating that subtype e.g. `/api/v3/views/work_packages_table` for `Views::WorkPackagesTable` and `/api/v3/views/team_planner` for `Views::TeamPlanner`
- To get the list of available subtypes and by that the endpoints for creating a subtype, use the
+ **Not yet implemented** To get the list of available subtypes and by that the endpoints for creating a subtype, use the
```
/api/v3/views/schemas
```
diff --git a/docs/api/apiv3/tags/query_projection_schema.yml b/docs/api/apiv3/tags/query_projection_schema.yml
deleted file mode 100644
index ef3059ee790..00000000000
--- a/docs/api/apiv3/tags/query_projection_schema.yml
+++ /dev/null
@@ -1,14 +0,0 @@
----
-description: |-
- A QueryProjection Schema describes the various types of QueryProjections available. There is no `QueryProject` type in itself
- but only subtypes of it e.g. `QueryProjection::Table` and `QueryProjection::Gantt`.
- Each subtype has properties of it's own so asside from the `_type` property, the other properties will be different from
- subtype to subtype.
-
- ## Linked Properties
-
- | Link | Description | Type | Constraints | Supported operations |
- | :-------------------: | ---------------------------------------- | ------------- | -------- | -------------------- |
- | self | This schema | QueryProjectionSchema | not null | READ |
-
-name: Query Projection Schema
diff --git a/docs/api/apiv3/tags/views.yml b/docs/api/apiv3/tags/views.yml
index 341bd30e653..ee81203a73b 100644
--- a/docs/api/apiv3/tags/views.yml
+++ b/docs/api/apiv3/tags/views.yml
@@ -6,28 +6,36 @@ description: |-
A View might then be a graph, a table, a gantt chart or something completely different.
The client will have to choose how to represenent in the view.
- A View instance will always be of a subtype of `View`, e.g. `View::List`. The properties between each `View` type might differ a lot.
+ A View instance will always be of a subtype of `Views`, e.g. `Views::WorkPackageslist`. The properties between each `Views` type might differ a lot.
**The View is a new concept so it is prone to change.**
+
+ Currently a lot of restrictions still apply:
+ * There will always be a query associated to the view when in the complete concept, this limitation should not be necessary.
+ * A query can only have one view associated.
+ * There is neither an update nor a delete endpoint and the schema and form endpoints are also missing.
+ To delete a view, simply delete the query.
+ * Most of the properties are deduced from the associated query and can thus only be updated via updating the query.
+ * The properties are not different between `Views` subtypes.
## Linked Properties
- | Link | Description | Type | Constraints | Supported operations |
- | :-------------------: | ---------------------------------------- | ------------- | -------- | -------------------- |
- | self | This view | View (a subtype of it) | not null | READ |
- | query | This query from which to fetch the data | Query | not null | READ/WRITE |
- | project | This project the view is defined in. If no project is specified, the View is considered global. Currently, the project will always be derived from the query. | Project | | READ |
+ | Link | Description | Type | Constraints | Supported operations |
+ | :-------------------: | ---------------------------------------- | ------------- | -------- | -------------------- |
+ | self | This view | View (a subtype of it) | not null | READ |
+ | query | This query from which to fetch the data | Query | not null | READ/WRITE |
+ | project | This project the view is defined in (deduces from the query). If no project is specified, the View is considered global. | Project | Deduced from the query | READ |
## Local Properties
- | Property | Description | Type | Constraints | Supported operations |
- | :--------------: | ------------------------------------------------------| ----------- | ------------------------------------ | -------------------- |
- | _type | The subtype chosen | String | Can only be one for which a schema exists | READ/WRITE (write only on creation) |
- | id | View id | Integer | x > 0 | READ |
- | name | View name | String | | READ/WRITE |
- | public | Can users besides the owner see the view? | Boolean | | READ/WRITE |
- | starred | Should the view be highlighted to the user? | Boolean | | READ |
- | createdAt | Time of creation | DateTime | not null | READ |
- | updatedAt | Time of the most recent change to the view | DateTime | not null | READ |
+ | Property | Description | Type | Constraints | Supported operations|
+ | :--------------: | ------------------------------------------------------| ----------- | ------------------------------------ | --------------------|
+ | _type | The subtype chosen | String | | READ |
+ | id | View id | Integer | x > 0 | READ |
+ | name | View name | String | Deduced from the query | READ |
+ | public | Can users besides the owner see the view? | Boolean | Deduced from the query | READ |
+ | starred | Should the view be highlighted to the user? | Boolean | Deduced from the query | READ |
+ | createdAt | Time of creation | DateTime | not null | READ |
+ | updatedAt | Time of the most recent change to the view | DateTime | not null | READ |
name: Views
diff --git a/modules/team_planner/spec/requests/api/v3/views/create_resource_spec.rb b/modules/team_planner/spec/requests/api/v3/views/create_resource_spec.rb
index ba2fe9fab32..fa7d41710a1 100644
--- a/modules/team_planner/spec/requests/api/v3/views/create_resource_spec.rb
+++ b/modules/team_planner/spec/requests/api/v3/views/create_resource_spec.rb
@@ -101,8 +101,8 @@ describe ::API::V3::Views::ViewsAPI,
let(:additional_setup) do
role.update_attribute(:permissions,
%w[view_work_packages
- save_queries
- manage_public_queries])
+ save_queries
+ manage_public_queries])
end
it_behaves_like 'unauthorized access'