mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-19 21:02:19 +00:00
* feat(#11608): UI: Show Email in teams page * update method name
This commit is contained in:
parent
3914868556
commit
9b78f12305
@ -33,6 +33,7 @@ const TEAM_DETAILS = {
|
|||||||
userId: 'aaron_johnson0',
|
userId: 'aaron_johnson0',
|
||||||
assetname: 'dim_address',
|
assetname: 'dim_address',
|
||||||
email: 'team1@gmail.com',
|
email: 'team1@gmail.com',
|
||||||
|
updatedEmail: 'updatedemail@gmail.com',
|
||||||
};
|
};
|
||||||
const hardDeleteTeamName = `team-ct-test-${uuid()}`;
|
const hardDeleteTeamName = `team-ct-test-${uuid()}`;
|
||||||
const HARD_DELETE_TEAM_DETAILS = {
|
const HARD_DELETE_TEAM_DETAILS = {
|
||||||
@ -82,6 +83,35 @@ describe('Teams flow should work properly', () => {
|
|||||||
updateOwner();
|
updateOwner();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Update email of created team', () => {
|
||||||
|
interceptURL('PATCH', '/api/v1/teams/*', 'updateEmail');
|
||||||
|
interceptURL('GET', '/api/v1/teams/name/*', 'getTeam');
|
||||||
|
|
||||||
|
// Clicking on created team
|
||||||
|
cy.get(`[data-row-key="${TEAM_DETAILS.name}"]`)
|
||||||
|
.contains(TEAM_DETAILS.name)
|
||||||
|
.click();
|
||||||
|
verifyResponseStatusCode('@getUserDetails', 200);
|
||||||
|
verifyResponseStatusCode('@getTeam', 200);
|
||||||
|
|
||||||
|
cy.get('[data-testid="edit-email"]').should('be.visible').click();
|
||||||
|
cy.get('[data-testid="email-input"]')
|
||||||
|
.should('be.visible')
|
||||||
|
.clear()
|
||||||
|
.type(TEAM_DETAILS.updatedEmail);
|
||||||
|
|
||||||
|
cy.get('[data-testid="save-edit-email"]').should('be.visible').click();
|
||||||
|
|
||||||
|
verifyResponseStatusCode('@updateEmail', 200);
|
||||||
|
|
||||||
|
cy.reload();
|
||||||
|
|
||||||
|
// check for updated email
|
||||||
|
cy.get('[data-testid="email-value"]')
|
||||||
|
.should('be.visible')
|
||||||
|
.contains(TEAM_DETAILS.updatedEmail);
|
||||||
|
});
|
||||||
|
|
||||||
it('Add user to created team', () => {
|
it('Add user to created team', () => {
|
||||||
interceptURL('GET', '/api/v1/users?&isBot=false&limit=15', 'getUsers');
|
interceptURL('GET', '/api/v1/users?&isBot=false&limit=15', 'getUsers');
|
||||||
interceptURL('PATCH', '/api/v1/teams/*', 'updateTeam');
|
interceptURL('PATCH', '/api/v1/teams/*', 'updateTeam');
|
||||||
|
@ -16,6 +16,7 @@ import {
|
|||||||
Button,
|
Button,
|
||||||
Col,
|
Col,
|
||||||
Dropdown,
|
Dropdown,
|
||||||
|
Input,
|
||||||
Modal,
|
Modal,
|
||||||
Row,
|
Row,
|
||||||
Space,
|
Space,
|
||||||
@ -205,6 +206,8 @@ const TeamDetailsV1 = ({
|
|||||||
useState<OperationPermission>(DEFAULT_ENTITY_PERMISSION);
|
useState<OperationPermission>(DEFAULT_ENTITY_PERMISSION);
|
||||||
const [isModalLoading, setIsModalLoading] = useState<boolean>(false);
|
const [isModalLoading, setIsModalLoading] = useState<boolean>(false);
|
||||||
const [showActions, setShowActions] = useState<boolean>(false);
|
const [showActions, setShowActions] = useState<boolean>(false);
|
||||||
|
const [email, setEmail] = useState<string>(currentTeam.email || '');
|
||||||
|
const [isEmailEdit, setIsEmailEdit] = useState<boolean>(false);
|
||||||
|
|
||||||
const addPolicy = t('label.add-entity', {
|
const addPolicy = t('label.add-entity', {
|
||||||
entity: t('label.policy'),
|
entity: t('label.policy'),
|
||||||
@ -589,6 +592,18 @@ const TeamDetailsV1 = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleUpdateEmail = () => {
|
||||||
|
if (currentTeam) {
|
||||||
|
const updatedData: Team = {
|
||||||
|
...currentTeam,
|
||||||
|
email,
|
||||||
|
};
|
||||||
|
|
||||||
|
updateTeamHandler(updatedData);
|
||||||
|
setIsEmailEdit(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const fetchPermissions = async () => {
|
const fetchPermissions = async () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
@ -965,7 +980,7 @@ const TeamDetailsV1 = ({
|
|||||||
|
|
||||||
const getTeamHeading = () => {
|
const getTeamHeading = () => {
|
||||||
return (
|
return (
|
||||||
<div className="tw-heading tw-text-link tw-text-base tw-mb-2">
|
<div className="tw-text-link tw-text-base">
|
||||||
{isHeadingEditing ? (
|
{isHeadingEditing ? (
|
||||||
<div className="tw-flex tw-items-center tw-gap-1">
|
<div className="tw-flex tw-items-center tw-gap-1">
|
||||||
<input
|
<input
|
||||||
@ -1037,6 +1052,66 @@ const TeamDetailsV1 = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const emailElement = (
|
||||||
|
<Space className="m-b-xs">
|
||||||
|
{isEmailEdit ? (
|
||||||
|
<Space>
|
||||||
|
<Input
|
||||||
|
className="w-64"
|
||||||
|
data-testid="email-input"
|
||||||
|
placeholder={t('label.enter-entity', {
|
||||||
|
entity: t('label.email-lowercase'),
|
||||||
|
})}
|
||||||
|
type="email"
|
||||||
|
value={email}
|
||||||
|
onChange={(e) => setEmail(e.target.value)}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
className="h-8 p-x-xss"
|
||||||
|
data-testid="cancel-edit-email"
|
||||||
|
size="small"
|
||||||
|
type="primary"
|
||||||
|
onClick={() => setIsEmailEdit(false)}>
|
||||||
|
<CloseOutlined />
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
className="h-8 p-x-xss"
|
||||||
|
data-testid="save-edit-email"
|
||||||
|
size="small"
|
||||||
|
type="primary"
|
||||||
|
onClick={handleUpdateEmail}>
|
||||||
|
<CheckOutlined />
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<Typography.Text data-testid="email-value">
|
||||||
|
{currentTeam.email ||
|
||||||
|
t('label.no-entity', { entity: t('label.email') })}
|
||||||
|
</Typography.Text>
|
||||||
|
<Tooltip
|
||||||
|
placement="bottomLeft"
|
||||||
|
title={
|
||||||
|
entityPermissions.EditAll
|
||||||
|
? t('label.edit-entity', {
|
||||||
|
entity: t('label.email'),
|
||||||
|
})
|
||||||
|
: t('message.no-permission-for-action')
|
||||||
|
}>
|
||||||
|
<Button
|
||||||
|
data-testid="edit-email"
|
||||||
|
disabled={!entityPermissions.EditAll}
|
||||||
|
icon={<IconEdit height={16} width={16} />}
|
||||||
|
size="small"
|
||||||
|
type="text"
|
||||||
|
onClick={() => setIsEmailEdit(true)}
|
||||||
|
/>
|
||||||
|
</Tooltip>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</Space>
|
||||||
|
);
|
||||||
|
|
||||||
const viewPermission =
|
const viewPermission =
|
||||||
entityPermissions.ViewAll || entityPermissions.ViewBasic;
|
entityPermissions.ViewAll || entityPermissions.ViewBasic;
|
||||||
|
|
||||||
@ -1109,6 +1184,7 @@ const TeamDetailsV1 = ({
|
|||||||
</Dropdown>
|
</Dropdown>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
{emailElement}
|
||||||
<Space size={0}>
|
<Space size={0}>
|
||||||
{extraInfo.map((info, index) => (
|
{extraInfo.map((info, index) => (
|
||||||
<Fragment key={uniqueId()}>
|
<Fragment key={uniqueId()}>
|
||||||
|
@ -128,6 +128,9 @@
|
|||||||
.w-max-256 {
|
.w-max-256 {
|
||||||
max-width: 256px;
|
max-width: 256px;
|
||||||
}
|
}
|
||||||
|
.w-64 {
|
||||||
|
width: 264px;
|
||||||
|
}
|
||||||
|
|
||||||
.w-max-13 {
|
.w-max-13 {
|
||||||
max-width: 13rem;
|
max-width: 13rem;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user