Skip to content

Commit

Permalink
[OGUI-1565] Display infologger link to each task in env-details (#2725)
Browse files Browse the repository at this point in the history
* Adds a new button to be displayed in-line with each FLP task of env-details page which will take the user to infologger with PID, RUN, ENV and HOSTNAME as fields set

---------
Co-authored-by: George Raduta <george.raduta@cern.ch>
  • Loading branch information
pepijndik authored Jan 29, 2025
1 parent 324b3e3 commit f83cd41
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 11 deletions.
11 changes: 8 additions & 3 deletions Control/public/common/buttons/infoLoggerRedirectButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ import { redirectButtonLink } from './redirectButtonLink.js';
* @returns {vnode} - button as link allowing user to open InfoLogger in a new tab
*/
export const infoLoggerButtonLink = (
{ partition, run, hostname, system, facility },
{ partition, run, hostname, system, facility, pid },
label = 'InfoLogger',
source = ''
source = '',
className = []
) => {
if (source) {
let href = `${source}?q={`;
Expand All @@ -50,12 +51,16 @@ export const infoLoggerButtonLink = (
if (facility) {
href += `"facility":{"match":"${facility}"},`;
}
if (pid) {
href += `"pid":{"match":"${pid}"},`;
}
if (href.slice(-1) === ',') { // remove trailing comma
href = href.slice(0, -1);
}
href += '}';
let title = `Open InfoLogger GUI`;
return redirectButtonLink(href, label, title, true, ['ph2', 'btn', 'primary', 'w-100']);
const classList = ['ph2', 'btn', 'primary', 'w-100', ...className];
return redirectButtonLink(href, label, title, true, classList);
}
return;
};
32 changes: 25 additions & 7 deletions Control/public/common/task/flpTasksTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,23 @@ import {
import pageLoading from '../pageLoading.js';
import showTableItem from '../showTableItem.js';
import { getTaskStateClassAssociation } from '../enums/TaskState.js';
import { infoLoggerButtonLink } from '../buttons/infoLoggerRedirectButton.js';

/**
* For a given list of FLP tasks, build a table with tasks details and buttons to allow for retrieving more details per task
* @param {Array<Task>} [tasks = []] - list of tasks to build table for
* @param {TaskTableModel} taskTableModel - task table model to use for features such as filtering and retrieving more details of task
* @param {loggerObject} loggerObject - object with information that will help building the InfoLogger link
* @param {object} loggerObject.fields - fields to be used in the InfoLogger query
* @param {string} loggerObject.url - URL to redirect to Info
* @return {vnode} - table of the FLP tasks
*/
export const flpTasksTable = (tasks, taskTableModel) => {
export const flpTasksTable = (
tasks,
taskTableModel,
{ fields: logFilterFields, url: infoLoggerUrl }
) => {
const tableColumns = ['Name', 'PID', 'Locked', 'Status', 'State', 'Host Name', 'More'];

return h('.scroll-auto.panel', [
h('table.table.table-sm', {style: 'margin-bottom: 0'}, [
h('thead',
Expand All @@ -46,11 +53,22 @@ export const flpTasksTable = (tasks, taskTableModel) => {
h('td.w-10', task.status),
h(`td.w-10${getTaskStateClassAssociation(task.state)}`, task.state),
h('td.w-20', task?.deploymentInfo?.hostname),
h('td.w-10',
h('button.btn-sm.btn-default', {
title: 'More Details',
onclick: () => taskTableModel.toggleTaskView(task.taskId),
}, taskTableModel.openedTaskViews[task.taskId] ? iconChevronTop() : iconChevronBottom())
h('td',
h('.flex-row', [
h('button.btn-sm.btn-default', {
title: 'More Details',
onclick: () => taskTableModel.toggleTaskView(task.taskId),
}, taskTableModel.openedTaskViews[task.taskId] ? iconChevronTop() : iconChevronBottom()),
infoLoggerButtonLink(
{
pid: task.pid,
...logFilterFields
},
'ILG',
infoLoggerUrl,
['btn-sm'],
),
]),
),
]),
taskTableModel.openedTaskViews[task.taskId] && taskTableModel.tasksAsRemoteDataById[task.taskId]
Expand Down
10 changes: 9 additions & 1 deletion Control/public/common/task/tasksPerHostPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ export const tasksPerHostPanel = (
if (source === EPN) {
[hostnameToIlg] = hostname.split('.');
}
const infoLoggerConfig = {
fields: {
run,
partition,
hostname: hostnameToIlg,
},
url: infoLoggerButtonUrl,
};
return h('', [
h('.p2.flex-row.bg-primary.white', [
h('h5.flex-grow-3', hostname),
Expand All @@ -106,7 +114,7 @@ export const tasksPerHostPanel = (
]),
]),
source === FLP
? flpTasksTable(tasksByHosts[hostname].list, taskTableModel)
? flpTasksTable(tasksByHosts[hostname].list, taskTableModel, infoLoggerConfig)
: epnTasksTable(tasksByHosts[hostname].list),
]);
})
Expand Down

0 comments on commit f83cd41

Please sign in to comment.