App-Netdisco

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

  [ENHANCEMENTS]

  * Store port control and device delete log messages

  [BUG FIXES]

  * z-index fix for modals
  * Better toastr message on device delete
  * Delete manual topology on device delete
  * Fix Node age stamp option in ports
  * Prevent cascade operations on virtual tables in DBIC

2.015000 - 2013-09-06

  [NEW FEATURES]

  * Device Modules tab (jeneric)
  * Half Duplex Ports Report
  * Remember device ports columns and display options in a Cookie
  * Delete device button for admins

lib/App/Netdisco/DB/Result/AccessControlListMap.pm  view on Meta::CPAN

  { data_type => "text", is_nullable => 0 },
  "left_acl_id",
  { data_type => "integer", is_nullable => 0 },
  "right_acl_id",
  { data_type => "integer", is_nullable => 1 },
);

__PACKAGE__->set_primary_key("id");

__PACKAGE__->belongs_to( left_acl => 'App::Netdisco::DB::Result::AccessControlList',
  { 'foreign.id' => 'self.left_acl_id' }, { cascade_delete => 1 } );

__PACKAGE__->belongs_to( left_acl_with_dns => 'App::Netdisco::DB::Result::Virtual::ACLEntriesWithDNS',
  { 'foreign.id' => 'self.left_acl_id' }, { cascade_delete => 1 } );

__PACKAGE__->belongs_to( right_acl => 'App::Netdisco::DB::Result::AccessControlList',
  { 'foreign.id' => 'self.right_acl_id' }, { cascade_delete => 1, join_type => 'left' } );

__PACKAGE__->belongs_to( right_acl_with_dns => 'App::Netdisco::DB::Result::Virtual::ACLEntriesWithDNS',
  { 'foreign.id' => 'self.right_acl_id' }, { cascade_delete => 1, join_type => 'left' } );

1;

lib/App/Netdisco/DB/Result/Admin.pm  view on Meta::CPAN

        "$args->{foreign_alias}.actionset"
            => { '@>' => \"string_to_array($args->{self_alias}.action,'')" },
        -and => [
            "$args->{foreign_alias}.deferrals"  => { '>=' => \'?' },
            "$args->{foreign_alias}.last_defer" =>
                { '>', \'(LOCALTIMESTAMP - ?::interval)' },
        ],
      ],
    };
  },
  { cascade_copy => 0, cascade_update => 0, cascade_delete => 0 }
);

=head2 target

Returns the single C<device> to which this Job entry was associated.

The JOIN is of type LEFT, in case the C<device> is not in the database.

=cut

lib/App/Netdisco/DB/Result/Device.pm  view on Meta::CPAN

    my $args = shift;
    return {
      "$args->{foreign_alias}.ip" => { -ident => "$args->{self_alias}.ip" },
      -or => [
        "$args->{foreign_alias}.dns" => { 'ilike', \'?' },
        "$args->{foreign_alias}.alias" => { '<<=', \'?' },
        "$args->{foreign_alias}.alias::text" => { 'ilike', \'?' },
      ],
    };
  },
  { cascade_copy => 0, cascade_update => 0, cascade_delete => 0 }
);

=head2 vlans

Returns the C<device_vlan> entries for this Device. That is, the list of VLANs
configured on or known by this Device.

=cut

__PACKAGE__->has_many( vlans => 'App::Netdisco::DB::Result::DeviceVlan', 'ip' );

lib/App/Netdisco/DB/Result/Device.pm  view on Meta::CPAN

=cut

__PACKAGE__->has_many( ports_by_mac => 'App::Netdisco::DB::Result::DevicePort',
  sub {
    my $args = shift;
    return {
      "$args->{foreign_alias}.ip" => { -ident => "$args->{self_alias}.ip" },
      "$args->{foreign_alias}.mac::text" => { 'ilike', \'?' },
    };
  },
  { cascade_copy => 0, cascade_update => 0, cascade_delete => 0 }
);

=head2 module_serials

Returns the set chassis modules on this Device.

=cut

__PACKAGE__->has_many( module_serials => 'App::Netdisco::DB::Result::DeviceModule',
  sub {
    my $args = shift;
    return {
      "$args->{foreign_alias}.ip" => { -ident => "$args->{self_alias}.ip" },
      "$args->{foreign_alias}.class" => 'chassis',
      -and => [
        "$args->{foreign_alias}.serial" => { '!=' => undef },
        "$args->{foreign_alias}.serial" => { '!=' => '' },
      ],
    };
  },
  { cascade_copy => 0, cascade_update => 0, cascade_delete => 0 }
);

=head2 modules

Returns the set chassis modules on this Device.

=cut

__PACKAGE__->has_many( modules => 'App::Netdisco::DB::Result::DeviceModule', 'ip' );

lib/App/Netdisco/DB/Result/DevicePort.pm  view on Meta::CPAN

  },
  { join_type => 'LEFT' },
);

__PACKAGE__->has_many( nodes_with_age => 'App::Netdisco::DB::Result::Virtual::NodeWithAge',
  {
    'foreign.switch' => 'self.ip',
    'foreign.port' => 'self.port',
  },
  { join_type => 'LEFT',
    cascade_copy => 0, cascade_update => 0, cascade_delete => 0 },
);

__PACKAGE__->has_many( active_nodes => 'App::Netdisco::DB::Result::Virtual::ActiveNode',
  {
    'foreign.switch' => 'self.ip',
    'foreign.port' => 'self.port',
  },
  { join_type => 'LEFT',
    cascade_copy => 0, cascade_update => 0, cascade_delete => 0 },
);

