Skip to content

Commit

Permalink
wip: show data connectors on project page
Browse files Browse the repository at this point in the history
  • Loading branch information
ciyer committed Oct 2, 2024
1 parent 46c4bf0 commit 2402c2e
Show file tree
Hide file tree
Showing 3 changed files with 154 additions and 49 deletions.
48 changes: 36 additions & 12 deletions client/src/features/projectsV2/api/projectV2.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ const injectedRtkApi = api.injectEndpoints({
getProjects: build.query<GetProjectsApiResponse, GetProjectsApiArg>({
query: (queryArg) => ({
url: `/projects`,
params: {
namespace: queryArg["namespace"],
page: queryArg.page,
per_page: queryArg.perPage,
},
params: { params: queryArg.params },
}),
}),
postProjects: build.mutation<PostProjectsApiResponse, PostProjectsApiArg>({
Expand Down Expand Up @@ -77,19 +73,23 @@ const injectedRtkApi = api.injectEndpoints({
method: "DELETE",
}),
}),
getProjectsByProjectIdDataConnectorLinks: build.query<
GetProjectsByProjectIdDataConnectorLinksApiResponse,
GetProjectsByProjectIdDataConnectorLinksApiArg
>({
query: (queryArg) => ({
url: `/projects/${queryArg.projectId}/data_connector_links`,
}),
}),
}),
overrideExisting: false,
});
export { injectedRtkApi as projectV2Api };
export type GetProjectsApiResponse =
/** status 200 List of projects */ ProjectsList;
export type GetProjectsApiArg = {
/** A namespace, used as a filter. */
namespace?: string;
/** Result's page number starting from 1 */
page?: number;
/** The number of results per page */
perPage?: number;
/** query parameters */
params?: ProjectGetQuery;
};
export type PostProjectsApiResponse =
/** status 201 The project was created */ Project;
Expand Down Expand Up @@ -138,6 +138,12 @@ export type DeleteProjectsByProjectIdMembersAndMemberIdApiArg = {
/** This is user's KeyCloak ID */
memberId: UserId;
};
export type GetProjectsByProjectIdDataConnectorLinksApiResponse =
/** status 200 List of data connector to project links */ DataConnectorToProjectLinksList;
export type GetProjectsByProjectIdDataConnectorLinksApiArg = {
/** the ID of the project */
projectId: Ulid;
};
export type Ulid = string;
export type ProjectName = string;
export type Slug = string;
Expand Down Expand Up @@ -171,6 +177,16 @@ export type ErrorResponse = {
message: string;
};
};
export type PaginationRequest = {
/** Result's page number starting from 1 */
page?: number;
/** The number of results per page */
per_page?: number;
};
export type ProjectGetQuery = PaginationRequest & {
/** A namespace, used as a filter. */
namespace?: string;
};
export type ProjectPost = {
name: ProjectName;
namespace: Slug;
Expand All @@ -188,7 +204,6 @@ export type ProjectPatch = {
description?: Description;
keywords?: KeywordsList;
};
export type UserEmail = string;
export type UserFirstLastName = string;
export type Role = "viewer" | "editor" | "owner";
export type ProjectMemberResponse = {
Expand All @@ -204,6 +219,14 @@ export type ProjectMemberPatchRequest = {
role: Role;
};
export type ProjectMemberListPatchRequest = ProjectMemberPatchRequest[];
export type DataConnectorToProjectLink = {
id: Ulid;
data_connector_id: Ulid;
project_id: Ulid;
creation_date: CreationDate;
created_by: UserId;
};
export type DataConnectorToProjectLinksList = DataConnectorToProjectLink[];
export const {
useGetProjectsQuery,
usePostProjectsMutation,
Expand All @@ -214,4 +237,5 @@ export const {
useGetProjectsByProjectIdMembersQuery,
usePatchProjectsByProjectIdMembersMutation,
useDeleteProjectsByProjectIdMembersAndMemberIdMutation,
useGetProjectsByProjectIdDataConnectorLinksQuery,
} = injectedRtkApi;
5 changes: 5 additions & 0 deletions client/src/features/projectsV2/api/projectV2.enhanced-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ const injectedApi = api.injectEndpoints({

const enhancedApi = injectedApi.enhanceEndpoints({
addTagTypes: [
"DataConnectors",
"Group",
"GroupMembers",
"Namespace",
Expand Down Expand Up @@ -237,6 +238,9 @@ const enhancedApi = injectedApi.enhanceEndpoints({
getProjectsByProjectId: {
providesTags: ["Project"],
},
getProjectsByProjectIdDataConnectorLinks: {
providesTags: ["DataConnectors"],
},
getProjectsByProjectIdMembers: {
providesTags: ["ProjectMembers"],
},
Expand Down Expand Up @@ -289,6 +293,7 @@ export const {
usePostProjectsMutation,
useGetProjectsByNamespaceAndSlugQuery,
useGetProjectsByProjectIdQuery,
useGetProjectsByProjectIdDataConnectorLinksQuery,
usePatchProjectsByProjectIdMutation,
useDeleteProjectsByProjectIdMutation,
useGetProjectsByProjectIdMembersQuery,
Expand Down
150 changes: 113 additions & 37 deletions client/src/features/projectsV2/api/projectV2.openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,12 @@
"parameters": [
{
"in": "query",
"description": "A namespace, used as a filter.",
"name": "namespace",
"required": false,
"description": "query parameters",
"name": "params",
"style": "form",
"explode": true,
"schema": {
"type": "string"
}
},
{
"in": "query",
"description": "Result's page number starting from 1",
"name": "page",
"required": false,
"schema": {
"type": "integer",
"minimum": 1,
"default": 1
}
},
{
"in": "query",
"description": "The number of results per page",
"name": "per_page",
"required": false,
"schema": {
"type": "integer",
"minimum": 1,
"maximum": 100,
"default": 20
"$ref": "#/components/schemas/ProjectGetQuery"
}
}
],
Expand Down Expand Up @@ -417,6 +395,38 @@
},
"tags": ["projects"]
}
},
"/projects/{project_id}/data_connector_links": {
"parameters": [
{
"in": "path",
"name": "project_id",
"required": true,
"schema": {
"$ref": "#/components/schemas/Ulid"
},
"description": "the ID of the project"
}
],
"get": {
"summary": "Get all links from data connectors to a given project",
"responses": {
"200": {
"description": "List of data connector to project links",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DataConnectorToProjectLinksList"
}
}
}
},
"default": {
"$ref": "#/components/responses/Error"
}
},
"tags": ["projects"]
}
}
},
"components": {
Expand Down Expand Up @@ -556,7 +566,7 @@
"type": "string",
"minLength": 26,
"maxLength": 26,
"pattern": "^[A-Z0-9]{26}$"
"pattern": "^[0-7][0-9A-HJKMNP-TV-Z]{25}$"
},
"ProjectName": {
"description": "Renku project name",
Expand Down Expand Up @@ -667,15 +677,15 @@
"minItems": 0
},
"ProjectMemberResponse": {
"description": "A member with full info (email, name, ...) and the access level to the project",
"description": "A member with full info (namespace, name, ...) and the access level to the project",
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"$ref": "#/components/schemas/UserId"
},
"email": {
"$ref": "#/components/schemas/UserEmail"
"namespace": {
"$ref": "#/components/schemas/Slug"
},
"first_name": {
"$ref": "#/components/schemas/UserFirstLastName"
Expand Down Expand Up @@ -707,17 +717,83 @@
"minLength": 1,
"maxLength": 256
},
"UserEmail": {
"type": "string",
"format": "email",
"description": "User email",
"example": "some-user@gmail.com"
},
"ETag": {
"type": "string",
"description": "Entity Tag",
"example": "9EE498F9D565D0C41E511377425F32F3"
},
"DataConnectorToProjectLinksList": {
"description": "A list of links from a data connector to a project",
"type": "array",
"items": {
"$ref": "#/components/schemas/DataConnectorToProjectLink"
}
},
"DataConnectorToProjectLink": {
"description": "A link from a data connector to a project in Renku 2.0",
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"$ref": "#/components/schemas/Ulid"
},
"data_connector_id": {
"$ref": "#/components/schemas/Ulid"
},
"project_id": {
"$ref": "#/components/schemas/Ulid"
},
"creation_date": {
"$ref": "#/components/schemas/CreationDate"
},
"created_by": {
"$ref": "#/components/schemas/UserId"
}
},
"required": [
"id",
"data_connector_id",
"project_id",
"creation_date",
"created_by"
]
},
"ProjectGetQuery": {
"description": "Query params for project get request",
"allOf": [
{
"$ref": "#/components/schemas/PaginationRequest"
},
{
"properties": {
"namespace": {
"description": "A namespace, used as a filter.",
"type": "string",
"default": ""
}
}
}
]
},
"PaginationRequest": {
"type": "object",
"additionalProperties": false,
"properties": {
"page": {
"description": "Result's page number starting from 1",
"type": "integer",
"minimum": 1,
"default": 1
},
"per_page": {
"description": "The number of results per page",
"type": "integer",
"minimum": 1,
"maximum": 100,
"default": 20
}
}
},
"ErrorResponse": {
"type": "object",
"properties": {
Expand Down

0 comments on commit 2402c2e

Please sign in to comment.