Add a delay in updateGraphiteData before making the backend call (#354)

This commit is contained in:
Prashant Khanduri 2016-06-15 03:59:42 -07:00 committed by Jean-Frédéric
parent dbe45f9b20
commit 718120c056

View File

@ -36,7 +36,11 @@ GRAPHITE_ENDPOINT = '/graphite/'
$(document).ready ->
updateGraphiteData()
$('#id_metric').on('keyup', updateGraphiteData)
$('#id_metric').on('keyup', complete)
complete = () ->
clearTimeout(timer)
timer = setTimeout(updateGraphiteData, 1000)
$('#id_metric').autocomplete
source: (request, response) ->