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

NOJIRA added copy button in poppermenu #426

Open
wants to merge 2 commits into
base: master
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
3 changes: 2 additions & 1 deletion frontend/public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"skipped": "Skipped",
"skip": "Skip",
"undefined": "Undefined",
"copy": "Copy",
"steps": "Steps",
"backgroundSteps": "Background Steps",
"skipAllSteps": "Skip All Steps",
Expand Down Expand Up @@ -66,4 +67,4 @@
"blocked": "This tag cannot be assigned",
"unassigned": "Unassigned"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ const useStyles = makeStyles(() =>

interface Props {
stepId: number;
stepName: string;
status: Status;
onStepStatusChange(e: MouseEvent<HTMLElement>, stepId: number, status: Status, newStatus: Status): void;
}

const PopperMenu: FC<Props> = ({ stepId, status, onStepStatusChange }) => {
const PopperMenu: FC<Props> = ({ stepId, stepName, status, onStepStatusChange }) => {
const classes = useStyles();
const { t } = useTranslation();
const ref = useRef(null);
Expand All @@ -45,6 +46,11 @@ const PopperMenu: FC<Props> = ({ stepId, status, onStepStatusChange }) => {
</ListItem>
);

const copyStepNameToClipboard = (event: MouseEvent<HTMLElement>): void => {
event.stopPropagation();
navigator.clipboard.writeText(stepName);
};

return (
<span ref={ref} onMouseEnter={(): void => setOpen(true)} onMouseLeave={(): void => setOpen(false)}>
<IconButton className={classes.moreButton}>
Expand All @@ -59,6 +65,9 @@ const PopperMenu: FC<Props> = ({ stepId, status, onStepStatusChange }) => {
{renderListItem(Failed)}
{renderListItem(Skipped)}
{renderListItem(Undefined)}
<ListItem button onClick={(e: MouseEvent<HTMLElement>): void => copyStepNameToClipboard(e)}>
{t('report.copy')}
</ListItem>
</List>
</Card>
</Fade>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const ScenarioStep: FC<Props> = ({ scenarioId, build, title, steps, classes }) =
<div className={stepTextClasses}>
<span className={classes.stepKeyword}>{step.keyword}</span>
<span>{`${step.name} `}</span>
<PopperMenu stepId={step.id} status={status} onStepStatusChange={onStepStatusChange} />
<PopperMenu stepId={step.id} stepName={step.name} status={status} onStepStatusChange={onStepStatusChange} />
</div>
{step.rows ? <CucumberTable rows={step.rows} /> : null}
</Box>
Expand Down