Display port descriptions in topology editing forms
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2.013002 -
|
||||
|
||||
[ENHANCEMENTS]
|
||||
|
||||
* Display port descriptions in topology editing form
|
||||
|
||||
2.013001 - 2013-08-23
|
||||
|
||||
[BUG FIXES]
|
||||
|
||||
@@ -22,4 +22,14 @@ __PACKAGE__->add_columns(
|
||||
__PACKAGE__->add_unique_constraint(['dev1','port1']);
|
||||
__PACKAGE__->add_unique_constraint(['dev2','port2']);
|
||||
|
||||
__PACKAGE__->belongs_to(
|
||||
device1 => 'App::Netdisco::DB::Result::Device',
|
||||
{'foreign.ip' => 'self.dev1'}
|
||||
);
|
||||
|
||||
__PACKAGE__->belongs_to(
|
||||
device2 => 'App::Netdisco::DB::Result::Device',
|
||||
{'foreign.ip' => 'self.dev2'}
|
||||
);
|
||||
|
||||
1;
|
||||
|
||||
@@ -26,7 +26,7 @@ ajax '/ajax/data/deviceip/typeahead' => require_login sub {
|
||||
$label = sprintf '%s (%s)',
|
||||
($d->dns || $d->name), $d->ip;
|
||||
}
|
||||
push @data, {label => $label, value => $d->ip};
|
||||
push @data, { label => $label, value => $d->ip };
|
||||
}
|
||||
|
||||
content_type 'application/json';
|
||||
@@ -46,10 +46,13 @@ ajax '/ajax/data/port/typeahead' => require_login sub {
|
||||
$set = $set->search({port => { -ilike => "\%$port\%" }})
|
||||
if $port;
|
||||
|
||||
my $results = [ sort { &App::Netdisco::Util::Web::sort_port($a->port, $b->port) } $set->all ];
|
||||
my $results = [
|
||||
map {{ label => (sprintf "%s (%s)", $_->port, $_->name), value => $_->port }}
|
||||
sort { &App::Netdisco::Util::Web::sort_port($a->port, $b->port) } $set->all
|
||||
];
|
||||
|
||||
content_type 'application/json';
|
||||
to_json [map {$_->port} @$results];
|
||||
to_json \@$results;
|
||||
};
|
||||
|
||||
true;
|
||||
|
||||
@@ -40,11 +40,12 @@
|
||||
</tr>
|
||||
[% WHILE (row = results.next) %]
|
||||
<tr>
|
||||
<td class="nd_center-cell"><a class="nd_linkcell"
|
||||
href="[% uri_for('/device') %]?q=[% row.dev1 | uri %]">[% row.dev1 | html_entity %]</a></td>
|
||||
<td class="nd_center-cell"><a class="nd_linkcell" href="[% uri_for('/device') %]?q=[% row.dev1 | uri %]">
|
||||
[% (row.device1.dns || row.device1.name || row.device1.ip) | html_entity %]</a>
|
||||
</td>
|
||||
<td class="nd_center-cell">[% row.port1 | html_entity %]</td>
|
||||
<td class="nd_center-cell"><a class="nd_linkcell"
|
||||
href="[% uri_for('/device') %]?q=[% row.dev2 | uri %]">[% row.dev2 | html_entity %]</a></td>
|
||||
<td class="nd_center-cell"><a class="nd_linkcell" href="[% uri_for('/device') %]?q=[% row.dev2 | uri %]">
|
||||
[% (row.device2.dns || row.device2.name || row.device2.ip) | html_entity %]</a></td>
|
||||
<td class="nd_center-cell">[% row.port2 | html_entity %]</td>
|
||||
<td class="nd_center-cell">
|
||||
<input data-form="del" name="dev1" type="hidden" value="[% row.dev1 | html_entity %]">
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
return response(data);
|
||||
});
|
||||
}
|
||||
,delay: 150
|
||||
,minLength: 0
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user