-
Notifications
You must be signed in to change notification settings - Fork 4.3k
feat(html-report): Keep query when clicking project filter + ability to right-click #35400
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
Changes from all commits
1f9671e
779025d
41fbbae
dbaa64e
e25c86b
da38ddb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ import { CopyToClipboard } from './copyToClipboard'; | |
import './links.css'; | ||
import { linkifyText } from '@web/renderUtils'; | ||
import { clsx, useFlash } from '@web/uiUtils'; | ||
import { filterWithToken } from './filter'; | ||
|
||
export function navigate(href: string | URL) { | ||
window.history.pushState({}, '', href); | ||
|
@@ -54,12 +55,11 @@ export const Link: React.FunctionComponent<{ | |
}; | ||
|
||
export const ProjectLink: React.FunctionComponent<{ | ||
searchParams: URLSearchParams, | ||
projectNames: string[], | ||
projectName: string, | ||
}> = ({ projectNames, projectName }) => { | ||
const encoded = encodeURIComponent(projectName); | ||
const value = projectName === encoded ? projectName : `"${encoded.replace(/%22/g, '%5C%22')}"`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this logic was here to support project names with spaces/quotes inside. Otherwise, tokenizing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense. Should I make it generic such that it also works for annotations and such? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that would be great. |
||
return <Link href={`#?q=p:${value}`}> | ||
}> = ({ searchParams, projectNames, projectName }) => { | ||
return <Link click={filterWithToken(searchParams, `p:${projectName}`, false)} ctrlClick={filterWithToken(searchParams, `p:${projectName}`, true)}> | ||
<span className={clsx('label', `label-color-${projectNames.indexOf(projectName) % 6}`)} style={{ margin: '6px 0 0 6px' }}> | ||
{projectName} | ||
</span> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,9 +37,8 @@ export const TestFileView: React.FC<React.PropsWithChildren<{ | |
expanded={isFileExpanded(file.fileId)} | ||
noInsets={true} | ||
setExpanded={(expanded => setFileExpanded(file.fileId, expanded))} | ||
header={<span> | ||
{file.fileName} | ||
</span>}> | ||
header={<span>{file.fileName}</span>} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like unrelated formatting change? |
||
> | ||
{file.tests.map(test => | ||
<div key={`test-${test.testId}`} className={clsx('test-file-test', 'test-file-test-outcome-' + test.outcome)}> | ||
<div className='hbox' style={{ alignItems: 'flex-start' }}> | ||
|
@@ -51,8 +50,7 @@ export const TestFileView: React.FC<React.PropsWithChildren<{ | |
<Link href={testResultHref({ test }) + filterParam} title={[...test.path, test.title].join(' › ')}> | ||
<span className='test-file-title'>{[...test.path, test.title].join(' › ')}</span> | ||
</Link> | ||
{projectNames.length > 1 && !!test.projectName && | ||
<ProjectLink projectNames={projectNames} projectName={test.projectName} />} | ||
{projectNames.length > 1 && !!test.projectName && <ProjectLink searchParams={searchParams} projectNames={projectNames} projectName={test.projectName} />} | ||
<LabelsClickView labels={test.tags} /> | ||
</span> | ||
</div> | ||
|
@@ -108,9 +106,7 @@ const LabelsClickView: React.FC<React.PropsWithChildren<{ | |
|
||
const onClickHandle = (e: React.MouseEvent, label: string) => { | ||
e.preventDefault(); | ||
const q = searchParams.get('q')?.toString() || ''; | ||
const tokens = q.split(' '); | ||
navigate(filterWithToken(tokens, label, e.metaKey || e.ctrlKey)); | ||
navigate(filterWithToken(searchParams, label, e.metaKey || e.ctrlKey)); | ||
}; | ||
|
||
return labels.length > 0 ? ( | ||
|
Uh oh!
There was an error while loading. Please reload this page.