Skip to content

Commit 489d43d

Browse files
committed
Merge branch 'dev' of https://github.com/terminusdb/terminus-client into dev
2 parents 50212f9 + 987559b commit 489d43d

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

lib/viewer/documentFrame.js

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,37 @@ DocumentFrame.prototype.filterFrame = function(loadRenderer){
141141
frame.compare = rule.compare();
142142
}
143143
if(rule.errors()){
144-
frame.errors = rule.errors();
145-
}
144+
frame.errors = frame.errors ? frame.errors.concat(rule.errors()) : rule.errors();
145+
}
146+
else if(rule.errors() === false) delete frame.errors
146147
}
147148
this.applyRules(false, false, myfilt);
148149
}
149150

151+
DocumentFrame.prototype.setErrors = function(errors, frameconf){
152+
this.clearErrors(frameconf)
153+
for(var i = 0; i<errors.length; i++){
154+
addRuleForVio(frameconf, errors[i])
155+
}
156+
this.applyRules(false, frameconf);
157+
}
158+
159+
DocumentFrame.prototype.clearErrors = function(frameconf){
160+
frameconf.all().errors(false)
161+
this.applyRules(false, frameconf)
162+
}
163+
164+
function addRuleForVio(docview, error){
165+
let prop = (error['api:property'] ? error['api:property']["@value"] : false)
166+
let subj = (error['api:subject'] ? error['api:subject']["@value"] : false)
167+
let val = (error['api:value'] ? error['api:value']["@value"] : false)
168+
let type = (error['api:type'] ? error['api:type']["@value"] : false)
169+
if(type && val){ //api:BadCast
170+
docview.data().value(val).range(type).errors([error])
171+
}
172+
}
150173

151-
/*
174+
/*"
152175
* adds render and compare functions to object frames
153176
*/
154177
DocumentFrame.prototype.applyRules = function(doc, config, mymatch){

lib/viewer/objectFrame.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ PropertyFrame.prototype.fillFromSchema = function (newid) {
657657
this.values = values;
658658
}
659659
else if (this.isClassChoice()) {
660-
const clss = this.cframe.getClassChoices();
660+
const clss = this.cframe.getClassChoices();
661661
if (clss && clss.length) {
662662
const empty = this.cframe.createEmptyChoice(clss[0], FrameHelper.genBNID(FrameHelper.urlFragment(clss[0])+ "_"));
663663
empty.parent = this;

0 commit comments

Comments
 (0)