From 4743bf13129a0b4f37460fe4807d311555dd7084 Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Fri, 6 Oct 2023 17:18:02 +0200
Subject: [PATCH] nice monitoring

---
 app/controllers/server/dashboard_controller.rb | 1 +
 app/models/communication/website.rb            | 5 +++++
 app/views/server/dashboard/index.html.erb      | 4 ++++
 3 files changed, 10 insertions(+)

diff --git a/app/controllers/server/dashboard_controller.rb b/app/controllers/server/dashboard_controller.rb
index df8224c68..e52c6bfa9 100644
--- a/app/controllers/server/dashboard_controller.rb
+++ b/app/controllers/server/dashboard_controller.rb
@@ -10,6 +10,7 @@ class Server::DashboardController < Server::ApplicationController
         path: server_websites_path
       }
     ]
+    @websites = Communication::Website.updatable_theme.ordered
     breadcrumb
   end
 end
diff --git a/app/models/communication/website.rb b/app/models/communication/website.rb
index 1e0fa32ed..db1023af1 100644
--- a/app/models/communication/website.rb
+++ b/app/models/communication/website.rb
@@ -90,6 +90,11 @@ class Communication::Website < ApplicationRecord
     ", term: "%#{sanitize_sql_like(term)}%")
   }
   scope :for_update, -> (autoupdate) { where(autoupdate_theme: autoupdate) }
+  scope :updatable_theme, -> {
+    where.not(repository: [nil, '']).
+    where.not(access_token: [nil, '']).
+    where.not(url: [nil, ''])
+  }
 
   def to_s
     "#{name}"
diff --git a/app/views/server/dashboard/index.html.erb b/app/views/server/dashboard/index.html.erb
index 2bf1d4b16..0415ed367 100644
--- a/app/views/server/dashboard/index.html.erb
+++ b/app/views/server/dashboard/index.html.erb
@@ -9,3 +9,7 @@
     </div>
   <% end %>
 </div>
+
+<%= osuny_panel 'Monitoring' do %>
+  <%= render 'server/websites/list', websites: @websites %>
+<% end %>
-- 
GitLab