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

Feature/fixed folders validation #1213

Merged
merged 84 commits into from
Sep 11, 2020

Conversation

NearW
Copy link
Contributor

@NearW NearW commented Sep 1, 2020

Validation for fixed folders

Please read the CONTRIBUTING.md before opening a PR.

Description

This should be the last PR to finish this epic. This branch is based on the fixed-folders implementation and should only be reviewed once the fixed-folders branch has been merged.

  • Adds a validation to ensure all the rules listed in the docs are enforced
  • Slightly refactored the validation to check for unique children. It's not a simple boolean check, but instead throws an error if a non-unique child was found
  • Adds a new error for the case that the nodes array of a file is empty. The test was wrong before.
  • Adds a new markdown file to document how the .cc.json changed with each update
  • Updates API-Version to 1.2

NearW added 29 commits August 19, 2020 16:00
…ure/fixed-folders

# Conflicts:
#	visualization/app/codeCharta/util/treeMapGenerator.ts
…-folders

# Conflicts:
#	visualization/app/codeCharta/util/treeMapGenerator.ts
…rs' into feature/fixed-folders

# Conflicts:
#	visualization/app/codeCharta/util/treeMapGenerator.ts
Fix nodes empty error
@NearW NearW added the pr-visualization Issues that touch the visualization pr(oject) which means web and desktop features. label Sep 1, 2020
@NearW
Copy link
Contributor Author

NearW commented Sep 9, 2020

image

It's not the prettiest, but it's finally detailed.

@NearW
Copy link
Contributor Author

NearW commented Sep 9, 2020

