Skip to content

Commit

Permalink
Add worker info in job_next_previous
Browse files Browse the repository at this point in the history
  • Loading branch information
ggardet committed Jul 25, 2023
1 parent b9e03ab commit 8100c64
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
10 changes: 8 additions & 2 deletions assets/javascripts/job_next_previous.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function setupJobNextPrevious() {
paging: true,
ordering: false,
deferRender: true,
columns: [{width: '5%'}, {data: 'result'}, {data: 'build'}, {data: 'finished'}],
columns: [{width: '5%'}, {data: 'result'}, {data: 'build'}, {data: 'assigned_worker'}, {data: 'finished'}],
processing: false,
order: false,
columnDefs: [
Expand All @@ -41,7 +41,8 @@ function setupJobNextPrevious() {
render: renderJobResults
},
{targets: 2, render: renderBuild},
{targets: 3, render: renderFinishTime}
{targets: 3, render: renderWorker},
{targets: 4, render: renderFinishTime}
],
initComplete: function (settings, json) {
setPage(json);
Expand Down Expand Up @@ -119,6 +120,11 @@ function renderBuild(data, type, row) {
return "<a href='" + link + "'>" + row.build + '</a>';
}

function renderWorker(data, type, row) {
var link = '/admin/workers/' + data;
return "<a href='" + link + "'>" + data + '</a>';
}

function renderFinishTime(data, type, row) {
var html = '';
if (data != null) {
Expand Down
1 change: 1 addition & 0 deletions lib/OpenQA/WebAPI/Controller/Test.pm
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ sub job_next_previous_ajax ($self) {
DT_RowId => 'job_result_' . $job_id,
id => $job_id,
name => $job->name,
assigned_worker => $job->assigned_worker->name,
distri => $job->DISTRI,
version => $job->VERSION,
build => $job->BUILD,
Expand Down
5 changes: 5 additions & 0 deletions t/ui/16-tests_job_next_previous.t
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ my @tds = $driver->find_child_elements($job99946, 'td');
is((shift @tds)->get_text(), 'C', '99946 is current job');
is((shift @tds)->get_text(), 'zypper_up', 'failed module of 99946');
is((shift @tds)->get_text(), '0091', 'build of 99946 is 0091');
(shift @tds)->get_text(); # Worker
is((shift @tds)->get_text(), 'about 3 hours ago ( 01:00 hours )', 'finished and duration of 99946');

my $job99947 = $driver->find_element('#job_next_previous_table #job_result_99947');
Expand Down Expand Up @@ -141,6 +142,7 @@ is((shift @tds)->get_text(), 'C', '99901 is current job');
$state = $driver->find_child_element(shift @tds, '.status', 'css');
is($state->get_attribute('title'), 'Done: passed', 'the latest job 99901 was passed');
is((shift @tds)->get_text(), '0091', 'build of 99901 is 0091');
(shift @tds)->get_text(); # Worker
is((shift @tds)->get_text(), 'about 4 hours ago ( 01:00 hours )', 'finished and duration of 99901');
is(scalar @{$driver->find_elements('#job_next_previous_table #job_result_99902')}, 1, 'found nearest next job 99902');
$driver->find_element_by_link_text('Previous')->click();
Expand All @@ -160,6 +162,7 @@ is((shift @tds)->get_text(), 'C&L', '99947 is current and the latest job');
$state = $driver->find_child_element(shift @tds, '.status', 'css');
is($state->get_attribute('title'), 'Done: passed', 'the latest job 99947 was passed');
is((shift @tds)->get_text(), '0092', 'build of 99947 is 0092');
(shift @tds)->get_text(); # Worker
is((shift @tds)->get_text(), 'about 2 hours ago ( 01:58 hours )', 'finished and duration of 99947');
is(scalar @{$driver->find_elements('#job_next_previous_table #job_result_99946')},
1, 'found nearest previous job 99946');
Expand Down Expand Up @@ -189,6 +192,7 @@ is((shift @tds)->get_text(), 'C&L', '99963 is current and the latest job');
$state = $driver->find_child_element(shift @tds, '.status', 'css');
is($state->get_attribute('title'), 'running', 'job 99963 was running');
is((shift @tds)->get_text(), '0091', 'build of 99963 is 0091');
(shift @tds)->get_text(); # Worker
is((shift @tds)->get_text(), 'Not yet: running', '99963 is not yet finished');
is(scalar @{$driver->find_elements('#job_next_previous_table #job_result_99962')}, 1, 'found previous job 99962');

Expand All @@ -205,6 +209,7 @@ is((shift @tds)->get_text(), 'C&L', '99928 is current and the latest job');
$state = $driver->find_child_element(shift @tds, '.status', 'css');
is($state->get_attribute('title'), 'scheduled', 'job 99928 was scheduled');
is((shift @tds)->get_text(), '0091', 'build of 99928 is 0091');
(shift @tds)->get_text(); # Worker
is((shift @tds)->get_text(), 'Not yet: scheduled', '99928 is not yet finished');

# check job next and previous under tests/latest route
Expand Down
1 change: 1 addition & 0 deletions templates/webapi/test/job_next_previous.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<th></th>
<th>Result</th>
<th>Build</th>
<th>Worker</th>
<th>Finished</th>
</tr>
</thead>
Expand Down

0 comments on commit 8100c64

Please sign in to comment.