From e8bd0e8a4c03c8f10fcb9e6ac5e9a10485ae9367 Mon Sep 17 00:00:00 2001 From: Markus Hauru Date: Thu, 5 May 2022 14:46:43 +0100 Subject: [PATCH] Fix levels, change colours and shapes --- eap_backend/eap_api/models.py | 2 +- frontend/src/components/utils.js | 7 +++++++ frontend/src/config.json | 25 ++++++++++++++----------- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/eap_backend/eap_api/models.py b/eap_backend/eap_api/models.py index 7533744b..eb8be083 100644 --- a/eap_backend/eap_api/models.py +++ b/eap_backend/eap_api/models.py @@ -105,7 +105,7 @@ class ClaimType(models.TextChoices): def save(self, *args, **kwargs): try: - parent_level = self.parent.level + parent_level = self.property_claim.level except AttributeError: # If the parent is a TopLevelNormativeGoal rather than a PropertyClaim, it # doesn't have a level. diff --git a/frontend/src/components/utils.js b/frontend/src/components/utils.js index 65ab6b9b..e11b77c0 100644 --- a/frontend/src/components/utils.js +++ b/frontend/src/components/utils.js @@ -37,6 +37,10 @@ function jsonToMermaid(in_json) { else if (shape === "diamond") return "{" + text + "}"; else if (shape === "rounded") return "(" + text + ")"; else if (shape === "circle") return "((" + text + "))"; + else if (shape === "hexagon") return "{{" + text + "}}"; + else if (shape === "parallelogram-left") return "[\\" + text + "\\]"; + else if (shape === "parallelogram-right") return "[/" + text + "/]"; + else if (shape === "stadium") return "([" + text + "])"; else if (shape === "data") return "[(" + text + ")]"; else return ""; } @@ -50,6 +54,9 @@ function jsonToMermaid(in_json) { } else { outputmd += "\nclass " + node + " class" + type + ";\n"; } + if (obj.level !== undefined) { + outputmd += "\nclass " + node + " classLevel" + obj.level + ";\n"; + } return outputmd; } diff --git a/frontend/src/config.json b/frontend/src/config.json index 733caa26..45ef01b4 100644 --- a/frontend/src/config.json +++ b/frontend/src/config.json @@ -3,13 +3,16 @@ "BOX_NCHAR": 25, "property_claim_types": ["Project claim", "System claim"], "mermaid_item_styleclasses": { - "classTopLevelNormativeGoal": "fill:#F4C095", - "classContext": "fill:#B56576", - "classSystemDescription": "fill:#B56576", - "classSystemClaim": "fill:#1B4965,color:#EEE", - "classProjectClaim": "fill:#80A1C1", - "classEvidentialClaim": "fill:#EBFFFF", - "classEvidence": "fill:#C0E4E4" + "classTopLevelNormativeGoal": "fill:#ff424e,color:#FFF", + "classContext": "fill:#009249,color:#FFF", + "classSystemDescription": "fill:#009249,color:#FFF", + "classSystemClaim": "fill:#9db4e6,color:#FFF", + "classProjectClaim": "fill:#9db4e6,color:#FFF", + "classEvidentialClaim": "fill:#4a8897,color:#FFF", + "classEvidence": "fill:#003e57,color:#FFF", + "classLevel1": "fill:#5986d7,color:#FFF", + "classLevel2": "fill:#7a9ddd,color:#FFF", + "classLevel3": "fill:#9db4e6,color:#FFF" }, "navigation": { "AssuranceCase": { @@ -22,7 +25,7 @@ "parent_names": ["AssuranceCase"], "parent_api_names": ["cases"], "parent_db_names": ["assurance_case_id"], - "shape": "square", + "shape": "hexagon", "children": ["Context", "PropertyClaim", "SystemDescription"], "parent_relation": "one-to-many" }, @@ -32,7 +35,7 @@ "parent_names": ["TopLevelNormativeGoal"], "parent_api_names": ["goals"], "parent_db_names": ["goal_id"], - "shape": "diamond", + "shape": "parallelogram-left", "children": [], "parent_relation": "one-to-many" }, @@ -42,7 +45,7 @@ "parent_names": ["TopLevelNormativeGoal"], "parent_api_names": ["goals"], "parent_db_names": ["goal_id"], - "shape": "diamond", + "shape": "parallelogram-right", "children": [], "parent_relation": "one-to-many" }, @@ -64,7 +67,7 @@ "parent_names": ["PropertyClaim"], "parent_api_names": ["propertyclaims"], "parent_db_names": ["property_claim_id"], - "shape": "rounded", + "shape": "stadium", "children": ["Evidence"], "parent_relation": "many-to-many" },