__PACKAGE__->has_many( active_nodes_with_age => 'App::Netdisco::DB::Result::Virtual::ActiveNodeWithAge',
  {
    'foreign.switch' => 'self.ip',
    'foreign.port' => 'self.port',
  },
  { join_type => 'LEFT',
    cascade_copy => 0, cascade_update => 0, cascade_delete => 0 },
);

=head2 logs

Returns the set of C<device_port_log> entries associated with this Port.

=cut

__PACKAGE__->has_many( logs => 'App::Netdisco::DB::Result::DevicePortLog',
  { 'foreign.ip' => 'self.ip', 'foreign.port' => 'self.port' },

lib/App/Netdisco/DB/Result/DevicePortSsid.pm  view on Meta::CPAN

Port SSID.

=cut

__PACKAGE__->has_many( nodes => 'App::Netdisco::DB::Result::Node',
  {
    'foreign.switch' => 'self.ip',
    'foreign.port' => 'self.port',
  },
  { join_type => 'LEFT',
    cascade_copy => 0, cascade_update => 0, cascade_delete => 0 },
);

1;

lib/App/Netdisco/DB/Result/DevicePortWireless.pm  view on Meta::CPAN

Port Wireless.

=cut

__PACKAGE__->has_many( nodes => 'App::Netdisco::DB::Result::Node',
  {
    'foreign.switch' => 'self.ip',
    'foreign.port' => 'self.port',
  },
  { join_type => 'LEFT',
    cascade_copy => 0, cascade_update => 0, cascade_delete => 0 },
);

1;

lib/App/Netdisco/DB/Result/DeviceVlan.pm  view on Meta::CPAN


__PACKAGE__->has_many( port_vlans_tagged => 'App::Netdisco::DB::Result::DevicePortVlan',
    sub {
      my $args = shift;
      return {
        "$args->{foreign_alias}.ip"   => { -ident => "$args->{self_alias}.ip" },
        "$args->{foreign_alias}.vlan" => { -ident => "$args->{self_alias}.vlan" },
        -not_bool => "$args->{foreign_alias}.native",
      };
    },
    { cascade_copy => 0, cascade_update => 0, cascade_delete => 0 }
);

=head2 port_vlans_untagged

Link relationship to support C<untagged_ports>, see below.

=cut

__PACKAGE__->has_many( port_vlans_untagged => 'App::Netdisco::DB::Result::DevicePortVlan',
    sub {
      my $args = shift;
      return {
        "$args->{foreign_alias}.ip"   => { -ident => "$args->{self_alias}.ip" },
        "$args->{foreign_alias}.vlan" => { -ident => "$args->{self_alias}.vlan" },
        -bool => "$args->{foreign_alias}.native",
      };
    },
    { cascade_copy => 0, cascade_update => 0, cascade_delete => 0 }
);

=head2 ports

Link relationship to support C<ports>.

=cut

__PACKAGE__->has_many( ports => 'App::Netdisco::DB::Result::DevicePortVlan',
    { 'foreign.ip' => 'self.ip', 'foreign.vlan' => 'self.vlan' },
    { cascade_copy => 0, cascade_update => 0, cascade_delete => 0 }
);

=head2 tagged_ports

Returns the set of Device Ports on which this VLAN is configured to be tagged.

=cut

__PACKAGE__->many_to_many( tagged_ports => 'port_vlans_tagged', 'port' );

lib/App/Netdisco/DB/Result/User.pm  view on Meta::CPAN

  "token_no_expire",
  { data_type => "boolean", default_value => \"false", is_nullable => 1 },
  "token_acl",
  { data_type => "text", is_nullable => 1 },
  "token_auth_only",
  { data_type => "boolean", default_value => \"false", is_nullable => 1 },
);
__PACKAGE__->set_primary_key("username");

__PACKAGE__->has_many( roles => 'App::Netdisco::DB::Result::Virtual::UserRole',
  'username', { cascade_copy => 0, cascade_update => 0, cascade_delete => 0 } );

__PACKAGE__->belongs_to( token_acl_name => 'App::Netdisco::DB::Result::AccessControlListName',
  { 'foreign.acl_name' => 'self.token_acl' }, { join_type => 'left' } );

sub created   { return (shift)->get_column('created')  }
sub last_seen { return (shift)->get_column('last_seen')  }

1;

share/public/javascripts/netdisco-tables.js  view on Meta::CPAN

  // Device label as netdisco shows it everywhere: dns, else name, else ip.
  // args.dns, args.name and args.ip name the row keys, each optional. A
  // caller that itself needs a "name" key for something other than a row
  // key (deviceLink's dispatch key is "name" too) cannot also write a row
  // key literally called "name" in the same JSON object: JSON.parse keeps
  // only the last of two identical keys. Such a caller nests dns/name/ip
  // under args.label instead, a second object with no such collision.
  //
  // The closures this replaces each read a fixed, different subset of
  // dns/name/ip (some never looked at name at all), so naming any one of the
  // three restricts the cascade to only the named tiers, still tried in dns,
  // name, ip order. Naming none is a caller with no such history to match,
  // so it gets the full three-tier fallback.
  const deviceLabel = function (args, row, fallback) {
    const a = args.label || args;
    const tiers = a.dns || a.name || a.ip ? [a.dns, a.name, a.ip] : ['dns', 'name', 'ip'];
    let value;
    tiers.forEach(function (key) {
      if (!value && key) value = get(row, key);
    });
    return value || fallback;



( run in 3.062 seconds using v1.01-cache-2.11-cpan-e7c6538aa59 )