diff --git a/assets/js/app.js b/assets/js/app.js index b3045c1..7120435 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -51,7 +51,7 @@ window.liveSocket = liveSocket; // progressbar.js@1.0.0 version is used // Docs: http://progressbarjs.readthedocs.org/en/1.0.0/ -window.loadStatusProgressBar = function(divId) { +window.loadStatusProgressBar = function(divId, isDown) { console.log(`Loading bar for id ${divId}`); let bar = new ProgressBar.Circle(`#${divId}`, { color: "#aaa", @@ -65,7 +65,7 @@ window.loadStatusProgressBar = function(divId) { autoStyleContainer: false, }, from: { color: "#aaa", width: 1 }, - to: { color: "#5cb571", width: 4 }, // #333 + to: { color: isDown ? "#d65c3a" : "#5cb571", width: 4 }, // #333 // Set default step function for all animate calls step: function (state, circle) { diff --git a/lib/zout_web/templates/project/index.html.heex b/lib/zout_web/templates/project/index.html.heex index 8f6ab77..e9fff72 100644 --- a/lib/zout_web/templates/project/index.html.heex +++ b/lib/zout_web/templates/project/index.html.heex @@ -19,7 +19,7 @@ <% end %> diff --git a/lib/zout_web/views/project_view.ex b/lib/zout_web/views/project_view.ex index 317c07b..3005fea 100644 --- a/lib/zout_web/views/project_view.ex +++ b/lib/zout_web/views/project_view.ex @@ -8,4 +8,8 @@ defmodule ZoutWeb.ProjectView do def render_status(%Downtime{status: status, start: start}), do: "#{status} since #{DateTime.to_iso8601(start)}" + + def is_down(nil), do: false + def is_down(%Downtime{status: :working}), do: false + def is_down(_), do: true end