2017-07-07 09:13:53 -05:00
|
|
|
## -*- coding: utf-8; -*-
|
2017-07-14 21:23:40 -05:00
|
|
|
<%inherit file="/master/index.mako" />
|
2017-07-07 09:13:53 -05:00
|
|
|
|
2017-12-02 17:08:17 -06:00
|
|
|
<%def name="extra_javascript()">
|
|
|
|
${parent.extra_javascript()}
|
2019-06-16 15:50:40 -05:00
|
|
|
% if not use_buefy:
|
2017-12-02 18:14:31 -06:00
|
|
|
% if master.results_executable and request.has_perm('{}.execute_multiple'.format(permission_prefix)):
|
2017-12-02 17:08:17 -06:00
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
var has_execution_options = ${'true' if master.has_execution_options(batch) else 'false'};
|
2018-01-05 11:21:30 -06:00
|
|
|
var dialog_opened = false;
|
2017-12-02 17:08:17 -06:00
|
|
|
|
|
|
|
$(function() {
|
|
|
|
|
|
|
|
$('#execute-results-button').click(function() {
|
2018-02-11 22:37:17 -06:00
|
|
|
var count = $('.grid-wrapper').gridwrapper('results_count');
|
|
|
|
if (!count) {
|
|
|
|
alert("There are no batch results to execute.");
|
|
|
|
return;
|
|
|
|
}
|
2017-12-02 17:08:17 -06:00
|
|
|
var form = $('form[name="execute-results"]');
|
|
|
|
if (has_execution_options) {
|
|
|
|
$('#execution-options-dialog').dialog({
|
|
|
|
title: "Execution Options",
|
2018-01-05 11:21:30 -06:00
|
|
|
width: 550,
|
2017-12-02 17:08:17 -06:00
|
|
|
height: 300,
|
|
|
|
modal: true,
|
|
|
|
buttons: [
|
|
|
|
{
|
|
|
|
text: "Execute",
|
|
|
|
click: function(event) {
|
|
|
|
dialog_button(event).button('option', 'label', "Executing, please wait...").button('disable');
|
|
|
|
form.submit();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "Cancel",
|
|
|
|
click: function() {
|
|
|
|
$(this).dialog('close');
|
|
|
|
}
|
|
|
|
}
|
2018-01-05 11:21:30 -06:00
|
|
|
],
|
|
|
|
open: function() {
|
|
|
|
if (! dialog_opened) {
|
2018-01-05 17:13:01 -06:00
|
|
|
$('#execution-options-dialog select[auto-enhance="true"]').selectmenu();
|
|
|
|
$('#execution-options-dialog select[auto-enhance="true"]').on('selectmenuopen', function(event, ui) {
|
|
|
|
show_all_options($(this));
|
|
|
|
});
|
2018-01-05 11:21:30 -06:00
|
|
|
dialog_opened = true;
|
|
|
|
}
|
|
|
|
}
|
2017-12-02 17:08:17 -06:00
|
|
|
});
|
|
|
|
} else {
|
|
|
|
$(this).button('option', 'label', "Executing, please wait...").button('disable');
|
|
|
|
form.submit();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
</script>
|
|
|
|
% endif
|
2019-06-16 15:50:40 -05:00
|
|
|
% endif
|
2017-12-02 17:08:17 -06:00
|
|
|
</%def>
|
|
|
|
|
|
|
|
<%def name="grid_tools()">
|
2019-10-09 11:19:48 -05:00
|
|
|
${parent.grid_tools()}
|
2017-12-02 18:14:31 -06:00
|
|
|
% if master.results_executable and request.has_perm('{}.execute_multiple'.format(permission_prefix)):
|
2019-06-16 15:50:40 -05:00
|
|
|
% if use_buefy:
|
|
|
|
<b-button type="is-primary"
|
|
|
|
@click="executeResults()"
|
|
|
|
:disabled="!total">
|
|
|
|
Execute Results
|
|
|
|
</b-button>
|
|
|
|
|
|
|
|
<b-modal has-modal-card
|
|
|
|
:active.sync="showExecutionOptions">
|
|
|
|
<div class="modal-card">
|
|
|
|
|
|
|
|
<header class="modal-card-head">
|
|
|
|
<p class="modal-card-title">Execution Options</p>
|
|
|
|
</header>
|
|
|
|
|
|
|
|
<section class="modal-card-body">
|
|
|
|
<p>
|
|
|
|
Please be advised, you are about to execute {{ total }} batches!
|
|
|
|
</p>
|
|
|
|
<br />
|
|
|
|
<tailbone-form ref="executeResultsForm"></tailbone-form>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<footer class="modal-card-foot">
|
|
|
|
<b-button @click="showExecutionOptions = false">
|
|
|
|
Cancel
|
|
|
|
</b-button>
|
|
|
|
<once-button type="is-primary"
|
|
|
|
@click="submitExecuteResults()"
|
|
|
|
text="Execute">
|
|
|
|
</once-button>
|
|
|
|
</footer>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</b-modal>
|
|
|
|
|
|
|
|
% else:
|
|
|
|
<button type="button" id="execute-results-button">Execute Results</button>
|
|
|
|
% endif
|
|
|
|
% endif
|
|
|
|
</%def>
|
|
|
|
|
2019-08-03 16:57:13 -05:00
|
|
|
<%def name="modify_this_page_vars()">
|
|
|
|
${parent.modify_this_page_vars()}
|
2019-06-16 15:50:40 -05:00
|
|
|
% if master.results_executable and request.has_perm('{}.execute_multiple'.format(permission_prefix)):
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
TailboneForm.methods.submit = function() {
|
|
|
|
this.$refs.actualForm.submit()
|
|
|
|
}
|
|
|
|
|
|
|
|
TailboneGridData.hasExecutionOptions = ${json.dumps(master.has_execution_options(batch))|n}
|
|
|
|
TailboneGridData.showExecutionOptions = false
|
|
|
|
|
|
|
|
TailboneGrid.methods.executeResults = function() {
|
|
|
|
|
|
|
|
// this should never happen since we disable the button when there are no results
|
|
|
|
if (!this.total) {
|
|
|
|
alert("There are no batch results to execute.")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.hasExecutionOptions) {
|
|
|
|
// show execution options modal, user can submit form from there
|
|
|
|
this.showExecutionOptions = true
|
|
|
|
|
|
|
|
} else {
|
|
|
|
// no execution options, but this still warrants a basic confirmation
|
|
|
|
if (confirm("Are you sure you wish to execute all " + this.total.toLocaleString('en') + " batches?")) {
|
|
|
|
alert('TODO: ok then you asked for it')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TailboneGrid.methods.submitExecuteResults = function() {
|
|
|
|
this.$refs.executeResultsForm.submit()
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
2017-12-02 17:08:17 -06:00
|
|
|
% endif
|
|
|
|
</%def>
|
|
|
|
|
2019-08-03 16:57:13 -05:00
|
|
|
<%def name="make_this_page_component()">
|
|
|
|
${parent.make_this_page_component()}
|
|
|
|
% if master.results_executable and request.has_perm('{}.execute_multiple'.format(permission_prefix)):
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
TailboneForm.data = function() { return TailboneFormData }
|
|
|
|
|
|
|
|
Vue.component('tailbone-form', TailboneForm)
|
|
|
|
|
|
|
|
</script>
|
|
|
|
% endif
|
|
|
|
</%def>
|
|
|
|
|
|
|
|
<%def name="render_this_page_template()">
|
|
|
|
${parent.render_this_page_template()}
|
|
|
|
% if master.results_executable and request.has_perm('{}.execute_multiple'.format(permission_prefix)):
|
|
|
|
${execute_form.render_deform(form_kwargs={'ref': 'actualForm'}, buttons=False)|n}
|
|
|
|
% endif
|
|
|
|
</%def>
|
2019-06-16 15:50:40 -05:00
|
|
|
|
|
|
|
|
2016-02-14 16:47:35 -06:00
|
|
|
${parent.body()}
|
2017-12-02 17:08:17 -06:00
|
|
|
|
2019-06-16 15:50:40 -05:00
|
|
|
% if not use_buefy:
|
2017-12-02 18:14:31 -06:00
|
|
|
% if master.results_executable and request.has_perm('{}.execute_multiple'.format(permission_prefix)):
|
2017-12-02 17:08:17 -06:00
|
|
|
<div id="execution-options-dialog" style="display: none;">
|
|
|
|
<br />
|
|
|
|
<p>
|
|
|
|
Please be advised, you are about to execute multiple batches!
|
|
|
|
</p>
|
|
|
|
<br />
|
2018-02-11 22:37:17 -06:00
|
|
|
${execute_form.render_deform(form_kwargs={'name': 'execute-results'}, buttons=False)|n}
|
2017-12-02 17:08:17 -06:00
|
|
|
</div>
|
|
|
|
% endif
|
2019-06-16 15:50:40 -05:00
|
|
|
% endif
|