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

feat: allow to put notes in namespaces on classDiagram #5814

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

Conversation

kairi003
Copy link
Contributor

@kairi003 kairi003 commented Sep 2, 2024

📑 Summary

It improve its support for notes inside namespaces.

Resolves #4706

image

📏 Design Decisions

It allows NoteNode to be added in the namespace.

  • classStatements parses not only classStatement but also noteStatement and returns an array of their IDs.
  • addClassesToNamespace() takes a new param noteNames and associates the namespace with the note.
  • In classRender-v2.ts addNotes() implements the process of adding to namespace like addClasses().
  • Changed notes from Array to ClassNoteMap.
  • Add fields to ClassNote.
    • parent: keeps the ID of the namespace.
    • index: holds the number of the note. index: holds the number of the note (used as a reference when generating the edge ID)

📋 Tasks

Make sure you

  • 📖 have read the contribution guidelines
  • 💻 have added necessary unit/e2e tests.
  • 📓 have added documentation. Make sure MERMAID_RELEASE_VERSION is used for all new features.
  • 🦋 If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Copy link

changeset-bot bot commented Sep 2, 2024

🦋 Changeset detected

Latest commit: d60b09c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
mermaid Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the Type: Enhancement New feature or request label Sep 2, 2024
Copy link

netlify bot commented Sep 2, 2024

Deploy Preview for mermaid-js ready!

Name Link
🔨 Latest commit d60b09c
🔍 Latest deploy log https://app.netlify.com/sites/mermaid-js/deploys/674babdadac1410008c9f944
😎 Deploy Preview https://deploy-preview-5814--mermaid-js.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Sep 2, 2024

Codecov Report

Attention: Patch coverage is 0% with 120 lines in your changes missing coverage. Please review.

Project coverage is 4.48%. Comparing base (df636c6) to head (d60b09c).

Files with missing lines Patch % Lines
...ges/mermaid/src/diagrams/class/classRenderer-v2.ts 0.00% 62 Missing ⚠️
packages/mermaid/src/diagrams/class/classDb.ts 0.00% 53 Missing ⚠️
packages/mermaid/src/diagrams/class/classTypes.ts 0.00% 4 Missing ⚠️
...ckages/mermaid/src/diagrams/class/classRenderer.js 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           develop   #5814      +/-   ##
==========================================
- Coverage     4.48%   4.48%   -0.01%     
==========================================
  Files          383     383              
  Lines        54038   54064      +26     
  Branches       596     596              
==========================================
  Hits          2425    2425              
- Misses       51613   51639      +26     
Flag Coverage Δ
unit 4.48% <0.00%> (-0.01%) ⬇️

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

Files with missing lines Coverage Δ
...ckages/mermaid/src/diagrams/class/classRenderer.js 0.00% <0.00%> (ø)
packages/mermaid/src/diagrams/class/classTypes.ts 0.00% <0.00%> (ø)
packages/mermaid/src/diagrams/class/classDb.ts 0.00% <0.00%> (ø)
...ges/mermaid/src/diagrams/class/classRenderer-v2.ts 0.00% <0.00%> (ø)

Copy link

argos-ci bot commented Sep 2, 2024

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ⚠️ Changes detected (Review) 341 added, 339 removed, 4 failures Dec 2, 2024, 10:48 PM

@kairi003 kairi003 force-pushed the feature/4706_allow_notes_in_namespace branch from c8a41d6 to fc0c793 Compare September 3, 2024 06:28
@kairi003 kairi003 changed the title Feature/4706 allow notes in namespace feat: allow notes in namespace Sep 7, 2024
Copy link

pkg-pr-new bot commented Sep 7, 2024

Open in Stackblitz

npm i https://pkg.pr.new/mermaid-js/mermaid@5814
npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/layout-elk@5814
npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/mermaid-zenuml@5814
npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/parser@5814

commit: d60b09c

