initial work on moving to d3-force-apex-plugin - json data

This commit is contained in:
Oliver Gorwits
2017-12-10 23:19:23 +00:00
parent f6c985bd60
commit 187265fc03
3 changed files with 42 additions and 81 deletions

View File

@@ -10,14 +10,19 @@ __PACKAGE__->table_class('DBIx::Class::ResultSource::View');
__PACKAGE__->table('device_links');
__PACKAGE__->result_source_instance->is_virtual(1);
__PACKAGE__->result_source_instance->view_definition(<<ENDSQL
SELECT dp.ip AS left_ip, dp.port AS left_port, di.ip AS right_ip, dp.remote_port AS right_port
FROM ( SELECT device_port.ip, device_port.port, device_port.remote_ip, device_port.remote_port
SELECT dp.ip AS left_ip, dp.port AS left_port, dp.name AS left_descr,
dp.speed AS speed,
dp2.ip AS right_ip, dp2.port AS right_port, dp2.name AS right_descr
FROM ( SELECT device_port.ip, device_port.port, device_port.name,
device_port.speed,
device_port.remote_ip, device_port.remote_port
FROM device_port
WHERE device_port.remote_port IS NOT NULL
GROUP BY device_port.ip, device_port.port, device_port.remote_ip, device_port.remote_port
ORDER BY device_port.ip) dp
WHERE device_port.remote_port IS NOT NULL ) dp
LEFT JOIN device_ip di ON dp.remote_ip = di.alias
LEFT JOIN device_port dp2 ON (di.ip = dp2.ip AND dp.remote_port = dp2.port)
WHERE di.ip IS NOT NULL
AND dp2.ip IS NOT NULL
AND dp.ip <= dp2.ip
ORDER BY dp.ip
ENDSQL
);
@@ -29,12 +34,21 @@ __PACKAGE__->add_columns(
'left_port' => {
data_type => 'text',
},
'left_descr' => {
data_type => 'text',
},
'speed' => {
data_type => 'text',
},
'right_ip' => {
data_type => 'inet',
},
'right_port' => {
data_type => 'text',
},
'right_descr' => {
data_type => 'text',
},
);
__PACKAGE__->has_many('left_vlans', 'App::Netdisco::DB::Result::DevicePortVlan',