From 97ce8642036c03aa30b1cfcdd035e9d099c45d7e Mon Sep 17 00:00:00 2001
From: noorhatoom <155294912+noorhatoom@users.noreply.github.com>
Date: Mon, 12 Jan 2026 13:56:18 +0200
Subject: [PATCH 1/3] Added ascending/descending to CPU+GPU+MEM
---
src/Routes/Tables/Algorithms/columns.jsx | 63 +++++++++++++++++++++---
1 file changed, 57 insertions(+), 6 deletions(-)
diff --git a/src/Routes/Tables/Algorithms/columns.jsx b/src/Routes/Tables/Algorithms/columns.jsx
index 897b3e1dd..e69ec43ba 100644
--- a/src/Routes/Tables/Algorithms/columns.jsx
+++ b/src/Routes/Tables/Algorithms/columns.jsx
@@ -13,7 +13,12 @@ import AlgorithmActions from './AlgorithmActions.react';
import AlgorithmBuildStats from './AlgorithmBuildStats.react';
import LastModified from './LastModified';
+// ============================================================================
+// CELL RENDERERS
+// ============================================================================
+
const HotWorkers = ({ value }) => {value};
+
const Cpu = ({ value }) =>
value ? (
{value}
@@ -81,6 +86,43 @@ const Name = ({ value, data }) =>
);
+const numericComparator = (a, b) => {
+ if (!a && !b) return 0;
+ if (!a) return 1;
+ if (!b) return -1;
+ return Number(a) - Number(b);
+};
+
+/**
+ * Comparator for memory values with unit parsing (Mi, Gi, Ki, Ti)
+ * Converts all values to bytes for accurate comparison
+ * Null/undefined values are sorted to the end
+ */
+const memoryComparator = (a, b) => {
+ if (!a && !b) return 0;
+ if (!a) return 1;
+ if (!b) return -1;
+
+ const parseMemory = mem => {
+ if (!mem) return 0;
+ const str = String(mem).trim();
+ const num = parseFloat(str);
+
+ if (str.includes('Gi') || str.includes('G')) {
+ return num * 1024 * 1024 * 1024;
+ } else if (str.includes('Mi') || str.includes('M')) {
+ return num * 1024 * 1024;
+ } else if (str.includes('Ki') || str.includes('K')) {
+ return num * 1024;
+ } else if (str.includes('Ti') || str.includes('T')) {
+ return num * 1024 * 1024 * 1024 * 1024;
+ }
+ return num;
+ };
+
+ return parseMemory(a) - parseMemory(b);
+};
+
export default [
{
headerName: '',
@@ -98,7 +140,7 @@ export default [
flex: 2,
sortable: true,
unSortIcon: true,
- comparator: (a, b) => sorter(a, b),
+ comparator: sorter,
cellRenderer: Name,
isPinning: true,
},
@@ -107,7 +149,7 @@ export default [
field: 'algorithmImage',
flex: 3,
sortable: true,
- comparator: (a, b) => sorter(a, b),
+ comparator: sorter,
cellRenderer: Image,
},
{
@@ -118,20 +160,29 @@ export default [
},
{
headerName: 'CPU',
- flex: 0.5,
+ flex: 0.6,
field: 'cpu',
+ sortable: true,
+ unSortIcon: true,
+ comparator: numericComparator,
cellRenderer: Cpu,
},
{
headerName: 'GPU',
- flex: 0.5,
+ flex: 0.6,
field: 'gpu',
+ sortable: true,
+ unSortIcon: true,
+ comparator: numericComparator,
cellRenderer: Gpu,
},
{
headerName: 'Mem',
flex: 0.7,
field: 'mem',
+ sortable: true,
+ unSortIcon: true,
+ comparator: memoryComparator,
cellRenderer: Memory,
},
{
@@ -140,7 +191,7 @@ export default [
field: 'minHotWorkers',
sortable: true,
unSortIcon: true,
- comparator: (a, b) => sorter(a, b),
+ comparator: sorter,
cellRenderer: HotWorkers,
},
{
@@ -149,7 +200,7 @@ export default [
field: 'modified',
sortable: true,
unSortIcon: true,
- comparator: (a, b) => sorter(a, b),
+ comparator: sorter,
cellRenderer: ({ data }) => (
),
From fb85422734e5ff2f0bafe8be657b2794168e4f35 Mon Sep 17 00:00:00 2001
From: noorhatoom <155294912+noorhatoom@users.noreply.github.com>
Date: Wed, 14 Jan 2026 13:32:31 +0200
Subject: [PATCH 2/3] added sorting to the cron job column
---
.../Tables/Pipelines/pipelineColumns.jsx | 33 +++++++++++++------
1 file changed, 23 insertions(+), 10 deletions(-)
diff --git a/src/Routes/Tables/Pipelines/pipelineColumns.jsx b/src/Routes/Tables/Pipelines/pipelineColumns.jsx
index 220344e4a..be84be536 100644
--- a/src/Routes/Tables/Pipelines/pipelineColumns.jsx
+++ b/src/Routes/Tables/Pipelines/pipelineColumns.jsx
@@ -8,10 +8,6 @@ import PipelineCron from './PipelineCron.react';
import PipelineStats from './PipelineStats.react';
import LastModified from './../Algorithms/LastModified';
-/* ---------- Cell Renderers ---------- */
-
-// params = { value, data, node, ... }
-
const AuditTrailCell = params => ;
const LastModifiedCell = params => (
;
const ActionsCell = params => ;
-/* ---------- Sorters ---------- */
+const cronComparator = (a, b) => {
+ const getEnabledStatus = trigger => {
+ if (!trigger) return null;
+ if (!trigger.cron) return null;
+
+ return trigger.cron.enabled ?? false;
+ };
+
+ const enabledA = getEnabledStatus(a);
+ const enabledB = getEnabledStatus(b);
-// const sortByName = (a, b) => sorter(a.name, b.name);
-// const sortByLastModified = (a, b) => sorter(a.modified, b.modified);
+ // Handle null cases (no cron job)
+ if (enabledA === null && enabledB === null) return 0;
+ if (enabledA === null) return 1;
+ if (enabledB === null) return -1;
+ // Sort by enabled status: true (ON) comes before false (OFF)
+ if (enabledA !== enabledB) {
+ return enabledB - enabledA;
+ }
+ return 0;
+};
const pipelineColumnDefs = [
{
headerName: '',
@@ -53,14 +66,15 @@ const pipelineColumnDefs = [
flex: 3,
sortable: true,
unSortIcon: true,
- // comparator: sortByName,
cellRenderer: PipelineNameCell,
},
{
headerName: 'Cron Job',
field: 'triggers',
flex: 1.5,
- sortable: false,
+ sortable: true,
+ unSortIcon: true,
+ comparator: cronComparator,
cellRenderer: CronCell,
},
{
@@ -76,7 +90,6 @@ const pipelineColumnDefs = [
flex: 1,
sortable: true,
unSortIcon: true,
- // comparator: sortByLastModified,
cellRenderer: LastModifiedCell,
cellStyle: { textAlign: 'center' },
},
From c58c2cc0e9916a0094d7dc0b06a0542d8b6fc21c Mon Sep 17 00:00:00 2001
From: noorhatoom <155294912+noorhatoom@users.noreply.github.com>
Date: Wed, 14 Jan 2026 15:33:35 +0200
Subject: [PATCH 3/3] comprator for builds stats
---
src/Routes/Tables/Algorithms/columns.jsx | 31 +++++++++++++++++++++---
1 file changed, 27 insertions(+), 4 deletions(-)
diff --git a/src/Routes/Tables/Algorithms/columns.jsx b/src/Routes/Tables/Algorithms/columns.jsx
index e69ec43ba..424966872 100644
--- a/src/Routes/Tables/Algorithms/columns.jsx
+++ b/src/Routes/Tables/Algorithms/columns.jsx
@@ -13,10 +13,6 @@ import AlgorithmActions from './AlgorithmActions.react';
import AlgorithmBuildStats from './AlgorithmBuildStats.react';
import LastModified from './LastModified';
-// ============================================================================
-// CELL RENDERERS
-// ============================================================================
-
const HotWorkers = ({ value }) => {value};
const Cpu = ({ value }) =>
@@ -122,6 +118,30 @@ const memoryComparator = (a, b) => {
return parseMemory(a) - parseMemory(b);
};
+/**
+ * Comparator for build stats sorting
+ * DESC: Prioritizes failed builds (highest count first)
+ * ASC: Prioritizes completed builds (highest count first)
+ */
+const buildStatsComparator = (a, b, isDescending) => {
+ // Handle null/undefined cases
+ if (!a && !b) return 0;
+ if (!a) return 1;
+ if (!b) return -1;
+
+ const aTotal = a.total || 0;
+ const bTotal = b.total || 0;
+
+ // Handle no builds cases
+ if (aTotal === 0 && bTotal === 0) return 0;
+ if (aTotal === 0) return 1;
+ if (bTotal === 0) return -1;
+
+ const aCount = isDescending ? a.failed || 0 : a.completed || 0;
+ const bCount = isDescending ? b.failed || 0 : b.completed || 0;
+
+ return bCount - aCount;
+};
export default [
{
@@ -155,7 +175,10 @@ export default [
{
headerName: 'Builds Stats',
flex: 0.7,
+ sortable: true,
+ unSortIcon: true,
field: 'buildStats',
+ comparator: buildStatsComparator,
cellRenderer: ({ value }) => ,
},
{