mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-25 17:04:54 +00:00
* fix: #13735 task assignee should be entity owner if present * added e2e tests for the same * do not allow edit asignee in case of entity has owner
This commit is contained in:
parent
597c49985e
commit
7b2206c09b
@ -61,7 +61,7 @@ export const editAssignee = () => {
|
||||
cy.get(`[data-testid="assignee-${assignee}"]`).should('be.visible');
|
||||
};
|
||||
|
||||
export const createDescriptionTask = (value) => {
|
||||
export const createDescriptionTask = (value, assigneeDisabled) => {
|
||||
interceptURL('POST', 'api/v1/feed', 'createTask');
|
||||
|
||||
cy.get('#title').should(
|
||||
@ -69,18 +69,27 @@ export const createDescriptionTask = (value) => {
|
||||
`Update description for table ${value.term}`
|
||||
);
|
||||
|
||||
cy.get('[data-testid="select-assignee"] > .ant-select-selector').type(
|
||||
value.assignee ?? assignee
|
||||
);
|
||||
// select value from dropdown
|
||||
verifyResponseStatusCode('@suggestApi', 200);
|
||||
if (assigneeDisabled) {
|
||||
cy.get('[data-testid="select-assignee"] > .ant-select-selector').contains(
|
||||
value.assignee
|
||||
);
|
||||
|
||||
cy.get(`[data-testid="assignee-option-${value.assignee ?? assignee}"]`)
|
||||
.should('be.visible')
|
||||
.trigger('mouseover')
|
||||
.trigger('click');
|
||||
cy.get(
|
||||
'[data-testid="select-assignee"] > .ant-select-selector input'
|
||||
).should('be.disabled');
|
||||
} else {
|
||||
cy.get('[data-testid="select-assignee"] > .ant-select-selector').type(
|
||||
value.assignee ?? assignee
|
||||
);
|
||||
// select value from dropdown
|
||||
verifyResponseStatusCode('@suggestApi', 200);
|
||||
|
||||
cy.clickOutside();
|
||||
cy.get(`[data-testid="assignee-option-${value.assignee ?? assignee}"]`)
|
||||
.should('be.visible')
|
||||
.trigger('mouseover')
|
||||
.trigger('click');
|
||||
cy.clickOutside();
|
||||
}
|
||||
|
||||
cy.get(descriptionBox).scrollIntoView().clear().type('Updated description');
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
/// <reference types="cypress" />
|
||||
|
||||
import {
|
||||
addOwner,
|
||||
interceptURL,
|
||||
toastNotification,
|
||||
verifyResponseStatusCode,
|
||||
@ -22,6 +23,7 @@ import {
|
||||
import { createEntityTable, hardDeleteService } from '../../common/EntityUtils';
|
||||
import {
|
||||
createAndUpdateDescriptionTask,
|
||||
createDescriptionTask,
|
||||
editAssignee,
|
||||
verifyTaskDetails,
|
||||
} from '../../common/TaskUtils';
|
||||
@ -193,4 +195,38 @@ describe('Task flow should work', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('Asignee field should be disabled for owned entity tasks', () => {
|
||||
interceptURL(
|
||||
'GET',
|
||||
`/api/v1/${ENTITY_TABLE.entity}/name/*`,
|
||||
'getEntityDetails'
|
||||
);
|
||||
|
||||
visitEntityDetailsPage({
|
||||
term: ENTITY_TABLE.term,
|
||||
serviceName: ENTITY_TABLE.serviceName,
|
||||
entity: ENTITY_TABLE.entity,
|
||||
});
|
||||
|
||||
addOwner('Adam Rodriguez', 'tables');
|
||||
|
||||
cy.get('[data-testid="request-description"]').click();
|
||||
|
||||
cy.wait('@getEntityDetails').then((res) => {
|
||||
const entity = res.response.body;
|
||||
|
||||
// create description task and verify asignee field to have owner
|
||||
// and should be disbaled
|
||||
|
||||
createDescriptionTask(
|
||||
{
|
||||
...ENTITY_TABLE,
|
||||
assignee: 'Adam Rodriguez',
|
||||
term: entity.displayName ?? entity.name,
|
||||
},
|
||||
true
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -468,6 +468,7 @@ export const TaskTab = ({
|
||||
}}
|
||||
onSave={() => assigneesForm.submit()}>
|
||||
<Assignees
|
||||
disabled={Boolean(owner)}
|
||||
options={options}
|
||||
value={updatedAssignees}
|
||||
onChange={(values) =>
|
||||
@ -490,7 +491,7 @@ export const TaskTab = ({
|
||||
profileWidth="24"
|
||||
showUserName={false}
|
||||
/>
|
||||
{(isCreator || hasEditAccess) && !isTaskClosed ? (
|
||||
{(isCreator || hasEditAccess) && !isTaskClosed && !owner ? (
|
||||
<Button
|
||||
className="flex-center p-0"
|
||||
data-testid="edit-assignees"
|
||||
|
@ -225,6 +225,7 @@ const RequestDescription = () => {
|
||||
},
|
||||
]}>
|
||||
<Assignees
|
||||
disabled={Boolean(entityData.owner)}
|
||||
options={options}
|
||||
value={assignees}
|
||||
onChange={setAssignees}
|
||||
|
@ -218,6 +218,7 @@ const RequestTag = () => {
|
||||
},
|
||||
]}>
|
||||
<Assignees
|
||||
disabled={Boolean(entityData.owner)}
|
||||
options={options}
|
||||
value={assignees}
|
||||
onChange={setAssignees}
|
||||
|
@ -234,6 +234,7 @@ const UpdateDescription = () => {
|
||||
},
|
||||
]}>
|
||||
<Assignees
|
||||
disabled={Boolean(entityData.owner)}
|
||||
options={options}
|
||||
value={assignees}
|
||||
onChange={setAssignees}
|
||||
|
@ -244,6 +244,7 @@ const UpdateTag = () => {
|
||||
},
|
||||
]}>
|
||||
<Assignees
|
||||
disabled={Boolean(entityData.owner)}
|
||||
options={options}
|
||||
value={assignees}
|
||||
onChange={setAssignees}
|
||||
|
@ -27,6 +27,7 @@ interface Props {
|
||||
value: Option[];
|
||||
onSearch: (value: string) => void;
|
||||
onChange: (values: Option[]) => void;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
const Assignees: FC<Props> = ({
|
||||
@ -34,6 +35,7 @@ const Assignees: FC<Props> = ({
|
||||
onSearch,
|
||||
onChange,
|
||||
options,
|
||||
disabled,
|
||||
}) => {
|
||||
const handleOnChange = (_values: Option[], newOptions: Option | Option[]) => {
|
||||
const newValues = (newOptions as Option[]).map((option) => ({
|
||||
@ -94,6 +96,7 @@ const Assignees: FC<Props> = ({
|
||||
className="ant-select-custom select-assignee"
|
||||
data-testid="select-assignee"
|
||||
defaultActiveFirstOption={false}
|
||||
disabled={disabled}
|
||||
filterOption={false}
|
||||
mode="multiple"
|
||||
notFoundContent={null}
|
||||
|
@ -116,7 +116,7 @@ const UserPage = () => {
|
||||
if (userData.id === currentUser?.id) {
|
||||
updateCurrentUser(response);
|
||||
}
|
||||
setUserData(response);
|
||||
setUserData((prev) => ({ ...prev, ...response }));
|
||||
} else {
|
||||
throw t('message.unexpected-error');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user