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

iso19139 - Update thumbnail add/update and remove to support index update/removal #8348

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

ianwallen
Copy link
Contributor

@ianwallen ianwallen commented Sep 4, 2024

In the case where we have the following list of images that were imported.

         <gmd:graphicOverview>
            <gmd:MD_BrowseGraphic>
               <gmd:fileName>
                  <gco:CharacterString>http://localhost:8080/geonetwork/srv/api/records/d14ed343-96a9-4e36-a639-b71def9f6cc0/attachments/test1.png</gco:CharacterString>
               </gmd:fileName>
               <gmd:fileDescription>
                  <gco:CharacterString>Image 1</gco:CharacterString>
               </gmd:fileDescription>
            </gmd:MD_BrowseGraphic>
         </gmd:graphicOverview>
         <gmd:graphicOverview>
            <gmd:MD_BrowseGraphic>
               <gmd:fileName>
                  <gco:CharacterString>http://localhost:8080/geonetwork/srv/api/records/d14ed343-96a9-4e36-a639-b71def9f6cc0/attachments/test2.png</gco:CharacterString>
               </gmd:fileName>
               <gmd:fileDescription>
                  <gco:CharacterString>Image 2</gco:CharacterString>
               </gmd:fileDescription>
            </gmd:MD_BrowseGraphic>
         </gmd:graphicOverview>
         <gmd:graphicOverview>
            <gmd:MD_BrowseGraphic>
               <gmd:fileName>
                  <gco:CharacterString>http://localhost:8080/geonetwork/srv/api/records/d14ed343-96a9-4e36-a639-b71def9f6cc0/attachments/test1.png</gco:CharacterString>
               </gmd:fileName>
               <gmd:fileDescription>
                  <gco:CharacterString>Image 3</gco:CharacterString>
               </gmd:fileDescription>
            </gmd:MD_BrowseGraphic>
         </gmd:graphicOverview>
         <gmd:graphicOverview>
            <gmd:MD_BrowseGraphic>
               <gmd:fileName>
                  <gco:CharacterString>http://localhost:8080/geonetwork/srv/api/records/d14ed343-96a9-4e36-a639-b71def9f6cc0/attachments/test2.png</gco:CharacterString>
               </gmd:fileName>
               <gmd:fileDescription>
                  <gco:CharacterString>Image 4</gco:CharacterString>
               </gmd:fileDescription>
            </gmd:MD_BrowseGraphic>
         </gmd:graphicOverview>

We want to edit the images and remove the duplicates similar to the online resources.

If we edit the resource, before this fix, it would only edit the first occurrence. And if we deleted the resource it would delete the first occurrence.

With this fix, it will delete/update the correct version.

In the default editor, it deletes the resources and the file from the store. A future enhancement could be to only delete the file from the store if there are no more duplicates.

Also default editor does not allow editing the descriptions or file type but in other schemas editing is allowed. Using this as a sample on how editing could be used.

Checklist

  • I have read the contribution guidelines
  • Pull request provided for main branch, backports managed with label
  • Good housekeeping of code, cleaning up comments, tests, and documentation
  • Clean commit history broken into understandable chucks, avoiding big commits with hundreds of files, cautious of reformatting and whitespace changes
  • Clean commit messages, longer verbose messages are encouraged
  • API Changes are identified in commit messages
  • Testing provided for features or enhancements using automatic tests
  • User documentation provided for new features or enhancements in manual
  • Build documentation provided for development instructions in README.md files
  • Library management using pom.xml dependency management. Update build documentation with intended library use and library tutorials or documentation

@josegar74
Copy link
Member

Also default editor does not allow editing the descriptions or file type but in other schemas editing is allowed. Using this as a sample on how editing could be used.

Indeed in main doesn't seem possible, as it's used another widget only for distributions:

<directive data-gn-distribution-resources-panel="gnCurrentEdit.metadata"
data-mode="viewConfig.distributionConfig.layout || ''"
data-editor-config="default"
data-related-config="[{
title: 'API',
filter: 'protocol:OGC:.*|ESRI:.*|atom.*',
editActions: ['addOnlinesrc']},
{
title: 'download',
filter: 'protocol:.*DOWNLOAD.*|DB:.*|FILE:.*',
editActions: ['addOnlinesrc']},
{
title: 'links',
filter:'-protocol:OGC:.*|ESRI:.*|atom.*|.*DOWNLOAD.*|DB:.*|FILE:.* AND -function:legend|featureCatalogue|dataQualityReport',
editActions: ['addOnlinesrc']}]"
/>

The online resources dialog allows both distributions and thumbnails, but the widget doesn't show the thumbnails as it was possible in 4.2.x, in favour of this other widget that doesn't allow to edit the thumbnails, only remove them:

<directive data-gn-overview-manager=""
data-file-types=".png,.gif,.jpeg,.jpg"/>

This seems to need a bit of improvement, but not related to the current pull request.

@josegar74 josegar74 added this to the 4.4.6 milestone Sep 4, 2024
Copy link
Member

@josegar74 josegar74 left a comment

Choose a reason for hiding this comment

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

I've done the following tests:


As currently main branch doesn't allow to edit thumbnails information, this pull request is not strictly required for main. But I think this should be improved in the future to be able to edit the thumbnails information, as can be done in 4.2.x. So it makes sense to include these changes, aligning this code in both branches.

@josegar74 josegar74 merged commit ee23e54 into geonetwork:main Sep 5, 2024
7 checks passed
@geonetworkbuild
Copy link
Collaborator

The backport to 4.2.x failed:

The process '/usr/bin/git' failed with exit code 1
stderr
error: could not apply 3013242b88... iso19139 - Update thumbnail add/update and remove to support index update/removal
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config advice.mergeConflict false"

stdout
Auto-merging schemas/iso19139/src/main/plugin/iso19139/process/thumbnail-add.xsl
CONFLICT (content): Merge conflict in schemas/iso19139/src/main/plugin/iso19139/process/thumbnail-add.xsl
Auto-merging schemas/iso19139/src/main/plugin/iso19139/process/thumbnail-remove.xsl
CONFLICT (content): Merge conflict in schemas/iso19139/src/main/plugin/iso19139/process/thumbnail-remove.xsl

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-4.2.x 4.2.x
# Navigate to the new working tree
cd .worktrees/backport-4.2.x
# Create a new branch
git switch --create backport-8348-to-4.2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick 3013242b88c001ae577fe15eb46a3169baf5be3d
# Push it to GitHub
git push --set-upstream origin backport-8348-to-4.2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-4.2.x

Then, create a pull request where the base branch is 4.2.x and the compare/head branch is backport-8348-to-4.2.x.

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

Successfully merging this pull request may close these issues.

3 participants