Commit 89357d87 authored by Maxime Chaillet's avatar Maxime Chaillet

Fix test in logbookContainer. Test partially the fetch fetching mechanism. It...

Fix test in logbookContainer. Test partially the fetch fetching mechanism. It fixes #126.
parent 9dbe50aa
......@@ -35,6 +35,8 @@ export function GUI_CONFIG() {
/* Default tag color used in the logbook when tag color is not set */
DEFAULT_TAG_COLOR: "#a6bded",
/* Activate the periodic refresh. So periodic http requests are performed*/
AUTOREFRESH_ENABLED: true,
/* Whether event list refreshed automatically or not by default. */
AUTOREFRESH_EVENTLIST: false,
/* the delay between 2 refreshments of event list. (in milliseconds)*/
......
import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import { getEventsByInvestigationId as getEventsByInvestigationIdRequest, getEventCountByInvestigationId as getEventCountByInvestigationIdRequest, createEvent, updateEvent } from './IORequests';
import { getEventsByInvestigationId, getEventCountByInvestigationId, createEvent, updateEvent } from './IORequests';
import _ from 'lodash';
import EventList from '../../components/Logbook/List/EventList';
......@@ -78,9 +78,9 @@ export class LogbookContainer extends React.Component {
<PeriodicRefresher
initialValue={this.state.pageEvents.length}
intervalInMilliSeconds={GUI_CONFIG().AUTOREFRESH_DELAY}
isEnabled={true}
isEnabled={GUI_CONFIG().AUTOREFRESH_ENABLED}
onCallbackSuccess={this.onNewEventsReceived}
periodicCallback={(onSuccess, onFailure) => getEventsByInvestigationIdRequest(user.sessionId, investigationId, GUI_CONFIG().EVENTS_PER_DOWNLOAD, 0, selectionFilter.find, GUI_CONFIG().DEFAULT_SORTING_FILTER, onSuccess, onFailure)}>
periodicCallback={(onSuccess, onFailure) => getEventsByInvestigationId(user.sessionId, investigationId, GUI_CONFIG().EVENTS_PER_DOWNLOAD, 0, selectionFilter.find, GUI_CONFIG().DEFAULT_SORTING_FILTER, onSuccess, onFailure)}>
<EventListMenu
availableTags={this.props.availableTags}
eventCountSinceLastRefresh={this.state.eventCountSinceLastRefresh}
......@@ -217,7 +217,7 @@ export class LogbookContainer extends React.Component {
});
}
getEventsByInvestigationIdRequest(user.sessionId, investigationId, GUI_CONFIG().EVENTS_PER_DOWNLOAD, offset, selectionFilter, sortingFilter, onSuccess, this.onEventsReceptionFailure);
getEventsByInvestigationId(user.sessionId, investigationId, GUI_CONFIG().EVENTS_PER_DOWNLOAD, offset, selectionFilter, sortingFilter, onSuccess, this.onEventsReceptionFailure);
// then possibly get event count for the current active selection filter
if (isEventCountRequestNeeded) {
......@@ -228,14 +228,14 @@ export class LogbookContainer extends React.Component {
fetchedEventCount: true
});
}
getEventCountByInvestigationIdRequest(investigationId, user.sessionId, selectionFilter, onSuccess, () => this.onEventCountReceptionFailure('eventCountSinceLastRefreshForCurrentSelectionFilter'));
getEventCountByInvestigationId(investigationId, user.sessionId, selectionFilter, onSuccess, () => this.onEventCountReceptionFailure('eventCountSinceLastRefreshForCurrentSelectionFilter'));
}
// Then get count of all events in the logbook used for the autorefresh feature
const onSuccess2 = (data) => {
this.setState({ eventCountSinceLastRefresh: parseInt(data.data, 10) });
}
getEventCountByInvestigationIdRequest(investigationId, user.sessionId, getSelectionFilterForAllAnnotationsAndNotifications(), onSuccess2, () => this.onEventCountReceptionFailure('eventCountSinceLastRefresh'));
getEventCountByInvestigationId(investigationId, user.sessionId, getSelectionFilterForAllAnnotationsAndNotifications(), onSuccess2, () => this.onEventCountReceptionFailure('eventCountSinceLastRefresh'));
}
/**
......
This diff is collapsed.
module.exports = {
rendering: {
renderAnimationFirstAndThenEventList: {
serverResponse1: {
data: [{
_id: 'testId1',
category: "comment",
content: [
{ format: 'plainText', text: 'this is a test' },
{ format: 'html', text: '<p> this is a test </p>' }
],
createdAt: '2018-01-01T00:01:00.000Z',
creationDate: '2018-01-01T00:00:00.000Z',
datasetId: null,
file: [],
fileSize: null,
filename: null,
investigationId: 'testInvestigationId',
machine: null,
previousVersionEvent: null,
software: null,
tag: [],
title: 'test title',
type: "annotation",
updatedAt: "2018-01-01T00:00:00.000Z",
username: "mchaille"
}]
},
serverResponse2: { data: '1' },
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment