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

1315 open links #989

Merged
merged 8 commits into from Nov 11, 2021
Merged

1315 open links #989

merged 8 commits into from Nov 11, 2021

Conversation

dhaneshnm
Copy link
Contributor

@dhaneshnm dhaneshnm commented Nov 8, 2021

Fixes #BlueBrain/nexus/issues/1315

  • Open the link in "project" column tool tip in search table.

Description

Allows links to get opened in new tab. If it is a delta link, it will open the corresponding fusion location.

How has this been tested?

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 not work as expected)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added necessary unit and integration tests.
  • I have added screenshots (if applicable), in the comment section.

@codecov-commenter
Copy link

codecov-commenter commented Nov 10, 2021

Codecov Report

❗ No coverage uploaded for pull request base (1.7.0-M1@d56d778). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head 532f3a5 differs from pull request most recent head d034ca5. Consider uploading reports for the commit d034ca5 to get more accurate results
Impacted file tree graph

@@             Coverage Diff             @@
##             1.7.0-M1     #989   +/-   ##
===========================================
  Coverage            ?   66.72%           
===========================================
  Files               ?       21           
  Lines               ?      595           
  Branches            ?      132           
===========================================
  Hits                ?      397           
  Misses              ?      198           
  Partials            ?        0           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d56d778...d034ca5. Read the comment docs.

Copy link
Contributor

@nicwells nicwells left a comment

Choose a reason for hiding this comment

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

Nice. Two small comments

@@ -187,6 +188,7 @@ const accessData = async (
const dataQuery: string = tableResource.dataQuery;
const columnConfig = tableResource.configuration as TableColumn[];
if (view['@type']?.includes('ElasticSearchView')) {
console.log('here ..2');
Copy link
Contributor

Choose a reason for hiding this comment

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

remove console.log

*/

export const deltaUrlToFusionUrl = (url: string, nexusWebBase: string) => {
const projectUrlPattern = /projects\/([\w-]+)\/([\w-]+)\/?$/;
Copy link
Contributor

Choose a reason for hiding this comment

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

How about using named regex groups here to make easier to interpret url param being extracted? Like this:

const projectUrlPattern = /projects/(?[\w-]+)/(?[\w-]+)/?$/;
const resourceUrlPattern = /resources/(?.[^/])/(?.[^/])/(.[^/])/(.)/;
const fileUrlPattern = /files(?/([\w-]+)/([\w-]+))/;

and then refer to groups like this projectUrl.groups?.org when constructing Fusion url to return. So like this:

if (projectUrl) {
return ${nexusWebBase}/admin/${projectUrl.groups?.org}/${projectUrl.groups?.project};
}
if (resourceUrl) {
return ${nexusWebBase}/admin/${resourceUrl.groups?.org}/${ resourceUrl.groups?.project }/${encodeURIComponent(url)};
}
if (fileUrl) {
return ${nexusWebBase}/admin${ fileUrl.groups?.orgprojectpath }/${encodeURIComponent(url)};
}

@dhaneshnm dhaneshnm merged commit 7407716 into 1.7.0-M1 Nov 11, 2021
@dhaneshnm dhaneshnm deleted the 1315-Open-Links branch November 11, 2021 09:12
dhaneshnm pushed a commit that referenced this pull request Mar 11, 2022
* Links opens in new tab
 - util method to recognize delta links.
 - Presentation logic open the link in new tab.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants