From da20d955c3935e5c6a9f3fb549bad45584bb11af Mon Sep 17 00:00:00 2001 From: Arne Tarara Date: Mon, 30 Oct 2023 09:33:51 +0100 Subject: [PATCH] RunID is now linked if available in Status --- api/main.py | 3 ++- frontend/js/status.js | 16 ++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/api/main.py b/api/main.py index 02a3f0b27..7156c9088 100644 --- a/api/main.py +++ b/api/main.py @@ -540,9 +540,10 @@ async def get_timeline_projects(): async def get_jobs(): # Do not get the email jobs as they do not need to be display in the frontend atm query = """ - SELECT j.id, j.name, j.url, j.filename, j.branch, m.description, j.state, j.updated_at, j.created_at + SELECT j.id, r.id as run_id, j.name, j.url, j.filename, j.branch, m.description, j.state, j.updated_at, j.created_at FROM jobs as j LEFT JOIN machines as m on m.id = j.machine_id + LEFT JOIN runs as r on r.job_id = j.id ORDER BY j.updated_at DESC, j.created_at ASC """ data = DB().fetch_all(query) diff --git a/frontend/js/status.js b/frontend/js/status.js index 56faf70b4..756133497 100644 --- a/frontend/js/status.js +++ b/frontend/js/status.js @@ -4,14 +4,14 @@ $(document).ready(function () { ajax: `${API_URL}/v1/jobs`, columns: [ { data: 0, title: 'ID'}, - { data: 1, title: 'Name'}, - { data: 2, title: 'Url'}, - { data: 3, title: 'Filename'}, - { data: 4, title: 'Branch'}, - { data: 5, title: 'Machine'}, - { data: 6, title: 'State'}, - { data: 7, title: 'Last Update', render: (data) => data == null ? '-' : dateToYMD(new Date(data)) }, - { data: 8, title: 'Created at', render: (data) => data == null ? '-' : dateToYMD(new Date(data)) }, + { data: 2, title: 'Name', render: (name, type, row) => row[1] == null ? name : `${name}` }, + { data: 3, title: 'Url'}, + { data: 4, title: 'Filename'}, + { data: 5, title: 'Branch'}, + { data: 6, title: 'Machine'}, + { data: 7, title: 'State'}, + { data: 8, title: 'Last Update', render: (el) => el == null ? '-' : dateToYMD(new Date(el)) }, + { data: 9, title: 'Created at', render: (el) => el == null ? '-' : dateToYMD(new Date(el)) }, ], deferRender: true, order: [[7, 'desc']] // API also orders, but we need to indicate order for the user