Using `Record<string, number> instead of

export interface KeyValuePair {
	[key: string]: number
}

doesn't work in the json schema. I reverted those changes.

…rs' into feature/fixed-folders

# Conflicts:
#	visualization/app/codeCharta/util/treeMapGenerator.spec.ts
…nto feature/fixed-folders-validation

# Conflicts:
#	visualization/app/codeCharta/codeCharta.service.spec.ts
…rs' into feature/fixed-folders-validation

# Conflicts:
#	visualization/.eslintrc.js
#	visualization/app/codeCharta/ressources/fixed-folders/fixed-folders-example.ts
#	visualization/app/codeCharta/util/__snapshots__/fileHelper.spec.ts.snap
#	visualization/app/codeCharta/util/__snapshots__/treeMapGenerator.spec.ts.snap
#	visualization/app/codeCharta/util/treeMapHelper.ts
visualization/API.md Outdated Show resolved Hide resolved
@NearW
Copy link
Contributor Author

NearW commented Sep 10, 2020

@BridgeAR PTAL at the last two commits and the two unresolved coversations.

I think this branch is ready to merge.

@@ -0,0 +1,32 @@
# API-Changelog
Copy link
Member

Choose a reason for hiding this comment

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

Just as a note for a follow up PR (not counted towards this feature): we might clarify what API this is about.

@NearW NearW merged commit a86e1f4 into feature/epic-fixed-folders Sep 11, 2020
@NearW NearW deleted the feature/fixed-folders-validation branch September 11, 2020 07:49
BridgeAR added a commit that referenced this pull request Sep 11, 2020
* Feature/fixed folders (#1199)

* Add example json representing folder structure in docs

* Update model with optional fixed and margin attributes

* Adds first steps to build the map, missing transformation of coordinates

* Refactor improve performance by counting nodes and blacklisted nodes at the same time

* Refactor improve performance by removing one loop

* Fix typo in y properties

* Add coordinate transformation, map is finally visible, but not scalable yet

* Add edges to example json

* Refactor use values in line

* Add size increases based on margin

* Refactor abstract methods and improved readability

* Fix broken tests after changing the method header

* Remove margin since it's not required anymore

* Add snapshot test for fixed folders

* Fix incoming and outgoing edge points are now set correctly

* Fix root folder name should be set based on the root-name of the map

* Presentation add example cc.json

* Presentation rename example cc.json

* Update rename fixed attributes

* Update snapshot since ids are no longer pre-decorated

* Refactor move static functions to helper file
Update jest.config to mock localStorage to test in IntelliJ

* Refactor convert class with static functions to exported objects with functions

* Refactor convert class with static functions to exported objects with functions

* Add no-else-return rule and fix errors

* Refactor use null propagation operator

* Update snapshots and remove unused snapshots

* Update visualization/app/codeCharta/util/treeMapGenerator.spec.ts

Co-authored-by: Ruben Bridgewater <ruben@bridgewater.de>

* Update visualization/app/codeCharta/util/fileHelper.ts

Co-authored-by: Ruben Bridgewater <ruben@bridgewater.de>

* Refactor rename isNodeToBeFlat to shouldNodeBeFlat

* Refactor use null coalescing to shorten code

* Refactor move shortcut return to the top to improve performance

* Update snapshot after renaming test

* Refactor rearrange function and add return statements to prevent obsolete calculations

* Refactor remove obsolete check in condition if attribute types are empty and added some more tests

* Refactor rename function

Co-authored-by: Ruben Bridgewater <ruben@bridgewater.de>

* Docs/fixed-folders (#1163)

* Add documentation on how to generate custom cc.jsons with the fixed attribute

* Fix list not formated correctly

* Update image with x and y coordinates and bounds

* Update remove margin from docs, since it's not required anymore
It is still recommended to apply a margin between folders, but the coordinates of the folders can be set to anything as long as these respect the rules.

* Update gh-pages/_posts/how-to/2020-08-17-fixate-folders-with-a-custom-cc-json.md

Co-authored-by: Ruben Bridgewater <ruben@bridgewater.de>

* Update gh-pages/_posts/how-to/2020-08-17-fixate-folders-with-a-custom-cc-json.md

* Update gh-pages/_posts/how-to/2020-08-17-fixate-folders-with-a-custom-cc-json.md

Co-authored-by: Ruben Bridgewater <ruben@bridgewater.de>

* Update renamed properties and rephrased explanation on how to set the coordinates

* Update gh-pages/_posts/how-to/2020-08-17-fixate-folders-with-a-custom-cc-json.md

Co-authored-by: Ruben Bridgewater <ruben@bridgewater.de>

* Update gh-pages/_posts/how-to/2020-08-17-fixate-folders-with-a-custom-cc-json.md

Co-authored-by: Ruben Bridgewater <ruben@bridgewater.de>

* Update docs

* Update gh-pages/_posts/how-to/2020-08-17-fixate-folders-with-a-custom-cc-json.md

Co-authored-by: Ruben Bridgewater <ruben@bridgewater.de>

* Update example image and it's corresponding cc.json

Co-authored-by: Ruben Bridgewater <ruben@bridgewater.de>

* Feature/fixed folders validation (#1213)

* Add example json representing folder structure in docs

* Update model with optional fixed and margin attributes

* Adds first steps to build the map, missing transformation of coordinates

* Refactor improve performance by counting nodes and blacklisted nodes at the same time

* Refactor improve performance by removing one loop

* Fix typo in y properties

* Add coordinate transformation, map is finally visible, but not scalable yet

* Add edges to example json

* Refactor use values in line

* Add size increases based on margin

* Refactor abstract methods and improved readability

* Fix broken tests after changing the method header

* Remove margin since it's not required anymore

* Add snapshot test for fixed folders

* Fix incoming and outgoing edge points are now set correctly

* Fix root folder name should be set based on the root-name of the map

* Add API.md to document the changes for the cc.json-api

* Update api-versions for tests and files

* Presentation add example cc.json

* Presentation rename example cc.json

* Add validation for fixed folders, not finalized

* Add finalized validation
Fix nodes empty error

* Update collect errors again instead of throwing them instantly

* Update e2e test to use the error messages enum instead of plain strings

* Fix missing whitespace in test of dialog message

* Update rename fixed attributes

* Update snapshot since ids are no longer pre-decorated

* Update tests with renamed fixed attributes

* Refactor move static functions to helper file
Update jest.config to mock localStorage to test in IntelliJ

* Refactor convert class with static functions to exported objects with functions

* Refactor convert class with static functions to exported objects with functions

* Add no-else-return rule and fix errors

* Refactor use null propagation operator

* Update snapshots and remove unused snapshots

* Add eslint rule no-lonely-if and autofix errors

* Update visualization/app/codeCharta/util/treeMapGenerator.spec.ts

Co-authored-by: Ruben Bridgewater <ruben@bridgewater.de>

* Update visualization/app/codeCharta/util/fileHelper.ts

Co-authored-by: Ruben Bridgewater <ruben@bridgewater.de>

* Refactor rename isNodeToBeFlat to shouldNodeBeFlat

* Refactor use null coalescing to shorten code

* Refactor move shortcut return to the top to improve performance

* Update snapshot after renaming test

* Refactor rearrange function and add return statements to prevent obsolete calculations

* Refactor remove obsolete check in condition if attribute types are empty and added some more tests

* Add e2e test to ensure lower api versions are working without errors or warnings

* Refactor replace custom type KeyValuePair with Record<string, number>

* Update jsonschema

* Refactor replace _.cloneDeep with the rfdc library

* Update snapshot with new api version

* Add fixedPosition attribute of folders resulting in errors during validation after their name for easier debugging

* Fix outOfBounds-Check not checking for negative width and height

* Add another test to ensure the new out of bounds function is working

* Add print found api version when a warning is thrown

* Update visualization/app/codeCharta/util/fileValidator.ts

Co-authored-by: Ruben Bridgewater <ruben@bridgewater.de>

* Update remove individual titles and use a generic title for errors and warnings

* Refactor check if both nodes have the fixedPosition attribute before starting calculating overlaps

* Refactor remove obsolete .values() call

* Add found duplicate node to error message
Refactor use a more intuitive implementation to find duplicate nodes
Fix duplicate file in example

* Update snapshot with new file names

* Fix broken e2e test with wrong warning message

* Refactor use root instead of whole file as parameter to validate fixed folders

* Refactor reorder functions

* Revert "Refactor replace custom type KeyValuePair with Record<string, number>"

This reverts commit 061ec81.

* Update json schema with KeyValuePair instead of Record again

* Move API.md from visualization to root of project

* Add throw an error if we encountered a fixed folder and the api version is smaller than 1.2

Co-authored-by: Ruben Bridgewater <ruben@bridgewater.de>

* Refactor rename file by replacing - with _ in the name

* Update CHANGELOG

* Update CHANGELOG, api version incremented

* Docs move api change to Changed section

* Update outdated property names

Co-authored-by: Ruben Bridgewater <ruben@bridgewater.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-visualization Issues that touch the visualization pr(oject) which means web and desktop features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants