Skip to content

Commit

Permalink
Be more specific which object we are adding
Browse files Browse the repository at this point in the history
  • Loading branch information
Yevhen Zavhorodnii committed Nov 21, 2024
1 parent 938e1be commit 8bd0aa4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions server/static/js/edit-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,29 +201,29 @@ $(document).ready(function() {

function showDataAssetsObjects(data) {
const editor = new EditorGenerator(data, schema.properties, $('#dataAssets'), undefined, generateEnumFields());
editor.generateEditorForObject('data_assets', (key, value) => {
editor.generateEditorForObject('data_assets', 'Add data asset', (key, value) => {
updateDiagramModel(diagramYaml);
});
}

function showRiskTrackingObjects(data) {
const editor = new EditorGenerator(data, schema.properties, $('#riskTrackingPropertyEditor'), undefined, generateEnumFields());
editor.generateEditorForObject('risk_tracking', (key, value) => {
editor.generateEditorForObject('risk_tracking', 'Add 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) => {
editor.generateEditorForObject('trust_boundaries', 'Add trust boundary', (key, value) => {
console.log('trust_boundaries changed + ' + key + ' = ' + value);
updateDiagramModel(diagramYaml);
});
}

function showSharedRuntimes(data) {
const editor = new EditorGenerator(data, schema.properties, $('#sharedRuntimes'), undefined, generateEnumFields());
editor.generateEditorForObject('shared_runtimes', (key, value) => {
editor.generateEditorForObject('shared_runtimes', 'Add shared runtime', (key, value) => {
updateDiagramModel(diagramYaml);
});
}
Expand Down
4 changes: 2 additions & 2 deletions server/static/js/property-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ class EditorGenerator {
}
}

generateEditorForObject(objectKey, callback = (key, value) => {}) {
generateEditorForObject(objectKey, addCaption, callback = (key, value) => {}) {
this.formContainer.empty();
if (this.title) {
const title = $('<label>')
Expand All @@ -449,7 +449,7 @@ class EditorGenerator {
const subObject = this.object[key] || {};
const extendableContainer = $('<div>').addClass('property-editor-extendable');
const addButton = $('<button>')
.text('Add Entry')
.text(addCaption)
.on('click', () => {
const newKey = prompt('Enter key for the new entry:');
if (!newKey) return;
Expand Down

0 comments on commit 8bd0aa4

Please sign in to comment.