Skip to content

Conversation

lucasgoral
Copy link
Contributor

What this PR does / why we need it:
Import members feature for Workspace and MCP creation that makes it easy to be consistent with assigning users to the resources.

image

@Lasserich
Copy link
Contributor

Lasserich commented Aug 29, 2025

image

Amazing! 🚀 This still looks a bit off.

Copy link
Contributor

@Lasserich Lasserich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice work!! minor comments/questions.


<ImportMembersDialog
open={isImportDialogOpen}
workspaceName={workspaceName}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you make the workspace/project name also visible in the dropdown when choosing if you want to import from a Project or Workspace?

Think this would make it cristal clear to the end-user which roles he is inheriting right now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

() =>
z
.object({
parentType: z.union([z.literal('Workspace'), z.literal('Project'), z.literal('')]),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think we need the last "empty" option here, no?

Copy link
Contributor

@andreaskienle andreaskienle Sep 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the change from the two checkboxes to the three steps (All / Users / ServiceAccounts), I removed zod from this component because there can't be any invalid state anymore.

setValue('parentType', selected, { shouldValidate: true, shouldDirty: true, shouldTouch: true });
}}
>
{!!workspaceName && <Option value="Workspace">{t('Entities.Workspace')}</Option>}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am confused by the logic, we are checking if there is a workspace name but then use the Option set to "Project". I would expect the value to be "Workspace" in this case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is correct. workspaceName is of type string | undefined. The logical operators work as follows:

  • !workspaceName is of type boolean and is true if workspaceName is falsy (i.e. either undefined or an empty string).
  • !!workspaceName just reverses this and is true if workspaceName is truthy (defined and non-empty).

So:

  • The first <Option value="Workspace" …> is rendered only when there is a workspaceName
  • The second <Option value="Project" …> is always rendered.

I changed the props of the component to make projectName a required string (which cannot be undefined) as our Import component requires this value to function properly.

}

const membersData = parentResourceData?.spec?.members ?? [];
const mockedMembers: Member[] = membersData.map(({ name, namespace, kind, roles }) => ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this mockedMembers is it mixing a unit test into this? I feel like there should be no cleaning necessary before no? Maybe just confusing naming.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably a leftover from testing locally, I've removed it

Copilot

This comment was marked as outdated.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces an import members feature that allows users to reuse member assignments from existing projects and workspaces when creating new workspaces or managed control planes (MCPs). The feature provides a dialog interface to select and import members, promoting consistency in member assignments across resources.

  • Adds an import dialog component for browsing and selecting members from parent resources
  • Updates the EditMembers component to include import functionality with filtering options
  • Enhances the useApiResource hook to support conditional API calls

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/lib/api/useApiResource.ts Adds optional disable parameter for conditional API calls
src/lib/api/types/crate/resourceObject.ts Adds generic type parameter for improved type safety
src/components/Members/ImportMembersDialog.tsx New dialog component for importing members from projects/workspaces
src/components/Members/EditMembers.tsx Integrates import functionality with reuse button and member merging logic
src/components/Members/MemberTable.tsx Updates column headers and consolidates edit/delete buttons
Various CSS and localization files Styling and text updates for the import feature

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@andreaskienle
Copy link
Contributor

Added your feedback (@Lasserich ) with the following changes:

  • Combined everything into a single dialog step (selection of Workspace/Project, Users/ServiceAccounts, and the actual member selection).
  • Removed the custom checkboxes as well as the “Select All” and “Deselect All” buttons in favour of the built-in selection functionality of the UI5 table component.
  • Replaced the two independent checkboxes with a segmented button (All / Users / ServiceAccounts), since only these three options are valid anyway.
  • The button now shows the number of members to be added.
  • Added toast message (“x members added. y members changed.”)
  • The name of the project/workspace is now shown in the dropdown list.
  • Disabled the query when the dialog is closed (the dialog is always mounted but hidden, which was triggering network requests continuously).
  • Various minor styling and other fixes.

Copy link
Contributor

@Hubert-Szczepanski-SAP Hubert-Szczepanski-SAP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good job guys!

@andreaskienle andreaskienle merged commit c930091 into main Sep 10, 2025
5 checks passed
@andreaskienle andreaskienle deleted the import-members branch September 10, 2025 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants