diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1c8130552d..5813cab4a0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - php: [8.1, 8.2] + php: [8.1, 8.2, 8.3] database: ["mariadb:10.2", "mysql:8"] services: database: diff --git a/resources/scripts/components/dashboard/DashboardContainer.tsx b/resources/scripts/components/dashboard/DashboardContainer.tsx index 25e0e4d28c..1267497fa9 100644 --- a/resources/scripts/components/dashboard/DashboardContainer.tsx +++ b/resources/scripts/components/dashboard/DashboardContainer.tsx @@ -29,8 +29,30 @@ export default () => { () => getServers({ page, type: showOnlyAdmin && rootAdmin ? 'admin' : undefined }) ); + const [sortedServers, setSortedServers] = useState([]); + useEffect(() => { if (!servers) return; + + const sorted = servers.items.slice().sort((a, b) => { + const aDescription = a.description || ''; + const bDescription = b.description || ''; + + const aMatch = aDescription.match(/^\[(\d+)\]/); + const bMatch = bDescription.match(/^\[(\d+)\]/); + + const aNumber = aMatch ? parseInt(aMatch[1], 10) : Number.MAX_SAFE_INTEGER; + const bNumber = bMatch ? parseInt(bMatch[1], 10) : Number.MAX_SAFE_INTEGER; + + if (aNumber === bNumber) { + // Se i numeri sono uguali, ordina per nome + return a.name.localeCompare(b.name); + } + + return aNumber - bNumber; + }); + setSortedServers(sorted); + if (servers.pagination.currentPage > 1 && !servers.items.length) { setPage(1); } @@ -65,7 +87,7 @@ export default () => { {!servers ? ( ) : ( - + {({ items }) => items.length > 0 ? ( items.map((server, index) => (