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

Gantt - Add target in links #4695

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

ykatchou
Copy link

@ykatchou ykatchou commented Aug 2, 2023

📑 Summary

In order to all links within gantt chart to open in a new tab (or allow a new target) i did add the target options to links.

Resolves #3326

📏 Design Decisions

As discussed in the issue #3326 , i did base my change on the changes done on flowchart in #1585.
I did limit the usage of target to the main case of a simple url.

As I’m not a js dev, i did start from a "clean" env.
To make the dev env works, I did need to do some slight changes.
Those changes were done in a dedicated commit (the first one) :

  • I did add the tsx package to handle compatibility issues with ts-node-esm.
  • I needed to run pnpm from npx.

Those changes were done in a dedicated commit (the first one), feel free to revert those.

📋 Tasks

Make sure you

@ykatchou ykatchou changed the title 3326 gantt improve links Gantt - Add target in links Aug 2, 2023
@codecov
Copy link

codecov bot commented Aug 2, 2023

Codecov Report

Merging #4695 (9bc1323) into develop (f8ebfee) will decrease coverage by 0.03%.
The diff coverage is 22.22%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #4695      +/-   ##
===========================================
- Coverage    45.32%   45.30%   -0.03%     
===========================================
  Files           52       52              
  Lines         6645     6651       +6     
  Branches        18       18              
===========================================
+ Hits          3012     3013       +1     
- Misses        3633     3638       +5     
Flag Coverage Δ
unit 45.30% <22.22%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
packages/mermaid/src/diagrams/gantt/ganttDb.js 76.15% <22.22%> (-0.45%) ⬇️

@ykatchou ykatchou marked this pull request as ready for review August 4, 2023 08:38
Comment on lines -36 to +39
"docs:release-version": "ts-node-esm scripts/update-release-version.mts",
"docs:verify-version": "ts-node-esm scripts/update-release-version.mts --verify",
"types:build-config": "ts-node-esm --transpileOnly scripts/create-types-from-json-schema.mts",
"types:verify-config": "ts-node-esm scripts/create-types-from-json-schema.mts --verify",
"docs:release-version": "tsx scripts/update-release-version.mts",
"docs:verify-version": "tsx scripts/update-release-version.mts --verify",
"types:build-config": "tsx --transpileOnly scripts/create-types-from-json-schema.mts",
"types:verify-config": "tsx scripts/create-types-from-json-schema.mts --verify",
Copy link
Member

Choose a reason for hiding this comment

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

Can you please move the changes related to npx and tsx to another PR?
We've had issues when using tsx in the past.

Copy link
Member

@sidharthv96 sidharthv96 left a comment

Choose a reason for hiding this comment

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

Nice work!

I think we can keep the syntax simpler by sticking to how other diagrams support targets. There's no need to support with and without quotes.

Comment on lines -620 to +626
links[id] = linkStr;
links[id] = [linkStr, target];
Copy link
Member

Choose a reason for hiding this comment

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

Don't use arrays, use objects, so it's clear when using the values.

      links[id] = {link: linkStr, target};

Comment on lines +45 to +53
"_self" return 'hreftarget';
\"_self\" return 'hreftarget';
"_blank" return 'hreftarget';
\"_blank\" return 'hreftarget';
"_parent" return 'hreftarget';
\"_parent\" return 'hreftarget';
"_top" return 'hreftarget';
\"_top\" return 'hreftarget';

Copy link
Member

Choose a reason for hiding this comment

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

"_self"                  return 'LINK_TARGET';
"_blank"                 return 'LINK_TARGET';
"_parent"                return 'LINK_TARGET';
"_top"                   return 'LINK_TARGET';

This is from flow.jison.

Why do we need the duplicates with escaped quotes?

@sidharthv96
Copy link
Member

@ykatchou waiting for your updates

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

Successfully merging this pull request may close these issues.

Allow links in Gantt Chart to be opened in new tab
2 participants