* Finished the new Databse->insert_or_update_manifests() method and started the manifest page in Striker.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 5 years ago
parent 7df405afcb
commit b82051cb37
  1. 16
      Anvil/Tools/Database.pm
  2. 56
      cgi-bin/striker
  3. 9
      html/skins/alteeve/anvil.html
  4. 2
      share/words.xml

@ -5060,7 +5060,7 @@ WHERE
} }
=head2 insert_or_update_mail_servers =head2 insert_or_update_manifests
This updates (or inserts) a record in the 'manifests' table. This table is used to the "manifests" used to create and repair Anvil! systems. This updates (or inserts) a record in the 'manifests' table. This table is used to the "manifests" used to create and repair Anvil! systems.
@ -5105,13 +5105,13 @@ This is the raw XML containing the manifest.
This is a free-form field for saving notes about the mnaifest. If this is set to C<< DELETED >>, it will be ignored in the web interface. This is a free-form field for saving notes about the mnaifest. If this is set to C<< DELETED >>, it will be ignored in the web interface.
=cut =cut
sub insert_or_update_mail_servers sub insert_or_update_manifests
{ {
my $self = shift; my $self = shift;
my $parameter = shift; my $parameter = shift;
my $anvil = $self->parent; my $anvil = $self->parent;
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3; my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "Database->insert_or_update_mail_servers()" }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "Database->insert_or_update_manifests()" }});
my $delete = defined $parameter->{'delete'} ? $parameter->{'delete'} : 0; my $delete = defined $parameter->{'delete'} ? $parameter->{'delete'} : 0;
my $uuid = defined $parameter->{uuid} ? $parameter->{uuid} : ""; my $uuid = defined $parameter->{uuid} ? $parameter->{uuid} : "";
@ -5167,12 +5167,6 @@ WHERE
$manifest_uuid = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__})->[0]->[0]; $manifest_uuid = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__})->[0]->[0];
$manifest_uuid = "" if not defined $manifest_uuid; $manifest_uuid = "" if not defined $manifest_uuid;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { manifest_uuid => $manifest_uuid }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { manifest_uuid => $manifest_uuid }});
if (($link_only) && (not $manifest_uuid))
{
# Can't INSERT.
return("");
}
} }
if ($delete) if ($delete)
@ -5253,10 +5247,6 @@ WHERE
} }
foreach my $row (@{$results}) foreach my $row (@{$results})
{ {
manifest_name,
manifest_last_ran,
manifest_xml,
manifest_note
my $old_manifest_name = $row->[0]; my $old_manifest_name = $row->[0];
my $old_manifest_last_ran = $row->[1]; my $old_manifest_last_ran = $row->[1];
my $old_manifest_xml = $row->[2]; my $old_manifest_xml = $row->[2];

@ -1529,13 +1529,49 @@ sub process_create
{ {
my ($anvil) = @_; my ($anvil) = @_;
# Show the option to create a new interface.
# Show existing manifests. # Show existing manifests.
### TODO: my $query = "
SELECT
manifest_uuid,
manifest_name,
manifest_last_ran,
manifest_xml,
manifest_note
FROM
manifests
ORDER BY
manifest_name ASC;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => {
results => $results,
count => $count,
}});
my $manifest_template = "";
if ($count)
{
foreach my $row (@{$results})
{
my $manifest_uuid = $row->[0];
my $manifest_name = $row->[1];
my $manifest_last_ran = $row->[2];
my $manifest_xml = $row->[3];
my $manifest_note = $row->[4];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => {
manifest_uuid => $manifest_uuid,
manifest_name => $manifest_name,
manifest_last_ran => $manifest_last_ran,
manifest_xml => $manifest_xml,
manifest_note => $manifest_note,
}});
$manifest_template .= $anvil->Template->get({file => "anvil.html", name => "existing-manifest-entry", variables => {
manifest_uuid => $manifest_uuid,
manifest_name => $manifest_name,
}});
}
}
# Store the previous CGI variables and display the new fields. # Store the previous CGI variables and display the new fields.
$anvil->data->{form}{back_link} = "?anvil=true"; $anvil->data->{form}{back_link} = "?anvil=true";
@ -1543,15 +1579,7 @@ sub process_create
$anvil->data->{cgi}{subtask}{value} = "" if not defined $anvil->data->{cgi}{subtask}{value}; $anvil->data->{cgi}{subtask}{value} = "" if not defined $anvil->data->{cgi}{subtask}{value};
$anvil->data->{cgi}{action}{value} = "" if not defined $anvil->data->{cgi}{action}{value}; $anvil->data->{cgi}{action}{value} = "" if not defined $anvil->data->{cgi}{action}{value};
$anvil->data->{form}{body} = $anvil->Template->get({file => "anvil.html", name => "create-menu", variables => { $anvil->data->{form}{body} = $anvil->Template->get({file => "anvil.html", name => "create-menu", variables => {
interface_form => $interface_form, existing_manifests => $manifest_template,
gateway_form => $say_gateway,
dns_form => $say_dns,
host_name_form => $host_name_form,
bcn_count => $bcn_pair_count,
sn_count => $sn_pair_count,
ifn_count => $ifn_pair_count,
host_uuid => $anvil->data->{cgi}{host_uuid}{value},
host_name => $host_name, # This is the current host name, used to find the data in the all_status.json
}}); }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { 'form::body' => $anvil->data->{form}{body} }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { 'form::body' => $anvil->data->{form}{body} }});

@ -53,13 +53,16 @@
<!-- start existing-manifest-entry --> <!-- start existing-manifest-entry -->
<tr> <tr>
<td> <td>
#!variable!run!# <a href="?anvil=true&task=manifest&run=true&manifest_uuid=#!variable!manifest_uuid!#">#!string!striker_0206!#</a>
</td> </td>
<td> <td>
#!variable!name!# #!variable!manifest_name!#
</td> </td>
<td> <td>
#!variable!edit!# <a href="?anvil=true&task=manifest&edit=true&manifest_uuid=#!variable!manifest_uuid!#">#!string!striker_0207!#</a>
</td>
<td>
<a href="?anvil=true&task=manifest&delete=true&manifest_uuid=#!variable!manifest_uuid!#"><img src="#!data!skin::url!#/images/delete.png" alt="#!string!striker_0068!#" style="height: .8em;"></a>
</td> </td>
</tr> </tr>
<!-- end existing-manifest-entry --> <!-- end existing-manifest-entry -->

@ -1071,6 +1071,8 @@ If you are comfortable that the target has changed for a known reason, you can s
<key name="striker_0203">Create or Run an Install Manifest</key> <key name="striker_0203">Create or Run an Install Manifest</key>
<key name="striker_0204">Create a new Install Manifest; The instructions used to assemble/repair a given Anvil! system.</key> <key name="striker_0204">Create a new Install Manifest; The instructions used to assemble/repair a given Anvil! system.</key>
<key name="striker_0205">Existing Manifests:</key> <key name="striker_0205">Existing Manifests:</key>
<key name="striker_0206">Run</key>
<key name="striker_0207">Edit</key>
<!-- These are generally units and appended to numbers --> <!-- These are generally units and appended to numbers -->
<key name="suffix_0001">#!variable!number!#/sec</key> <key name="suffix_0001">#!variable!number!#/sec</key>

Loading…
Cancel
Save