Commit 66b4d9af authored by Jerome Mariette's avatar Jerome Mariette
Browse files

fix a bug with status and add the render function to the status (for hidden element buildings)

parent b8e030b5
......@@ -184,6 +184,9 @@
$("#reset_workflow").click(function(){ $('#setAndRunModalBody').wfform('reset'); });
$('#setAndRunModal').on('shown.bs.modal', function() {
$('#setAndRunModalBody').wfform('render');
});
$('#statusModal').on('shown.bs.modal', function() {
$('#statusModalBody').wfstatus('render');
});
$("#back_workflow").click(function(){
$('#statusModalBody').wfstatus('reload');
......
......@@ -556,6 +556,11 @@
<p>Requests the jflow server to rerun the workflow.
</p>
<pre class="pre-hl "><code class="javascript">$('#element').wfstatus('rerun')</code></pre>
<h4>.wfstatus('render')</h4>
<p>Render the status. This method can be useful when the form is built within a hidden <code>$("#element")</code>. The function
allows to render the <code>cytoscape</code> graph.
</p>
<pre class="pre-hl "><code class="javascript">$('#element').wfform('render')</code></pre>
<h4>.wfstatus('reset', component_name)</h4>
<p>Requests the jflow server to reset a specific component. The <code>component_name</code> variable should be given to the function.
</p>
......
......@@ -30,6 +30,7 @@
var WFStatus = function (element, options) {
this.$element = $(element);
this.options = $.extend({}, $.fn.wfstatus.defaults, options);
this.cytoptions = {};
if (this.options.serverURL == "") { this.options.serverURL = $.fn.activewf.defaults.serverURL; }
}
......@@ -134,7 +135,7 @@
}
}
WFStatus.prototype._createcytoscape = function(nodes, edges) {
WFStatus.prototype._createcytoscape = function(nodes, edges, $this) {
var cytoptions = {
style: cytoscape.stylesheet()
......@@ -282,11 +283,14 @@
cy.panzoom({});
}
}
setTimeout(function(){
$('#cytoscape_panel').cytoscape(cytoptions);
}, 100);
$this.cytoptions = cytoptions;
$('#cytoscape_panel').cytoscape(cytoptions);
}
WFStatus.prototype.render = function() {
// handle a bootstrap bug in case the status is in a modal
$(document).off('focusin.bs.modal');
$('#cytoscape_panel').cytoscape(this.cytoptions);
}
WFStatus.prototype._graphview = function() {
......@@ -376,7 +380,7 @@
$this.$element.find("#wfstatus_error_location").text( data.errors["location"] );
$this.$element.find("#wfstatus_error_panel").show();
}
$this._createcytoscape(nodes, edges);
$this._createcytoscape(nodes, edges, $this);
}
});
}
......
This diff is collapsed.
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