From 9867adbcc25e9f7abbf46b63cd22e7007f8881e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manus=20D=C3=A9ploiement=20Santinova?= Date: Fri, 4 Sep 2026 15:51:49 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20placer=20les=20services=20infra=20en=20?= =?UTF-8?q?t=C3=AAte=20des=20listes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/src/routes.js | 3 ++- src/frontend/src/pages/AppsPage.jsx | 6 +++++- src/frontend/src/pages/DashboardPage.jsx | 4 +++- src/frontend/src/utils/appSorting.js | 15 +++++++++++++++ 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 src/frontend/src/utils/appSorting.js diff --git a/src/backend/src/routes.js b/src/backend/src/routes.js index 81ad828..a593b64 100644 --- a/src/backend/src/routes.js +++ b/src/backend/src/routes.js @@ -447,8 +447,9 @@ router.get('/public/apps', (req, res) => { // getAllStatuses() retourne un tableau vide si aucun check n'a encore été effectué // On ne déclenche PAS checkAllApps() ici pour éviter de bloquer la réponse const statuses = getAllStatuses(); + // Le portail répartit lui-même les applications par onglet, y compris INFRA. + // L’API expose donc toutes les applications du registre local, sans en masquer. const publicApps = config.apps - .filter((a) => a.category !== 'INFRA') // Exclure les apps infra (portail, dashboard) .map((a) => { const status = statuses.find((s) => s.id === a.id); return { diff --git a/src/frontend/src/pages/AppsPage.jsx b/src/frontend/src/pages/AppsPage.jsx index b5d727e..cc880d1 100644 --- a/src/frontend/src/pages/AppsPage.jsx +++ b/src/frontend/src/pages/AppsPage.jsx @@ -3,6 +3,7 @@ import { Box, RefreshCw, Plus } from 'lucide-react'; import AppCard from '../components/AppCard'; import AddAppModal from '../components/AddAppModal'; import { getApps, getGiteaCommits } from '../utils/api'; +import { sortAppsWithInfraFirst } from '../utils/appSorting'; export default function AppsPage({ apps, onRefresh }) { const [commitsMap, setCommitsMap] = useState({}); @@ -26,6 +27,9 @@ export default function AppsPage({ apps, onRefresh }) { }); }, [apps]); + // Les services d’infrastructure restent visibles en premier, sans modifier les données API. + const sortedApps = sortAppsWithInfraFirst(apps); + const handleAddSuccess = () => { setShowAddModal(false); // Rafraîchir la liste après un délai pour laisser le temps au health check @@ -86,7 +90,7 @@ export default function AppsPage({ apps, onRefresh }) { ) : (
- {apps.map((app) => ( + {sortedApps.map((app) => ( a.status === 'online').length; const offlineApps = apps.filter((a) => a.status === 'offline').length; const errorApps = apps.filter((a) => a.status === 'error').length; + const sortedApps = sortAppsWithInfraFirst(apps); return (
@@ -147,7 +149,7 @@ export default function DashboardPage({ apps }) {

Aucune application détectée

) : (
- {apps.map((app) => { + {sortedApps.map((app) => { const isInfra = app.category === "INFRA" || ["portail-santinova", "manus-dashboard"].includes(app.id); return (
({ app, index })) + .sort((left, right) => { + const leftPriority = left.app?.category === 'INFRA' ? 0 : 1; + const rightPriority = right.app?.category === 'INFRA' ? 0 : 1; + return leftPriority - rightPriority || left.index - right.index; + }) + .map(({ app }) => app); +}