Use Rails plugin generator and adapt

This commit is contained in:
Chris Seelus
2021-02-10 22:10:43 +01:00
parent 9b9193e1c8
commit d53520bbf0
22 changed files with 385 additions and 106 deletions

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,26 @@
nav {
position: relative;
z-index: 2;
}
nav .brand-logo {
font-size: 1.75em;
letter-spacing: -0.05em;
}
main {
position: relative;
z-index: 1;
padding: 20px;
}
main .page-footer {
margin: 0 -20px -20px -20px;
}
.page-footer > .footer-copyright {
padding: 20px;
}
.responsive-overflow {
overflow-x: auto;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,5 @@
module Crono
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
end
end

View File

@@ -0,0 +1,11 @@
module Crono
class JobsController < ApplicationController
def index
@jobs = Crono::CronoJob.all
end
def show
@job = Crono::CronoJob.find(params[:id])
end
end
end

View File

@@ -0,0 +1,54 @@
<header>
<h4>Running Jobs</h4>
</header>
<div class="responsive-overflow">
<table id="job_list">
<tr>
<th>Job</th>
<th>Last performed at</th>
<th>Status</th>
<th></th>
</tr>
<% @jobs.each do |job| %>
<tr>
<td>
<%= job.job_id %>
</td>
<td>
<%= job.last_performed_at || 'Never performed yet' %>
</td>
<td>
<% if job.last_performed_at.nil? %>
<span class="grey-text darken-3" title="This job has never been performed yet.">
<i class="mdi-device-access-time"></i>
Pending
</span>
<% elsif job.healthy %>
<a href="<%= job_path(job) %>">
<span class="green-text darken-3" title="This job was performed successfully.">
<i class="mdi-action-done"></i>
Success
</span>
</a>
<% else %>
<a href="<%= job_path(job) %>">
<span class="red-text" title="There were problems with this job. Follow the link to check the log.">
<i class="mdi-alert-warning"></i>
Error
</span>
</a>
<% end %>
</td>
<td>
<% if job.last_performed_at %>
<a href="<%= job_path(job) %>" class="right">
Log
<i class="mdi-navigation-chevron-right"></i>
</a>
<% end %>
</td>
</tr>
<% end %>
</table>
</div>

View File

@@ -0,0 +1,17 @@
<header class="blue-grey lighten-4 grey-text text-darken-4">
<a href="<%= root_url %>">
<i class="mdi-navigation-chevron-left"></i>
&lsaquo; Back to Home
</a>
<h4>Last log of <i><%= @job.job_id %></i>:</h4>
</header>
<% if @job.healthy == false %>
<div class="row red-text">
<div class="s12 center-align">
<i class="mdi-alert-warning"></i>
An error occurs during the last execution of this job.
Check the log below for details.
</div>
</div>
<% end %>
<pre class="responsive-overflow"><%= @job.log %></pre>

View File

@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta content="IE=edge" http-equiv="X-UA-Compatible"/>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"/>
<title>Crono Dashboard</title>
<%= stylesheet_link_tag 'crono/materialize.min.css', media: "all" %>
<%= stylesheet_link_tag 'crono/application', media: "all" %>
<%= csrf_meta_tags %>
</head>
<body class="blue-grey darken-2">
<nav class="blue-grey white-text" role="navigation">
<a class="brand-logo center" href="<%= root_path %>">
<b>Crono</b> Dashboard
</a>
</nav>
<main class="container blue-grey lighten-4">
<%= yield %>
<footer class="page-footer blue-grey darken-2">
<div class="footer-copyright blue-grey">
Crono v<%= Crono::VERSION %>
<a class="right" href="https://github.com/plashchynski/crono" target="_blank">Documentation</a>
</div>
</footer>
</main>
</body>
</html>