mirror of https://github.com/gophish/gophish
Changing UI Refresh to a Longer Poll + Manual Refresh (#587)
* Added refresh button and reduced lag for large campaigns (#565) * Amended refresh function to allow manual refreshes Moved the function out of document.ready and tied it to the button. Also reduced automatic refresh to 60 seconds, to make it easier for medium - large campaigns to be viewed without lagging. * Amended refresh function to allow manual refreshes * Update campaign_results.html * Re-building the campaign_results JSpull/604/head
parent
2514bccb05
commit
bddb9fdb28
File diff suppressed because one or more lines are too long
|
@ -399,6 +399,8 @@ function poll() {
|
|||
}
|
||||
})
|
||||
map.bubbles(bubbles)
|
||||
$("#refresh_message").hide()
|
||||
$("#refresh_btn").show()
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -674,18 +676,25 @@ function load() {
|
|||
errorFlash(" Campaign not found!")
|
||||
})
|
||||
}
|
||||
|
||||
var setRefresh
|
||||
function refresh() {
|
||||
if (!doPoll) {
|
||||
return;
|
||||
}
|
||||
$("#refresh_message").show()
|
||||
$("#refresh_btn").hide()
|
||||
poll()
|
||||
clearTimeout(setRefresh)
|
||||
setRefresh = setTimeout(refresh, 60000)
|
||||
};
|
||||
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
load();
|
||||
// Start the polling loop
|
||||
function refresh() {
|
||||
if (!doPoll) {
|
||||
return;
|
||||
}
|
||||
$("#refresh_message").show()
|
||||
poll()
|
||||
$("#refresh_message").hide()
|
||||
setTimeout(refresh, 10000)
|
||||
};
|
||||
|
||||
// Start the polling loop
|
||||
setTimeout(refresh, 10000)
|
||||
setRefresh = setTimeout(refresh, 60000)
|
||||
})
|
||||
|
|
|
@ -54,6 +54,9 @@
|
|||
<button type="button" class="btn btn-danger" data-toggle="tooltip" onclick="deleteCampaign()">
|
||||
<i class="fa fa-trash-o fa-lg"></i> Delete
|
||||
</button>
|
||||
<button id="refresh_btn" type="button" class="btn btn-blue" data-toggle="tooltip" onclick="refresh()">
|
||||
<i class="fa fa-refresh fa-lg"></i> Refresh
|
||||
</button>
|
||||
<span id="refresh_message">
|
||||
<i class="fa fa-spin fa-spinner"></i> Refreshing
|
||||
</span>
|
||||
|
|
Loading…
Reference in New Issue