Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

Add prefix on svg id #76

Merged
merged 6 commits into from
Jun 15, 2022
Merged

Add prefix on svg id #76

merged 6 commits into from
Jun 15, 2022

Conversation

tadam50
Copy link
Contributor

@tadam50 tadam50 commented May 31, 2022

Signed-off-by: Thomas ADAM tadam@silicom.fr

Please check if the PR fulfills these requirements (please use '[x]' to check the checkboxes, or submit the PR and then click the checkboxes)

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Does this PR already have an issue describing the problem ? If so, link to this issue using '#XXX' and skip the rest
No

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Feature

What is the current behavior? (You can also link to an open issue here)
If a web page display 2 different svg diagram, same id can be used twice

What is the new behavior (if this is a feature change)?
Add prefix on id svg attribut, to avoid same id can be used twice

Does this PR introduce a breaking change or deprecate an API? If yes, check the following:

  • The Breaking Change or Deprecated label has been added
  • The migration guide has been updated in the github wiki (What changes might users need to make in their application due to this PR?)

Other information:

(if any of the questions/checkboxes don't apply, please delete them entirely)

@tadam50 tadam50 requested a review from flo-dup May 31, 2022 13:07
@tadam50 tadam50 self-assigned this May 31, 2022
src/main/java/com/powsybl/nad/svg/SvgWriter.java Outdated Show resolved Hide resolved
private final Map<String, String> edgeIdByDiagramId = new TreeMap<>(Comparator.comparingInt(Integer::valueOf));
private final Map<String, String> edgeIdByDiagramId = new LinkedHashMap<>();

private final Optional<UnaryOperator<String>> diagramIdFunction;
Copy link
Contributor

Choose a reason for hiding this comment

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

It's usually not such a good idea to have Optional<> fields. You can keep the UnaryOperator, and replace the null with identity function

tadam50 added 5 commits June 14, 2022 17:03
Signed-off-by: Thomas ADAM <tadam@silicom.fr>
Signed-off-by: Thomas ADAM <tadam@silicom.fr>
Signed-off-by: Thomas ADAM <tadam@silicom.fr>
Signed-off-by: Thomas ADAM <tadam@silicom.fr>
Signed-off-by: Thomas ADAM <tadam@silicom.fr>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
@sonarqubecloud
Copy link

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

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@flo-dup flo-dup merged commit 31675a6 into main Jun 15, 2022
@flo-dup flo-dup deleted the add_svg_prefix branch June 15, 2022 11:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants