Skip to content

Commit

Permalink
Merge e963d3c into 3562334
Browse files Browse the repository at this point in the history
  • Loading branch information
mhauru committed May 9, 2022
2 parents 3562334 + e963d3c commit a1fa015
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 22 deletions.
1 change: 1 addition & 0 deletions HOWTO_deploy_to_Azure.md
Expand Up @@ -44,6 +44,7 @@ docker push DOCKER_USERNAME/eap_backend:latest
* DBUSER=NAME_OF_THE_DATABASE_USER_YOU_JUST_CREATED@NAME_OF_THE_DATABASE
* DBPASSWORD=THE_PASSWORD_FOR_THE_USER_YOU_JUST_MADE
* Test that the backend is working (will take a few minutes to start up the first time) by going to https://BACKEND_WEBAPP_NAME.azurewebsites.net/api/cases and you should get an empty list.
* You may also want to turn on Continuous deployment from the Deployment Center settings, to have Azure pull the latest container every time one is available.

### Create frontend docker image

Expand Down
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
6 changes: 0 additions & 6 deletions frontend/src/components/CaseContainer.js
Expand Up @@ -489,18 +489,12 @@ class CaseContainer extends Component {
<EditableText
initialValue={this.state.assurance_case.name}
textsize="xlarge"
style={{
height: 30,
}}
onSubmit={(value) => this.submitCaseChange("name", value)}
editMode={this.inEditMode()}
/>
<EditableText
initialValue={this.state.assurance_case.description}
size="small"
style={{
height: 0,
}}
onSubmit={(value) =>
this.submitCaseChange("description", value)
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/ItemEditor.js
Expand Up @@ -105,7 +105,7 @@ function ItemEditor(props) {
}
const parentType = parentToAdd["type"];
const parentId = parentToAdd["id"];
const url = `${configData.BASE_URL}/${
const url = `${getBaseURL()}/${
configData.navigation[props.type]["api_name"]
}/${props.id}/`;
const response = await fetch(url);
Expand All @@ -131,7 +131,7 @@ function ItemEditor(props) {
}
const parentType = parentToRemove["type"];
const parentId = parentToRemove["id"];
const url = `${configData.BASE_URL}/${
const url = `${getBaseURL()}/${
configData.navigation[props.type]["api_name"]
}/${props.id}/`;
const response = await fetch(url);
Expand Down
7 changes: 5 additions & 2 deletions frontend/src/components/ParentSelector.js
@@ -1,6 +1,7 @@
import { Select } from "grommet";
import React, { Component } from "react";
import { useParams } from "react-router-dom";
import { getBaseURL } from "./utils.js";
import configData from "../config.json";

class ParentSelector extends Component {
Expand All @@ -19,7 +20,7 @@ class ParentSelector extends Component {

async getCurrentParents() {
const db_name = configData.navigation[this.props.type]["db_name"];
const url = `${configData.BASE_URL}/parents/${db_name}/${this.props.id}`;
const url = `${getBaseURL()}/parents/${db_name}/${this.props.id}`;
const currentParents = [];
await fetch(url)
.then((response) => response.json())
Expand All @@ -35,7 +36,9 @@ class ParentSelector extends Component {
for (let i = 0; i < parentNames.length; i++) {
const parentName = parentNames[i];
const parentApiName = parentApiNames[i];
const url = `${configData.BASE_URL}/${parentApiName}/?case_id=${this.props.caseId}`;
const url = `${getBaseURL()}/${parentApiName}/?case_id=${
this.props.caseId
}`;
await fetch(url)
.then((response) => response.json())
.then((json) => {
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 a1fa015

Please sign in to comment.