Skip to content

Commit

Permalink
Merge pull request gooddata#4314 from xMort/fast_track
Browse files Browse the repository at this point in the history
  • Loading branch information
xMort committed Nov 13, 2023
2 parents e10d03b + 1e9bc7f commit d019164
Show file tree
Hide file tree
Showing 30 changed files with 280 additions and 161 deletions.
36 changes: 19 additions & 17 deletions libs/sdk-ui-kit/api/sdk-ui-kit.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ export const AddGranteeBase: React_2.FC<IAddGranteeBaseProps>;
// @internal (undocumented)
export type AddMessageType = (message: MessageDescriptor, options?: Pick<IMessageDefinition, "duration" | "intensive" | "values">) => string;

// @alpha (undocumented)
// @internal (undocumented)
export const AddUserGroupsToUsersDialog: React_2.FC<IAddUserGroupsToUsersDialogProps>;

// @alpha (undocumented)
// @internal (undocumented)
export const AddUsersToUserGroupsDialog: React_2.FC<IAddUsersToUserGroupsDialogProps>;

// @alpha (undocumented)
// @internal (undocumented)
export const AddWorkspaceToSubjects: React_2.FC<IAddWorkspaceToSubjectsProps>;

// @internal (undocumented)
Expand Down Expand Up @@ -356,16 +356,16 @@ export const defaultColorPaletteMetadataObject: IColorPaletteDefinition;
// @internal
export const defaultThemeMetadataObject: IThemeDefinition;

// @alpha (undocumented)
// @internal (undocumented)
export const DeleteUserDialog: React_2.FC<IDeleteUserDialogProps>;

// @alpha (undocumented)
// @internal (undocumented)
export const DeleteUserGroupDialog: React_2.FC<IDeleteUserGroupDialogProps>;

// @alpha (undocumented)
// @internal (undocumented)
export const DeleteUserGroupsDialog: React_2.FC<IDeleteUserGroupsDialogProps>;

// @alpha (undocumented)
// @internal (undocumented)
export const DeleteUsersDialog: React_2.FC<IDeleteUsersDialogProps>;

// @internal (undocumented)
Expand Down Expand Up @@ -784,7 +784,7 @@ export interface IAddGranteeBaseProps {
sharedObject: IAffectedSharedObject;
}

