Skip to content

Commit

Permalink
cancel buttons work several times now
Browse files Browse the repository at this point in the history
  • Loading branch information
M-Wicenec committed Jul 30, 2021
1 parent dab0950 commit a597149
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions daliuge-engine/dlg/manager/web/static/js/dm.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,17 +296,9 @@ function fillDmTable(sessions, tbodyEl, sessionLink, DimSessionLink, cancelBtnSe
var actionCells = rows.selectAll('td.actions').data(function values(s) { return [s.sessionId]; });
actionCells.enter().append('td').classed('actions', true)
.append("button").attr('id', cancelBtnSessionId)
.attr("type", 'button').attr('class', 'btn btn-secondary').text('Cancel')
.attr("type", 'button').attr('class', 'btn btn-secondary').attr('onclick', '(cancel_session(serverUrl,this.id))').text('Cancel')
actionCells.select('button')
actionCells.exit().remove()
sessions.forEach(function(session) {
// console.log(session)
var cancelSessionBtn = d3.select("#cancelBtn" + hashCode(session.sessionId));
// Listeners for the cancelSession button
cancelSessionBtn.on('click', function(){
cancel_session(serverUrl, session.sessionId, cancelSessionBtn);
});
})
}
function promptNewSession(serverUrl, tbodyEl, refreshBtn) {
bootbox.prompt("Session ID", function(sessionId) {
Expand Down Expand Up @@ -625,8 +617,15 @@ function does_status_allow_cancel(status) {
* @param sessionId to cancel
* @param cancelSessionBtn that initiated the cancel
*/
function cancel_session(serverUrl, sessionId, cancelSessionBtn) {

// function cancel_session(serverUrl, sessionId, cancelSessionBtn) {
function cancel_session(serverUrl, buttonId) {
//getting session id from sibling in table using js
button = "#"+buttonId
sessionId = $(button).parent().parent().find("td.details").find('a').attr("href")
sessionId = sessionId.split("=")
sessionId = sessionId[1].split("&")
sessionId = sessionId[0]
cancelSessionBtn = $(button)
var url = serverUrl + '/api';
url += '/sessions/' + sessionId;

Expand Down

0 comments on commit a597149

Please sign in to comment.