Skip to content

Commit

Permalink
Fixes Bug <TBD> doesn't show in the Objective Modeler dropdown (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
Noel-Bastubbe authored Mar 22, 2023
1 parent c165fc4 commit 482f082
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/lib/dependencymodeler/modeling/DepElementFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ DepElementFactory.$inject = [

DepElementFactory.prototype.createBusinessObject = function (type, attrs) {
const element = this._moddle.create(type, attrs || {});
element.name = 'undefined';
if(!element.id) {
const prefix = (element.$type || '').replace(/^[^:]*:/g, '') + '_';
element.id = this._ids.nextPrefixed(prefix, element);
Expand Down
5 changes: 2 additions & 3 deletions app/lib/objectivemodeler/OmModeler.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ OmModeler.prototype.getCurrentObjective = function () {
}

OmModeler.prototype.addObjective = function (objectiveReference) {
var rootBoard = this.get('elementFactory').createRootBoard(objectiveReference.name || '<TBD>', objectiveReference);
var rootBoard = this.get('elementFactory').createRootBoard(objectiveReference.name || 'undefined', objectiveReference);
this._definitions.get('rootBoards').push(rootBoard[0]);
this._definitions.get('rootElements').push(rootBoard[1]);
this._emit(ObjectiveEvents.DEFINITIONS_CHANGED, {definitions: this._definitions});
Expand Down Expand Up @@ -263,12 +263,11 @@ OmModeler.prototype.getObjectsOfClass = function (clazz) {

OmModeler.prototype.getObjectInstancesOfClass = function (clazz) {
let instances = this._definitions.get('objectInstances');
let result = instances.filter((instance, gfx) =>
return instances.filter((instance, gfx) =>
is(instance, 'om:ObjectInstance') &&
clazz.id &&
instance.classRef?.id === clazz.id
);
return result;
}

OmModeler.prototype.renameObjective = function (objectiveReference, name) {
Expand Down

0 comments on commit 482f082

Please sign in to comment.