display clean version of creation stamp on port log
This commit is contained in:
@@ -40,10 +40,19 @@ __PACKAGE__->add_columns(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
=head1 ADDITIONAL COLUMNS
|
||||||
|
|
||||||
# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02
|
=head2 creation_stamp
|
||||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5moCbYoDG2BqT7VrP/MRkA
|
|
||||||
|
Formatted version of the C<creation> field, accurate to the second.
|
||||||
|
|
||||||
|
The format is somewhat like ISO 8601 or RFC3339 but without the middle C<T>
|
||||||
|
between the date stamp and time stamp. That is:
|
||||||
|
|
||||||
|
2012-02-06 12:49:23
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub creation_stamp { return (shift)->get_column('creation_stamp') }
|
||||||
|
|
||||||
|
|
||||||
# You can replace this text with custom code or comments, and it will be preserved on regeneration
|
|
||||||
1;
|
1;
|
||||||
|
|||||||
39
Netdisco/lib/App/Netdisco/DB/ResultSet/DevicePortLog.pm
Normal file
39
Netdisco/lib/App/Netdisco/DB/ResultSet/DevicePortLog.pm
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
package App::Netdisco::DB::ResultSet::DevicePortLog;
|
||||||
|
use base 'App::Netdisco::DB::ResultSet';
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings FATAL => 'all';
|
||||||
|
|
||||||
|
__PACKAGE__->load_components(qw/
|
||||||
|
+App::Netdisco::DB::ExplicitLocking
|
||||||
|
/);
|
||||||
|
|
||||||
|
=head1 ADDITIONAL METHODS
|
||||||
|
|
||||||
|
=head2 with_times
|
||||||
|
|
||||||
|
This is a modifier for any C<search()> which will add the following additional
|
||||||
|
synthesized column to the result set:
|
||||||
|
|
||||||
|
=over 4
|
||||||
|
|
||||||
|
=item creation_stamp
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub with_times {
|
||||||
|
my ($rs, $cond, $attrs) = @_;
|
||||||
|
|
||||||
|
return $rs
|
||||||
|
->search_rs($cond, $attrs)
|
||||||
|
->search({},
|
||||||
|
{
|
||||||
|
'+columns' => {
|
||||||
|
creation_stamp => \"to_char(creation, 'YYYY-MM-DD HH24:MI:SS')",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
@@ -28,7 +28,7 @@ ajax '/ajax/content/admin/portlog' => require_role admin => sub {
|
|||||||
}, {
|
}, {
|
||||||
order_by => { -desc => [qw/creation/] },
|
order_by => { -desc => [qw/creation/] },
|
||||||
rows => 200,
|
rows => 200,
|
||||||
});
|
})->with_times;
|
||||||
|
|
||||||
content_type('text/html');
|
content_type('text/html');
|
||||||
template 'ajax/admintask/portlog.tt', {
|
template 'ajax/admintask/portlog.tt', {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
[% WHILE (row = results.next) %]
|
[% WHILE (row = results.next) %]
|
||||||
<tr>
|
<tr>
|
||||||
<td class="nd_center-cell">[% row.creation | html_entity %]</td>
|
<td class="nd_center-cell">[% row.creation_stamp | html_entity %]</td>
|
||||||
<td class="nd_center-cell">[% row.username | html_entity %]</td>
|
<td class="nd_center-cell">[% row.username | html_entity %]</td>
|
||||||
<td class="nd_center-cell">[% row.userip | html_entity %]</td>
|
<td class="nd_center-cell">[% row.userip | html_entity %]</td>
|
||||||
<td class="nd_center-cell">[% row.action | html_entity %]</td>
|
<td class="nd_center-cell">[% row.action | html_entity %]</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user