Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

introduce closure to mutate resource or file id for dom use only #1766

Merged
merged 3 commits into from
Nov 9, 2021

Conversation

fschade
Copy link
Collaborator

@fschade fschade commented Nov 8, 2021

Description

in some cases the resource or item id is not a valid dom selector, to be able to mutate the id this introduces a closure to do so.

Related Issue

Motivation and Context

valid dom selectors

How Has This Been Tested?

  • unit tests
  • yarn link and web

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Tests

Checklist:

  • Code changes
  • Unit tests added
  • Documentation added/updated

Open tasks:

Copy link
Contributor

@pascalwengerter pascalwengerter left a comment

Choose a reason for hiding this comment

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

I added an offending ID in the examples (e.g. line 641 id: "forest:19",) to test this, and it visibly breaks the component (by always rendering the dropdown menu) even if the regex itself does the job - string "aa:a/a-a" gets turned into "aaaaa"

@pascalwengerter
Copy link
Contributor

I added an offending ID in the examples (e.g. line 641 id: "forest:19",) to test this, and it visibly breaks the component (by always rendering the dropdown menu) even if the regex itself does the job - string "aa:a/a-a" gets turned into "aaaaa"

Would be great to have this covered in test data somehow, too 😇

@fschade
Copy link
Collaborator Author

fschade commented Nov 8, 2021

I added an offending ID in the examples (e.g. line 641 id: "forest:19",) to test this, and it visibly breaks the component (by always rendering the dropdown menu) even if the regex itself does the job - string "aa:a/a-a" gets turned into "aaaaa"

nice thanks, yes this should fail in line 641, the example overwrites the resourceDomSelector here with an unsafe implementation, if you remove the overwrite it will fallback to here and will work.

the case is covered here for an overwrite and here for the default behavior. Thanks for your deep dive ❤️

@pascalwengerter
Copy link
Contributor

I added an offending ID in the examples (e.g. line 641 id: "forest:19",) to test this, and it visibly breaks the component (by always rendering the dropdown menu) even if the regex itself does the job - string "aa:a/a-a" gets turned into "aaaaa"

nice thanks, yes this should fail in line 641, the example overwrites the resourceDomSelector here with an unsafe implementation, if you remove the overwrite it will fallback to here and will work.

the case is covered here for an overwrite and here for the default behavior. Thanks for your deep dive heart

Okay now I've read the actual implementation 🤦🏽 if CERN confirms this works with their EOS IDs (which it should) I'm happy to approve, merge & release!

@pascalwengerter
Copy link
Contributor

I added an offending ID in the examples (e.g. line 641 id: "forest:19",) to test this, and it visibly breaks the component (by always rendering the dropdown menu) even if the regex itself does the job - string "aa:a/a-a" gets turned into "aaaaa"

nice thanks, yes this should fail in line 641, the example overwrites the resourceDomSelector here with an unsafe implementation, if you remove the overwrite it will fallback to here and will work.
the case is covered here for an overwrite and here for the default behavior. Thanks for your deep dive heart

Okay now I've read the actual implementation 🤦🏽 if CERN confirms this works with their EOS IDs (which it should) I'm happy to approve, merge & release!

Not sure how smart it is to overwrite the sanitization function in an example though, creates knots in the heads of people like me haha

@diocas
Copy link

diocas commented Nov 9, 2021

@fschade just tested and it fixes the issue. (the 0-9\-_ that you added after was important :))
Not sure if hashing would be more future proof, but is reasonable to expect that letter and numbers would suffice.

@sonarcloud
Copy link

sonarcloud bot commented Nov 9, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

23.1% 23.1% Coverage
0.0% 0.0% Duplication

@fschade
Copy link
Collaborator Author

fschade commented Nov 9, 2021

@kulmann, @pascalwengerter please have a look, i also touched the naming if ..file.. to ..item.. in this PR.
I know that it's not related to this PR's topic but popped up in the rebase

Copy link
Contributor

@pascalwengerter pascalwengerter left a comment

Choose a reason for hiding this comment

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

Changes LGTM, thanks for the additional cleanup!

@pascalwengerter pascalwengerter merged commit 2895d31 into master Nov 9, 2021
@delete-merged-branch delete-merged-branch bot deleted the resource-dom-selector branch November 9, 2021 16:13
@@ -13,8 +13,8 @@
@highlight="fileClicked"
@rowMounted="rowMounted"
@contextmenuClicked="showContextMenu"
@fileDropped="fileDropped"
@fileDragged="fileDragged"
@itemDropped="fileDropped"
Copy link
Contributor

Choose a reason for hiding this comment

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

This was an unnecessary breaking change in retrospect (it's the OcFilesTable so file as a prefix is fine, slipped through my code review), let's discuss if we want to rollback & re-release or ship a bugfix release tomorrow

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

Successfully merging this pull request may close these issues.

None yet

4 participants