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

Import feature: show the differences of an element when it is updated by an import (and refactor) #810

Open
wants to merge 202 commits into
base: dev-2.2.0
Choose a base branch
from

Conversation

MyPyDavid
Copy link
Member

@MyPyDavid MyPyDavid commented Nov 1, 2023

Description

This PR implements a text difference viewer for the import of RDMO content elements (catalogs, optionsets, etc..).
It uses the react-diff-viewer-continued to display the changes during an import. In the back-end a sort of "track changes" function tracks the current and new state of each element which is returned in the json response.
The code architecture of the import is refactored into one central import function under management with helpers for each type of element.

Related issue: #468

Includes bug fix for: #998

Motivation and Context

How has this been tested?

Screenshots (if appropriate)

Currently:

management-import-optionsets-1-changes

previous version ![management-import-optionsets-1-changes](https://github.com/rdmorganiser/rdmo/assets/13996213/e5fcb01c-bc8e-4c86-9b89-4318fd015c47)
older previous version ![management-import-optionsets-1-changes](https://github.com/rdmorganiser/rdmo/assets/13996213/afec9fae-839b-496f-a817-5329f4167a45)

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Code style update (formatting, renaming)
    • some type hints have been added to the new code
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

Checklist

  • I have read the contributor guide.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
    • also added more front end e2e tests
  • All new and existing tests passed.

Still todo

Front-end

  • add filter on top of import page
  • add info messages summary on top of import page
  • button to show only the changed elements

@jochenklar jochenklar added this to the 2.2.0 milestone Nov 24, 2023
@jochenklar jochenklar changed the base branch from dev-2.1.0 to dev-2.2.0 December 12, 2023 13:46
@MyPyDavid MyPyDavid changed the title Show the differences of an element when it is updated by an import Show the differences of an element when it is updated by an import (and refactor import) Apr 4, 2024
@MyPyDavid MyPyDavid marked this pull request as ready for review April 11, 2024 09:52
@MyPyDavid
Copy link
Member Author

MyPyDavid commented Apr 26, 2024

  • fix the actions in the sidebar

@MyPyDavid MyPyDavid changed the title Show the differences of an element when it is updated by an import (and refactor import) Import feature: show the differences of an element when it is updated by an import (and refactor) May 15, 2024
package-lock.json Outdated Show resolved Hide resolved
rdmo/conditions/imports.py Outdated Show resolved Hide resolved
rdmo/core/constants.py Show resolved Hide resolved
rdmo/core/constants.py Show resolved Hide resolved
rdmo/core/import_helpers.py Outdated Show resolved Hide resolved
rdmo/core/xml.py Outdated Show resolved Hide resolved
rdmo/management/imports.py Show resolved Hide resolved
rdmo/management/imports.py Outdated Show resolved Hide resolved
rdmo/management/imports.py Outdated Show resolved Hide resolved
rdmo/management/imports.py Show resolved Hide resolved
@jochenklar
Copy link
Member

I am sorry, there is more work to do on the css. Paddings and margins are off all over the place.

@jochenklar
Copy link
Member

jochenklar commented May 16, 2024

Screenshot_2024-05-16_15-08-24

The padding needs to align with the rest of the panel.

I think we should only use the <code> for URIs or Element/Model names. Just Normal font should suffice. Also the "Changed:" label in the front is redundant.

MyPyDavid and others added 22 commits July 3, 2024 11:34
@MyPyDavid
Copy link
Member Author

rebased to dev-2.2.0 and force pushed

@jochenklar
Copy link
Member

I think new is great since we use new/neu also in the interface.

@MyPyDavid
Copy link
Member Author

ok, changed the text to "new"
and added (new from dev-220) the short_title field to the import helpers

@jochenklar
Copy link
Member

Sorry I found more bugs:

  • if you upload and import a faulty file the message is missleading:

image

with this xml

<?xml version="1.0" encoding="UTF-8"?>
<rdmo xmlns:dc="http:https://purl.org/dc/elements/1.1/" created="2024-07-01T10:53:07.185903+02:00" version="2.2.0.dev1">
	<question dc:uri="http:https://example.com/terms/questions/catalog/blocks/set/block/b">
		<uri_prefix>http:https://example.com/terms</uri_prefix>
	</question>
</rdmo>

(GitHub does not allow XML uploads)

  • For the same file: I got this

image

after I click Question or click show. I think this is also because of the broken xml file, so it is not super important.

  • I would remove the onClick on the created/updated badge or add cursor: pointer; using css, upt to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants