Commit fb9c9343 authored by David Hoksza's avatar David Hoksza
Browse files

upgrade to minerva v14

parent 79045960
Pipeline #12924 passed with stages
in 1 minute and 38 seconds
......@@ -2,6 +2,11 @@ require('../css/styles.css');
const jq = require('jquery');
//bootstrap table requires jquery to be in the global scope
if (window.$ === undefined && minerva.$ !== undefined) {
window.$ = window.jQuery = window.jquery = minerva.$;
}
require('bootstrap-table');
//var select2 = require('select2-browserify/');
......@@ -19,7 +24,7 @@ const settings = {
drugColumnName: 'Drug',
typeColumnName: 'Type',
reactionColumnName: 'Reaction',
dataSource: 'https://raw.githubusercontent.com/davidhoksza/drug-reactions-data/master/FinalReferenceStandard200LabelsTrimmed.csv'
dataSource: 'https://raw.githubusercontent.com/davidhoksza/drug-reactions-data/master/FinalReferenceStandard200LabelsTrimmed.csv1'
};
const globals = {
......@@ -130,12 +135,30 @@ function getContainerClass() {
function initMainContainer(){
$container = $(`<div class="${getContainerClass()}"></div>`).appendTo(pluginContainer);
$container.append(`
<div class="panel panel-default drugs-loading">
<div class="panel-body">
<i class="fa fa-circle-o-notch fa-spin"></i> Obtaining drug-bioentities mapping. This might take several minutes
if this is the first time the plugin is loaded for this map ...
</div>
</div>`);
<div class="modal fade">
<div class="modal-dialog">
<div class="modal-content border-danger">
<div class="modal-header bg-danger text-light">
<h4 class="modal-title">Error</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
</div>
<div class="modal-body">
<p>Loading the dataset from <i>${settings.dataSource}</i> failed.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="panel card panel-default drugs-loading">
<div class="panel-body card-body">
<i class="fa fa-circle-o-notch fa-spin"></i> Obtaining drug-bioentities mapping. This might take several minutes
if this is the first time the plugin is loaded for this map ...
</div>
</div>
`);
return $container;
}
......@@ -146,31 +169,14 @@ function initMainPageStructure(container){
<table class="adr-table"></table>
<div class="panel panel-warning error-panel hidden">
<div class="panel-heading"> No mapping found </div>
<div class="panel-body">
<div class="panel card panel-warning border-warning error-panel d-none hidden">
<div class="panel-heading card-header bg-warning"> No mapping found </div>
<div class="panel-body m-3">
Either the elements in the map are not targeted by any drug in the source
<a href="https://bionlp.nlm.nih.gov/tac2017adversereactions/" target="_blank">data set</a>
or the respective elements are not annotated by HGNC.
</div>
</div>
<div class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">Error</h4>
</div>
<div class="modal-body">
<p class="text-warning">Issue.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
`);
// container.find('.btn-search').on('click', () => search() );
......@@ -180,6 +186,7 @@ function initMainPageStructure(container){
function initAdrTable($container) {
if (globals.adrDataMap.length === 0){
$container.find('.error-panel').removeClass('hidden');
$container.find('.error-panel').removeClass('d-none');
return;
}
......@@ -400,6 +407,9 @@ function initDrugBioEntities(){
);
return Promise.all(promisses);
}, function () {
showModal();
return [];
}).then(function (drugSearchResults) {
drugNames.forEach((dn, i) => {
const dsrProcessed = processDSR(dn, drugSearchResults[i]);
......
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