aboutsummaryrefslogtreecommitdiffstats
path: root/app/assets/javascripts
diff options
context:
space:
mode:
authorAlban Peignier2015-05-19 11:00:47 +0200
committerAlban Peignier2015-05-19 11:00:47 +0200
commit840c0ee89722930d63d5f12fdbbf76adfbc8a717 (patch)
tree6e15856ec6a756fbaf191b32f592c8cedacde51b /app/assets/javascripts
parent53ec8195413d0137f439073a5fd9862ca4eb4a20 (diff)
downloadchouette-core-840c0ee89722930d63d5f12fdbbf76adfbc8a717.tar.bz2
Reload Import/Export/Validation pages every 30s when job is started
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r--app/assets/javascripts/compliance_checks/show.js.coffee19
-rw-r--r--app/assets/javascripts/partials/ie_report.js.coffee.erb11
2 files changed, 20 insertions, 10 deletions
diff --git a/app/assets/javascripts/compliance_checks/show.js.coffee b/app/assets/javascripts/compliance_checks/show.js.coffee
index 8b3c2d6ca..3a6cf0ace 100644
--- a/app/assets/javascripts/compliance_checks/show.js.coffee
+++ b/app/assets/javascripts/compliance_checks/show.js.coffee
@@ -1,12 +1,12 @@
$(".compliance_checks.show, .imports.compliance_check").ready ->
get_compliance_check_results = (html_container, css_class) ->
- html_container.each ->
+ html_container.each ->
if( $( this ).hasClass(css_class) )
$( this ).show()
else
$( this ).hide()
-
+
Morris.Donut({
element: 'error',
data: [
@@ -34,10 +34,15 @@ $(".compliance_checks.show, .imports.compliance_check").ready ->
when 0 then get_compliance_check_results( $(".report tbody tr"), "nok_warning")
when 1 then get_compliance_check_results( $(".report tbody tr"), "uncheck_warning")
when 2 then get_compliance_check_results( $(".report tbody tr"), "ok_warning") )
-
+
$(".notice").popover({ container: "body", html: false, trigger: "focus", placement: "bottom" })
# Hide and show error details
- $(".title_error").each ->
- $( this ).click ->
- $(this).next(".details_error").toggle()
- $(this).children("i").toggleClass("fa-plus-square fa-minus-square")
+ $(".title_error").each ->
+ $( this ).click ->
+ $(this).next(".details_error").toggle()
+ $(this).children("i").toggleClass("fa-plus-square fa-minus-square")
+
+ refreshInterval = $(".report").data("refresh-interval")
+ if refreshInterval > 0
+ reloadPage = () -> window.location.reload()
+ setInterval(reloadPage,refreshInterval * 1000)
diff --git a/app/assets/javascripts/partials/ie_report.js.coffee.erb b/app/assets/javascripts/partials/ie_report.js.coffee.erb
index 3e38ce87b..ec9e5f836 100644
--- a/app/assets/javascripts/partials/ie_report.js.coffee.erb
+++ b/app/assets/javascripts/partials/ie_report.js.coffee.erb
@@ -1,5 +1,5 @@
-$(".imports.show, .exports.show").ready ->
-
+$(".imports.show, .exports.show").ready ->
+
get_export_results = (html_container, html_element) ->
html_container.children().each ->
if( $( this ).is(html_element) )
@@ -40,7 +40,7 @@ $(".imports.show, .exports.show").ready ->
{ object: $("th.stop_areas").text(), value: $(".lines table").data("total-stop_areas") },
{ object: $("th.access_points").text(), value: $(".lines table").data("total-access_points") },
{ object: $("th.vehicle_journeys").text(), value: $(".lines table").data("total-vehicle_journeys") },
- { object: $("th.journey_patterns").text(), value: $(".lines table").data("total-journey_patterns") },
+ { object: $("th.journey_patterns").text(), value: $(".lines table").data("total-journey_patterns") },
],
xkey: 'object',
ykeys: ['value'],
@@ -51,3 +51,8 @@ $(".imports.show, .exports.show").ready ->
hideHover: true
}).on('click', update = (i, row) ->
get_export_results( $(".report"), $("div.lines")) )
+
+ refreshInterval = $(".report").data("refresh-interval")
+ if refreshInterval > 0
+ reloadPage = () -> window.location.reload()
+ setInterval(reloadPage,refreshInterval * 1000)