Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implements workspace candidates picker #899

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions public/locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"<0>Use <2>crontab.guru</2> to help you create a cron expression.</0>": "<0>Use <2>crontab.guru</2> to help you create a cron expression.</0>",
"A new code has been sent to your mailbox.": "A new code has been sent to your mailbox.",
"A pipeline with the selected notebook already exist": "A pipeline with the selected notebook already exist",
"A valid email address is mandatory": "A valid email address is mandatory",
"About connections": "About connections",
"About datasets": "About datasets",
"About pipelines": "About pipelines",
Expand Down Expand Up @@ -317,6 +318,7 @@
"Scheduled run of {{label}}": "Scheduled run of {{label}}",
"Scheduling": "Scheduling",
"Search...": "Search...",
"Search for a user...": "Search for a user...",
"Secret": "Secret",
"Secret access key": "Secret access key",
"Security": "Security",
Expand All @@ -338,6 +340,7 @@
"Select the columns to display in the grid": "Select the columns to display in the grid",
"Select...": "Select...",
"Send a new code": "Send a new code",
"Send invite to... ": "Send invite to... ",
"Separate values with a new line": "Separate values with a new line",
"Service Account Key": "Service Account Key",
"Set a new password": "Set a new password",
Expand Down
3 changes: 3 additions & 0 deletions public/locales/fr/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"<0>Use <2>crontab.guru</2> to help you create a cron expression.</0>": "<0>Utilisez <2>crontab.guru</2> pour vous aider à créer une expression cron.</0>",
"A new code has been sent to your mailbox.": "Un nouveau code a été envoyé à votre adresse e-mail.",
"A pipeline with the selected notebook already exist": "Un pipeline avec le carnet sélectionné existe déjà",
"A valid email address is mandatory": "Une adresse email valide est requise",
"About connections": "A propos des connexions",
"About datasets": "À propos des ensembles de données",
"About pipelines": "À propos des pipelines",
Expand Down Expand Up @@ -319,6 +320,7 @@
"Scheduled run of {{label}}": "Exécution programmée de {{label}}",
"Scheduling": "Programmation",
"Search...": "Recherche...",
"Search for a user...": "Rechercher un utilisateur...",
"Secret": "Secret",
"Secret access key": "Clé d'accès secrète",
"Security": "Sécurité",
Expand All @@ -340,6 +342,7 @@
"Select the columns to display in the grid": "Sélectionner les colonnes à afficher dans la grille",
"Select...": "Sélectionner...",
"Send a new code": "Envoyer un nouveau code",
"Send invite to... ": "Envoyer une invitation à... ",
"Separate values with a new line": "Séparer les valeurs par une nouvelle ligne",
"Service Account Key": "Clé de compte de service",
"Set a new password": "Définir un nouveau mot de passe",
Expand Down
35 changes: 35 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1644,6 +1644,28 @@ type GenericOutput {
uri: String!
}

"""Represents an input to add a user into a workspace."""
input InsertWorkspaceMemberInput {
userEmail: String!
role: WorkspaceMembershipRole!
workspaceSlug: String!
}

"""The type of the potential error on workspace membership insertion."""
enum InsertWorkspaceMemberError {
WORKSPACE_NOT_FOUND
PERMISSION_DENIED
ALREADY_EXISTS
SERVER_ERROR
}

"""The type of the result of a workspace membership insertion."""
type InsertWorkspaceMemberResult {
success: Boolean!
errors: [InsertWorkspaceMemberError!]!
workspaceMembership: WorkspaceMembership
}

