* Created Job->running() to return '1' when one or more jobs are in progress on the host.

* Started work on a "Jobs" button on the Striker UI to be able to see the progress of jobs that are running in the background.
* Updated the Help icon and added the jobs (tasks) icons.
* Made logging around dhcpd more verbose to help figure out why it's auto-running after initial configuration.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 6 years ago
parent 276364db33
commit 3c980a5c6d
  1. 38
      Anvil/Tools/Job.pm
  2. 2
      README.md
  3. 13
      cgi-bin/striker
  4. BIN
      html/skins/alteeve/images/help_icon.png
  5. BIN
      html/skins/alteeve/images/help_icon.xcf
  6. BIN
      html/skins/alteeve/images/help_icon_off.png
  7. BIN
      html/skins/alteeve/images/help_icon_on.png
  8. BIN
      html/skins/alteeve/images/help_icon_original.png
  9. 3
      html/skins/alteeve/images/sources.txt
  10. BIN
      html/skins/alteeve/images/tasks_jobs-active_icon.png
  11. BIN
      html/skins/alteeve/images/tasks_no-jobs_icon.png
  12. 11
      html/skins/alteeve/main.html
  13. 2
      rpm/SPECS/anvil.spec
  14. 8
      tools/anvil-daemon
  15. 6
      tools/striker-manage-install-target

@ -14,6 +14,7 @@ my $THIS_FILE = "Job.pm";
### Methods;
# clear
# get_job_uuid
# running
# update_progress
=pod
@ -190,6 +191,43 @@ AND
return($job_uuid);
}
=head2 running
This simple returns C<< 1 >> if one or more jobs are pending or running on this host. If none are (or all are at 100%), it returns C<< 0 >>.
This method takes no parameters
=cut
sub running
{
my $self = shift;
my $parameter = shift;
my $anvil = $self->parent;
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
my $query = "
SELECT
COUNT(*)
FROM
jobs
WHERE
job_progress != '100'
AND
job_host_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($anvil->Get->host_uuid)."
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
my $job_count = $results->[0]->[0];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
results => $results,
job_count => $job_count,
}});
my $jobs_running = $job_count ? 1 : 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { jobs_running => $jobs_running }});
return($jobs_running);
}
=head2 update_progress
This updates the progress if we were called with a job UUID.

@ -6,5 +6,5 @@ Major components;
* The "Striker" Web interface
* Tools for Striker dashboards, Anvil! nodes and DR targets
This project is being designed for RHEL 7, Pacemaker, DRBD v9, Corosync 3 and Kronosnet.
This project is being designed for RHEL 8, Pacemaker 2, DRBD v9, Corosync 3 and Kronosnet 1.

