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

[Enterprise Search] Add notices for deactivated users and SMTP callout #103285

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const RoleMapping: React.FC = () => {
selectedEngines,
selectedAuthProviders,
roleMappingErrors,
formLoading,
} = useValues(RoleMappingsLogic);

const isNew = !roleMapping;
Expand All @@ -67,6 +68,7 @@ export const RoleMapping: React.FC = () => {
return (
<RoleMappingFlyout
disabled={attributeValueInvalid || !hasEngineAssignment}
formLoading={formLoading}
isNew={isNew}
closeUsersAndRolesFlyout={closeUsersAndRolesFlyout}
handleSaveMapping={handleSaveMapping}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ describe('RoleMappingsLogic', () => {
userFormIsNewUser: true,
userFormUserIsExisting: true,
smtpSettingsPresent: false,
formLoading: false,
};

const mappingsServerProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,15 @@ export const RoleMappingsLogic = kea<MakeLogicType<RoleMappingsValues, RoleMappi
setRoleMappingsData: (_, { smtpSettingsPresent }) => smtpSettingsPresent,
},
],
formLoading: [
false,
{
handleSaveMapping: () => true,
handleSaveUser: () => true,
initializeRoleMappings: () => false,
setRoleMappingErrors: () => false,
},
],
},
selectors: ({ selectors }) => ({
selectedOptions: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const User: React.FC = () => {
userCreated,
userFormIsNewUser,
smtpSettingsPresent,
formLoading,
} = useValues(RoleMappingsLogic);

const roleTypes = hasAdvancedRoles ? [...standardRoles, ...advancedRoles] : standardRoles;
Expand Down Expand Up @@ -102,6 +103,7 @@ export const User: React.FC = () => {
return (
<UserFlyout
disabled={flyoutDisabled}
formLoading={formLoading}
isComplete={userCreated}
isNew={userFormIsNewUser}
closeUserFlyout={closeUsersAndRolesFlyout}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ interface Props {
children: React.ReactNode;
isNew: boolean;
disabled: boolean;
formLoading: boolean;
closeUsersAndRolesFlyout(): void;
handleSaveMapping(): void;
}
Expand All @@ -44,6 +45,7 @@ export const RoleMappingFlyout: React.FC<Props> = ({
children,
isNew,
disabled,
formLoading,
closeUsersAndRolesFlyout,
handleSaveMapping,
}) => (
Expand Down Expand Up @@ -77,7 +79,8 @@ export const RoleMappingFlyout: React.FC<Props> = ({
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButton
disabled={disabled}
disabled={disabled || formLoading}
isLoading={formLoading}
onClick={handleSaveMapping}
fill
data-test-subj="FlyoutButton"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,5 @@ export interface RoleMappingsBaseValues extends RoleMappingsBaseServerDetails {
userCreated: boolean;
userFormIsNewUser: boolean;
accessAllEngines: boolean;
formLoading: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ interface Props {
isNew: boolean;
isComplete: boolean;
disabled: boolean;
formLoading: boolean;
closeUserFlyout(): void;
handleSaveUser(): void;
}
Expand All @@ -49,6 +50,7 @@ export const UserFlyout: React.FC<Props> = ({
isNew,
isComplete,
disabled,
formLoading,
closeUserFlyout,
handleSaveUser,
}) => {
Expand All @@ -75,7 +77,12 @@ export const UserFlyout: React.FC<Props> = ({
<EuiButtonEmpty onClick={closeUserFlyout}>{CANCEL_BUTTON_LABEL}</EuiButtonEmpty>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButton disabled={disabled} onClick={handleSaveUser} fill>
<EuiButton
disabled={disabled || formLoading}
isLoading={formLoading}
scottybollinger marked this conversation as resolved.
Show resolved Hide resolved
onClick={handleSaveUser}
fill
>
{isNew ? ADD_USER_LABEL : UPDATE_USER_LABEL}
</EuiButton>
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export const RoleMapping: React.FC = () => {
selectedAuthProviders,
roleMapping,
roleMappingErrors,
formLoading,
} = useValues(RoleMappingsLogic);

const isNew = !roleMapping;
Expand All @@ -69,6 +70,7 @@ export const RoleMapping: React.FC = () => {
return (
<RoleMappingFlyout
disabled={attributeValueInvalid || !hasGroupAssignment}
formLoading={formLoading}
isNew={isNew}
closeUsersAndRolesFlyout={closeUsersAndRolesFlyout}
handleSaveMapping={handleSaveMapping}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ describe('RoleMappingsLogic', () => {
userFormIsNewUser: true,
userFormUserIsExisting: true,
smtpSettingsPresent: false,
formLoading: false,
};
const roleGroup = {
id: '123',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,15 @@ export const RoleMappingsLogic = kea<MakeLogicType<RoleMappingsValues, RoleMappi
setRoleMappingsData: (_, { smtpSettingsPresent }) => smtpSettingsPresent,
},
],
formLoading: [
false,
{
handleSaveMapping: () => true,
handleSaveUser: () => true,
initializeRoleMappings: () => false,
setRoleMappingErrors: () => false,
},
],
},
selectors: ({ selectors }) => ({
selectedOptions: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const User: React.FC = () => {
userCreated,
userFormIsNewUser,
smtpSettingsPresent,
formLoading,
} = useValues(RoleMappingsLogic);

const showGroupAssignmentSelector = availableGroups.length > 0;
Expand Down Expand Up @@ -99,6 +100,7 @@ export const User: React.FC = () => {
return (
<UserFlyout
disabled={flyoutDisabled}
formLoading={formLoading}
isComplete={userCreated}
isNew={userFormIsNewUser}
closeUserFlyout={closeUsersAndRolesFlyout}
Expand Down