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

Dataset Page: apply markdown transforming only to TEXTBOX type fields #588

Conversation

ChengShi-1
Copy link
Contributor

@ChengShi-1 ChengShi-1 commented Jan 24, 2025

What this PR does / why we need it:

Related issue: IQSS/dataverse-client-javascript#244

We would move html to markdown transformation from js-dataverse repo to this frontend repo in dataset pages. We assume we will get raw dataset summary and metadata info from js-dataverse, and then we'll deal with the format transformation issue. Only if the field is in textbox type, we'll transform html tags into markdown.

  • Update keepRawField = true parameter so as to getDataset with raw data
  • Update markdown component, allow transforming HTML to markdown
  • Update JSMetadataBlockInfoMapper.ts, get type of fields
  • Apply markdown component if type == 'TEXTBOX'

Which issue(s) this PR closes:

Special notes for your reviewer:

Suggestions on how to test this:

npm i.& npm run build to update package.json
Check the HTML Tags
Overall, the Edit/Create dataset page should always give html tags and whatever is entered. Some TEXTBOX fields in Dataset (summary/citation metadata) page, should display in HTML format.

  1. Create a Dataset
  • Fill out the form, and give some html tags to fields. such as <b> description </b>

TEXTBOX fields, should display HTML include: Description, Related Publication, Notes (EDIT page: Related Material, Related Dataset, Data Source, Origin of Historical Sources, Characteristic of Sources, Documentation and Access to Sources) Other than these fields, should go with plain text .

  1. Check Dataset Summary and MetadataDisplay
  • On the dataset page, if it's TEXTBOX type, it should shown with the HTML styles and without HTML tags. For instance, <b>test</b> should render correctly as test (bold). (see image below)
  • If the field is not in TEXTBOX fields, such as subtitle and keywords, should be <b>test</b> included html tag if input tags, not as the rendered bold text or plain text.
  • Check the format in both summary part and Metadata tab > Citation Metadata
    image
    image
  1. Edit the Dataset Metadata
  • Verify that when the dataset metadata opens for editing, the pre-filled text in fields matches exactly what was entered during creation, with html tags.
  • On the edit page, the field should display exactly what you entered: <b>test</b>, always with html tags if they're put, not as the rendered bold text or plain text.
    image
  1. Save Changes and Confirm Updates
  • After saving the edited metadata, verify that all changes successfully update on the dataset display page.

Check the underscore escaping
refered to IQSS/dataverse-client-javascript#241

  1. Create a Dataset
  • Fill out the form, and give some underscores and other symbols to fields. such as __description/title__
  1. Check Dataset Summary and MetadataDisplay
  • On the dataset page, check if the underscore work well without extra characters or symbols.
  1. Edit the Dataset Metadata
  • Verify that when the dataset metadata opens for editing, the pre-filled text in fields matches exactly what was entered during creation.
  1. Save Changes and Confirm Updates
  • After saving the edited metadata, verify that all changes successfully update on the dataset display page.

Does this PR introduce a user interface change? If mockups are available, please link/include them here:

Is there a release notes update needed for this change?:

Additional documentation:

@ChengShi-1 ChengShi-1 linked an issue Jan 24, 2025 that may be closed by this pull request
@ChengShi-1 ChengShi-1 added bug Something isn't working SPA: Dataset page (View) SPA: Edit Dataset Page GREI Re-arch GREI re-architecture-related SPA.Q1 Not related to any specific Q1 feature FY25 Sprint 15 FY25 Sprint 15 (2025-01-15 - 2025-01-29) labels Jan 24, 2025
@coveralls
Copy link

coveralls commented Jan 24, 2025

Coverage Status

coverage: 97.324% (+0.1%) from 97.204%
when pulling 8f02002 on 587-edit-dataset-page-do-not-transform-metadata-values-to-markdown
into 27cb2f4 on develop.

@ChengShi-1 ChengShi-1 added Size: 3 A percentage of a sprint. 2.1 hours. Original size: 3 labels Jan 24, 2025
@ekraffmiller ekraffmiller self-assigned this Jan 24, 2025
@ekraffmiller

This comment was marked as outdated.

@ekraffmiller

This comment was marked as outdated.

