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
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5moCbYoDG2BqT7VrP/MRkA
|
||||
=head2 creation_stamp
|
||||
|
||||
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;
|
||||
|
||||
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/] },
|
||||
rows => 200,
|
||||
});
|
||||
})->with_times;
|
||||
|
||||
content_type('text/html');
|
||||
template 'ajax/admintask/portlog.tt', {
|
||||
|
||||
Reference in New Issue
Block a user