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

filter user annotations in all flows #773

Open
wants to merge 16 commits into
base: develop
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
13 changes: 7 additions & 6 deletions src/redux/actions/api/LSFAPI/LSFAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const patchAnnotation = async (
});
return res;
} catch (err) {
return err;
return { err, status: 400 };
}
};

Expand All @@ -133,7 +133,7 @@ const patchReview = async (
autoSave=false
) => {
try {
await axiosInstance.patch(`/annotation/${annotationID}/`, {
const res = await axiosInstance.patch(`/annotation/${annotationID}/`, {
lead_time: (new Date() - load_time) / 1000 + Number(lead_time ?? 0),
annotation_status: review_status,
result: result,
Expand All @@ -150,13 +150,14 @@ const patchReview = async (
}),
...(autoSave && { auto_save: true }),
});
return res;
// if (review_status === "to_be_revised") {
// await axiosInstance.patch(`/annotation/${parentAnnotation}/`, {
// annotation_status: review_status,
// });
// }
} catch (err) {
return err;
return { err, status: 400 };
}
};

Expand All @@ -173,17 +174,17 @@ const patchSuperChecker = async (
) => {
console.log(superchecknotes,"superchecknotes")
try {
await axiosInstance.patch(`/annotation/${annotationID}/`, {
const res = await axiosInstance.patch(`/annotation/${annotationID}/`, {
lead_time: (new Date() - load_time) / 1000 + Number(lead_time ?? 0),
annotation_status: review_status,
result: result,
parent_annotation: parentAnnotation,
supercheck_notes: superchecknotes,
...(autoSave && { auto_save: true }),
});

return res;
} catch (err) {
return err;
return { err, status: 400 };
}
};

Expand Down
243 changes: 126 additions & 117 deletions src/ui/pages/component/CL-Transcription/SuperCheckerStageButtons.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ const SuperCheckerStageButtons = ({
disableSkip,
anchorEl,
setAnchorEl,
filterMessage,
disableBtns,
// taskData,
}) => {
// const classes = AudioTranscriptionLandingStyle();
Expand Down Expand Up @@ -127,7 +129,7 @@ const SuperCheckerStageButtons = ({
</div>

<Grid container spacing={1} sx={{ mt: 2, mb: 5, ml: 3 }}>
<Grid item>
{!disableBtns && <Grid item>
{taskData?.super_check_user === user?.id && (
<Tooltip title="Save task for later">
<Button
Expand All @@ -154,7 +156,7 @@ const SuperCheckerStageButtons = ({
</Button>
</Tooltip>
)}
</Grid>
</Grid>}

<Grid item>
<Tooltip title="Go to next task">
Expand All @@ -175,137 +177,144 @@ const SuperCheckerStageButtons = ({
</Tooltip>
</Grid>

<Grid item>
{!disableSkip && taskData?.super_check_user === user?.id && (
<Tooltip title="skip to next task">
<Button
value="Skip"
type="default"
variant="outlined"
{!disableBtns && <>
<Grid item>
{!disableSkip && taskData?.super_check_user === user?.id && (
<Tooltip title="skip to next task">
<Button
value="Skip"
type="default"
variant="outlined"
onClick={() =>
handleSuperCheckerClick(
"skipped",
SuperChecker.id,
SuperChecker.lead_time,
)
}
style={{
minWidth: "120px",
border: "1px solid gray",
color: "#d00",
pt: 2,
pb: 2,
}}
// className="lsf-button"
>
Skip
</Button>
</Tooltip>
)}
</Grid>
<Grid item>
{taskData?.super_check_user === user?.id && (
<Tooltip title="Reject">
<Button
value="rejected"
type="default"
variant="outlined"
onClick={() =>
handleSuperCheckerClick(
"rejected",
SuperChecker.id,
SuperChecker.lead_time,
SuperChecker.parent_annotation
)
}
disabled={
ProjectData.revision_loop_count >
taskData?.revision_loop_count?.super_check_count
? false
: true
}
style={{
minWidth: "120px",
border: "1px solid gray",
color: (
ProjectData.revision_loop_count >
taskData?.revision_loop_count?.super_check_count
? false
: true
)
? "#B2BABB"
: "#f5222d",
pt: 2,
pb: 2,
}}
>
Reject
</Button>
</Tooltip>
)}
</Grid>
<Grid item>
{taskData?.super_check_user === user?.id && (
<Tooltip title="Validate">
<Button
id="accept-button"
value="Validate"
type="default"
aria-controls={open ? "accept-menu" : undefined}
aria-haspopup="true"
aria-expanded={open ? "true" : undefined}
style={{
minWidth: "120px",
border: "1px solid gray",
color: "#52c41a",
pt: 3,
pb: 3,
}}
onClick={handleClick}
endIcon={<KeyboardArrowDownIcon />}
>
Validate
</Button>
</Tooltip>
)}
<StyledMenu
id="accept-menu"
MenuListProps={{
"aria-labelledby": "accept-button",
}}
anchorEl={anchorEl}
open={open}
onClose={handleClose}
>
<MenuItem
onClick={() =>
handleSuperCheckerClick(
"skipped",
"validated",
SuperChecker.id,
SuperChecker.lead_time,
SuperChecker.parent_annotation
)
}
style={{
minWidth: "120px",
border: "1px solid gray",
color: "#d00",
pt: 2,
pb: 2,
}}
// className="lsf-button"
disableRipple
>
Skip
</Button>
</Tooltip>
)}
</Grid>
<Grid item>
{taskData?.super_check_user === user?.id && (
<Tooltip title="Reject">
<Button
value="rejected"
type="default"
variant="outlined"
Validated No Changes
</MenuItem>
<MenuItem
onClick={() =>
handleSuperCheckerClick(
"rejected",
"validated_with_changes",
SuperChecker.id,
SuperChecker.lead_time,
SuperChecker.parent_annotation
)
}
disabled={
ProjectData.revision_loop_count >
taskData?.revision_loop_count?.super_check_count
? false
: true
}
style={{
minWidth: "120px",
border: "1px solid gray",
color: (
ProjectData.revision_loop_count >
taskData?.revision_loop_count?.super_check_count
? false
: true
)
? "#B2BABB"
: "#f5222d",
pt: 2,
pb: 2,
}}
>
Reject
</Button>
</Tooltip>
)}
</Grid>
<Grid item>
{taskData?.super_check_user === user?.id && (
<Tooltip title="Validate">
<Button
id="accept-button"
value="Validate"
type="default"
aria-controls={open ? "accept-menu" : undefined}
aria-haspopup="true"
aria-expanded={open ? "true" : undefined}
style={{
minWidth: "120px",
border: "1px solid gray",
color: "#52c41a",
pt: 3,
pb: 3,
}}
onClick={handleClick}
endIcon={<KeyboardArrowDownIcon />}
disableRipple
>
Validate
</Button>
</Tooltip>
)}
<StyledMenu
id="accept-menu"
MenuListProps={{
"aria-labelledby": "accept-button",
}}
anchorEl={anchorEl}
open={open}
onClose={handleClose}
>
<MenuItem
onClick={() =>
handleSuperCheckerClick(
"validated",
SuperChecker.id,
SuperChecker.lead_time,
SuperChecker.parent_annotation
)
}
disableRipple
>
Validated No Changes
</MenuItem>
<MenuItem
onClick={() =>
handleSuperCheckerClick(
"validated_with_changes",
SuperChecker.id,
SuperChecker.lead_time,
SuperChecker.parent_annotation
)
}
disableRipple
>
Validated with Changes
</MenuItem>
</StyledMenu>
</Grid>
Validated with Changes
</MenuItem>
</StyledMenu>
</Grid>
</>}
</Grid>
{filterMessage && (
<Alert severity="info" sx={{ ml:2,mb: 2,width:"95%" }}>
{filterMessage}
</Alert>
)}
</>
);
};
Expand Down
1 change: 1 addition & 0 deletions src/ui/pages/component/common/Tooltip.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const LightTooltip = styled(({ className, ...props }) => (
color: 'rgba(0, 0, 0, 0.87)',
boxShadow: theme.shadows[1],
fontSize: 11,
maxWidth: 400,
},
}));

Expand Down
Loading