@cmbz cmbz added the FY25 Sprint 16 FY25 Sprint 16 (2025-01-29 - 2025-02-12) label Jan 30, 2025
@ChengShi-1 ChengShi-1 self-assigned this Feb 3, 2025
@ChengShi-1 ChengShi-1 marked this pull request as ready for review February 5, 2025 18:30
@ChengShi-1 ChengShi-1 removed their assignment Feb 5, 2025
@g-saracca g-saracca self-assigned this Feb 6, 2025
g-saracca
g-saracca previously approved these changes Feb 13, 2025
Copy link
Contributor

@g-saracca g-saracca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, approving

@ofahimIQSS
Copy link
Contributor

ofahimIQSS commented Feb 18, 2025

On this step I have come across an observation: On the edit page, the field should display exactly what you entered: test, not as the rendered bold text or plain text.

When I enter my HTML description, it doesn't save the HTML tags when I go back to edit it:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HTML Elements Example</title>
</head>
<body>

    <a href="https://www.example.com">This is a link</a><br>

    <b>Bold text</b><br>

    <blockquote>This is a blockquote.</blockquote>

    <br> <!-- Line break -->

    <code>console.log("Hello, World!");</code><br>

    <del>Deleted text</del><br>

    <dl>
        <dt>Term 1</dt>

@ChengShi-1 ChengShi-1 self-assigned this Feb 19, 2025
@ChengShi-1 ChengShi-1 assigned g-saracca and unassigned ChengShi-1 Feb 19, 2025
@ChengShi-1 ChengShi-1 requested a review from g-saracca February 19, 2025 20:08
@ChengShi-1
Copy link
Contributor Author

@g-saracca Hi German, please help to re-review it, thank you! I forgot add transform function to subfields before, so I apply it to subfields. I didn't add tests because after merging with dev branch, the test coverage pass magically

Copy link
Contributor

@g-saracca g-saracca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good!

@g-saracca g-saracca removed their assignment Feb 19, 2025
@ofahimIQSS
Copy link
Contributor

Im still seeing the same issue - if i put in my HTML code as mentioned above, I come back to edit the Collections description, I am unable to see the input with the HTML tags.
Please let me know if i'm misunderstanding anything.

Screen.Recording.2025-02-21.at.11.20.47.AM.mov

@ChengShi-1
Copy link
Contributor Author

Im still seeing the same issue - if i put in my HTML code as mentioned above, I come back to edit the Collections description, I am unable to see the input with the HTML tags. Please let me know if i'm misunderstanding anything.

Screen.Recording.2025-02-21.at.11.20.47.AM.mov

@ofahimIQSS Hi Omer, thanks for testing. This PR changes only work for Dataset related pages. The collection would be fixed #608 here

@ChengShi-1 ChengShi-1 changed the title fix: update keepRawFields to prevent markdown Dataset Page: apply markdown transforming only to TEXTBOX type fields Feb 21, 2025
Copy link
Contributor

@g-saracca g-saracca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ChengShi-1, remember to install turndown library and don't use the js-dataverse peer dependency turndown library.

@ofahimIQSS
Copy link
Contributor

getting this error now:
image

@ChengShi-1
Copy link
Contributor Author

getting this error now: image

Hi Omer, please try cd dataverse-frontend to the front end folder and then run npm i again see if it works

Copy link
Contributor

@g-saracca g-saracca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reapproving, thanks cheng!

@ofahimIQSS
Copy link
Contributor

testing passed- Merging PR

@ofahimIQSS ofahimIQSS merged commit 64ab9a7 into develop Feb 24, 2025
10 of 14 checks passed
@ofahimIQSS ofahimIQSS deleted the 587-edit-dataset-page-do-not-transform-metadata-values-to-markdown branch February 24, 2025 16:40
@ofahimIQSS ofahimIQSS removed their assignment Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working FY25 Sprint 15 FY25 Sprint 15 (2025-01-15 - 2025-01-29) FY25 Sprint 16 FY25 Sprint 16 (2025-01-29 - 2025-02-12) FY25 Sprint 17 FY25 Sprint 17 (2025-02-12 - 2025-02-26) GREI Re-arch GREI re-architecture-related Original size: 3 Size: 3 A percentage of a sprint. 2.1 hours. SPA: Dataset page (View) SPA: Edit Dataset Page SPA.Q1 Not related to any specific Q1 feature
Projects
Status: Done 🧹
Development

Successfully merging this pull request may close these issues.

Edit Dataset Page: do not transform metadata values to markdown
6 participants