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

Feature 474 #475

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a6836b5
Adding loadingSpinner gif image to use instead of 'Loading 3MB' message.
jrmartin Dec 16, 2019
1415b47
remove debugging logs
jrmartin Dec 16, 2019
489cfbc
change name of loading image to 'splash.png'
jrmartin Dec 16, 2019
3370746
Merge remote-tracking branch 'origin/development' into feature_467
jrmartin Dec 16, 2019
b2a79df
A new option added under 'help' menu, test updated to reflect this
jrmartin Dec 16, 2019
9bfb9b6
Merge remote-tracking branch 'origin/development' into feature_467
jrmartin Dec 21, 2019
4cca1ea
update clickQuickHelp reference
jrmartin Dec 21, 2019
059bb4b
Overview component cookie logic implementation
jrmartin Dec 21, 2019
6b81408
cleaning code
jrmartin Dec 21, 2019
a9d9188
clean width
jrmartin Dec 21, 2019
95c9c61
cleaning
jrmartin Dec 22, 2019
9417d03
run tests without quick help panel
jrmartin Dec 22, 2019
7faaa15
one more test
jrmartin Dec 22, 2019
78661ff
Testing with logs, figuring out why jest tests started failing on all
jrmartin Dec 23, 2019
c29a4e1
Test against development branch
jrmartin Dec 23, 2019
82cdad7
revert development branch test
jrmartin Dec 23, 2019
11478bb
Increase timeout, testing
jrmartin Dec 23, 2019
5ab5cb0
Looks like virgo is not starting up, debug logs
jrmartin Dec 23, 2019
d559894
one more debugging test
jrmartin Dec 23, 2019
81d94e3
test against development branch once more
jrmartin Dec 23, 2019
d432cb7
Final customizations to quick help window
jrmartin Dec 23, 2019
074e301
Test with mvn clean installs without --quiet flag
jrmartin Dec 23, 2019
30c37b1
Add test for getting rid of 'quick help modal'
jrmartin Dec 23, 2019
02324b3
changes for new quick help modal tests and some code cleaning
jrmartin Dec 24, 2019
29bd0ed
Cleaning code
jrmartin Dec 24, 2019
e3afd33
remove mvn install of frontend, reverts to development branch version
jrmartin Dec 24, 2019
a5043f6
fixing test
jrmartin Dec 24, 2019
591f226
Add again 'mvn install ' of frontend in Dockerfile, needs it
jrmartin Dec 24, 2019
c7fca54
revert package.json
jrmartin Dec 24, 2019
6904e60
Test with clean before install
jrmartin Dec 24, 2019
ed027e6
remove 'rmv src' from frontend mvn install
jrmartin Dec 24, 2019
2e40319
revert previous comment, breaks docker again
jrmartin Dec 24, 2019
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
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ RUN export DEBUG=false; if test "$build_type" = "development" ; then export DEBU
RUN cd $HOME/workspace/org.geppetto.frontend/src/main/webapp &&\
$HOME/rename.sh https://github.com/openworm/geppetto-client.git "${targetBranch}" "${originBranch}" "${defaultBranch}"

RUN cd $HOME/workspace/org.geppetto.frontend &&\
/bin/echo -e "\e[96mMaven install org.geppetto.frontend\e[0m" &&\
mvn ${mvnOpt} clean install &&\
rm -rf src

COPY dockerFiles/geppetto.plan $HOME/workspace/org.geppetto/geppetto.plan
COPY dockerFiles/config.json $HOME/workspace/org.geppetto/utilities/source_setup/config.json
COPY dockerFiles/startup.sh /
Expand Down
36 changes: 35 additions & 1 deletion components/VFBMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import SpotLight from 'geppetto-client/js/components/interface/spotlight/spotlig
import HTMLViewer from 'geppetto-client/js/components/interface/htmlViewer/HTMLViewer';
import ControlPanel from 'geppetto-client/js/components/interface/controlPanel/controlpanel';
import * as FlexLayout from 'geppetto-client/js/components/interface/flexLayout2/src/index';

import QuickHelp from './interface/VFBOverview/QuickHelp';

require('../css/base.less');
require('../css/VFBMain.less');
Expand Down Expand Up @@ -879,6 +879,39 @@ export default class VFBMain extends React.Component {
}
}.bind(this));
}.bind(this);

window.setCookie = function ( name, value, days ) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + (value || "") + expires + "; path=/";
};

window.getCookie = function ( name ) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1, c.length);
}
if ( c.indexOf(nameEQ) == 0 ) {
var result = c.substring(nameEQ.length, c.length);
return result;
}
}
return null;
};

