Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug has been fixed: Defiant doesn't support dash (-) in xpath nodes #53

Merged
merged 1 commit into from
Sep 12, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions cvat/apps/engine/static/engine/js/shapeFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ class FilterModel {
lock: shape.model.lock
};

// We replace all dashes due to defiant.js can't work with it
function convertAttributes(attributes) {
let converted = {};
for (let attrId in attributes) {
converted[attributes[attrId].name.toLowerCase()] = ('' + attributes[attrId].value).toLowerCase();
converted[attributes[attrId].name.toLowerCase().replace(/-/g, "_")] = ('' + attributes[attrId].value).toLowerCase();
}
return converted;
}
Expand All @@ -38,11 +39,11 @@ class FilterModel {
_convertCollection(collection) {
let converted = {};
for (let labelId in this._labels) {
converted[this._labels[labelId]] = [];
converted[this._labels[labelId].replace(/-/g, "_")] = [];
}

for (let shape of collection) {
converted[this._labels[shape.model.label].toLowerCase()].push(this._convertShape(shape));
converted[this._labels[shape.model.label].toLowerCase().replace(/-/g, "_")].push(this._convertShape(shape));
}
return converted;
}
Expand Down Expand Up @@ -109,7 +110,7 @@ class FilterView {
this._filterString.on('change', (e) => {
let value = $.trim(e.target.value);
if (value.length) {
value = value.split('|').map(x => '/d:data/' + x).join('|').toLowerCase();
value = value.split('|').map(x => '/d:data/' + x).join('|').toLowerCase().replace(/-/g, "_");
}
if (this._controller.updateFilter(value)) {
this._filterString.css('color', 'green');
Expand Down