From 482f082ff18bc29dee78907612cbc1121c87acde Mon Sep 17 00:00:00 2001 From: Noel-Bastubbe <82881590+Noel-Bastubbe@users.noreply.github.com> Date: Wed, 22 Mar 2023 14:03:23 +0100 Subject: [PATCH] Fixes Bug doesn't show in the Objective Modeler dropdown (#86) --- app/lib/dependencymodeler/modeling/DepElementFactory.js | 1 + app/lib/objectivemodeler/OmModeler.js | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/lib/dependencymodeler/modeling/DepElementFactory.js b/app/lib/dependencymodeler/modeling/DepElementFactory.js index 9d0d8f15..5fab0aef 100644 --- a/app/lib/dependencymodeler/modeling/DepElementFactory.js +++ b/app/lib/dependencymodeler/modeling/DepElementFactory.js @@ -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); diff --git a/app/lib/objectivemodeler/OmModeler.js b/app/lib/objectivemodeler/OmModeler.js index af613c42..08d6dc22 100644 --- a/app/lib/objectivemodeler/OmModeler.js +++ b/app/lib/objectivemodeler/OmModeler.js @@ -187,7 +187,7 @@ OmModeler.prototype.getCurrentObjective = function () { } OmModeler.prototype.addObjective = function (objectiveReference) { - var rootBoard = this.get('elementFactory').createRootBoard(objectiveReference.name || '', 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}); @@ -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) {