@kairi003 kairi003 changed the title feat: allow notes in namespace feat: allow to put notes in namespace on classDiagram Sep 7, 2024
@kairi003 kairi003 changed the title feat: allow to put notes in namespace on classDiagram feat: allow to put notes in namespaces on classDiagram Sep 7, 2024
@jgreywolf
Copy link
Contributor

@kairi003 please resolve the conflicts, then I will review

@kairi003
Copy link
Contributor Author

kairi003 commented Nov 8, 2024

@jgreywolf
Sorry, it will take some time to resolve the conflict.
I must understand the new classRenderer-v3 by #5880 and re-implement this PR.

@kairi003 kairi003 force-pushed the feature/4706_allow_notes_in_namespace branch from dbc04be to ab58538 Compare November 9, 2024 17:11
@kairi003
Copy link
Contributor Author

kairi003 commented Nov 9, 2024

@jgreywolf
Thank you very much for your patience.
I have successfully resolved the conflicts and merged the features.
Could you review it?

@kairi003 kairi003 force-pushed the feature/4706_allow_notes_in_namespace branch from ec7c7b6 to 25c43fa Compare November 9, 2024 17:36
@The-Alchemist
Copy link
Contributor

Looks like the tests are failing, but not because of any code issues but because of a timeout:

Error: You have reached the maximum screenshot capacity included in your Pro open source xl Plan. Please upgrade your Plan.
    at throwAPIError (file:///__w/mermaid/mermaid/node_modules/.pnpm/@[email protected]/node_modules/@argos-ci/api-client/dist/index.mjs:28:15)
    at upload (file:///__w/mermaid/mermaid/node_modules/.pnpm/@[email protected]/node_modules/@argos-ci/core/dist/index.mjs:886:9)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.<anonymous> (file:///__w/mermaid/mermaid/node_modules/.pnpm/@[email protected][email protected]/node_modules/@argos-ci/cypress/dist/task.mjs:32:21)
    at async Object.handlerThatCallsUserDefinedHandler [as handler] (/__w/mermaid/mermaid/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@applitools/eyes-cypress/dist/plugin/pluginExport.js:105:21)
Test run failed, code 1

https://github.com/mermaid-js/mermaid/actions/runs/11872956086/job/33087297356?pr=5814

@kairi003 kairi003 force-pushed the feature/4706_allow_notes_in_namespace branch from 21ce35c to 875827f Compare November 20, 2024 22:18
@kairi003
Copy link
Contributor Author

kairi003 commented Nov 20, 2024

Looks like the tests are failing, but not because of any code issues but because of a timeout:

Error: You have reached the maximum screenshot capacity included in your Pro open source xl Plan. Please upgrade your Plan.
    at throwAPIError (file:///__w/mermaid/mermaid/node_modules/.pnpm/@[email protected]/node_modules/@argos-ci/api-client/dist/index.mjs:28:15)
    at upload (file:///__w/mermaid/mermaid/node_modules/.pnpm/@[email protected]/node_modules/@argos-ci/core/dist/index.mjs:886:9)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.<anonymous> (file:///__w/mermaid/mermaid/node_modules/.pnpm/@[email protected][email protected]/node_modules/@argos-ci/cypress/dist/task.mjs:32:21)
    at async Object.handlerThatCallsUserDefinedHandler [as handler] (/__w/mermaid/mermaid/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@applitools/eyes-cypress/dist/plugin/pluginExport.js:105:21)
Test run failed, code 1

https://github.com/mermaid-js/mermaid/actions/runs/11872956086/job/33087297356?pr=5814

Note that the last non-merge commit is 70f679d, which passes the required tests.
Only argos-ci seems to fail, but this is due to the addition of a new e2e test case.

https://app.argos-ci.com/mermaid/mermaid/builds/2448/118222601

@kairi003
Copy link
Contributor Author

https://github.com/marketplace/argos-ci
The screenshot capacity of argos-ci is reset monthly. e2e test should be re-run after the month changes.

@kairi003
Copy link
Contributor Author

kairi003 commented Dec 1, 2024

it requres #6102 to pass e2e test, i think

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

class diagrams: allow notes for namespace'd classes
3 participants