AddEdgeModal/SearchContainer: change separator character '#' to long string

master
Clément Notin 2019-02-15 19:00:20 +01:00 committed by cnotin
parent 5b8ee5e28f
commit b4a6564f31
2 changed files with 16 additions and 12 deletions

View File

@ -2,6 +2,8 @@ import React, { Component } from "react";
import { Modal } from "react-bootstrap";
import { buildSearchQuery } from 'utils';
const SEPARATOR = "#BLOODHOUNDSEPARATOR#";
export default class AddEdgeModal extends Component {
constructor() {
super();
@ -49,7 +51,7 @@ export default class AddEdgeModal extends Component {
type: record._fields[0].labels[0]
});
map[index] = props;
data.push(`${props.name}#${index}`);
data.push(`${props.name}${SEPARATOR}${index}`);
})
this.map = map;
@ -58,11 +60,11 @@ export default class AddEdgeModal extends Component {
})
},
updater: function(item){
let [_, index] = item.split('#');
let [_, index] = item.split(SEPARATOR);
return this.map[index];
},
matcher: function(item){
let [name,index] = item.split('#');
let [name,index] = item.split(SEPARATOR);
let obj = this.map[index];
let searchTerm = this.query.includes(':') ? this.query.split(':')[1] : this.query;
@ -75,7 +77,7 @@ export default class AddEdgeModal extends Component {
}
},
highlighter: function(item){
let [name,index] = item.split('#');
let [name,index] = item.split(SEPARATOR);
let obj = this.map[index];
let searchTerm = this.query.includes(':') ? this.query.split(':')[1] : this.query;
let type = obj.type;

View File

@ -4,6 +4,8 @@ import Icon from "../Icon";
import TabContainer from "./TabContainer";
import { buildSearchQuery, buildSelectQuery } from "utils";
const SEPARATOR = "#BLOODHOUNDSEPARATOR#";
export default class SearchContainer extends Component {
constructor(props) {
super(props);
@ -73,7 +75,7 @@ export default class SearchContainer extends Component {
type: record._fields[0].labels[0]
});
map[index] = props;
data.push(`${props.name}#${index}`);
data.push(`${props.name}${SEPARATOR}${index}`);
})
this.map = map;
@ -113,13 +115,13 @@ export default class SearchContainer extends Component {
}.bind(this),
autoSelect: false,
updater: function (item) {
let spl = item.split("#");
let spl = item.split(SEPARATOR);
let index = spl[1];
let obj = this.map[index];
return obj;
},
matcher: function (item) {
let spl = item.split("#");
let spl = item.split(SEPARATOR);
let name = spl[0];
let index = spl[1];
let obj = this.map[index];
@ -144,7 +146,7 @@ export default class SearchContainer extends Component {
}
},
highlighter: function (item) {
let spl = item.split("#");
let spl = item.split(SEPARATOR);
let name = spl[0];
let index = spl[1];
let obj = this.map[index];
@ -210,7 +212,7 @@ export default class SearchContainer extends Component {
type: record._fields[0].labels[0]
});
map[index] = props;
data.push(`${props.name}#${index}`);
data.push(`${props.name}${SEPARATOR}${index}`);
index++;
})
@ -237,13 +239,13 @@ export default class SearchContainer extends Component {
}.bind(this),
autoSelect: false,
updater: function (item) {
let spl = item.split("#");
let spl = item.split(SEPARATOR);
let index = spl[1];
let obj = this.map[index];
return obj;
},
matcher: function (item) {
let spl = item.split("#");
let spl = item.split(SEPARATOR);
let name = spl[0];
let index = spl[1];
let obj = this.map[index];
@ -268,7 +270,7 @@ export default class SearchContainer extends Component {
}
},
highlighter: function (item) {
let spl = item.split("#");
let spl = item.split(SEPARATOR);
let name = spl[0];
let index = spl[1];
let obj = this.map[index];