Skip to content

Commit

Permalink
Fix levels, change colours and shapes
Browse files Browse the repository at this point in the history
  • Loading branch information
mhauru committed May 5, 2022
1 parent f76b76c commit e8bd0e8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion eap_backend/eap_api/models.py
Expand Up @@ -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.
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/components/utils.js
Expand Up @@ -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 "";
}
Expand All @@ -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;
}

Expand Down
25 changes: 14 additions & 11 deletions frontend/src/config.json
Expand Up @@ -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": {
Expand All @@ -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"
},
Expand All @@ -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"
},
Expand All @@ -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"
},
Expand All @@ -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"
},
Expand Down

0 comments on commit e8bd0e8

Please sign in to comment.