// @alpha (undocumented)
// @internal (undocumented)
export interface IAddUserGroupsToUsersDialogProps {
// (undocumented)
onClose: () => void;
Expand All @@ -796,7 +796,7 @@ export interface IAddUserGroupsToUsersDialogProps {
userIds: string[];
}

// @alpha (undocumented)
// @internal (undocumented)
export interface IAddUsersToUserGroupsDialogProps {
// (undocumented)
onClose: () => void;
Expand All @@ -808,7 +808,7 @@ export interface IAddUsersToUserGroupsDialogProps {
userGroupIds: string[];
}

// @alpha (undocumented)
// @internal (undocumented)
export interface IAddWorkspaceToSubjectsProps {
// (undocumented)
ids: string[];
Expand Down Expand Up @@ -1312,7 +1312,7 @@ export interface IDateTimeConfigOptions {
now?: Date;
}

// @alpha (undocumented)
// @internal (undocumented)
export interface IDeleteUserDialogProps {
// (undocumented)
onClose: () => void;
Expand All @@ -1324,7 +1324,7 @@ export interface IDeleteUserDialogProps {
userId: string;
}

// @alpha (undocumented)
// @internal (undocumented)
export interface IDeleteUserGroupDialogProps {
// (undocumented)
onClose: () => void;
Expand All @@ -1336,7 +1336,7 @@ export interface IDeleteUserGroupDialogProps {
userGroupId: string;
}

// @alpha (undocumented)
// @internal (undocumented)
export interface IDeleteUserGroupsDialogProps {
// (undocumented)
onClose: () => void;
Expand All @@ -1348,7 +1348,7 @@ export interface IDeleteUserGroupsDialogProps {
userGroupIds: string[];
}

// @alpha (undocumented)
// @internal (undocumented)
export interface IDeleteUsersDialogProps {
// (undocumented)
onClose: () => void;
Expand Down Expand Up @@ -4042,6 +4042,8 @@ export interface IUiSettings {

// @internal (undocumented)
export interface IUserEditDialogProps {
// (undocumented)
changeUserMembership?: boolean;
// (undocumented)
initialView?: UserEditDialogMode;
// (undocumented)
Expand Down Expand Up @@ -4699,7 +4701,7 @@ export const useOverlayZIndex: (uuid: string) => number;
// @internal (undocumented)
export const UserEditDialog: React_2.FC<IUserEditDialogProps>;

// @alpha (undocumented)
// @internal (undocumented)
export type UserEditDialogMode = "VIEW" | "WORKSPACE" | "USER_GROUPS" | "DETAIL";

// @internal
Expand All @@ -4708,7 +4710,7 @@ export const useResponsiveContext: () => IResponsiveConfig;
// @internal (undocumented)
export const UserGroupEditDialog: React_2.FC<IUserGroupEditDialogProps>;

// @alpha (undocumented)
// @internal (undocumented)
export type UserGroupEditDialogMode = "VIEW" | "WORKSPACE" | "USERS" | "DETAIL";

// @internal (undocumented)
Expand Down Expand Up @@ -4738,7 +4740,7 @@ export interface UseToastMessageType {
// @internal (undocumented)
export function withBubble<T>(WrappedComponent: React_2.ComponentType<T>): React_2.FC<T & IWithBubbleProps>;

// @alpha (undocumented)
// @internal (undocumented)
export type WorkspacePermissionSubject = "user" | "userGroup";

// @internal (undocumented)
Expand Down
Binary file modified libs/sdk-ui-kit/gooddata-sdk-ui-kit-0.0.0-dev.0.tgz
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const alignPoints: IAlignPoint[] = [{ align: "cc cc" }];
const noGrantedUserGroups: IGrantedUserGroup[] = [];

/**
* @alpha
* @internal
*/
export interface IAddUserGroupsToUsersDialogProps {
userIds: string[];
Expand All @@ -21,7 +21,7 @@ export interface IAddUserGroupsToUsersDialogProps {
}

/**
* @alpha
* @internal
*/
export const AddUserGroupsToUsersDialog: React.FC<IAddUserGroupsToUsersDialogProps> = ({
userIds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const alignPoints: IAlignPoint[] = [{ align: "cc cc" }];
const noGrantedUsers: IUserMember[] = [];

/**
* @alpha
* @internal
*/
export interface IAddUsersToUserGroupsDialogProps {
userGroupIds: string[];
Expand All @@ -21,7 +21,7 @@ export interface IAddUsersToUserGroupsDialogProps {
}

/**
* @alpha
* @internal
*/
export const AddUsersToUserGroupsDialog: React.FC<IAddUsersToUserGroupsDialogProps> = ({
userGroupIds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const alignPoints: IAlignPoint[] = [{ align: "cc cc" }];
const noGrantedWorkspaces: IGrantedWorkspace[] = [];

/**
* @alpha
* @internal
*/
export interface IAddWorkspaceToSubjectsProps {
ids: string[];
Expand All @@ -22,7 +22,7 @@ export interface IAddWorkspaceToSubjectsProps {
}

/**
* @alpha
* @internal
*/
export const AddWorkspaceToSubjects: React.FC<IAddWorkspaceToSubjectsProps> = ({
ids,
Expand Down
24 changes: 13 additions & 11 deletions libs/sdk-ui-kit/src/Dialog/UserManagementDialogs/DeleteLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import React from "react";

import { Button } from "../../Button/index.js";
import { withBubble } from "../../Bubble/index.js";
import { IAlignPoint } from "../../typings/positioning.js";

const alignPoints: IAlignPoint[] = [{ align: "bc tc" }];

export interface IDeleteLinkProps {
isDeleteLinkEnabled: boolean;
Expand All @@ -30,17 +33,16 @@ export const DeleteLink: React.FC<IDeleteLinkProps> = (props) => {
const { isDeleteLinkEnabled, disabledLinkTooltipTextId } = props;
return (
<div>
{
isDeleteLinkEnabled ? (
<Link {...props} />
) : (
<DisabledLinKWithBubble
{...props}
showBubble={true}
bubbleTextId={disabledLinkTooltipTextId}
/>
)
}
{isDeleteLinkEnabled ? (
<Link {...props} />
) : (
<DisabledLinKWithBubble
{...props}
showBubble={true}
bubbleTextId={disabledLinkTooltipTextId}
alignPoints={alignPoints}
/>
)}
</div>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { DeleteConfirmDialog } from "./ConfirmDialogs/DeleteConfirmDialog.js";
import { useDeleteUser } from "./dialogHooks.js";

/**
* @alpha
* @internal
*/
export interface IDeleteUserDialogProps {
userId: string;
Expand All @@ -19,7 +19,7 @@ export interface IDeleteUserDialogProps {
}

/**
* @alpha
* @internal
*/
export const DeleteUserDialog: React.FC<IDeleteUserDialogProps> = ({
userId,
Expand All @@ -32,9 +32,7 @@ export const DeleteUserDialog: React.FC<IDeleteUserDialogProps> = ({
return (
<DeleteConfirmDialog
titleText={intl.formatMessage(userManagementMessages.deleteUserConfirmTitle)}
bodyText={intl.formatMessage(userManagementMessages.deleteUserConfirmBody, {
br: <br />,
})}
bodyText={intl.formatMessage(userManagementMessages.deleteUserConfirmBody)}
onConfirm={deleteUser}
onCancel={onClose}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { DeleteConfirmDialog } from "./ConfirmDialogs/DeleteConfirmDialog.js";
import { useDeleteUserGroup } from "./dialogHooks.js";

/**
* @alpha
* @internal
*/
export interface IDeleteUserGroupDialogProps {
userGroupId: string;
Expand All @@ -19,7 +19,7 @@ export interface IDeleteUserGroupDialogProps {
}

/**
* @alpha
* @internal
*/
export const DeleteUserGroupDialog: React.FC<IDeleteUserGroupDialogProps> = ({
userGroupId,
Expand All @@ -32,9 +32,7 @@ export const DeleteUserGroupDialog: React.FC<IDeleteUserGroupDialogProps> = ({
return (
<DeleteConfirmDialog
titleText={intl.formatMessage(userManagementMessages.deleteUserGroupConfirmTitle)}
bodyText={intl.formatMessage(userManagementMessages.deleteUserGroupConfirmBody, {
br: <br />,
})}
bodyText={intl.formatMessage(userManagementMessages.deleteUserGroupConfirmBody)}
onConfirm={deleteUserGroup}
onCancel={onClose}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useToastMessage } from "../../Messages/index.js";
import { DeleteConfirmDialog } from "./ConfirmDialogs/DeleteConfirmDialog.js";

/**
* @alpha
* @internal
*/
export interface IDeleteUserGroupsDialogProps {
userGroupIds: string[];
Expand All @@ -20,7 +20,7 @@ export interface IDeleteUserGroupsDialogProps {
}

/**
* @alpha
* @internal
*/
export const DeleteUserGroupsDialog: React.FC<IDeleteUserGroupsDialogProps> = ({
userGroupIds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useToastMessage } from "../../Messages/index.js";
import { DeleteConfirmDialog } from "./ConfirmDialogs/DeleteConfirmDialog.js";

/**
* @alpha
* @internal
*/
export interface IDeleteUsersDialogProps {
userIds: string[];
Expand All @@ -20,7 +20,7 @@ export interface IDeleteUsersDialogProps {
}

/**
* @alpha
* @internal
*/
export const DeleteUsersDialog: React.FC<IDeleteUsersDialogProps> = ({
userIds,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// (C) 2023 GoodData Corporation

import { useIntl } from "react-intl";
import React, { useCallback } from "react";
import React, { useCallback, useEffect } from "react";
import { IUser } from "@gooddata/sdk-model";

import { BackButton } from "../../BackButton.js";
Expand All @@ -14,15 +14,21 @@ import { userManagementMessages } from "../../../locales.js";

export interface IEditUserDetailsProps {
isAdmin: boolean;
isBootstrapUser: boolean;
user: IUser;
enableBackButton?: boolean;
changeUserMembership?: boolean;
onSubmit: (user: IUser, isAdmin: boolean) => void;
onCancel: () => void;
onClose: () => void;
}

export const EditUserDetails: React.FC<IEditUserDetailsProps> = ({
user,
isBootstrapUser,
isAdmin,
enableBackButton,
changeUserMembership,
onSubmit,
onCancel,
onClose,
Expand All @@ -35,6 +41,14 @@ export const EditUserDetails: React.FC<IEditUserDetailsProps> = ({
onCancel,
);

// change user membership if dialog was opened for that reason, enable Save button, do it just once
useEffect(() => {
if (changeUserMembership) {
onChange(updatedUser, !isUpdatedAdmin);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const backButtonRenderer = useCallback(() => {
return <BackButton onClick={onCancel} className="s-user-management-navigate-back" />;
}, [onCancel]);
Expand All @@ -51,9 +65,15 @@ export const EditUserDetails: React.FC<IEditUserDetailsProps> = ({
onCancel={onCancel}
onSubmit={onSave}
onClose={onClose}
headerLeftButtonRenderer={backButtonRenderer}
headerLeftButtonRenderer={enableBackButton ? backButtonRenderer : undefined}
>
<UserDetailsView user={updatedUser} isAdmin={isUpdatedAdmin} mode="EDIT" onChange={onChange} />
<UserDetailsView
user={updatedUser}
isAdmin={isUpdatedAdmin}
isBootstrapUser={isBootstrapUser}
mode="EDIT"
onChange={onChange}
/>
</ConfirmDialogBase>
);
};
Loading

0 comments on commit d019164

Please sign in to comment.