Skip to content

Commit

Permalink
Include "Raise an Issue" link on Test Review page
Browse files Browse the repository at this point in the history
  • Loading branch information
howard-e committed Nov 21, 2024
1 parent 977d2af commit 45e897c
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 7 deletions.
12 changes: 10 additions & 2 deletions client/components/SortableIssuesTable/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const SORT_FIELDS = {
CLOSED_AT: 'closedAt'
};

const SortableIssuesTable = ({ issues }) => {
const SortableIssuesTable = ({ issues, issueLink }) => {
const [activeSort, setActiveSort] = useState(SORT_FIELDS.STATUS);
const [sortOrder, setSortOrder] = useState(TABLE_SORT_ORDERS.ASC);
const [activeFilter, setActiveFilter] = useState('OPEN');
Expand Down Expand Up @@ -187,12 +187,20 @@ const SortableIssuesTable = ({ issues }) => {
{renderTableBody()}
</ThemeTable>
)}
{issueLink && (
<div style={{ marginTop: '1rem' }}>
<a href={issueLink} target="_blank" rel="noreferrer">
Raise an Issue
</a>
</div>
)}
</>
);
};

SortableIssuesTable.propTypes = {
issues: PropTypes.arrayOf(IssuePropType).isRequired
issues: PropTypes.arrayOf(IssuePropType).isRequired,
issueLink: PropTypes.string
};

export default SortableIssuesTable;
14 changes: 12 additions & 2 deletions client/components/TestReview/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { Fragment, useMemo, useState } from 'react';
import { useQuery } from '@apollo/client';
import { TEST_REVIEW_PAGE_QUERY } from './queries';
import { Container } from 'react-bootstrap';
import { Link, useParams } from 'react-router-dom';
import { Link, useLocation, useParams } from 'react-router-dom';
import { Helmet } from 'react-helmet';
import PageStatus from '../common/PageStatus';
import InstructionsRenderer from '../CandidateReview/CandidateTestPlanRun/InstructionsRenderer';
Expand All @@ -12,6 +12,7 @@ import { derivePhaseName } from '../../utils/aria';
import { dates } from 'shared';
import supportJson from '../../resources/support.json';
import SortableIssuesTable from '../SortableIssuesTable';
import createIssueLink from '../../utils/createIssueLink';

const Ul = styled.ul`
li {
Expand All @@ -28,6 +29,7 @@ const FilterButtonContainer = styled.div`
`;

const TestReview = () => {
const location = useLocation();
const { testPlanVersionId } = useParams();

const { loading, data, error } = useQuery(TEST_REVIEW_PAGE_QUERY, {
Expand Down Expand Up @@ -237,7 +239,15 @@ const TestReview = () => {
}
)}
</ul>
<SortableIssuesTable issues={issues} />
<SortableIssuesTable
issues={issues}
issueLink={createIssueLink({
testPlanTitle: testPlanVersion.title,
testPlanDirectory: testPlanVersion.testPlan.directory,
versionString: testPlanVersion.versionString,
testReviewLink: `https://aria-at-.w3.org${location.pathname}`
})}
/>
<h2>Tests</h2>
<FilterButtonContainer>
<FilterButtons
Expand Down
1 change: 0 additions & 1 deletion client/components/TestRun/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import { evaluateAuth } from '../../utils/evaluateAuth';
import './TestRun.css';
import ReviewConflicts from '../ReviewConflicts';
import createIssueLink from '../../utils/createIssueLink';
import { dates } from 'shared';
import { Provider as CollectionJobContextProvider } from './CollectionJobContext';
import { useUrlTestIndex } from '../../hooks/useUrlTestIndex';

Expand Down
16 changes: 14 additions & 2 deletions client/utils/createIssueLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const GITHUB_ISSUES_URL =
? 'https://github.com/w3c/aria-at'
: 'https://github.com/bocoup/aria-at';

// TODO: Use At.key
const atLabelMap = {
'VoiceOver for macOS': 'vo',
JAWS: 'jaws',
Expand Down Expand Up @@ -46,7 +47,8 @@ const createIssueLink = ({
browserName = null,
browserVersionName = null,
conflictMarkdown = null,
reportLink = null
reportLink = null,
testReviewLink = null
}) => {
if (!(testPlanDirectory || testPlanTitle || versionString || atName)) {
throw new Error('Cannot create issue link due to missing parameters');
Expand Down Expand Up @@ -74,7 +76,8 @@ const createIssueLink = ({
`${titleStart}: "${testTitle}" (${testPlanTitle}, ` +
`Test ${testSequenceNumber}, ${versionString})`;
} else {
title = `${atName} General Feedback: ${testPlanTitle} ${versionString}`;
title = `General Feedback: ${testPlanTitle} ${versionString}`;
if (atName) title = `${atName} ${title}`;
}

const labels =
Expand Down Expand Up @@ -121,6 +124,13 @@ const createIssueLink = ({
'\n';
}

let metadataFormatted = '';
let testReviewLinkFormatted = '';
if (testReviewLink) {
testReviewLinkFormatted = `- Test Review Page: [Link](${testReviewLink})\n`;
metadataFormatted = `## Metadata\n\n` + testReviewLinkFormatted + '\n';
}

const hiddenIssueMetadata = JSON.stringify({
testPlanDirectory,
versionString,
Expand All @@ -136,6 +146,7 @@ const createIssueLink = ({
`## Description of Behavior\n\n` +
`<!-- Write your description here -->\n\n` +
testSetupFormatted +
metadataFormatted +
`<!-- The following data allows the issue to be imported into the ` +
`ARIA AT App -->\n` +
`<!-- ARIA_AT_APP_ISSUE_DATA = ${hiddenIssueMetadata} -->`;
Expand Down Expand Up @@ -172,6 +183,7 @@ export const getIssueSearchLink = ({
versionString,
testSequenceNumber = null
}) => {
// TODO: Use At.key
let atKey;
if (atName === 'JAWS' || atName === 'NVDA') {
atKey = atName.toLowerCase();
Expand Down

0 comments on commit 45e897c

Please sign in to comment.