mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-12-06 20:47:26 +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');
|
cy.get(`[data-testid="assignee-${assignee}"]`).should('be.visible');
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createDescriptionTask = (value) => {
|
export const createDescriptionTask = (value, assigneeDisabled) => {
|
||||||
interceptURL('POST', 'api/v1/feed', 'createTask');
|
interceptURL('POST', 'api/v1/feed', 'createTask');
|
||||||
|
|
||||||
cy.get('#title').should(
|
cy.get('#title').should(
|
||||||
@ -69,18 +69,27 @@ export const createDescriptionTask = (value) => {
|
|||||||
`Update description for table ${value.term}`
|
`Update description for table ${value.term}`
|
||||||
);
|
);
|
||||||
|
|
||||||
cy.get('[data-testid="select-assignee"] > .ant-select-selector').type(
|
if (assigneeDisabled) {
|
||||||
value.assignee ?? assignee
|
cy.get('[data-testid="select-assignee"] > .ant-select-selector').contains(
|
||||||
);
|
value.assignee
|
||||||
// select value from dropdown
|
);
|
||||||
verifyResponseStatusCode('@suggestApi', 200);
|
|
||||||
|
|
||||||
cy.get(`[data-testid="assignee-option-${value.assignee ?? assignee}"]`)
|
cy.get(
|
||||||
.should('be.visible')
|
'[data-testid="select-assignee"] > .ant-select-selector input'
|
||||||
.trigger('mouseover')
|
).should('be.disabled');
|
||||||
.trigger('click');
|
} 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');
|
cy.get(descriptionBox).scrollIntoView().clear().type('Updated description');
|
||||||
|
|
||||||
|
|||||||
@ -14,6 +14,7 @@
|
|||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
addOwner,
|
||||||
interceptURL,
|
interceptURL,
|
||||||
toastNotification,
|
toastNotification,
|
||||||
verifyResponseStatusCode,
|
verifyResponseStatusCode,
|
||||||
@ -22,6 +23,7 @@ import {
|
|||||||
import { createEntityTable, hardDeleteService } from '../../common/EntityUtils';
|
import { createEntityTable, hardDeleteService } from '../../common/EntityUtils';
|
||||||
import {
|
import {
|
||||||
createAndUpdateDescriptionTask,
|
createAndUpdateDescriptionTask,
|
||||||
|
createDescriptionTask,
|
||||||
editAssignee,
|
editAssignee,
|
||||||
verifyTaskDetails,
|
verifyTaskDetails,
|
||||||
} from '../../common/TaskUtils';
|
} 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()}>
|
onSave={() => assigneesForm.submit()}>
|
||||||
<Assignees
|
<Assignees
|
||||||
|
disabled={Boolean(owner)}
|
||||||
options={options}
|
options={options}
|
||||||
value={updatedAssignees}
|
value={updatedAssignees}
|
||||||
onChange={(values) =>
|
onChange={(values) =>
|
||||||
@ -490,7 +491,7 @@ export const TaskTab = ({
|
|||||||
profileWidth="24"
|
profileWidth="24"
|
||||||
showUserName={false}
|
showUserName={false}
|
||||||
/>
|
/>
|
||||||
{(isCreator || hasEditAccess) && !isTaskClosed ? (
|
{(isCreator || hasEditAccess) && !isTaskClosed && !owner ? (
|
||||||
<Button
|
<Button
|
||||||
className="flex-center p-0"
|
className="flex-center p-0"
|
||||||
data-testid="edit-assignees"
|
data-testid="edit-assignees"
|
||||||
|
|||||||
@ -225,6 +225,7 @@ const RequestDescription = () => {
|
|||||||
},
|
},
|
||||||
]}>
|
]}>
|
||||||
<Assignees
|
<Assignees
|
||||||
|
disabled={Boolean(entityData.owner)}
|
||||||
options={options}
|
options={options}
|
||||||
value={assignees}
|
value={assignees}
|
||||||
onChange={setAssignees}
|
onChange={setAssignees}
|
||||||
|
|||||||
@ -218,6 +218,7 @@ const RequestTag = () => {
|
|||||||
},
|
},
|
||||||
]}>
|
]}>
|
||||||
<Assignees
|
<Assignees
|
||||||
|
disabled={Boolean(entityData.owner)}
|
||||||
options={options}
|
options={options}
|
||||||
value={assignees}
|
value={assignees}
|
||||||
onChange={setAssignees}
|
onChange={setAssignees}
|
||||||
|
|||||||
@ -234,6 +234,7 @@ const UpdateDescription = () => {
|
|||||||
},
|
},
|
||||||
]}>
|
]}>
|
||||||
<Assignees
|
<Assignees
|
||||||
|
disabled={Boolean(entityData.owner)}
|
||||||
options={options}
|
options={options}
|
||||||
value={assignees}
|
value={assignees}
|
||||||
onChange={setAssignees}
|
onChange={setAssignees}
|
||||||
|
|||||||
@ -244,6 +244,7 @@ const UpdateTag = () => {
|
|||||||
},
|
},
|
||||||
]}>
|
]}>
|
||||||
<Assignees
|
<Assignees
|
||||||
|
disabled={Boolean(entityData.owner)}
|
||||||
options={options}
|
options={options}
|
||||||
value={assignees}
|
value={assignees}
|
||||||
onChange={setAssignees}
|
onChange={setAssignees}
|
||||||
|
|||||||
@ -27,6 +27,7 @@ interface Props {
|
|||||||
value: Option[];
|
value: Option[];
|
||||||
onSearch: (value: string) => void;
|
onSearch: (value: string) => void;
|
||||||
onChange: (values: Option[]) => void;
|
onChange: (values: Option[]) => void;
|
||||||
|
disabled?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Assignees: FC<Props> = ({
|
const Assignees: FC<Props> = ({
|
||||||
@ -34,6 +35,7 @@ const Assignees: FC<Props> = ({
|
|||||||
onSearch,
|
onSearch,
|
||||||
onChange,
|
onChange,
|
||||||
options,
|
options,
|
||||||
|
disabled,
|
||||||
}) => {
|
}) => {
|
||||||
const handleOnChange = (_values: Option[], newOptions: Option | Option[]) => {
|
const handleOnChange = (_values: Option[], newOptions: Option | Option[]) => {
|
||||||
const newValues = (newOptions as Option[]).map((option) => ({
|
const newValues = (newOptions as Option[]).map((option) => ({
|
||||||
@ -94,6 +96,7 @@ const Assignees: FC<Props> = ({
|
|||||||
className="ant-select-custom select-assignee"
|
className="ant-select-custom select-assignee"
|
||||||
data-testid="select-assignee"
|
data-testid="select-assignee"
|
||||||
defaultActiveFirstOption={false}
|
defaultActiveFirstOption={false}
|
||||||
|
disabled={disabled}
|
||||||
filterOption={false}
|
filterOption={false}
|
||||||
mode="multiple"
|
mode="multiple"
|
||||||
notFoundContent={null}
|
notFoundContent={null}
|
||||||
|
|||||||
@ -116,7 +116,7 @@ const UserPage = () => {
|
|||||||
if (userData.id === currentUser?.id) {
|
if (userData.id === currentUser?.id) {
|
||||||
updateCurrentUser(response);
|
updateCurrentUser(response);
|
||||||
}
|
}
|
||||||
setUserData(response);
|
setUserData((prev) => ({ ...prev, ...response }));
|
||||||
} else {
|
} else {
|
||||||
throw t('message.unexpected-error');
|
throw t('message.unexpected-error');
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user