add comments

This commit is contained in:
Oliver Gorwits
2019-08-23 09:25:17 +01:00
parent 8a66cf91af
commit 86daf7174d
3 changed files with 4 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ use base 'DBIx::Class::Core';
__PACKAGE__->table_class('DBIx::Class::ResultSource::View');
# NOTE this query is in `git grep 'THREE PLACES'`
__PACKAGE__->table('port_utilization');
__PACKAGE__->result_source_instance->is_virtual(1);
__PACKAGE__->result_source_instance->view_definition(<<ENDSQL

View File

@@ -67,6 +67,7 @@ sub with_is_free {
->search({},
{
'+columns' => { is_free =>
# NOTE this query is in `git grep 'THREE PLACES'`
\["me.up_admin = 'up' AND me.up != 'up' AND me.type != 'propVirtual' AND "
."((age(now(), to_timestamp(extract(epoch from device.last_discover) - (device.uptime/100))) < ?::interval "
."AND (last_node.time_last IS NULL OR age(now(), last_node.time_last) > ?::interval)) "
@@ -96,6 +97,7 @@ sub only_free_ports {
->search_rs($cond, $attrs)
->search(
{
# NOTE this query is in `git grep 'THREE PLACES'`
'me.up_admin' => 'up',
'me.up' => { '!=' => 'up' },
'me.type' => { '!=' => 'propVirtual' },

View File

@@ -82,6 +82,7 @@ get '/ajax/content/device/ports' => require_login sub {
});
}
delete $port_state{free};
# showing free ports requires showing down ports
++$port_state{down};
}