"""Represents the input for inviting a member to a workspace."""
input InviteWorkspaceMemberInput {
workspaceSlug: String!
Expand Down Expand Up @@ -2085,6 +2107,9 @@ type Mutation {

"""Pin or unpin a dataset for a workspace."""
pinDataset(input: PinDatasetInput!): PinDatasetResult!

"""Insert user as member of a workspace."""
insertWorkspaceMember(input: InsertWorkspaceMemberInput!): InsertWorkspaceMemberResult!
}

type NotebookServer {
Expand Down Expand Up @@ -2566,6 +2591,9 @@ type Query {

"""Search datasets."""
datasets(query: String, page: Int = 1, perPage: Int = 15): DatasetPage!

"""Search workspace candidates."""
workspaceCandidates(query: String, workspace: String): WorkspaceCandidatesResult!
}

"""
Expand Down Expand Up @@ -3402,6 +3430,13 @@ type Workspace {
datasets(pinned: Boolean, query: String, page: Int = 1, perPage: Int = 15): DatasetLinkPage!
}

"""
The result of a workspaceCandidates query
"""
type WorkspaceCandidatesResult {
items: [User!]!
}

"""Represents an invitation to join a workspace."""
type WorkspaceInvitation {
id: UUID!
Expand Down
7 changes: 0 additions & 7 deletions src/core/features/UserPicker/UserPicker.tsx

This file was deleted.

1 change: 0 additions & 1 deletion src/core/features/UserPicker/index.ts

This file was deleted.

44 changes: 44 additions & 0 deletions src/graphql/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1736,6 +1736,29 @@ export type GenericOutput = {
uri: Scalars['String']['output'];
};

/** The type of the potential error on workspace membership insertion. */
export enum InsertWorkspaceMemberError {
AlreadyExists = 'ALREADY_EXISTS',
PermissionDenied = 'PERMISSION_DENIED',
ServerError = 'SERVER_ERROR',
WorkspaceNotFound = 'WORKSPACE_NOT_FOUND'
}

/** Represents an input to add a user into a workspace. */
export type InsertWorkspaceMemberInput = {
role: WorkspaceMembershipRole;
userEmail: Scalars['String']['input'];
workspaceSlug: Scalars['String']['input'];
};

/** The type of the result of a workspace membership insertion. */
export type InsertWorkspaceMemberResult = {
__typename?: 'InsertWorkspaceMemberResult';
errors: Array<InsertWorkspaceMemberError>;
success: Scalars['Boolean']['output'];
workspaceMembership?: Maybe<WorkspaceMembership>;
};

/** Represents the input for inviting a member to a workspace. */
export type InviteWorkspaceMemberInput = {
role: WorkspaceMembershipRole;
Expand Down Expand Up @@ -2051,6 +2074,8 @@ export type Mutation = {
generateNewDatabasePassword: GenerateNewDatabasePasswordResult;
generatePipelineWebhookUrl: GeneratePipelineWebhookUrlResult;
generateWorkspaceToken: GenerateWorkspaceTokenResult;
/** Insert user as member of a workspace. */
insertWorkspaceMember: InsertWorkspaceMemberResult;
inviteWorkspaceMember: InviteWorkspaceMemberResult;
joinWorkspace: JoinWorkspaceResult;
launchAccessmodAnalysis: LaunchAccessmodAnalysisResult;
Expand Down Expand Up @@ -2349,6 +2374,11 @@ export type MutationGenerateWorkspaceTokenArgs = {
};


export type MutationInsertWorkspaceMemberArgs = {
input: InsertWorkspaceMemberInput;
};


export type MutationInviteWorkspaceMemberArgs = {
input: InviteWorkspaceMemberInput;
};
Expand Down Expand Up @@ -3041,6 +3071,8 @@ export type Query = {
team?: Maybe<Team>;
teams: TeamPage;
workspace?: Maybe<Workspace>;
/** Search workspace candidates. */
workspaceCandidates: WorkspaceCandidatesResult;
workspaces: WorkspacePage;
};

Expand Down Expand Up @@ -3231,6 +3263,12 @@ export type QueryWorkspaceArgs = {
};


export type QueryWorkspaceCandidatesArgs = {
query?: InputMaybe<Scalars['String']['input']>;
workspace?: InputMaybe<Scalars['String']['input']>;
};


export type QueryWorkspacesArgs = {
page?: InputMaybe<Scalars['Int']['input']>;
perPage?: InputMaybe<Scalars['Int']['input']>;
Expand Down Expand Up @@ -4026,6 +4064,12 @@ export type WorkspaceMembersArgs = {
perPage?: InputMaybe<Scalars['Int']['input']>;
};

/** The result of a workspaceCandidates query */
export type WorkspaceCandidatesResult = {
__typename?: 'WorkspaceCandidatesResult';
items: Array<User>;
};

/** Represents an invitation to join a workspace. */
export type WorkspaceInvitation = {
__typename?: 'WorkspaceInvitation';
Expand Down
1 change: 1 addition & 0 deletions src/pages/workspaces/[workspaceSlug]/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { OnSaveFn } from "core/components/DataCard/FormSection";
import { useUpdateWorkspaceMutation } from "workspaces/graphql/mutations.generated";
import { useState } from "react";
import InviteMemberDialog from "workspaces/features/InviteMemberDialog";

import WorkspaceMembers from "workspaces/features/WorkspaceMembers";
import CountryProperty from "core/components/DataCard/CountryProperty";
import { ensureArray } from "core/helpers/array";
Expand Down
Loading
Loading