mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-11-25 02:10:32 -06:00
SEARCH-155
Index real-time data. - safety checks - removed lodash isobject
This commit is contained in:
parent
f1122c35d3
commit
698e1a3b32
@ -122,7 +122,7 @@
|
||||
buttonIndex.addEventListener('click', function () {
|
||||
let batchIndex = batchNumber.value;
|
||||
search.readJson(batchIndex).then(function (res) {
|
||||
search.indexBatch(res).then(function () {
|
||||
search.indexBatch(JSON.stringify(res)).then(function () {
|
||||
resultsEl.innerHTML = "Index created";
|
||||
});
|
||||
}).catch(function (err) {
|
||||
@ -185,7 +185,7 @@
|
||||
|
||||
sendMessage.addEventListener('click', function () {
|
||||
if (realTimeIndexing.value !== "") {
|
||||
let message = JSON.parse(realTimeIndexing.value);
|
||||
let message = realTimeIndexing.value;
|
||||
resultsEl.innerHTML = search.realTimeIndexing(message);
|
||||
} else {
|
||||
resultsEl.innerHTML = "Please check the entered value"
|
||||
|
@ -6,7 +6,6 @@ const electron = require('electron');
|
||||
const childProcess = require('child_process');
|
||||
const app = electron.app;
|
||||
const path = require('path');
|
||||
const isObject = require('lodash.isplainobject');
|
||||
const isDevEnv = require('../utils/misc.js').isDevEnv;
|
||||
const isMac = require('../utils/misc.js').isMac;
|
||||
|
||||
@ -110,7 +109,12 @@ class Search {
|
||||
*/
|
||||
indexBatch(messages) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!messages && !(JSON.parse(messages) instanceof Array)) {
|
||||
if (!messages) {
|
||||
reject(new Error('Messages is required'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(JSON.parse(messages) instanceof Array)) {
|
||||
reject(new Error('Messages must be an array'));
|
||||
return;
|
||||
}
|
||||
@ -152,8 +156,12 @@ class Search {
|
||||
* @param message
|
||||
*/
|
||||
realTimeIndexing(message) {
|
||||
if (!message && !isObject(JSON.parse(message))) {
|
||||
return new Error('Messages must be an object');
|
||||
if (!message) {
|
||||
return new Error('Message is required');
|
||||
}
|
||||
|
||||
if (!(JSON.parse(message) instanceof Array)){
|
||||
return new Error('Message must be an array');
|
||||
}
|
||||
|
||||
if (!this.isInitialized) {
|
||||
|
@ -109,7 +109,6 @@
|
||||
"ffi": "^2.2.0",
|
||||
"filesize": "^3.5.10",
|
||||
"keymirror": "0.1.1",
|
||||
"lodash.isplainobject": "^4.0.6",
|
||||
"node-forge": "^0.7.1",
|
||||
"randomstring": "^1.1.5",
|
||||
"ref": "^1.3.4",
|
||||
|
Loading…
Reference in New Issue
Block a user