Skip to content

Commit

Permalink
Introduce Top Level Imports (#3464)
Browse files Browse the repository at this point in the history
* Fixed: #3463 - Introduce Top Level Imports

* entity/property dialog fixes and improvements
  • Loading branch information
delchev authored Feb 18, 2024
1 parent b909eec commit d01e6b4
Show file tree
Hide file tree
Showing 8 changed files with 136 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ angular.module('edmDetails', ['ideUI', 'ideView'])
feedPath: $scope.dataParameters.feedPath,
roleRead: $scope.dataParameters.roleRead,
roleWrite: $scope.dataParameters.roleWrite,
importsCode: $scope.dataParameters.importsCode
}, true);
} else {
messageHub.postMessage('edm.editor.property', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ angular.module('ui.entity-data.modeler', ["ideUI", "ideView", "ideWorkspace", "i
cell.value.feedPath = msg.data.feedPath;
cell.value.roleRead = msg.data.roleRead;
cell.value.roleWrite = msg.data.roleWrite;
cell.value.importsCode = msg.data.importsCode;

$scope.graph.model.setValue(cell, cell.value.clone());

Expand Down Expand Up @@ -990,6 +991,7 @@ angular.module('ui.entity-data.modeler', ["ideUI", "ideView", "ideWorkspace", "i
roleWrite: cell.value.roleWrite,
perspectives: $scope.graph.model.perspectives,
navigations: $scope.graph.model.navigations,
importsCode: cell.value.importsCode
},
null,
false,
Expand Down Expand Up @@ -1209,6 +1211,9 @@ angular.module('ui.entity-data.modeler', ["ideUI", "ideView", "ideWorkspace", "i
if (child.value.feedSchedule && child.value.feedSchedule !== "") {
child.value.feedSchedule = atob(child.value.feedSchedule);
}
if (child.value.importsCode && child.value.importsCode !== "") {
child.value.importsCode = atob(child.value.importsCode);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Entity.prototype.roleWrite = null;
Entity.prototype.projectionReferencedModel = null;
Entity.prototype.projectionReferencedEntity = null;
Entity.prototype.referenceProjections = [];
Entity.prototype.importsCode = null;

Entity.prototype.clone = function () {
return mxUtils.clone(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ function createModel(graph) {
if (child.value.projectionReferencedEntity && child.value.projectionReferencedEntity !== "") {
entityContent += ' projectionReferencedEntity="' + child.value.projectionReferencedEntity + '"';
}
if (child.value.importsCode && child.value.importsCode !== "") {
child.value.importsCode = btoa(child.value.importsCode);
entityContent += ' importsCode="' + child.value.importsCode + '"';
}

entityContent += '>\n';
model.push(entityContent);
Expand Down Expand Up @@ -242,6 +246,9 @@ function createModel(graph) {
if (child.value.feedPassword) {
child.value.feedPassword = atob(child.value.feedPassword);
}
if (child.value.importsCode) {
child.value.importsCode = atob(child.value.importsCode);
}
}
}

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ exports.process = function (model, parameters) {
}
}
}
if (e.importsCode && e.importsCode !== "") {
let base64 = require("utils/base64");
let bytes = require("io/bytes");
e.importsCode = bytes.byteArrayToText(base64.decode(e.importsCode));
}

e.referencedProjections = [];
e.properties.forEach(p => {
p.dataNotNull = p.dataNullable === "false";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ function ForbiddenError(message) {
this.stack = (new Error()).stack;
}
#end
#if($importsCode && $importsCode != "")
// custom imports
${importsCode}
#end

export interface ${name}Entity {
#foreach ($property in $properties)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
import { Controller, Get, Post, Put, Delete, response } from "sdk/http"
import { ${name}Repository, ${name}EntityOptions } from "../../dao/${perspectiveName}/${name}Repository";
import { HttpUtils } from "../utils/HttpUtils";
#if($importsCode && $importsCode != "")
// custom imports
${importsCode}
#end

#if($isEntityPropertyPropertyEnabled)
class ValidationError extends Error {
Expand Down

0 comments on commit d01e6b4

Please sign in to comment.