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

fix: prevent reassignment of bot run before status is completed, cancelled, or errored #1300

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions client/components/ManageBotRunDialog/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import RetryCanceledCollectionsButton from './RetryCanceledCollectionsButton';
import StopRunningCollectionButton from './StopRunningCollectionButton';
import ViewLogsButton from './ViewLogsButton';
import { TestPlanRunPropType, UserPropType } from '../common/proptypes';
import { COLLECTION_JOB_STATUS } from '../../utils/collectionJobStatus';

const ManageBotRunDialog = ({
testPlanReportId,
Expand Down Expand Up @@ -68,6 +69,19 @@ const ManageBotRunDialog = ({
[testers, testPlanReportAssignedTestersQuery]
);

const isBotRunFinished = useMemo(() => {
const status = collectionJobQuery?.collectionJobByTestPlanRunId?.status;
if (!status) return false;
switch (status) {
case COLLECTION_JOB_STATUS.COMPLETED:
case COLLECTION_JOB_STATUS.ERROR:
case COLLECTION_JOB_STATUS.CANCELLED:
return true;
default:
return false;
}
}, [collectionJobQuery]);

const actions = useMemo(() => {
return [
{
Expand All @@ -77,6 +91,7 @@ const ManageBotRunDialog = ({
testPlanRun: testPlanRun,
possibleTesters: possibleReassignees,
label: 'Assign To ...',
disabled: !isBotRunFinished,
onChange
}
},
Expand Down
5 changes: 4 additions & 1 deletion client/components/common/AssignTesterDropdown/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const AssignTesterDropdown = ({
possibleTesters,
onChange,
label,
disabled = false,
dropdownAssignTesterButtonRef,
setAlertMessage = () => {}
}) => {
Expand Down Expand Up @@ -139,6 +140,7 @@ const AssignTesterDropdown = ({
aria-label="Assign testers"
className="assign-tester"
variant="secondary"
disabled={disabled}
>
{renderLabel()}
</Dropdown.Toggle>
Expand Down Expand Up @@ -216,7 +218,8 @@ AssignTesterDropdown.propTypes = {
label: PropTypes.string,
draftTestPlanRuns: PropTypes.arrayOf(TestPlanRunPropType),
setAlertMessage: PropTypes.func,
dropdownAssignTesterButtonRef: PropTypes.object
dropdownAssignTesterButtonRef: PropTypes.object,
disabled: PropTypes.bool
};

export default AssignTesterDropdown;
Loading