Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
createChannel() {
// create a channel and listen the changes
const channelObj = manager.create(this.context.appbaseRef, this.context.type, this.react, 100, 0, false, this.props.componentId);
this.channelId = channelObj.channelId;
this.channelListener = channelObj.emitter.addListener(channelObj.channelId, (res) => {
if (res.error) {
this.setState({
queryStart: false
});
}
if (res.appliedQuery) {
const data = res.data;
if (data && data.aggregations) {
if (data.aggregations.max && data.aggregations.min) {
this.setState({
range: {
min: data.aggregations.min.value,
max: data.aggregations.max.value
}
createChannel() {
this.includeAggQuery();
// create a channel and listen the changes
const channelObj = manager.create(this.context.appbaseRef, this.context.type, this.react, 100, 0, false, this.props.componentId);
this.channelId = channelObj.channelId;
this.channelListener = channelObj.emitter.addListener(this.channelId, (res) => {
if (res.error) {
this.setState({
queryStart: false
});
}
if (res.appliedQuery && Object.keys(res.appliedQuery).length) {
this.queryLevel = this.getQueryLevel(res.appliedQuery);
this.setState({
queryStart: false,
rawData: res.data
});
this.setData(res.data, this.queryLevel);
}
});
createChannel() {
for (let level = 1; level < this.props.dataField.length; level += 1) {
const react = this.getReact(level);
// create a channel and listen the changes
this.channelObj[level] = manager.create(this.context.appbaseRef, this.context.type, react);
this.channelId[level] = this.channelObj[level].channelId;
this.channelListener[level] = this.localChannel(level, react);
// this.listenLoadingChannel(channelObj, "loadListenerParent");
}
this.setInitialData();
}
createChannel() {
this.includeAggQuery();
// create a channel and listen the changes
const channelObj = manager.create(this.context.appbaseRef, this.context.type, this.react, 100, 0, false, this.props.componentId);
this.channelId = channelObj.channelId;
this.channelListener = channelObj.emitter.addListener(this.channelId, (res) => {
if (res.error) {
this.setState({
queryStart: false
});
}
if (res.appliedQuery && Object.keys(res.appliedQuery).length) {
this.queryLevel = this.getQueryLevel(res.appliedQuery);
this.setState({
queryStart: false,
rawData: res.data
});
this.setData(res.data, this.queryLevel);
}
});
createChannel(executeChannel = false) {
// create a channel and listen the changes
const channelObj = manager.create(this.context.appbaseRef, this.context.type, this.react, this.props.size, this.props.from, this.props.stream);
this.channelId = channelObj.channelId;
this.channelListener = channelObj.emitter.addListener(channelObj.channelId, (res) => {
// implementation to prevent initialize query issue if old query response is late then the newer query
// then we will consider the response of new query and prevent to apply changes for old query response.
// if queryStartTime of channel response is greater than the previous one only then apply changes
if (res.error && res.startTime > this.queryStartTime) {
this.setState({
queryStart: false,
showPlaceholder: false
});
}
if (res.appliedQuery) {
if (res.mode === "historic" && res.startTime > this.queryStartTime) {
const visibleNoResults = res.appliedQuery && res.data && !res.data.error ? (!(res.data.hits && res.data.hits.total)) : false;
const resultStats = {
createChannel() {
this.includeAggQuery();
// create a channel and listen the changes
const channelObj = manager.create(this.context.appbaseRef, this.context.type, this.react);
this.channelId = channelObj.channelId;
this.channelListener = channelObj.emitter.addListener(this.channelId, (res) => {
if (res.error) {
this.setState({
queryStart: false
});
}
if (res.appliedQuery) {
const data = res.data;
let rawData;
if (res.mode === "streaming") {
rawData = this.state.rawData;
rawData.hits.hits.push(res.data);
} else if (res.mode === "historic") {
rawData = data;
}
createChannel(executeChannel = false) {
// create a channel and listen the changes
const channelObj = manager.create(this.context.appbaseRef, this.context.type, this.react, this.props.size, this.props.from, this.props.stream);
this.channelId = channelObj.channelId;
this.channelListener = channelObj.emitter.addListener(channelObj.channelId, (res) => {
// implementation to prevent initialize query issue if old query response is late then the newer query
// then we will consider the response of new query and prevent to apply changes for old query response.
// if queryStartTime of channel response is greater than the previous one only then apply changes
if (res.error && res.startTime > this.queryStartTime) {
this.setState({
queryStart: false,
showPlaceholder: false
});
}
if (res.appliedQuery) {
if (res.mode === "historic" && res.startTime > this.queryStartTime) {
const visibleNoResults = res.appliedQuery && res.data && !res.data.error ? (!(res.data.hits && res.data.hits.total)) : false;
const resultStats = {
createChannel() {
const channelObj = manager.create(this.context.appbaseRef, this.context.type, this.react, 100, 0, false, this.props.componentId);
this.channelId = channelObj.channelId;
this.channelListener = channelObj.emitter.addListener(channelObj.channelId, (res) => {
const data = res.data;
let rawData;
if (res.mode === "streaming") {
rawData = this.state.rawData;
rawData.hits.hits.push(res.data);
} else if (res.mode === "historic") {
rawData = data;
}
this.setState({
rawData
});
this.setData(rawData, res.appliedQuery.body.query);
});
this.listenLoadingChannel(channelObj);