@ -126,11 +126,20 @@ sub print_and_exit
back_button => $back_button,
refresh_button => $refresh_button,
}});
# The jobs button is "on" when the user is logged in and there is one or more jobs on this system
# under 100% complete.
my $say_jobs_button = $anvil->Template->get({file => "main.html", name => "jobs_button_off"});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { say_jobs_button => $say_jobs_button }});
if (($anvil->data->{sys}{users}{user_name}) && ($anvil->Job->running({debug => 2})))
{
$say_jobs_button = $anvil->Template->get({file => "main.html", name => "jobs_button_on"});
}
my $right_buttons = $anvil->Template->get({file => "main.html", name => "button_bar_right", variables => {
anvil_button => $anvil->data->{sys}{users}{user_name} ? $anvil->Template->get({file => "main.html", name => "anvil_button_on"}) : $anvil->Template->get({file => "main.html", name => "anvil_button_off"}),
striker_button => $anvil->data->{sys}{users}{user_name} ? $anvil->Template->get({file => "main.html", name => "striker_button_on"}) : $anvil->Template->get({file => "main.html", name => "striker_button_off"}),
configure_button => $anvil->data->{sys}{users}{user_name} ? $anvil->Template->get({file => "main.html", name => "configure_button_on"}) : $anvil->Template->get({file => "main.html", name => "configure_button_off"}),
jobs_button => $say_jobs_button,
striker_button => $anvil->data->{sys}{users}{user_name} ? $anvil->Template->get({file => "main.html", name => "striker_button_on"}) : $anvil->Template->get({file => "main.html", name => "striker_button_off"}),
user_button => $anvil->data->{sys}{users}{user_name} ? $anvil->Template->get({file => "main.html", name => "user_button_on"}) : $anvil->Template->get({file => "main.html", name => "user_button_off"}),
}});
my $footer = $anvil->Template->get({file => "main.html", name => "footer", variables => {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 16 KiB

@ -46,3 +46,6 @@ reset by Mooms from the Noun Project (https://thenounproject.com/search/?q=reset
Target by bezier master from the Noun Project (https://thenounproject.com/term/target/898037/)
- install_target.png
Task by Ramesha from the Noun Project (https://thenounproject.com/term/task/1212201/)
- tasks_icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

@ -33,6 +33,9 @@
<!-- start button_bar_right -->
<table id="button_bar">
<tr>
<td>
#!variable!jobs_button!#
</td>
<td>
#!variable!configure_button!#
</td>
@ -52,6 +55,14 @@
</table>
<!-- end button_bar_right -->
<!-- start jobs_button_off -->
<img src="#!data!skin::url!#/images/tasks_no-jobs_icon.png" class="top_icon">
<!-- end jobs_button_off -->
<!-- start jobs_button_on -->
<a href="?jobs=true"><img src="#!data!skin::url!#/images/tasks_jobs-active_icon.png" class="top_icon"></a>
<!-- end jobs_button_on -->
<!-- start configure_button_off -->
<img src="#!data!skin::url!#/images/configure_icon_off.png" class="top_icon">
<!-- end configure_button_off -->

@ -3,7 +3,7 @@
%define anvilgroup admin
Name: anvil
Version: 3.0
Release: 21%{?dist}
Release: 22%{?dist}
Summary: Alteeve Anvil! complete package.
License: GPLv2+

@ -273,15 +273,15 @@ sub check_install_target
my $status = "unavailable";
my $output = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{'striker-manage-install-target'}." --status --check --no-refresh"});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { output => $output }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { output => $output }});
foreach my $line (split/\n/, $output)
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { line => $line }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { line => $line }});
if ($line =~ /status=(\d)/)
{
my $digit = $1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { digit => $digit }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { digit => $digit }});
if ($digit == 0)
{
@ -291,7 +291,7 @@ sub check_install_target
{
$status = "enabled";
}
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { status => $status }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { status => $status }});
last;
}
}

@ -93,7 +93,7 @@ $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list
if ($anvil->data->{switches}{status})
{
my $dhcpd_running = $anvil->System->check_daemon({daemon => $anvil->data->{sys}{daemon}{dhcpd}});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { dhcpd_running => $dhcpd_running }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { dhcpd_running => $dhcpd_running }});
if ($dhcpd_running)
{
print $anvil->Words->string({key => "message_0123"})."\n";
@ -493,7 +493,7 @@ sub setup_boot_environment
range => $range,
router => $bcn_ip,
}});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { dhcpd_conf_body => $dhcpd_conf_body }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { dhcpd_conf_body => $dhcpd_conf_body }});
# Return code if '1' means the file was changed, '2' indicates it didn't change. '0' means something
# went wrong.
@ -501,7 +501,7 @@ sub setup_boot_environment
body => $dhcpd_conf_body,
file => $anvil->data->{path}{configs}{'dhcpd.conf'},
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { dhcpd_conf_success => $dhcpd_conf_success }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { dhcpd_conf_success => $dhcpd_conf_success }});
if (not $dhcpd_conf_success)
{
# Failed.

Loading…
Cancel
Save