Skip to content

Commit

Permalink
task/WC-91: Directories in Publication Preview should open in the Cur…
Browse files Browse the repository at this point in the history
…ation listing (#1425)

* Directories in Publication Preview open in the Curation listing

* fix links inside the publication pipeline

* revert link _target change
  • Loading branch information
jarosenb authored Sep 5, 2024
1 parent c9ce7ad commit 541144e
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ export const PipelineOtherSelectFiles: React.FC<{
api="tapis"
system={`project-${data.baseProject.uuid}`}
fileTags={data.baseProject.value.fileTags}
baseRoute={`/projects/${projectId}/curation`}
/>
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,62 +40,64 @@ export const EntityFileListingTable: React.FC<{
path?: string;
selectedFile?: TFileListing;
}>({ isOpen: false });

const { projectId } = useParams();
const doi = useDoiContext();
const columns: TFileListingColumns = [
{
title: 'File Name',
dataIndex: 'name',
ellipsis: true,
render: (data, record) => (
<div>
{record.type === 'dir' ? (
<Link
className="listing-nav-link"
to={`./${encodeURIComponent(record.path)}${
doi ? `?doi=${doi}` : ''
}`}
style={{ pointerEvents: preview ? 'none' : 'all' }}
replace={false}
>
<i
role="none"
style={{ color: '#333333' }}
className="fa fa-folder"
>
&nbsp;&nbsp;
</i>
{data}
</Link>
) : (
<>
<FileTypeIcon name={record.name} />
&nbsp;&nbsp;
<Button
type="link"
onClick={() =>
setPreviewModalState({
isOpen: true,
path: record.path,
selectedFile: { ...record, doi },
})
}
render: (data, record) => {
const fileNavPath = preview
? `/projects/${projectId}/curation/${encodeURIComponent(record.path)}`
: `./${encodeURIComponent(record.path)}${doi ? `?doi=${doi}` : ''}`;
return (
<div>
{record.type === 'dir' ? (
<Link
className="listing-nav-link"
to={fileNavPath}
replace={false}
>
<i
role="none"
style={{ color: '#333333' }}
className="fa fa-folder"
>
&nbsp;&nbsp;
</i>
{data}
</Button>
</>
)}
<div>
{treeData.value.fileTags
.filter((t) => t.path === record.path)
.map((t) => (
<Tag color="#337ab7" key={t.tagName}>
{t.tagName}
</Tag>
))}
</Link>
) : (
<>
<FileTypeIcon name={record.name} />
&nbsp;&nbsp;
<Button
type="link"
onClick={() =>
setPreviewModalState({
isOpen: true,
path: record.path,
selectedFile: { ...record, doi },
})
}
>
{data}
</Button>
</>
)}
<div>
{treeData.value.fileTags
.filter((t) => t.path === record.path)
.map((t) => (
<Tag color="#337ab7" key={t.tagName}>
{t.tagName}
</Tag>
))}
</div>
</div>
</div>
),
);
},
},
];
return (
Expand Down

0 comments on commit 541144e

Please sign in to comment.