Skip to content

Commit

Permalink
Experimental result popover.
Browse files Browse the repository at this point in the history
  • Loading branch information
drgrice1 committed Oct 18, 2023
1 parent c42143f commit 655b0fa
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 27 deletions.
5 changes: 1 addition & 4 deletions lib/WeBWorK/ContentGenerator/Instructor/JobManager.pm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ use constant FIELDS => [
[ started => x('Started') ],
[ finished => x('Finished') ],
[ state => x('State') ],
[ result => x('Result') ]
];

use constant SORT_SUBS => {
Expand All @@ -42,8 +41,7 @@ use constant SORT_SUBS => {
created => \&byCreatedTime,
started => \&byStartedTime,
finished => \&byFinishedTime,
state => \&byState,
result => \&byResult
state => \&byState
};

sub initialize ($c) {
Expand Down Expand Up @@ -178,6 +176,5 @@ sub byCreatedTime { return $a->{created} <=> $b->{created} }
sub byStartedTime { return $a->{started} <=> $b->{started} }
sub byFinishedTime { return $a->{finished} <=> $b->{finished} }
sub byState { return $a->{state} cmp $b->{state} }
sub byResult { return lc $a->{result} cmp lc $b->{result} }

1;
34 changes: 22 additions & 12 deletions templates/ContentGenerator/Instructor/JobManager.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@
<%= link_to maketext('State') => '#', class => 'sort-header',
data => { sort_field => 'state' } =%>
</th>
<th>
<%= link_to maketext('Result') => '#', class => 'sort-header',
data => { sort_field => 'result' } =%>
</th>
</tr>
</thead>
<tbody class="table-group-divider">
Expand Down Expand Up @@ -137,14 +133,28 @@
$jobs->{$jobID}{finished}, '', 'datetime_format_medium', $ce->{language}) =%>
% }
</td>
<td><%= $jobs->{$jobID}{state} %></td>
<td style="min-width:20em">
% if (ref($jobs->{$jobID}{result}) eq 'ARRAY') {
% for (@{ $jobs->{$jobID}{result} } ) {
<p class="m-0"><%= $_ %></p>
% }
% } else {
<%= $jobs->{$jobID}{result} // '' %>
<td>
<%= $jobs->{$jobID}{state} =%>
% if (defined $jobs->{$jobID}{result}) {
% content_for "result_$jobID", begin
% if (ref($jobs->{$jobID}{result}) eq 'ARRAY') {
% for (@{ $jobs->{$jobID}{result} } ) {
<p class="m-0"><%= $_ %></p>
% }
% } else {
<%= $jobs->{$jobID}{result} %>
% }
% end
<%= link_to '#', class => 'help-popup',
data => {
bs_toggle => 'popover',
bs_title => maketext('Result'),
bs_html => 'true',
bs_content => content("result_$jobID")->xml_escape
}, begin =%>
<i class="icon fa-solid fa-circle-question" data-alt="Result" aria-hidden="true">
</i>
<% end =%>
% }
</td>
</tr>
Expand Down
18 changes: 7 additions & 11 deletions templates/HelpFiles/InstructorJobManager.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,13 @@
<dt><%= maketext('State') %></dt>
<dd>
<%= maketext('The current state of the job. This will be one of "inactive", "active", "finished", or '
. '"failed". If a job is "inactive" it means that the job has been added to the queue, but execution of '
. 'the job has not yet started. If a job is "active" it means that the job is currently being executed. '
. 'If a job is "finished" it means that the execution of the job has successfully completed. If a job is '
. '"failed" it means that the execution of job has completed, but there were errors in the execution of '
. 'the job.') =%>
</dd>
<dt><%= maketext('Result') %></dt>
<dd>
<%= maketext('The result set by the job when execution is completed. This will be shown if the job is in the '
. '"finished" or "failed" states, and will contain information about what happened when the job was '
. 'executed.') =%>
. '"failed". If a job is "inactive" it means that the job has been added to the queue, but execution '
. 'of the job has not yet started. If a job is "active" it means that the job is currently being '
. 'executed. If a job is "finished" it means that the execution of the job has successfully '
. 'completed. If a job is "failed" it means that the execution of job has completed, but there were '
. 'errors in the execution of the job. If the job is in the "finished" or "failed" state, then there '
. 'will also be a popover containing information about what happened when the job was executed.') =%>
</p>
</dd>
</dl>
%
Expand Down

0 comments on commit 655b0fa

Please sign in to comment.