// Retrieve cookie for 'quick_help' modal
var cookie = getCookie("show_quick_help");
// Show 'Quick Help' modal if cookie to hide it is not set to True
if ( cookie != 1) {
GEPPETTO.trigger('show_quick_help');
}

this.canvasReference.flipCameraY();
this.canvasReference.flipCameraZ();
Expand Down Expand Up @@ -1210,6 +1243,7 @@ export default class VFBMain extends React.Component {

return (
<div style={{ height: '100%', width: '100%' }}>
<QuickHelp id="quickHelp" />
<VFBToolBar
htmlOutputHandler={this.renderHTMLViewer}
menuHandler={this.menuHandler}/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,14 @@ var toolbarMenu = {
handlerAction: "clickFeedback",
parameters: []
}
},
{
label: "Click Help",
icon: "fa fa-book",
action: {
handlerAction: "clickQuickHelp",
parameters: []
}
}
]
}
Expand Down
78 changes: 78 additions & 0 deletions components/interface/VFBOverview/QuickHelp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
define(function (require) {

var React = require('react');
var CreateClass = require('create-react-class');
var GEPPETTO = require('geppetto');

var logoDiv = CreateClass({
escFunction : function (event) {
if ( event.keyCode === 27 ) {
this.hide()
}
},

show : function () {
$("#quick_help_modal").show();
},

hide : function () {
$("#quick_help_modal").hide();
},

componentDidMount: function () {
var self = this;
GEPPETTO.on('show_quick_help', function () {
self.show();
}.bind(this));

GEPPETTO.on('hide_quick_help', function () {
self.hide();
}.bind(this));

document.addEventListener("keydown", this.escFunction, false);

var self = this;
$(document).mouseup( function (e) {
var container = $("#quick_help_content");

// if the target of the click isn't the container nor a descendant of the container
if (!container.is(e.target) && container.has(e.target).length === 0) {
self.hide();
}
});
},

handleChange : function ( e ){
// set 30 days expiration
window.setCookie('show_quick_help', document.getElementById('quick_help_dialog').checked ? 1 : 0, 30);
},

render: function () {
return (
<div id="quick_help_modal" className="modal callout" style={ { display : "none", width : "auto" , height : "auto", position : "relative" , zIndex: "2000 !important" } }>
<div id="vfb-content-block" style={ { display : "block", width : "60%" , height : "60%" , textAlign : "center" , margin : "0 auto" } } >
<div id="quick_help_content" className="modal-content">
<div className="modal-header">
<button className="close-slider fa fa-times" id = "x" style = { { float : "right" } } onClick = {e => this.hide()} / >
<h3 className="text-center"> Quick Help
<span style= { { color : "white" } } > Virtual Fly Brain</span>
</h3>
</div>
<div className="modal-body">
<img src={"geppetto/build/splash.png"} alt="" / >
<div>
<div>
<input type="checkbox" id="quick_help_dialog" onChange={e => this.handleChange(e)} ref={ input => this.myinput = input} name="help_dialog" / >
<label htmlFor="help_dialog"><h3>Dont show up the quick help on startup screen.</h3></label>
</div>
</div>
</div>
</div>
</div>
</div>
)
}
});

return logoDiv;
});
9 changes: 8 additions & 1 deletion components/interface/VFBToolbar/VFBToolBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ export default class VFBToolBar extends React.Component {
this.feedbackHTML = require('../../configuration/VFBToolbar/vfbtoolbarHTML').feedback;
this.contributeHTML = require('../../configuration/VFBToolbar/vfbtoolbarHTML').contribute;


this.clickAbout = this.clickAbout.bind(this);
this.menuHandler = this.menuHandler.bind(this);
this.clickFeedback = this.clickFeedback.bind(this);
this.clickContribute = this.clickContribute.bind(this);
this.clickQuickHelp = this.clickQuickHelp.bind(this);
}

