attribute dialog doesn't allow to (attempt to) save relation without target note

This commit is contained in:
azivner
2018-11-19 21:58:52 +01:00
parent 3608857f25
commit 5bf5d1cac4
3 changed files with 12 additions and 2 deletions

View File

@@ -114,7 +114,7 @@ function AttributesModel() {
function isValid() {
for (let attributes = self.ownedAttributes(), i = 0; i < attributes.length; i++) {
if (self.isEmptyName(i)) {
if (self.isEmptyName(i) || self.isEmptyRelationTarget(i)) {
return false;
}
}
@@ -212,6 +212,12 @@ function AttributesModel() {
return cur.name.trim() === "" && !cur.isDeleted && (cur.attributeId !== "" || cur.labelValue !== "" || cur.relationValue);
};
this.isEmptyRelationTarget = function(index) {
const cur = self.ownedAttributes()[index]();
return cur.type === "relation" && !cur.isDeleted && cur.name && !cur.relationValue;
};
this.getTargetAttribute = function(target) {
const context = ko.contextFor(target);
const index = context.$index();