Skip to content

Commit

Permalink
Allow to change communication link
Browse files Browse the repository at this point in the history
  • Loading branch information
Yevhen Zavhorodnii committed Nov 18, 2024
1 parent 9a080c0 commit b71adbd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
11 changes: 7 additions & 4 deletions server/static/js/edit-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,19 @@ $(document).ready(function() {
var editorSchema = nodeType === 'data_asset' ?
schema.properties.data_assets.additionalProperties.properties :
schema.properties.technical_assets.additionalProperties.properties;
const classEditor = new EditorGenerator(nodeData, editorSchema, $('#itemPropertyEditor'), title, generateEnumFields());
classEditor.generateEditor(['communication_links']);
const assetEditor = new EditorGenerator(nodeData, editorSchema, $('#itemPropertyEditor'), title, generateEnumFields());
assetEditor.generateEditor([], ['communication_links'], () => {
updateDiagramModel(diagramYaml, $('#showDataAssetsCheckBox').is(':checked'));
});
}

function showProjectFields(nodeData) {
const classEditor = new EditorGenerator(nodeData, schema.properties, $('#projectInfo'), undefined, generateEnumFields());
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'];
classEditor.generateEditor(hiddenProperties, extendableProperties);
projectEditor.generateEditor(hiddenProperties, extendableProperties);
}

function showTechnicalAssets(data) {
Expand Down Expand Up @@ -202,6 +204,7 @@ $(document).ready(function() {
return {
"technical_assets_running": technical_assets,
"technical_assets_inside": technical_assets,
"target": technical_assets,
"trust_boundaries_nested": trust_boundaries,
"data_assets_processed": data_assets,
"data_assets_stored": data_assets,
Expand Down
7 changes: 6 additions & 1 deletion server/static/js/property-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ class EditorGenerator {
toggleButton.text(toggleButton.text() === '>' ? 'v' : '>');
});

if (this.object[key] === undefined) {
this.object[key] = {};
}
const subObject = this.object[key] || {};
const subSchema = property.properties || {};

Expand Down Expand Up @@ -172,7 +175,9 @@ class EditorGenerator {
});

entryContainer.append(keyInput, valueEditor, deleteButton);
extendableContainer.append(entryContainer);

const delimiter = $('<br /> <br />');
extendableContainer.append(entryContainer, delimiter);
}
};

Expand Down

0 comments on commit b71adbd

Please sign in to comment.