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

Fix result modal working only on first table page #17

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 6 additions & 1 deletion ndscheduler/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@
<option value="600">10 minutes</option>
<option value="3600">1 hour</option>
<option value="43200">12 hours</option>
<option value="86400">24 hours</option>
<option value="86400">1 day</option>
<option value="172800">2 days</option>
<option value="604800">1 week</option>
<option value="2592000">1 month</option>
<option value="15552000">6 months</option>
<option value="31557600">1 year</option>
</select>
</div>
<div class="form-group">
Expand Down
27 changes: 12 additions & 15 deletions ndscheduler/static/js/views/executions/table-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ define(['utils',
{ "orderable": false, "className": "table-result-column", "targets": 5 }
]
});

$('#executions-table tbody').on('click', '[data-action=show-result]', function(e) {
e.preventDefault();
$('#result-box').text(decodeURI($(this).data('content')));
$('#execution-result-modal').modal();
});
},

/**
Expand Down Expand Up @@ -100,21 +106,12 @@ define(['utils',
if (data.length) {
this.table.fnClearTable();
this.table.fnAddData(data);

var buttons = $('[data-action=show-result]');
_.each(buttons, function(btn) {
$(btn).on('click', _.bind(function(e) {
e.preventDefault();
$('#result-box').text(decodeURI($(btn).data('content')));
$('#execution-result-modal').modal();
}, this));

// If there's a query parameter result, we'll display the result.
if (!_.isUndefined(utils.getParameterByName('result'))) {
$('#result-box').text(executions[0].get('result'));
$('#execution-result-modal').modal();
}
});

// If there's a query parameter result, we'll display the result.
if (!_.isUndefined(utils.getParameterByName('result'))) {
$('#result-box').text(executions[0].get('result'));
$('#execution-result-modal').modal();
}
}

utils.stopSpinner(this.spinner);
Expand Down