diff --git a/cms/config/sync/admin-role.strapi-super-admin.json b/cms/config/sync/admin-role.strapi-super-admin.json index 3042e86a..ebabe185 100644 --- a/cms/config/sync/admin-role.strapi-super-admin.json +++ b/cms/config/sync/admin-role.strapi-super-admin.json @@ -95,6 +95,53 @@ }, "conditions": [] }, + { + "action": "plugin::content-manager.explorer.create", + "actionParameters": {}, + "subject": "api::data-tool-ecosystem.data-tool-ecosystem", + "properties": { + "fields": [ + "name" + ] + }, + "conditions": [] + }, + { + "action": "plugin::content-manager.explorer.delete", + "actionParameters": {}, + "subject": "api::data-tool-ecosystem.data-tool-ecosystem", + "properties": {}, + "conditions": [] + }, + { + "action": "plugin::content-manager.explorer.publish", + "actionParameters": {}, + "subject": "api::data-tool-ecosystem.data-tool-ecosystem", + "properties": {}, + "conditions": [] + }, + { + "action": "plugin::content-manager.explorer.read", + "actionParameters": {}, + "subject": "api::data-tool-ecosystem.data-tool-ecosystem", + "properties": { + "fields": [ + "name" + ] + }, + "conditions": [] + }, + { + "action": "plugin::content-manager.explorer.update", + "actionParameters": {}, + "subject": "api::data-tool-ecosystem.data-tool-ecosystem", + "properties": { + "fields": [ + "name" + ] + }, + "conditions": [] + }, { "action": "plugin::content-manager.explorer.create", "actionParameters": {}, @@ -206,7 +253,8 @@ "site", "languages", "data_tool_resource_type", - "technical_skills" + "geography", + "data_tool_ecosystems" ] }, "conditions": [] @@ -236,7 +284,8 @@ "site", "languages", "data_tool_resource_type", - "technical_skills" + "geography", + "data_tool_ecosystems" ] }, "conditions": [] @@ -252,7 +301,8 @@ "site", "languages", "data_tool_resource_type", - "technical_skills" + "geography", + "data_tool_ecosystems" ] }, "conditions": [] diff --git a/cms/config/sync/core-store.plugin_content_manager_configuration_content_types##api##data-tool-ecosystem.data-tool-ecosystem.json b/cms/config/sync/core-store.plugin_content_manager_configuration_content_types##api##data-tool-ecosystem.data-tool-ecosystem.json new file mode 100644 index 00000000..e76bca51 --- /dev/null +++ b/cms/config/sync/core-store.plugin_content_manager_configuration_content_types##api##data-tool-ecosystem.data-tool-ecosystem.json @@ -0,0 +1,116 @@ +{ + "key": "plugin_content_manager_configuration_content_types::api::data-tool-ecosystem.data-tool-ecosystem", + "value": { + "uid": "api::data-tool-ecosystem.data-tool-ecosystem", + "settings": { + "bulkable": true, + "filterable": true, + "searchable": true, + "pageSize": 10, + "mainField": "name", + "defaultSortBy": "name", + "defaultSortOrder": "ASC" + }, + "metadatas": { + "id": { + "edit": {}, + "list": { + "label": "id", + "searchable": true, + "sortable": true + } + }, + "name": { + "edit": { + "label": "name", + "description": "", + "placeholder": "", + "visible": true, + "editable": true + }, + "list": { + "label": "name", + "searchable": true, + "sortable": true + } + }, + "createdAt": { + "edit": { + "label": "createdAt", + "description": "", + "placeholder": "", + "visible": false, + "editable": true + }, + "list": { + "label": "createdAt", + "searchable": true, + "sortable": true + } + }, + "updatedAt": { + "edit": { + "label": "updatedAt", + "description": "", + "placeholder": "", + "visible": false, + "editable": true + }, + "list": { + "label": "updatedAt", + "searchable": true, + "sortable": true + } + }, + "createdBy": { + "edit": { + "label": "createdBy", + "description": "", + "placeholder": "", + "visible": false, + "editable": true, + "mainField": "firstname" + }, + "list": { + "label": "createdBy", + "searchable": true, + "sortable": true + } + }, + "updatedBy": { + "edit": { + "label": "updatedBy", + "description": "", + "placeholder": "", + "visible": false, + "editable": true, + "mainField": "firstname" + }, + "list": { + "label": "updatedBy", + "searchable": true, + "sortable": true + } + } + }, + "layouts": { + "list": [ + "id", + "name", + "createdAt", + "updatedAt" + ], + "edit": [ + [ + { + "name": "name", + "size": 6 + } + ] + ] + } + }, + "type": "object", + "environment": null, + "tag": null +} \ No newline at end of file diff --git a/cms/config/sync/core-store.plugin_content_manager_configuration_content_types##api##data-tool.data-tool.json b/cms/config/sync/core-store.plugin_content_manager_configuration_content_types##api##data-tool.data-tool.json index 57b1ccce..b566fe6a 100644 --- a/cms/config/sync/core-store.plugin_content_manager_configuration_content_types##api##data-tool.data-tool.json +++ b/cms/config/sync/core-store.plugin_content_manager_configuration_content_types##api##data-tool.data-tool.json @@ -92,20 +92,35 @@ "sortable": true } }, - "technical_skills": { + "geography": { "edit": { - "label": "technical_skills", + "label": "geography", "description": "", "placeholder": "", "visible": true, "editable": true }, "list": { - "label": "technical_skills", + "label": "geography", "searchable": true, "sortable": true } }, + "data_tool_ecosystems": { + "edit": { + "label": "data_tool_ecosystems", + "description": "", + "placeholder": "", + "visible": true, + "editable": true, + "mainField": "name" + }, + "list": { + "label": "data_tool_ecosystems", + "searchable": false, + "sortable": false + } + }, "createdAt": { "edit": { "label": "createdAt", @@ -199,7 +214,13 @@ "size": 6 }, { - "name": "technical_skills", + "name": "geography", + "size": 6 + } + ], + [ + { + "name": "data_tool_ecosystems", "size": 6 } ] diff --git a/cms/config/sync/user-role.public.json b/cms/config/sync/user-role.public.json index 066442e3..86043057 100644 --- a/cms/config/sync/user-role.public.json +++ b/cms/config/sync/user-role.public.json @@ -15,6 +15,30 @@ { "action": "api::data-source.data-source.findOne" }, + { + "action": "api::data-tool-ecosystem.data-tool-ecosystem.find" + }, + { + "action": "api::data-tool-ecosystem.data-tool-ecosystem.findOne" + }, + { + "action": "api::data-tool-language.data-tool-language.find" + }, + { + "action": "api::data-tool-language.data-tool-language.findOne" + }, + { + "action": "api::data-tool-resource-type.data-tool-resource-type.find" + }, + { + "action": "api::data-tool-resource-type.data-tool-resource-type.findOne" + }, + { + "action": "api::data-tool.data-tool.find" + }, + { + "action": "api::data-tool.data-tool.findOne" + }, { "action": "api::fishing-protection-level-stat.fishing-protection-level-stat.find" }, @@ -121,4 +145,4 @@ "action": "plugin::users-permissions.auth.sendEmailConfirmation" } ] -} \ No newline at end of file +} diff --git a/cms/src/api/data-tool-ecosystem/content-types/data-tool-ecosystem/schema.json b/cms/src/api/data-tool-ecosystem/content-types/data-tool-ecosystem/schema.json new file mode 100644 index 00000000..4d4e495f --- /dev/null +++ b/cms/src/api/data-tool-ecosystem/content-types/data-tool-ecosystem/schema.json @@ -0,0 +1,19 @@ +{ + "kind": "collectionType", + "collectionName": "data_tool_ecosystems", + "info": { + "singularName": "data-tool-ecosystem", + "pluralName": "data-tool-ecosystems", + "displayName": "Data Tool Ecosystem", + "description": "" + }, + "options": { + "draftAndPublish": true + }, + "pluginOptions": {}, + "attributes": { + "name": { + "type": "string" + } + } +} diff --git a/cms/src/api/data-tool-ecosystem/controllers/data-tool-ecosystem.ts b/cms/src/api/data-tool-ecosystem/controllers/data-tool-ecosystem.ts new file mode 100644 index 00000000..3d278e82 --- /dev/null +++ b/cms/src/api/data-tool-ecosystem/controllers/data-tool-ecosystem.ts @@ -0,0 +1,7 @@ +/** + * data-tool-ecosystem controller + */ + +import { factories } from '@strapi/strapi' + +export default factories.createCoreController('api::data-tool-ecosystem.data-tool-ecosystem'); diff --git a/cms/src/api/data-tool-ecosystem/documentation/1.0.0/data-tool-ecosystem.json b/cms/src/api/data-tool-ecosystem/documentation/1.0.0/data-tool-ecosystem.json new file mode 100644 index 00000000..3c025b42 --- /dev/null +++ b/cms/src/api/data-tool-ecosystem/documentation/1.0.0/data-tool-ecosystem.json @@ -0,0 +1,507 @@ +{ + "/data-tool-ecosystems": { + "get": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DataToolEcosystemListResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Data-tool-ecosystem" + ], + "parameters": [ + { + "name": "sort", + "in": "query", + "description": "Sort by attributes ascending (asc) or descending (desc)", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "pagination[withCount]", + "in": "query", + "description": "Return page/pageSize (default: true)", + "deprecated": false, + "required": false, + "schema": { + "type": "boolean" + } + }, + { + "name": "pagination[page]", + "in": "query", + "description": "Page number (default: 0)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "pagination[pageSize]", + "in": "query", + "description": "Page size (default: 25)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "pagination[start]", + "in": "query", + "description": "Offset value (default: 0)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "pagination[limit]", + "in": "query", + "description": "Number of entities to return (default: 25)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "fields", + "in": "query", + "description": "Fields to return (ex: title,author)", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "populate", + "in": "query", + "description": "Relations to return", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "filters", + "in": "query", + "description": "Filters to apply", + "deprecated": false, + "required": false, + "schema": { + "type": "object" + }, + "style": "deepObject" + }, + { + "name": "locale", + "in": "query", + "description": "Locale to apply", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + } + ], + "operationId": "get/data-tool-ecosystems" + }, + "post": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DataToolEcosystemResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Data-tool-ecosystem" + ], + "parameters": [], + "operationId": "post/data-tool-ecosystems", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DataToolEcosystemRequest" + } + } + } + } + } + }, + "/data-tool-ecosystems/{id}": { + "get": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DataToolEcosystemResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Data-tool-ecosystem" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "deprecated": false, + "required": true, + "schema": { + "type": "number" + } + } + ], + "operationId": "get/data-tool-ecosystems/{id}" + }, + "put": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DataToolEcosystemResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Data-tool-ecosystem" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "deprecated": false, + "required": true, + "schema": { + "type": "number" + } + } + ], + "operationId": "put/data-tool-ecosystems/{id}", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DataToolEcosystemRequest" + } + } + } + } + }, + "delete": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Data-tool-ecosystem" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "deprecated": false, + "required": true, + "schema": { + "type": "number" + } + } + ], + "operationId": "delete/data-tool-ecosystems/{id}" + } + } +} diff --git a/cms/src/api/data-tool-ecosystem/routes/data-tool-ecosystem.ts b/cms/src/api/data-tool-ecosystem/routes/data-tool-ecosystem.ts new file mode 100644 index 00000000..36883ef6 --- /dev/null +++ b/cms/src/api/data-tool-ecosystem/routes/data-tool-ecosystem.ts @@ -0,0 +1,7 @@ +/** + * data-tool-ecosystem router + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreRouter('api::data-tool-ecosystem.data-tool-ecosystem'); diff --git a/cms/src/api/data-tool-ecosystem/services/data-tool-ecosystem.ts b/cms/src/api/data-tool-ecosystem/services/data-tool-ecosystem.ts new file mode 100644 index 00000000..d5719cd0 --- /dev/null +++ b/cms/src/api/data-tool-ecosystem/services/data-tool-ecosystem.ts @@ -0,0 +1,7 @@ +/** + * data-tool-ecosystem service + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreService('api::data-tool-ecosystem.data-tool-ecosystem'); diff --git a/cms/src/api/data-tool/content-types/data-tool/schema.json b/cms/src/api/data-tool/content-types/data-tool/schema.json index 62b3e456..f8cb927d 100644 --- a/cms/src/api/data-tool/content-types/data-tool/schema.json +++ b/cms/src/api/data-tool/content-types/data-tool/schema.json @@ -33,8 +33,13 @@ "relation": "oneToOne", "target": "api::data-tool-resource-type.data-tool-resource-type" }, - "technical_skills": { + "geography": { "type": "text" + }, + "data_tool_ecosystems": { + "type": "relation", + "relation": "oneToMany", + "target": "api::data-tool-ecosystem.data-tool-ecosystem" } } } diff --git a/cms/types/generated/contentTypes.d.ts b/cms/types/generated/contentTypes.d.ts index 9087eafa..025b067e 100644 --- a/cms/types/generated/contentTypes.d.ts +++ b/cms/types/generated/contentTypes.d.ts @@ -770,7 +770,12 @@ export interface ApiDataToolDataTool extends Schema.CollectionType { 'oneToOne', 'api::data-tool-resource-type.data-tool-resource-type' >; - technical_skills: Attribute.Text; + geography: Attribute.Text; + data_tool_ecosystems: Attribute.Relation< + 'api::data-tool.data-tool', + 'oneToMany', + 'api::data-tool-ecosystem.data-tool-ecosystem' + >; createdAt: Attribute.DateTime; updatedAt: Attribute.DateTime; publishedAt: Attribute.DateTime; @@ -789,6 +794,38 @@ export interface ApiDataToolDataTool extends Schema.CollectionType { }; } +export interface ApiDataToolEcosystemDataToolEcosystem + extends Schema.CollectionType { + collectionName: 'data_tool_ecosystems'; + info: { + singularName: 'data-tool-ecosystem'; + pluralName: 'data-tool-ecosystems'; + displayName: 'Data Tool Ecosystem'; + description: ''; + }; + options: { + draftAndPublish: true; + }; + attributes: { + name: Attribute.String; + createdAt: Attribute.DateTime; + updatedAt: Attribute.DateTime; + publishedAt: Attribute.DateTime; + createdBy: Attribute.Relation< + 'api::data-tool-ecosystem.data-tool-ecosystem', + 'oneToOne', + 'admin::user' + > & + Attribute.Private; + updatedBy: Attribute.Relation< + 'api::data-tool-ecosystem.data-tool-ecosystem', + 'oneToOne', + 'admin::user' + > & + Attribute.Private; + }; +} + export interface ApiDataToolLanguageDataToolLanguage extends Schema.CollectionType { collectionName: 'data_tool_languages'; @@ -1487,6 +1524,7 @@ declare module '@strapi/types' { 'api::data-info.data-info': ApiDataInfoDataInfo; 'api::data-source.data-source': ApiDataSourceDataSource; 'api::data-tool.data-tool': ApiDataToolDataTool; + 'api::data-tool-ecosystem.data-tool-ecosystem': ApiDataToolEcosystemDataToolEcosystem; 'api::data-tool-language.data-tool-language': ApiDataToolLanguageDataToolLanguage; 'api::data-tool-resource-type.data-tool-resource-type': ApiDataToolResourceTypeDataToolResourceType; 'api::fishing-protection-level.fishing-protection-level': ApiFishingProtectionLevelFishingProtectionLevel; diff --git a/frontend/orval.config.ts b/frontend/orval.config.ts index 44ecc634..57049f8e 100644 --- a/frontend/orval.config.ts +++ b/frontend/orval.config.ts @@ -51,6 +51,7 @@ module.exports = { 'Data-tool', 'Data-tool-language', 'Data-tool-resource-type', + 'Data-tool-ecosystem', ], }, }, diff --git a/frontend/src/containers/knowledge-hub/card-filters/ecosystems/index.tsx b/frontend/src/containers/knowledge-hub/card-filters/ecosystems/index.tsx new file mode 100644 index 00000000..2d546d5d --- /dev/null +++ b/frontend/src/containers/knowledge-hub/card-filters/ecosystems/index.tsx @@ -0,0 +1,49 @@ +import { useCallback } from 'react'; + +import { useAtom } from 'jotai'; + +import Icon from '@/components/ui/icon'; +import { cardFiltersAtom } from '@/store/knowledge-hub'; +import CheckIcon from '@/styles/icons/check.svg?sprite'; +import { useGetDataToolEcosystems } from '@/types/generated/data-tool-ecosystem'; +import { DataToolEcosystem } from 'types/generated/strapi.schemas'; + +const CardFiltersEcosystems = (): JSX.Element => { + const [filters, setFilters] = useAtom(cardFiltersAtom); + + const ecosystemsQuery = useGetDataToolEcosystems( + {}, + { + query: { + select: ({ data }) => data.map(({ attributes }) => attributes.name), + }, + } + ); + + const onSelectLanguage = useCallback( + (ecosystem: DataToolEcosystem['name']) => { + setFilters((prevFilters) => ({ + ...prevFilters, + ecosystem: prevFilters.ecosystem === ecosystem ? null : ecosystem, + })); + }, + [setFilters] + ); + + return ( + + ); +}; + +export default CardFiltersEcosystems; diff --git a/frontend/src/containers/knowledge-hub/card-filters/index.tsx b/frontend/src/containers/knowledge-hub/card-filters/index.tsx index a90741de..46dc3285 100644 --- a/frontend/src/containers/knowledge-hub/card-filters/index.tsx +++ b/frontend/src/containers/knowledge-hub/card-filters/index.tsx @@ -10,6 +10,7 @@ import FilterIcon from '@/styles/icons/filter.svg?sprite'; import ArrowDown from '@/styles/icons/triangle-down.svg?sprite'; import ArrowUp from '@/styles/icons/triangle-up.svg?sprite'; +import CardFiltersEcosystems from './ecosystems'; import CardFiltersLanguages from './languages'; import CardFiltersResourceTypes from './resource-types'; @@ -32,7 +33,7 @@ const CardFilters = (): JSX.Element => { type="button" className="flex items-center space-x-1 font-mono text-xs uppercase underline" > - Change resource type + Change resource category @@ -67,6 +68,17 @@ const CardFilters = (): JSX.Element => { + + + + + + + +