Skip to content

fix: use retraction_reason in file view alert #410

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

Open
wants to merge 4 commits into
base: main
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
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ smaht-portal
Change Log
----------

0.167.1
=======
`PR 410 fix: use retraction_reason in file view alert <https://github.com/smaht-dac/smaht-portal/pull/410>`

* Use retraction_reason property to create file overview alert string instead of notes_to_tsv


0.167.0
=======
`PR 412 Submission Status page: Add Donor and Tissue select fields <https://github.com/smaht-dac/smaht-portal/pull/412>`
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "encoded"
version = "0.167.0"
version = "0.167.1"
description = "SMaHT Data Analysis Portal"
authors = ["4DN-DCIC Team <[email protected]>"]
license = "MIT"
Expand Down
30 changes: 25 additions & 5 deletions src/encoded/static/components/item-pages/FileView.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,14 @@ const FileViewHeader = (props) => {
status,
description,
notes_to_tsv,
retraction_reason = '',
release_tracker_description = '',
release_tracker_title = '',
} = context;
const selectedFile = new Map([[context['@id'], context]]);

// Accessions of files whose alert banners are rendered differently
const accessionsOfInterest = ['SMAFI557D2E7', 'SMAFIB6EQLZM'];
const accessionsOfInterest = ['SMAFIB6EQLZM'];

// Prepare a message string for the retracted warning banner
let retractedWarningMessage = '';
Expand All @@ -109,14 +110,33 @@ const FileViewHeader = (props) => {
const description =
release_tracker_description ||
`${context?.file_format?.display_title} file`;
const note = context?.notes_to_tsv?.[0]
? `was ${context?.notes_to_tsv?.[0]}`
: 'was retracted';

const retraction = retraction_reason
? `was retracted due to ${retraction_reason
.substring(0, 1)
.toLowerCase()}${retraction_reason.substring(1)}`
: `was retracted`;

const replacement = context?.replaced_by ? (
<>
The replacement is made {''}
<a
href={context?.replaced_by?.['@id']}
target="_blank"
rel="noreferrer noopener"
className="link-underline-hover">
available here
</a>
.
</>
) : (
''
);

retractedWarningMessage = (
<>
This {description}
{title} {note}.
{title} {retraction}. {replacement}
</>
);
}
Expand Down
Loading