From e04e5d7d892ae5b68a74ad582c33a5e2eaf5fc07 Mon Sep 17 00:00:00 2001 From: Justin McCarthy Date: Thu, 17 May 2018 18:27:21 -0700 Subject: [PATCH] switch cron to 6-figure expressions. introduce hashes by tab. --- example/templates/index.ace | 19 +++++++++++++++++-- internal/render/html.go | 2 +- internal/ticket/scheduler.go | 2 ++ themes/comply-blank/templates/index.ace | 2 +- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/example/templates/index.ace b/example/templates/index.ace index 0ee01b6..c0dd9fe 100644 --- a/example/templates/index.ace +++ b/example/templates/index.ace @@ -13,11 +13,24 @@ html lang=en = javascript document.addEventListener("DOMContentLoaded", function(event) { document.querySelectorAll('.cron').forEach(function(el) { - el.innerHTML = prettyCron.toString(el.innerHTML) + el.innerHTML = prettyCron.toString((""+el.innerHTML).trim(),true) // 6-field expressions }) + if (window.location.hash != "") { + var hashComponents = window.location.hash.split('#') + if (hashComponents.length>1) { + var destination = hashComponents[1] + if (["overview","narratives","policies","procedures","standards"].indexOf(destination) >= 0) { + show(destination) + } + } + } }) function show(name) { + if(history.replaceState) { + history.replaceState(null, null, '#'+name); + } + var items = document.getElementsByClassName('top-nav') for (var i=0; i ws.onclose = function(e) { // reload! if (connected) { - window.location=window.location + window.location.reload(true) } } })() diff --git a/internal/ticket/scheduler.go b/internal/ticket/scheduler.go index f1d81cc..6103024 100644 --- a/internal/ticket/scheduler.go +++ b/internal/ticket/scheduler.go @@ -98,6 +98,8 @@ func TriggerScheduled() error { } func trigger(procedure *model.Procedure) { + fmt.Printf("triggering procedure %s (cron expression: %s)\n", procedure.Name, procedure.Cron) + // TODO: don't hardcode GH tp := model.GetPlugin(model.GitHub) tp.Create(&model.Ticket{ diff --git a/themes/comply-blank/templates/index.ace b/themes/comply-blank/templates/index.ace index 0ee01b6..cc5fdf3 100644 --- a/themes/comply-blank/templates/index.ace +++ b/themes/comply-blank/templates/index.ace @@ -13,7 +13,7 @@ html lang=en = javascript document.addEventListener("DOMContentLoaded", function(event) { document.querySelectorAll('.cron').forEach(function(el) { - el.innerHTML = prettyCron.toString(el.innerHTML) + el.innerHTML = prettyCron.toString(el.innerHTML,true) // 6-field expressions }) })