Skip to content

Commit

Permalink
Move risk tracking to bottom
Browse files Browse the repository at this point in the history
  • Loading branch information
Yevhen Zavhorodnii committed Nov 20, 2024
1 parent 1dcca4b commit 99563ce
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
13 changes: 9 additions & 4 deletions server/static/css/edit-model.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ body {
border: 1px solid #ccc;
}

.checkbox-label {
font-size: 0.6em;
}

.property-editor {
border: 1px solid #ccc;
padding: 10px;
Expand All @@ -53,6 +49,15 @@ body {
overflow-y: auto; /* Enable vertical scroll */
}

.risk-property-editor {
border: 1px solid #ccc;
padding: 10px;
width: 50%;
height: 320px;
background-color: #efb9b9;
overflow-y: auto; /* Enable vertical scroll */
}

.property-editor-item {
display: flex;
align-items: center;
Expand Down
4 changes: 4 additions & 0 deletions server/static/edit-model.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
<div id="myDiagramDiv" class="diagram"></div>
<div id="itemPropertyEditor" class="property-editor"></div>
</div>
<div class="diagram-container">
<div id="riskTrackingPropertyEditor" class="risk-property-editor"></div>
<div id="riskPropertyEditor" class="risk-property-editor"></div>
</div>
</body>
<script src="./js/schema.js"></script>
<script src="./js/property-editor.js"></script>
Expand Down
22 changes: 14 additions & 8 deletions server/static/js/edit-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ $(document).ready(function() {
.add(
new go.Panel("Auto")
.add(
new go.Shape("RoundedRectangle", { // surrounds the Placeholder
new go.Shape("RoundedRectangle", {
parameter1: 14,
fill: "rgba(128,128,128,0.33)"
}),
new go.Placeholder( // represents the area of all member parts,
{ padding: 5}) // with some extra padding around them
new go.Placeholder(
{ padding: 5})
),
new go.TextBlock({ // group title
new go.TextBlock({
alignment: go.Spot.Right, font: "Bold 12pt Sans-Serif"
})
.bind("caption")
Expand Down Expand Up @@ -147,6 +147,7 @@ $(document).ready(function() {
showDataAssetsObjects(yamlData);
showTrustBoundaries(yamlData);
showSharedRuntimes(yamlData);
showRiskTrackingObjects(yamlData);
}

function openAssetEditor(nodeData, nodeType, title) {
Expand All @@ -161,10 +162,8 @@ $(document).ready(function() {

function showProjectFields(nodeData) {
const projectEditor = new EditorGenerator(nodeData, schema.properties, $('#projectInfo'), undefined, generateEnumFields());
const hiddenProperties = ['communication_links', 'data_assets_processed', 'data_assets_stored',
'data_assets_sent', 'data_assets_received', 'data_assets', 'technical_assets',
'trust_boundaries', 'shared_runtimes', 'individual_risk_categories', 'includes'];
const extendableProperties = ['questions', 'abuse_cases', 'security_requirements', 'risk_tracking'];
const hiddenProperties = ['data_assets', 'technical_assets', 'trust_boundaries', 'shared_runtimes', 'risk_tracking'];
const extendableProperties = ['questions', 'abuse_cases', 'security_requirements', 'individual_risk_categories'];
projectEditor.generateEditor(hiddenProperties, extendableProperties);
}

Expand All @@ -182,6 +181,13 @@ $(document).ready(function() {
});
}

function showRiskTrackingObjects(data) {
const editor = new EditorGenerator(data, schema.properties, $('#riskTrackingPropertyEditor'), undefined, generateEnumFields());
editor.generateEditorForObject('risk_tracking', (key, value) => {
updateDiagramModel(diagramYaml);
});
}

function showTrustBoundaries(data) {
const editor = new EditorGenerator(data, schema.properties, $('#trustBoundaries'), undefined, generateEnumFields());
editor.generateEditorForObject('trust_boundaries', (key, value) => {
Expand Down

0 comments on commit 99563ce

Please sign in to comment.