componentWillMount () {
Expand Down Expand Up @@ -213,6 +213,10 @@ export default class VFBToolBar extends React.Component {
this.props.htmlOutputHandler(htmlContent);
window.ga('vfb.send', 'pageview', (window.location.pathname + '?page=Contribute'));
}

clickQuickHelp () {
GEPPETTO.trigger('show_quick_help');
}

menuHandler (click) {
switch (click.handlerAction) {
Expand All @@ -234,6 +238,9 @@ export default class VFBToolBar extends React.Component {
case 'clickContribute':
this.clickContribute();
break;
case 'clickQuickHelp':
this.clickQuickHelp();
break;
default:
return this.props.menuHandler(click);
}
Expand Down
Binary file added images/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions tests/jest/vfb/3d-viewer-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const puppeteer = require('puppeteer');
const { TimeoutError } = require('puppeteer/Errors');

import { getUrlFromProjectId } from './cmdline.js';
import { wait4selector, click } from './utils';
import { wait4selector, click, closeModalWindow} from './utils';
import * as ST from './selectors';

const baseURL = process.env.url || 'http://localhost:8080/org.geppetto.frontend';
Expand All @@ -15,7 +15,6 @@ describe('VFB 3D Viewer Component Tests', () => {
beforeAll(async () => {
jest.setTimeout(1800000);
await page.goto(PROJECT_URL);

});

// Tests that expected components are present when VFB page loads
Expand All @@ -40,6 +39,11 @@ describe('VFB 3D Viewer Component Tests', () => {
it('Term info component created after load', async () => {
await wait4selector(page, 'div#VFBTermInfo_el_1_component', { visible: true })
})

it('Hide Quick Help Modal Window', async () => {
closeModalWindow(page);
await wait4selector(page, 'div#quick_help_modal', { hidden : true })
})

it('Term info component correctly populated at startup', async () => {
// Checks name in Term Info is present and correct
Expand Down
7 changes: 6 additions & 1 deletion tests/jest/vfb/batch-request-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const puppeteer = require('puppeteer');
const { TimeoutError } = require('puppeteer/Errors');

import { getUrlFromProjectId } from './cmdline.js';
import { wait4selector, click } from './utils';
import { wait4selector, click, closeModalWindow } from './utils';
import * as ST from './selectors';

const baseURL = process.env.url || 'http://localhost:8080/org.geppetto.frontend';
Expand Down Expand Up @@ -44,6 +44,11 @@ describe('VFB Batch Requests Tests', () => {
it('Term info component created after load', async () => {
await wait4selector(page, 'div#VFBTermInfo_el_1_component', { visible: true })
})

it('Hide Quick Help Modal Window', async () => {
closeModalWindow(page);
await wait4selector(page, 'div#quick_help_modal', { hidden : true })
})

//Function used for testing existance of text inside term info component
it('Element ventral complex on adult brain template JFRC2 appeared in popup', async () => {
Expand Down
7 changes: 6 additions & 1 deletion tests/jest/vfb/control-panel-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const puppeteer = require('puppeteer');
const { TimeoutError } = require('puppeteer/Errors');

import { getUrlFromProjectId } from './cmdline.js';
import { wait4selector, click } from './utils';
import { wait4selector, click, closeModalWindow } from './utils';
import * as ST from './selectors';

const baseURL = process.env.url || 'http://localhost:8080/org.geppetto.frontend';
Expand Down Expand Up @@ -41,6 +41,11 @@ describe('VFB Control Panel Tests', () => {
await wait4selector(page, 'div#VFBTermInfo_el_2_component', { visible: true })
})

it('Hide Quick Help Modal Window', async () => {
closeModalWindow(page);
await wait4selector(page, 'div#quick_help_modal', { hidden : true })
})

it('Term info component correctly populated at startup', async () => {
await page.waitForFunction('document.getElementById("VFBTermInfo_el_0_component").innerText.startsWith("fru-M-200266 (VFB_00000001)")');
})
Expand Down
18 changes: 9 additions & 9 deletions tests/jest/vfb/menu-component-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const puppeteer = require('puppeteer');
const { TimeoutError } = require('puppeteer/Errors');

import { getCommandLineArg, getUrlFromProjectId } from './cmdline.js';
import { wait4selector, click } from './utils';
import { wait4selector, click, closeModalWindow } from './utils';
import * as ST from './selectors';

const baseURL = process.env.url || 'http://localhost:8080/org.geppetto.frontend';
Expand Down Expand Up @@ -38,6 +38,11 @@ describe('VFB Menu Component Tests', () => {
it('Term info component correctly populated at startup', async () => {
await page.waitForFunction('document.getElementById("VFBTermInfo_el_0_component").innerText.startsWith("adult brain template JFRC2 (VFB_00017894)")', {timeout : 120000});
})

it('Hide Quick Help Modal Window', async () => {
closeModalWindow(page);
await wait4selector(page, 'div#quick_help_modal', { hidden : true })
})
})

//Tests Menu Components for About and Help Work
Expand All @@ -51,14 +56,9 @@ describe('VFB Menu Component Tests', () => {
expect(dropDownMenuItems).toEqual(4);
})

it('About Modal Appears', async () => {
await page.evaluate(async () => document.getElementById("About").click());
// Wait for selector to appear, this means About modal was opened
await wait4selector(page, '#vfb-content-block', { visible: true })
})

// Tests modal title bar is populated with expected title for About modal
it('About Modal Title Correct', async () => {
await page.evaluate(async () => document.getElementById("About").click());
await page.waitForFunction('document.getElementById("vfb-content-titlebar").innerText.startsWith("About Virtual Fly Brain")');
})

Expand All @@ -82,9 +82,9 @@ describe('VFB Menu Component Tests', () => {
await page.evaluate(async () => document.getElementById("Help").click());
// Wait for drop down menu of 'Help' to show
await wait4selector(page, "ul.MuiList-root", { visible: true, timeout : 120000 })
// Check there's three elements in the drop down menu of 'Help'
// Check there's four elements in the drop down menu of 'Help'
const dropDownMenuItems = await page.evaluate(async () => document.getElementsByClassName("MuiListItem-root").length);
expect(dropDownMenuItems).toEqual(3);
expect(dropDownMenuItems).toEqual(4);
})

it('Help Modal FAQ Tab Opened', async () => {
Expand Down
9 changes: 7 additions & 2 deletions tests/jest/vfb/query-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const puppeteer = require('puppeteer');
const { TimeoutError } = require('puppeteer/Errors');

import { getUrlFromProjectId } from './cmdline.js';
import { wait4selector, click } from './utils';
import { wait4selector, click, closeModalWindow } from './utils';
import * as ST from './selectors';

const baseURL = process.env.url || 'http://localhost:8080/org.geppetto.frontend';
Expand Down Expand Up @@ -40,6 +40,11 @@ describe('VFB Query Component Tests', () => {
it('Term info component created after load', async () => {
await wait4selector(page, 'div#VFBTermInfo_el_1_component', { visible: true })
})

it('Hide Quick Help Modal Window', async () => {
closeModalWindow(page);
await wait4selector(page, 'div#quick_help_modal', { hidden : true })
})

it('Term info component correctly populated at startup', async () => {
await page.waitForFunction('document.getElementById("VFBTermInfo_el_0_component").innerText.startsWith("adult brain template JFRC2 (VFB_00017894)")');
Expand Down Expand Up @@ -87,7 +92,7 @@ describe('VFB Query Component Tests', () => {

it('Term info correctly populated for example of Medulla after query results info button click', async () => {
await page.evaluate(async selector => $("#VFB_00030624-image-container").find("img").click())
await wait4selector(page, '#VFB_00030624_deselect_buttonBar_btn', { visible: true, timeout : 10000 })
await wait4selector(page, '#VFB_00030624_deselect_buttonBar_btn', { visible: true, timeout : 60000 })
await page.waitForFunction('document.getElementById("VFBTermInfo_el_0_component").innerText.startsWith("medulla on adult brain template JFRC2 (VFB_00030624)")');
})
})
Expand Down
7 changes: 6 additions & 1 deletion tests/jest/vfb/slice-viewer-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const puppeteer = require('puppeteer');
const { TimeoutError } = require('puppeteer/Errors');

import { getUrlFromProjectId } from './cmdline.js';
import { wait4selector, click } from './utils';
import { wait4selector, click, closeModalWindow } from './utils';
import * as ST from './selectors';

const baseURL = process.env.url || 'http://localhost:8080/org.geppetto.frontend';
Expand Down Expand Up @@ -40,6 +40,11 @@ describe('VFB Slice Viewer Component Tests', () => {
it('Term info component created after load', async () => {
await wait4selector(page, 'div#VFBTermInfo_el_1_component', { visible: true })
})

it('Hide Quick Help Modal Window', async () => {
closeModalWindow(page);
await wait4selector(page, 'div#quick_help_modal', { hidden : true })
})

it('Term info component correctly populated at startup', async () => {
await page.waitForFunction('document.getElementById("VFBTermInfo_el_0_component").innerText.startsWith("adult brain template JFRC2 (VFB_00017894)")');
Expand Down
7 changes: 6 additions & 1 deletion tests/jest/vfb/spotlight-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const puppeteer = require('puppeteer');
const { TimeoutError } = require('puppeteer/Errors');

import { getUrlFromProjectId } from './cmdline.js';
import { wait4selector, click } from './utils';
import { wait4selector, click, closeModalWindow } from './utils';
import * as ST from './selectors';

const baseURL = process.env.url || 'http://localhost:8080/org.geppetto.frontend';
Expand Down Expand Up @@ -40,6 +40,11 @@ describe('VFB Spotlight Tests', () => {
it('Term info component created after load', async () => {
await wait4selector(page, 'div#VFBTermInfo_el_1_component', { visible: true })
})

it('Hide Quick Help Modal Window', async () => {
closeModalWindow(page);
await wait4selector(page, 'div#quick_help_modal', { hidden : true })
})

it('Term info component correctly populated at startup', async () => {
await page.waitForFunction('document.getElementById("VFBTermInfo_el_0_component").innerText.startsWith("adult brain template JFRC2 (VFB_00017894)")');
Expand Down
Loading