Skip to content

[BUG] There is no pop-up window when user is deleted from Project/Notebook level #374#706

Open
IamBigBobby wants to merge 6 commits into
3.0from
ng-374
Open

[BUG] There is no pop-up window when user is deleted from Project/Notebook level #374#706
IamBigBobby wants to merge 6 commits into
3.0from
ng-374

Conversation

@IamBigBobby

@IamBigBobby IamBigBobby commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

task: #374

screenshots:
Project page:
image
Notebook page:
image
Experiments page:
image

type="checkbox"
class="mt-0.5"
[(ngModel)]="removeFromChildren"
[attr.aria-label]="'Also remove this member from all Experiments in this Notebook.'"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This dialog can be shown when deleting from Project or Notebook. Wordings must also change depending on it (e.g. "Also remove this member from all Experiments in this Notebook" vs "Also remove this member from all Notebooks and Experiments in this Project")

Also, please update the visible text in span to match aria-label (current wording "Also removes from this Projects, and ..." is a little broken)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

fixed

now it manages form getCascadeCheckboxLabel method in team.component.ts, depends on endpoint:

 private getCascadeCheckboxLabel(endpoint: string): string | undefined {
    if (endpoint.startsWith('projects/')) {
      return 'Also remove this member from all Notebooks and Experiments in this Project.';
    }
    if (endpoint.startsWith('notebooks/')) {
      return 'Also remove this member from all Experiments in this Notebook.';
    }
    return undefined;
  }

const updatePayload: ACLUpdate = {
username: member.username,
level: newLevel,
...(newLevel === AclLevel.NONE ? { deleteNested } : {}),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Minor, but can be newLevel === AclLevel.None ? deleteNested : false (or maybe newLevel === AclLevel.None && deleteNested)

false is a safe value to pass even if AclLevel is other than None

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

refactored

this._team.set(updated);
this.teamChanged.emit(updated);
}
if (!projectAcl) return;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It looks like this check validates against backend returning null, but it would also fail on empty list. We can't have empty list here (there should be at least author), but it's more clear if we remove this check. Backend always returns ACLEntry[]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

removed


export interface RemoveMemberConfirmationDialogData {
showCascadeCheckbox: boolean;
title?: string;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Seems fields other that showCascadeCheckbox never used?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

refactored

readonly data = inject<RemoveMemberConfirmationDialogData>(MAT_DIALOG_DATA);
private dialogRef = inject(MatDialogRef<RemoveMemberConfirmationDialogComponent, RemoveMemberConfirmationResult>);

removeFromChildren = true;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We now have 3 places where eln-team component is used: Project, Notebook, Experiment. First two should have removeFromChildren = true, Experiment should have removeFromChildren = false

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

refactored, now it depends on depends on availability cascadeCheckboxLabel field (look at team.compoent.ts)

private getCascadeCheckboxLabel(endpoint: string): string | undefined {
    if (endpoint.startsWith('projects/')) {
      return 'Also remove this member from all Notebooks and Experiments in this Project.';
    }
    if (endpoint.startsWith('notebooks/')) {
      return 'Also remove this member from all Experiments in this Notebook.';
    }
    return undefined;
  }

  private buildRemoveMemberDialogData(endpoint: string): RemoveMemberConfirmationDialogData {
    const cascadeCheckboxLabel = this.getCascadeCheckboxLabel(endpoint);

    return {
      showCascadeCheckbox: !!cascadeCheckboxLabel,
      cascadeCheckboxLabel,
    };
  }

readonly data = inject<RemoveMemberConfirmationDialogData>(MAT_DIALOG_DATA);
private dialogRef = inject(MatDialogRef<RemoveMemberConfirmationDialogComponent, RemoveMemberConfirmationResult>);

readonly cascadeCheckboxLabel =

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe better have non-nullable cascadeCheckboxLabel and demand dialog caller to always provide the text?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

refacted

this.teamChanged.emit(updatedTeam);
}

private getCascadeCheckboxLabel(endpoint: string): string | undefined {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks a little strange that we calculate endpoint based on entity type and then calculate the message based on that endpoint. Logically, it should depend on entity type also. Can we instead add a message to TeamComponentConfig?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

refacted

@@ -0,0 +1,16 @@
<div class="p-6">

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Shall we reuse eln-form-dialog? It will give us title and buttons for free

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.

2 participants