Skip to content

Commit

Permalink
#483 Improve checking and notifications
Browse files Browse the repository at this point in the history
when trying to change base type.
#484 Log error when trying to delete inheritanceConnector.

(cherry picked from commit 47bf1e6)
  • Loading branch information
pmeijer authored and brollb committed Sep 4, 2015
1 parent 6f64aa8 commit 957fd8d
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,19 @@ define(['js/logger',
}
);
return;
} else {
do {
if (baseNode.getId() === targetId) {
dialog.alert('Invalid base modification',
'Change of base node would create circular inheritance!',
function () {

}
);
return;
}
baseNode = self._client.getNode(baseNode.getBaseId());
} while (baseNode);
}

dialog.confirm('Confirm base change',
Expand All @@ -87,7 +100,19 @@ define(['js/logger',
self._onCreateNewConnection(params);
}
);
} else if (!oldBaseNode) {
dialog.alert('Invalid base modification',
'Cannot change the base of the FCO!',
function () {
}
);
}
} else {
dialog.alert('Invalid base modification',
'Base already set to the new base!',
function () {
}
);
}
}
return;
Expand Down
48 changes: 24 additions & 24 deletions src/client/js/Panels/MetaEditor/MetaEditorControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -1250,30 +1250,30 @@ define(['js/logger',
};


//MetaEditorControl.prototype._deleteInheritanceRelationship = function (parentID, objectID) {
// var objectNode = this._client.getNode(objectID),
// objectBaseId,
// baseNode;
//
// if (objectNode) {
// objectBaseId = objectNode.getBaseId();
//
// if (objectBaseId) {
// baseNode = this._client.getNode(objectBaseId);
// if (baseNode) {
// objectBaseId = baseNode.getAttribute(nodePropertyNames.Attributes.name) + ' (' + objectBaseId + ')';
// }
// /*this.logger.debug('Deleting InheritanceRelationship from "' +
// objectNode.getAttribute(nodePropertyNames.Attributes.name) + '" (' + objectID + ') to parent "' +
// objectBaseId + '"');
// this._client.delBase(objectID);*/
// //TEMPORARILY DO NOT ALLOW DELETING INHERITANCE RELATIONSHIP
// this.logger.warn('Deleting InheritanceRelationship from "' +
// objectNode.getAttribute(nodePropertyNames.Attributes.name) + '" (' + objectID +
// ') to parent "' + objectBaseId + '" is not allowed...');
// }
// }
//};
MetaEditorControl.prototype._deleteInheritanceRelationship = function (parentID, objectID) {
var objectNode = this._client.getNode(objectID),
objectBaseId,
baseNode;

if (objectNode) {
objectBaseId = objectNode.getBaseId();

if (objectBaseId) {
baseNode = this._client.getNode(objectBaseId);
if (baseNode) {
objectBaseId = baseNode.getAttribute(nodePropertyNames.Attributes.name) + ' (' + objectBaseId + ')';
}
/*this.logger.debug('Deleting InheritanceRelationship from "' +
objectNode.getAttribute(nodePropertyNames.Attributes.name) + '" (' + objectID + ') to parent "' +
objectBaseId + '"');
this._client.delBase(objectID);*/
//TEMPORARILY DO NOT ALLOW DELETING INHERITANCE RELATIONSHIP
this.logger.error('Deleting InheritanceRelationship from "' +
objectNode.getAttribute(nodePropertyNames.Attributes.name) + '" (' + objectID +
') to parent "' + objectBaseId + '" is not allowed...');
}
}
};
/****************************************************************************/
/* END OF --- CREATE NEW CONNECTION BETWEEN TWO ITEMS */
/****************************************************************************/
Expand Down

0 comments on commit 957fd8d

Please sign in to comment.