Skip to content

Commit

Permalink
Prevent old_file_browser api calls and grid generation in current fil… (
Browse files Browse the repository at this point in the history
#2056)

* Prevent old_file_browser api calls and grid generation in current file browser

* Jkmarx/data set clean up (#2057)

* Remove provenance files.

* Remove data_set_old dependencies.

* Remove data_set_old dependencies.

* Remove reflow for old data set table.

* Remove spinner reference and library.

* Remove unused globals.
  • Loading branch information
jkmarx committed Aug 28, 2017
1 parent 218256e commit a679b99
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 199 deletions.
37 changes: 18 additions & 19 deletions refinery/static/source/js/refinery/contents.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,26 @@
var currentAnalysisUuid = analysisUuid;

$(document).ready(function () {
configurator = new DataSetConfigurator(externalStudyUuid, externalAssayUuid, "configurator-panel", REFINERY_API_BASE_URL, csrf_token);
configurator.initialize();
// To avoid generation when in the current file browser
if (window.location.href.indexOf('provenance') > -1) {
configurator = new DataSetConfigurator(externalStudyUuid, externalAssayUuid, "configurator-panel", REFINERY_API_BASE_URL, csrf_token);
configurator.initialize();


// event handling
var documentTableCommands = new Backbone.Wreqr.Commands();
var facetViewCommands = new Backbone.Wreqr.Commands();
var analysisViewCommands = new Backbone.Wreqr.Commands();
var pivotMatrixCommands = new Backbone.Wreqr.Commands();
var clientCommands = new Backbone.Wreqr.Commands();
var queryCommands = new Backbone.Wreqr.Commands();
var dataSetMonitorCommands = new Backbone.Wreqr.Commands();
// event handling
var documentTableCommands = new Backbone.Wreqr.Commands();
var facetViewCommands = new Backbone.Wreqr.Commands();
var analysisViewCommands = new Backbone.Wreqr.Commands();
var pivotMatrixCommands = new Backbone.Wreqr.Commands();
var clientCommands = new Backbone.Wreqr.Commands();
var queryCommands = new Backbone.Wreqr.Commands();
var dataSetMonitorCommands = new Backbone.Wreqr.Commands();

var lastSolrResponse = null,
lastProvVisSolrResponse = null;
var lastSolrResponse = null,
lastProvVisSolrResponse = null;

var showAnnotation = false;
var showAnnotation = false;

// To avoid generation when in the data set 2 browser
if (window.location.href.indexOf('data_sets') === -1) {
configurator.initialize(function () {
query = new SolrQuery(configurator, queryCommands);
query.initialize();
Expand Down Expand Up @@ -456,14 +456,13 @@
client.initialize(query, false);
client.initialize(annotationQuery, false);
});
}


configurator.getState(function () {
configurator.getState(function () {
// callback
});

});

}
});


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,10 @@ SolrDocumentTable.prototype.render = function(solrResponse) {
.trigger('refinery/solrTable/destroy')
.html("");
// Required while data set 2 lives in parallel.
if (window.location.href.indexOf('data_sets') === -1) {
self._renderTable(solrResponse);
self._renderTable(solrResponse);
//$( "#" + self._parentElementId ).html( code );
// attach event listeners
// ..
}
};

SolrDocumentTable.prototype._renderTable = function(solrResponse) {
Expand Down
177 changes: 0 additions & 177 deletions refinery/templates/core/data_set2.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@


{% block head_html %}
<link rel="stylesheet" href="{% static "vendor/spectrum/spectrum.css" %}" />
<link rel="stylesheet" href="{% static "styles/provenance-visualization.css" %}" />
<link rel="stylesheet" href="{% static "styles/file-browser.css" %}" />
<link rel="stylesheet" href="{% static "vendor/tipsy/src/stylesheets/tipsy.css" %}" />
<link rel="stylesheet" href="{% static "vendor/select2/select2.css" %}" />
<link rel="styleSheet" href="{% static "vendor/angular-ui-grid/ui-grid.min.css" %}"/>
<link rel="stylesheet" href="{% static "vendor/ui-select/dist/select.min.css" %}" />
Expand Down Expand Up @@ -84,50 +81,13 @@ <h1>Data Set

{% endblock %}

{% block vendor_scripts %}
<script type="text/javascript" src="{% static "js/d3/fisheye.js" %}"></script>
<script type="text/javascript" src="{% static "js/underscore/underscore-min.js" %}"></script>
<script type="text/javascript" src="{% static "js/backbone/backbone-min.js" %}"></script>
<script type="text/javascript" src="{% static "js/backbone-marionette/backbone.marionette.js" %}"></script>
<script type="text/javascript" src="{% static "js/bootbox/bootbox.min.js" %}"></script>

<!-- adding spinner -->
<script language="javascript" type="text/javascript" src="{% static "js/spin/spin.min.js" %}"></script>

<script language="javascript" type="text/javascript">
var opts = {
lines: 13, // The number of lines to draw
length: 4, // The length of each line
width: 2, // The line thickness
radius: 6, // The radius of the inner circle
corners: 1, // Corner roundness (0..1)
rotate: 0, // The rotation offset
color: '#000', // #rgb or #rrggbb
speed: 1, // Rounds per second
trail: 60, // Afterglow percentage
shadow: false, // Whether to render a shadow
hwaccel: false, // Whether to use hardware acceleration
className: 'spinner', // The CSS class to assign to the spinner
zIndex: 2e9, // The z-index (defaults to 2000000000)
top: 'top', // Top position relative to parent in px
left: 'top' // Left position relative to parent in px
};
</script>

{% endblock %}

{% block script %}


<!-- Refinery libraries -->
<script type="text/javascript">
var REFINERY_BASE_URL = document.location.host;
var REFINERY_API_BASE_URL = "/api/v1/";
var REFINERY_SOLR_BASE_URL = "{{ REFINERY_SOLR_BASE_URL }}";
var externalAssayUuid = "{{ assay_uuid }}";
var externalStudyUuid = "{{ study_uuid }}";
var externalAssayId = "{{ assay_id }}";
var externalStudyId = "{{ study_id }}";
var dataSetUuid = "{{ data_set.uuid }}";
var analysisUuid = "{{ analysis_uuid }}";

Expand All @@ -152,142 +112,5 @@ <h1>Data Set
</rp-node-selection-popover-detail>
</script>

<script type="text/javascript" src="{% static "js/refinery/solr/solr_utilities.js" %}"></script>
<script type="text/javascript" src="{% static "js/refinery/solr/solr_client.js" %}"></script>
<script type="text/javascript" src="{% static "js/refinery/solr/solr_query.js" %}"></script>
<script type="text/javascript" src="{% static "js/refinery/solr/solr_response.js" %}"></script>
<script type="text/javascript" src="{% static "js/refinery/solr/solr_document_table.js" %}"></script>
<script type="text/javascript" src="{% static "js/refinery/solr/solr_facet_view.js" %}"></script>
<script type="text/javascript" src="{% static "js/refinery/solr/solr_analysis_view.js" %}"></script>
<script type="text/javascript" src="{% static "js/refinery/solr/solr_document_count_view.js" %}"></script>
<script type="text/javascript" src="{% static "js/refinery/solr/solr_pivot_matrix.js" %}"></script>
<script type="text/javascript" src="{% static "vendor/tipsy/src/javascripts/jquery.tipsy.js" %}"></script>

<script type="text/javascript" src="{% static "js/refinery/contents.js" %}">var query;</script>
<script type="text/javascript" src="{% static "js/refinery/data_set_manager/data_set_configurator.js" %}"></script>
<script type="text/javascript" src="{% static "js/refinery/core/node_set_manager.js" %}"></script>
<script type="text/javascript" src="{% static "js/refinery/core/analysis_api_client.js" %}"></script>
<script type="text/javascript" src="{% static "js/refinery/core/data_set_monitor.js" %}"></script>

<script type="text/javascript" src="{% static "vendor/floatThead/dist/jquery.floatThead.min.js" %}"></script>

<!-- provenance visualization -->
<script type="text/javascript" src="{% static "vendor/lodash/lodash.min.js" %}"></script>
<script type="text/javascript" src="{% static "vendor/graphlib/dist/graphlib.core.min.js" %}"></script>
<script type="text/javascript" src="{% static "vendor/dagre/dist/dagre.core.min.js" %}"></script>
<script type="text/javascript" src="{% static "vendor/spectrum/spectrum.js" %}"></script>

<script type="text/javascript" src="{% static "js/provvis/provvis-helpers.js" %}"></script>
<script type="text/javascript" src="{% static "js/provvis/provvis-decl.js" %}"></script>
<script type="text/javascript" src="{% static "js/provvis/provvis-init.js" %}"></script>
<script type="text/javascript" src="{% static "js/provvis/provvis-layout.js" %}"></script>
<script type="text/javascript" src="{% static "js/provvis/provvis-motifs.js" %}"></script>
<script type="text/javascript" src="{% static "js/provvis/provvis-render.js" %}"></script>
<script type="text/javascript" src="{% static "js/provvis/provvis.js" %}"></script>

<script type="application/javascript">
setTimeout(function() {
sizing();
}, 750);
$(document).ready(function () {
$("#navigation-tabs a").on('shown', function (e) {
sizing();
$(window).trigger('refinery/floatThead/reflow');
})

$("[rel=tooltip]").tooltip();
});

/*
* Sticky table header using floatThead.js
*/
(function(window, $, undefined){
'use strict';

var $solrTable = $('#assay-files-table'),
$table = $('#table_matrix'),
$window = $(window);

/**
* Debounce / Throttle
* Call a function with a delay after some calling.
* @param {Function} fn Function to be called.
* @param {Int} delay Delay in milliseconds.
* @return {Function} Function to be called.
*/
function debounce(fn, delay) {
var timer = null;
return function () {
var context = this, args = arguments;
clearTimeout(timer);
timer = setTimeout(function () {
fn.apply(context, args);
}, delay);
};
}

/*
* Initialize floatThead with all its magic.
*/
function initFloatThead () {
/*
* Start floatThead
*/
$table.floatThead({
autoReflow: true,
scrollContainer: function($table){
return $table.closest('.scrollable-floatThead');
},
zIndex: 2
});

/*
* Reflow floatThead when the browser's window size changes
*/
$window.on('resize.floatThead orientationchange.floatThead',
debounce(function () {
if ($table.is(":visible")) {
$table.floatThead('reflow');
}
}, 250)
);

/*
* Reflow floatThead when an custom script makes changes that change
* the tables layout.
*/
$window.on('refinery/floatThead/reflow', debounce(function () {
if ($table.is(":visible")) {
$table.floatThead('reflow');
}
}, 100));

$solrTable.on('refinery/solrTable/destroy', destroyFloatThead);
}

function destroyFloatThead () {
$table.floatThead('destroy');
$window.off('refinery/floatThead/reflow');
$window.off('resize.floatThead orientationchange.floatThead');
}

/*
* The table might not have been created when this code runs so we have to
* listen to a custom event to tell us that we are all set. We make sure
* to only listen to that event once!
*/
if (!$table.length) {
$solrTable.on('refinery/solrTable/created', function () {
$table = $('#table_matrix');
initFloatThead();
})
} else {
initFloatThead();
}
}
)(window, jQuery);

</script>

{% endblock %}

0 comments on commit a679b99

Please sign in to comment.